Merge "Update ASM logging for U release" into udc-qpr-dev am: 53e91c63af
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23874531 Change-Id: Ifab79d9ca6eaebff5cd848170c3403d248699d6d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -2031,6 +2031,13 @@ class ActivityStarter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ASM rules have failed. Log why
|
||||||
|
return logAsmFailureAndCheckFeatureEnabled(r, newTask, targetTask, shouldBlockActivityStart,
|
||||||
|
taskToFront);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean logAsmFailureAndCheckFeatureEnabled(ActivityRecord r, boolean newTask,
|
||||||
|
Task targetTask, boolean shouldBlockActivityStart, boolean taskToFront) {
|
||||||
// ASM rules have failed. Log why
|
// ASM rules have failed. Log why
|
||||||
ActivityRecord targetTopActivity = targetTask == null ? null
|
ActivityRecord targetTopActivity = targetTask == null ? null
|
||||||
: targetTask.getActivity(ar -> !ar.finishing && !ar.isAlwaysOnTop());
|
: targetTask.getActivity(ar -> !ar.finishing && !ar.isAlwaysOnTop());
|
||||||
@@ -2041,6 +2048,13 @@ class ActivityStarter {
|
|||||||
? FrameworkStatsLog.ACTIVITY_ACTION_BLOCKED__ACTION__ACTIVITY_START_SAME_TASK
|
? FrameworkStatsLog.ACTIVITY_ACTION_BLOCKED__ACTION__ACTIVITY_START_SAME_TASK
|
||||||
: FrameworkStatsLog.ACTIVITY_ACTION_BLOCKED__ACTION__ACTIVITY_START_DIFFERENT_TASK);
|
: FrameworkStatsLog.ACTIVITY_ACTION_BLOCKED__ACTION__ACTIVITY_START_DIFFERENT_TASK);
|
||||||
|
|
||||||
|
boolean blockActivityStartAndFeatureEnabled = ActivitySecurityModelFeatureFlags
|
||||||
|
.shouldRestrictActivitySwitch(mCallingUid)
|
||||||
|
&& shouldBlockActivityStart;
|
||||||
|
|
||||||
|
String asmDebugInfo = getDebugInfoForActivitySecurity("Launch", r, targetTask,
|
||||||
|
targetTopActivity, blockActivityStartAndFeatureEnabled, /*taskToFront*/taskToFront);
|
||||||
|
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.ACTIVITY_ACTION_BLOCKED,
|
FrameworkStatsLog.write(FrameworkStatsLog.ACTIVITY_ACTION_BLOCKED,
|
||||||
/* caller_uid */
|
/* caller_uid */
|
||||||
mSourceRecord != null ? mSourceRecord.getUid() : mCallingUid,
|
mSourceRecord != null ? mSourceRecord.getUid() : mCallingUid,
|
||||||
@@ -2069,13 +2083,11 @@ class ActivityStarter {
|
|||||||
targetTask != null && mSourceRecord != null
|
targetTask != null && mSourceRecord != null
|
||||||
&& !targetTask.equals(mSourceRecord.getTask()) && targetTask.isVisible(),
|
&& !targetTask.equals(mSourceRecord.getTask()) && targetTask.isVisible(),
|
||||||
/* bal_code */
|
/* bal_code */
|
||||||
mBalCode
|
mBalCode,
|
||||||
|
/* task_stack */
|
||||||
|
asmDebugInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
boolean blockActivityStartAndFeatureEnabled = ActivitySecurityModelFeatureFlags
|
|
||||||
.shouldRestrictActivitySwitch(mCallingUid)
|
|
||||||
&& shouldBlockActivityStart;
|
|
||||||
|
|
||||||
String launchedFromPackageName = r.launchedFromPackage;
|
String launchedFromPackageName = r.launchedFromPackage;
|
||||||
if (ActivitySecurityModelFeatureFlags.shouldShowToast(mCallingUid)) {
|
if (ActivitySecurityModelFeatureFlags.shouldShowToast(mCallingUid)) {
|
||||||
String toastText = ActivitySecurityModelFeatureFlags.DOC_LINK
|
String toastText = ActivitySecurityModelFeatureFlags.DOC_LINK
|
||||||
@@ -2085,8 +2097,7 @@ class ActivityStarter {
|
|||||||
UiThread.getHandler().post(() -> Toast.makeText(mService.mContext,
|
UiThread.getHandler().post(() -> Toast.makeText(mService.mContext,
|
||||||
toastText, Toast.LENGTH_LONG).show());
|
toastText, Toast.LENGTH_LONG).show());
|
||||||
|
|
||||||
logDebugInfoForActivitySecurity("Launch", r, targetTask, targetTopActivity,
|
Slog.i(TAG, asmDebugInfo);
|
||||||
blockActivityStartAndFeatureEnabled, /* taskToFront */ taskToFront);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockActivityStartAndFeatureEnabled) {
|
if (blockActivityStartAndFeatureEnabled) {
|
||||||
@@ -2104,7 +2115,7 @@ class ActivityStarter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Only called when an activity launch may be blocked, which should happen very rarely */
|
/** Only called when an activity launch may be blocked, which should happen very rarely */
|
||||||
private void logDebugInfoForActivitySecurity(String action, ActivityRecord r, Task targetTask,
|
private String getDebugInfoForActivitySecurity(String action, ActivityRecord r, Task targetTask,
|
||||||
ActivityRecord targetTopActivity, boolean blockActivityStartAndFeatureEnabled,
|
ActivityRecord targetTopActivity, boolean blockActivityStartAndFeatureEnabled,
|
||||||
boolean taskToFront) {
|
boolean taskToFront) {
|
||||||
final String prefix = "[ASM] ";
|
final String prefix = "[ASM] ";
|
||||||
@@ -2165,7 +2176,7 @@ class ActivityStarter {
|
|||||||
joiner.add(prefix + "BalCode: " + balCodeToString(mBalCode));
|
joiner.add(prefix + "BalCode: " + balCodeToString(mBalCode));
|
||||||
|
|
||||||
joiner.add(prefix + "------ Activity Security " + action + " Debug Logging End ------");
|
joiner.add(prefix + "------ Activity Security " + action + " Debug Logging End ------");
|
||||||
Slog.i(TAG, joiner.toString());
|
return joiner.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2339,7 +2350,7 @@ class ActivityStarter {
|
|||||||
+ ActivitySecurityModelFeatureFlags.DOC_LINK,
|
+ ActivitySecurityModelFeatureFlags.DOC_LINK,
|
||||||
Toast.LENGTH_LONG).show());
|
Toast.LENGTH_LONG).show());
|
||||||
|
|
||||||
logDebugInfoForActivitySecurity("Clear Top", mStartActivity, targetTask, targetTaskTop,
|
getDebugInfoForActivitySecurity("Clear Top", mStartActivity, targetTask, targetTaskTop,
|
||||||
shouldBlockActivityStart, /* taskToFront */ true);
|
shouldBlockActivityStart, /* taskToFront */ true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1752,7 +1752,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
|
|||||||
/* multi_window */
|
/* multi_window */
|
||||||
false,
|
false,
|
||||||
/* bal_code */
|
/* bal_code */
|
||||||
-1
|
-1,
|
||||||
|
/* task_stack */
|
||||||
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
boolean restrictActivitySwitch = ActivitySecurityModelFeatureFlags
|
boolean restrictActivitySwitch = ActivitySecurityModelFeatureFlags
|
||||||
|
|||||||
Reference in New Issue
Block a user