Add BAL log info
Add simple logs when background activity is not blocked to help debugging. Bug: 267291845 Test: manual tests Change-Id: I22f782a66903a873c2d5145315ccb6c1b4a89bff
This commit is contained in:
@@ -406,6 +406,8 @@ class ActivityStarter {
|
||||
PendingIntentRecord originatingPendingIntent;
|
||||
BackgroundStartPrivileges backgroundStartPrivileges;
|
||||
|
||||
final StringBuilder logMessage = new StringBuilder();
|
||||
|
||||
/**
|
||||
* The error callback token passed in {@link android.window.WindowContainerTransaction}
|
||||
* for TaskFragment operation error handling via
|
||||
@@ -734,7 +736,14 @@ class ActivityStarter {
|
||||
if (res != START_SUCCESS) {
|
||||
return res;
|
||||
}
|
||||
res = executeRequest(mRequest);
|
||||
|
||||
try {
|
||||
res = executeRequest(mRequest);
|
||||
} finally {
|
||||
mRequest.logMessage.append(" result code=").append(res);
|
||||
Slog.i(TAG, mRequest.logMessage.toString());
|
||||
mRequest.logMessage.setLength(0);
|
||||
}
|
||||
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
|
||||
@@ -933,8 +942,14 @@ class ActivityStarter {
|
||||
? UserHandle.getUserId(aInfo.applicationInfo.uid) : 0;
|
||||
final int launchMode = aInfo != null ? aInfo.launchMode : 0;
|
||||
if (err == ActivityManager.START_SUCCESS) {
|
||||
Slog.i(TAG, "START u" + userId + " {" + intent.toShortString(true, true, true, false)
|
||||
+ "} with " + launchModeToString(launchMode) + " from uid " + callingUid);
|
||||
request.logMessage.append("START u").append(userId).append(" {")
|
||||
.append(intent.toShortString(true, true, true, false))
|
||||
.append("} with ").append(launchModeToString(launchMode))
|
||||
.append(" from uid ").append(callingUid);
|
||||
if (callingUid != realCallingUid
|
||||
&& realCallingUid != Request.DEFAULT_REAL_CALLING_UID) {
|
||||
request.logMessage.append(" (realCallingUid=").append(realCallingUid).append(")");
|
||||
}
|
||||
}
|
||||
|
||||
ActivityRecord sourceRecord = null;
|
||||
@@ -1103,6 +1118,11 @@ class ActivityStarter {
|
||||
request.backgroundStartPrivileges,
|
||||
intent,
|
||||
checkedOptions);
|
||||
if (balCode != BAL_ALLOW_DEFAULT) {
|
||||
request.logMessage.append(" (").append(
|
||||
BackgroundActivityStartController.balCodeToString(balCode))
|
||||
.append(")");
|
||||
}
|
||||
} finally {
|
||||
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ public class BackgroundActivityStartController {
|
||||
// anything that has fallen through would currently be aborted
|
||||
Slog.w(
|
||||
TAG,
|
||||
"Background activity start [callingPackage: "
|
||||
"Background activity launch blocked [callingPackage: "
|
||||
+ callingPackage
|
||||
+ "; callingUid: "
|
||||
+ callingUid
|
||||
@@ -502,7 +502,7 @@ public class BackgroundActivityStartController {
|
||||
}
|
||||
builder.append("Activity start allowed: " + msg + ". callingUid: " + callingUid + ". ");
|
||||
builder.append("BAL Code: ");
|
||||
builder.append(code);
|
||||
builder.append(balCodeToString(code));
|
||||
Slog.d(TAG, builder.toString());
|
||||
}
|
||||
return code;
|
||||
|
||||
Reference in New Issue
Block a user