diff options
| author | 2023-10-12 12:20:07 +0000 | |
|---|---|---|
| committer | 2023-10-12 12:20:07 +0000 | |
| commit | f7f16510ff7e7adcc510c97aaeb70f2f8e483ab8 (patch) | |
| tree | a7050a4e5a64bbf964a5b79c38e5fd57b408da29 | |
| parent | f25c6a5519ecf2d2e70baa06a415e89d1ab1cca1 (diff) | |
| parent | 996ff0ceb33f218b5e90b9be93cb059337b45cfd (diff) | |
Merge "swipe-dismiss: use original context for theme check" into main
| -rw-r--r-- | core/java/android/window/WindowOnBackInvokedDispatcher.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/window/WindowOnBackInvokedDispatcher.java b/core/java/android/window/WindowOnBackInvokedDispatcher.java index 849e0b32591a..3d4bc2f1b51c 100644 --- a/core/java/android/window/WindowOnBackInvokedDispatcher.java +++ b/core/java/android/window/WindowOnBackInvokedDispatcher.java @@ -467,6 +467,7 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { boolean requestsPredictiveBack = false; // Check if the context is from an activity. + Context originalContext = context; while ((context instanceof ContextWrapper) && !(context instanceof Activity)) { context = ((ContextWrapper) context).getBaseContext(); } @@ -515,8 +516,10 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // 3. windowSwipeToDismiss=false should be respected for apps not opted in, // which disables PB & onBackPressed caused by BackAnimController's // setTrigger(true) + // Use the original context to resolve the styled attribute so that they stay + // true to the window. TypedArray windowAttr = - context.obtainStyledAttributes( + originalContext.obtainStyledAttributes( new int[] {android.R.attr.windowSwipeToDismiss}); boolean windowSwipeToDismiss = true; if (windowAttr.getIndexCount() > 0) { |