diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-10-05 23:32:19 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-10-05 23:32:19 +0000 |
| commit | 8a9ce0b825125a29f612675e748168700516facf (patch) | |
| tree | 3ae43f349b1fd935d6d8ff7a3999fc90aec80e9e /core/java/android | |
| parent | 8831a5d3014cb7595da9e0430d906171fc5ed799 (diff) | |
| parent | 0ad7eb26737059b7cd92a9fcdbf68ac128a14446 (diff) | |
Merge "Use AttributionSource Builder" into stage-aosp-master am: d34ebacb36 am: f81f06da29 am: c786f0e5ae am: 0ad7eb2673
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15889347
Change-Id: If0f3080880fe98dbc316756e584eea20bc88dc4b
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/bluetooth/BluetoothManager.java | 5 | ||||
| -rw-r--r-- | core/java/android/content/AttributionSource.java | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/core/java/android/bluetooth/BluetoothManager.java b/core/java/android/bluetooth/BluetoothManager.java index c21362cd89f9..20152f3d2471 100644 --- a/core/java/android/bluetooth/BluetoothManager.java +++ b/core/java/android/bluetooth/BluetoothManager.java @@ -88,8 +88,9 @@ public final class BluetoothManager { uid = android.os.Process.SYSTEM_UID; } try { - res = new AttributionSource(uid, - AppGlobals.getPackageManager().getPackagesForUid(uid)[0], null); + res = new AttributionSource.Builder(uid) + .setPackageName(AppGlobals.getPackageManager().getPackagesForUid(uid)[0]) + .build(); } catch (RemoteException ignored) { } } diff --git a/core/java/android/content/AttributionSource.java b/core/java/android/content/AttributionSource.java index bdb7900b5bb9..6ae2bb5b642a 100644 --- a/core/java/android/content/AttributionSource.java +++ b/core/java/android/content/AttributionSource.java @@ -474,6 +474,18 @@ public final class AttributionSource implements Parcelable { mAttributionSourceState.uid = uid; } + public Builder(@NonNull AttributionSource current) { + if (current == null) { + throw new IllegalArgumentException("current AttributionSource can not be null"); + } + mAttributionSourceState.uid = current.getUid(); + mAttributionSourceState.packageName = current.getPackageName(); + mAttributionSourceState.attributionTag = current.getAttributionTag(); + mAttributionSourceState.token = current.getToken(); + mAttributionSourceState.renouncedPermissions = + current.mAttributionSourceState.renouncedPermissions; + } + /** * The package that is accessing the permission protected data. */ |
