Merge "Tag some "new Binder()" instances to detect leaks." into sc-dev am: c8955e0799

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15225384

Change-Id: I97ad328303c4c297294400a74d887c9067d4f2ba
This commit is contained in:
TreeHugger Robot
2021-07-08 00:45:01 +00:00
committed by Automerger Merge Worker
2 changed files with 7 additions and 4 deletions

View File

@@ -120,6 +120,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
*/
public final class BluetoothAdapter {
private static final String TAG = "BluetoothAdapter";
private static final String DESCRIPTOR = "android.bluetooth.BluetoothAdapter";
private static final boolean DBG = true;
private static final boolean VDBG = false;
@@ -805,7 +806,7 @@ public final class BluetoothAdapter {
mManagerService = Objects.requireNonNull(managerService);
mAttributionSource = Objects.requireNonNull(attributionSource);
mLeScanClients = new HashMap<LeScanCallback, ScanCallback>();
mToken = new Binder();
mToken = new Binder(DESCRIPTOR);
}
/**

View File

@@ -86,6 +86,8 @@ import java.util.Set;
*/
@Immutable
public final class AttributionSource implements Parcelable {
private static final String DESCRIPTOR = "android.content.AttributionSource";
private final @NonNull AttributionSourceState mAttributionSourceState;
private @Nullable AttributionSource mNextCached;
@@ -95,7 +97,7 @@ public final class AttributionSource implements Parcelable {
@TestApi
public AttributionSource(int uid, @Nullable String packageName,
@Nullable String attributionTag) {
this(uid, packageName, attributionTag, new Binder());
this(uid, packageName, attributionTag, new Binder(DESCRIPTOR));
}
/** @hide */
@@ -130,7 +132,7 @@ public final class AttributionSource implements Parcelable {
AttributionSource(int uid, @Nullable String packageName, @Nullable String attributionTag,
@Nullable String[] renouncedPermissions, @Nullable AttributionSource next) {
this(uid, packageName, attributionTag, new Binder(), renouncedPermissions, next);
this(uid, packageName, attributionTag, new Binder(DESCRIPTOR), renouncedPermissions, next);
}
AttributionSource(int uid, @Nullable String packageName, @Nullable String attributionTag,
@@ -541,7 +543,7 @@ public final class AttributionSource implements Parcelable {
if ((mBuilderFieldsSet & 0x10) == 0) {
mAttributionSourceState.next = null;
}
mAttributionSourceState.token = new Binder();
mAttributionSourceState.token = new Binder(DESCRIPTOR);
if (mAttributionSourceState.next == null) {
// The NDK aidl backend doesn't support null parcelable arrays.
mAttributionSourceState.next = new AttributionSourceState[0];