More detailed logging to aid debugging.
We've seen an obscure case where our "isOrphaned" health check is failing, and it looks like it might be related to a per-process record being recycled in an unexpected way. Bug: 273536153 Test: atest FrameworksMockingServicesTests:BroadcastQueueTest Test: atest FrameworksMockingServicesTests:BroadcastQueueModernImplTest Test: atest FrameworksMockingServicesTests:BroadcastRecordTest Change-Id: I3942cda29a8da8f75a8b71de9b62142caafcc230
This commit is contained in:
@@ -393,6 +393,10 @@ class BroadcastProcessQueue {
|
||||
setProcessInstrumented(false);
|
||||
setProcessPersistent(false);
|
||||
}
|
||||
|
||||
// Since we may have just changed our PID, invalidate cached strings
|
||||
mCachedToString = null;
|
||||
mCachedToShortString = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1128,16 +1132,16 @@ class BroadcastProcessQueue {
|
||||
@Override
|
||||
public String toString() {
|
||||
if (mCachedToString == null) {
|
||||
mCachedToString = "BroadcastProcessQueue{"
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " " + processName + "/" + UserHandle.formatUid(uid) + "}";
|
||||
mCachedToString = "BroadcastProcessQueue{" + toShortString() + "}";
|
||||
}
|
||||
return mCachedToString;
|
||||
}
|
||||
|
||||
public String toShortString() {
|
||||
if (mCachedToShortString == null) {
|
||||
mCachedToShortString = processName + "/" + UserHandle.formatUid(uid);
|
||||
mCachedToShortString = Integer.toHexString(System.identityHashCode(this))
|
||||
+ " " + ((app != null) ? app.getPid() : "?") + ":" + processName + "/"
|
||||
+ UserHandle.formatUid(uid);
|
||||
}
|
||||
return mCachedToShortString;
|
||||
}
|
||||
|
||||
@@ -1041,9 +1041,7 @@ final class BroadcastRecord extends Binder {
|
||||
if (label == null) {
|
||||
label = intent.toString();
|
||||
}
|
||||
mCachedToString = "BroadcastRecord{"
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " u" + userId + " " + label + "}";
|
||||
mCachedToString = "BroadcastRecord{" + toShortString() + "}";
|
||||
}
|
||||
return mCachedToString;
|
||||
}
|
||||
@@ -1055,7 +1053,7 @@ final class BroadcastRecord extends Binder {
|
||||
label = intent.toString();
|
||||
}
|
||||
mCachedToShortString = Integer.toHexString(System.identityHashCode(this))
|
||||
+ ":" + label + "/u" + userId;
|
||||
+ " " + label + "/u" + userId;
|
||||
}
|
||||
return mCachedToShortString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user