Merge "Fix NPE by making Toast on UI thread" into udc-dev

This commit is contained in:
Louis Chang
2023-03-07 08:58:28 +00:00
committed by Android (Google) Code Review

View File

@@ -1729,14 +1729,11 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
} }
if (ActivitySecurityModelFeatureFlags.shouldShowToast(callingUid)) { if (ActivitySecurityModelFeatureFlags.shouldShowToast(callingUid)) {
Toast toast = Toast.makeText(mService.mContext, UiThread.getHandler().post(() -> Toast.makeText(mService.mContext,
(ActivitySecurityModelFeatureFlags.DOC_LINK (ActivitySecurityModelFeatureFlags.DOC_LINK
+ (restrictActivitySwitch + (restrictActivitySwitch ? " returned home due to "
? "returned home due to " : " would return home due to ")
: "would return home due to ") + callingLabel), Toast.LENGTH_LONG).show());
+ callingLabel),
Toast.LENGTH_LONG);
UiThread.getHandler().post(toast::show);
} }
// If the activity switch should be restricted, return home rather than the // If the activity switch should be restricted, return home rather than the