-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for productId in transport (#5485)
Allow logging the productId together with the event in transport. For googlers b/303136538
- Loading branch information
Showing
24 changed files
with
415 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# Unreleased | ||
|
||
|
||
* [feature] Added new APIs to support passing a product id when logging an event. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
transport/transport-api/src/main/java/com/google/android/datatransport/ProductData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.android.datatransport; | ||
|
||
import androidx.annotation.Nullable; | ||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class ProductData { | ||
@Nullable | ||
public abstract Integer getProductId(); | ||
|
||
public static ProductData withProductId(@Nullable Integer productId) { | ||
return new AutoValue_ProductData(productId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# Unreleased | ||
|
||
|
||
* [feature] Added support for product id. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...ckend-cct/src/main/java/com/google/android/datatransport/cct/internal/ComplianceData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.android.datatransport.cct.internal; | ||
|
||
import android.util.SparseArray; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class ComplianceData { | ||
public enum ProductIdOrigin { | ||
NOT_SET(0), | ||
EVENT_OVERRIDE(5); | ||
|
||
private static final SparseArray<ProductIdOrigin> valueMap = new SparseArray<>(); | ||
|
||
private final int value; | ||
|
||
static { | ||
valueMap.put(0, NOT_SET); | ||
valueMap.put(5, EVENT_OVERRIDE); | ||
} | ||
|
||
ProductIdOrigin(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
@Nullable | ||
public static ProductIdOrigin forNumber(int value) { | ||
return valueMap.get(value); | ||
} | ||
} | ||
|
||
@Nullable | ||
public abstract ExternalPrivacyContext getPrivacyContext(); | ||
|
||
@Nullable | ||
public abstract ProductIdOrigin getProductIdOrigin(); | ||
|
||
@NonNull | ||
public static Builder builder() { | ||
return new AutoValue_ComplianceData.Builder(); | ||
} | ||
|
||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
@NonNull | ||
public abstract Builder setPrivacyContext(@Nullable ExternalPrivacyContext value); | ||
|
||
@NonNull | ||
public abstract Builder setProductIdOrigin(@Nullable ProductIdOrigin value); | ||
|
||
@NonNull | ||
public abstract ComplianceData build(); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
.../src/main/java/com/google/android/datatransport/cct/internal/ExternalPRequestContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.android.datatransport.cct.internal; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class ExternalPRequestContext { | ||
@Nullable | ||
public abstract Integer getOriginAssociatedProductId(); | ||
|
||
@NonNull | ||
public static Builder builder() { | ||
return new AutoValue_ExternalPRequestContext.Builder(); | ||
} | ||
|
||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
@NonNull | ||
public abstract Builder setOriginAssociatedProductId(@Nullable Integer value); | ||
|
||
@NonNull | ||
public abstract ExternalPRequestContext build(); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...t/src/main/java/com/google/android/datatransport/cct/internal/ExternalPrivacyContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.android.datatransport.cct.internal; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class ExternalPrivacyContext { | ||
@Nullable | ||
public abstract ExternalPRequestContext getPrequest(); | ||
|
||
@NonNull | ||
public static Builder builder() { | ||
return new AutoValue_ExternalPrivacyContext.Builder(); | ||
} | ||
|
||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
@NonNull | ||
public abstract Builder setPrequest(@Nullable ExternalPRequestContext value); | ||
|
||
@NonNull | ||
public abstract ExternalPrivacyContext build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Unreleased | ||
* [unchanged] Updated internal Dagger dependency. | ||
* [feature] Added support for product id. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.