Merge "Fix NPE by making Toast on UI thread" into udc-dev
diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
index df471c5..710c4af 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
@@ -1729,14 +1729,11 @@
}
if (ActivitySecurityModelFeatureFlags.shouldShowToast(callingUid)) {
- Toast toast = Toast.makeText(mService.mContext,
+ UiThread.getHandler().post(() -> Toast.makeText(mService.mContext,
(ActivitySecurityModelFeatureFlags.DOC_LINK
- + (restrictActivitySwitch
- ? "returned home due to "
- : "would return home due to ")
- + callingLabel),
- Toast.LENGTH_LONG);
- UiThread.getHandler().post(toast::show);
+ + (restrictActivitySwitch ? " returned home due to "
+ : " would return home due to ")
+ + callingLabel), Toast.LENGTH_LONG).show());
}
// If the activity switch should be restricted, return home rather than the