Loading core/java/android/window/WindowOnBackInvokedDispatcher.java +9 −10 Original line number Diff line number Diff line Loading @@ -442,8 +442,7 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { return WindowOnBackInvokedDispatcher .isOnBackInvokedCallbackEnabled(activityInfo, applicationInfo, () -> originalContext.obtainStyledAttributes( new int[] {android.R.attr.windowSwipeToDismiss}), true); () -> originalContext); } @Override Loading Loading @@ -501,7 +500,7 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { */ public static boolean isOnBackInvokedCallbackEnabled(@Nullable ActivityInfo activityInfo, @NonNull ApplicationInfo applicationInfo, @NonNull Supplier<TypedArray> windowAttrSupplier, boolean recycleTypedArray) { @NonNull Supplier<Context> contextSupplier) { // new back is enabled if the feature flag is enabled AND the app does not explicitly // request legacy back. if (!ENABLE_PREDICTIVE_BACK) { Loading Loading @@ -547,15 +546,15 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // setTrigger(true) // Use the original context to resolve the styled attribute so that they stay // true to the window. TypedArray windowAttr = windowAttrSupplier.get(); final Context context = contextSupplier.get(); boolean windowSwipeToDismiss = true; if (windowAttr != null) { if (windowAttr.getIndexCount() > 0) { windowSwipeToDismiss = windowAttr.getBoolean(0, true); } if (recycleTypedArray) { windowAttr.recycle(); if (context != null) { final TypedArray array = context.obtainStyledAttributes( new int[]{android.R.attr.windowSwipeToDismiss}); if (array.getIndexCount() > 0) { windowSwipeToDismiss = array.getBoolean(0, true); } array.recycle(); } if (DEBUG) { Loading services/core/java/com/android/server/wm/ActivityRecord.java +12 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import static android.app.WindowConfiguration.activityTypeToString; import static android.app.admin.DevicePolicyResources.Drawables.Source.PROFILE_SWITCH_ANIMATION; import static android.app.admin.DevicePolicyResources.Drawables.Style.OUTLINE; import static android.app.admin.DevicePolicyResources.Drawables.WORK_PROFILE_ICON; import static android.content.Context.CONTEXT_RESTRICTED; import static android.content.Intent.ACTION_MAIN; import static android.content.Intent.CATEGORY_HOME; import static android.content.Intent.CATEGORY_LAUNCHER; Loading Loading @@ -2231,7 +2232,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mOptInOnBackInvoked = WindowOnBackInvokedDispatcher .isOnBackInvokedCallbackEnabled(info, info.applicationInfo, () -> ent != null ? ent.array : null, false); () -> { Context appContext = null; try { appContext = mAtmService.mContext.createPackageContextAsUser( info.packageName, CONTEXT_RESTRICTED, UserHandle.of(mUserId)); appContext.setTheme(theme); } catch (PackageManager.NameNotFoundException ignore) { } return appContext; }); } /** Loading Loading
core/java/android/window/WindowOnBackInvokedDispatcher.java +9 −10 Original line number Diff line number Diff line Loading @@ -442,8 +442,7 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { return WindowOnBackInvokedDispatcher .isOnBackInvokedCallbackEnabled(activityInfo, applicationInfo, () -> originalContext.obtainStyledAttributes( new int[] {android.R.attr.windowSwipeToDismiss}), true); () -> originalContext); } @Override Loading Loading @@ -501,7 +500,7 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { */ public static boolean isOnBackInvokedCallbackEnabled(@Nullable ActivityInfo activityInfo, @NonNull ApplicationInfo applicationInfo, @NonNull Supplier<TypedArray> windowAttrSupplier, boolean recycleTypedArray) { @NonNull Supplier<Context> contextSupplier) { // new back is enabled if the feature flag is enabled AND the app does not explicitly // request legacy back. if (!ENABLE_PREDICTIVE_BACK) { Loading Loading @@ -547,15 +546,15 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // setTrigger(true) // Use the original context to resolve the styled attribute so that they stay // true to the window. TypedArray windowAttr = windowAttrSupplier.get(); final Context context = contextSupplier.get(); boolean windowSwipeToDismiss = true; if (windowAttr != null) { if (windowAttr.getIndexCount() > 0) { windowSwipeToDismiss = windowAttr.getBoolean(0, true); } if (recycleTypedArray) { windowAttr.recycle(); if (context != null) { final TypedArray array = context.obtainStyledAttributes( new int[]{android.R.attr.windowSwipeToDismiss}); if (array.getIndexCount() > 0) { windowSwipeToDismiss = array.getBoolean(0, true); } array.recycle(); } if (DEBUG) { Loading
services/core/java/com/android/server/wm/ActivityRecord.java +12 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import static android.app.WindowConfiguration.activityTypeToString; import static android.app.admin.DevicePolicyResources.Drawables.Source.PROFILE_SWITCH_ANIMATION; import static android.app.admin.DevicePolicyResources.Drawables.Style.OUTLINE; import static android.app.admin.DevicePolicyResources.Drawables.WORK_PROFILE_ICON; import static android.content.Context.CONTEXT_RESTRICTED; import static android.content.Intent.ACTION_MAIN; import static android.content.Intent.CATEGORY_HOME; import static android.content.Intent.CATEGORY_LAUNCHER; Loading Loading @@ -2231,7 +2232,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mOptInOnBackInvoked = WindowOnBackInvokedDispatcher .isOnBackInvokedCallbackEnabled(info, info.applicationInfo, () -> ent != null ? ent.array : null, false); () -> { Context appContext = null; try { appContext = mAtmService.mContext.createPackageContextAsUser( info.packageName, CONTEXT_RESTRICTED, UserHandle.of(mUserId)); appContext.setTheme(theme); } catch (PackageManager.NameNotFoundException ignore) { } return appContext; }); } /** Loading