Loading core/java/android/window/ProxyOnBackInvokedDispatcher.java +15 −2 Original line number Diff line number Diff line Loading @@ -90,10 +90,14 @@ public class ProxyOnBackInvokedDispatcher implements OnBackInvokedDispatcher { synchronized (mLock) { mCallbacks.add(Pair.create(callback, priority)); if (mActualDispatcher != null) { if (priority <= PRIORITY_SYSTEM) { mActualDispatcher.registerSystemOnBackInvokedCallback(callback); } else { mActualDispatcher.registerOnBackInvokedCallback(priority, callback); } } } } /** * Transfers all the pending callbacks to the provided dispatcher. Loading Loading @@ -171,7 +175,16 @@ public class ProxyOnBackInvokedDispatcher implements OnBackInvokedDispatcher { return; } clearCallbacksOnDispatcher(); if (actualDispatcher instanceof ProxyOnBackInvokedDispatcher) { // We don't want to nest ProxyDispatchers, so if we are given on, we unwrap its // actual dispatcher. // This can happen when an Activity is recreated but the Window is preserved (e.g. // when going from split-screen back to single screen) mActualDispatcher = ((ProxyOnBackInvokedDispatcher) actualDispatcher).mActualDispatcher; } else { mActualDispatcher = actualDispatcher; } transferCallbacksToDispatcher(); } } Loading core/java/com/android/internal/policy/PhoneWindow.java +3 −1 Original line number Diff line number Diff line Loading @@ -342,7 +342,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { boolean mDecorFitsSystemWindows = true; private ProxyOnBackInvokedDispatcher mProxyOnBackInvokedDispatcher = private final ProxyOnBackInvokedDispatcher mProxyOnBackInvokedDispatcher = new ProxyOnBackInvokedDispatcher(); static class WindowManagerHolder { Loading Loading @@ -378,6 +378,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // window, as we'll be skipping the addView in handleResumeActivity(), and // the token will not be updated as for a new window. getAttributes().token = preservedWindow.getAttributes().token; mProxyOnBackInvokedDispatcher.setActualDispatcher( preservedWindow.getOnBackInvokedDispatcher()); } // Even though the device doesn't support picture-in-picture mode, // an user can force using it through developer options. Loading Loading
core/java/android/window/ProxyOnBackInvokedDispatcher.java +15 −2 Original line number Diff line number Diff line Loading @@ -90,10 +90,14 @@ public class ProxyOnBackInvokedDispatcher implements OnBackInvokedDispatcher { synchronized (mLock) { mCallbacks.add(Pair.create(callback, priority)); if (mActualDispatcher != null) { if (priority <= PRIORITY_SYSTEM) { mActualDispatcher.registerSystemOnBackInvokedCallback(callback); } else { mActualDispatcher.registerOnBackInvokedCallback(priority, callback); } } } } /** * Transfers all the pending callbacks to the provided dispatcher. Loading Loading @@ -171,7 +175,16 @@ public class ProxyOnBackInvokedDispatcher implements OnBackInvokedDispatcher { return; } clearCallbacksOnDispatcher(); if (actualDispatcher instanceof ProxyOnBackInvokedDispatcher) { // We don't want to nest ProxyDispatchers, so if we are given on, we unwrap its // actual dispatcher. // This can happen when an Activity is recreated but the Window is preserved (e.g. // when going from split-screen back to single screen) mActualDispatcher = ((ProxyOnBackInvokedDispatcher) actualDispatcher).mActualDispatcher; } else { mActualDispatcher = actualDispatcher; } transferCallbacksToDispatcher(); } } Loading
core/java/com/android/internal/policy/PhoneWindow.java +3 −1 Original line number Diff line number Diff line Loading @@ -342,7 +342,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { boolean mDecorFitsSystemWindows = true; private ProxyOnBackInvokedDispatcher mProxyOnBackInvokedDispatcher = private final ProxyOnBackInvokedDispatcher mProxyOnBackInvokedDispatcher = new ProxyOnBackInvokedDispatcher(); static class WindowManagerHolder { Loading Loading @@ -378,6 +378,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // window, as we'll be skipping the addView in handleResumeActivity(), and // the token will not be updated as for a new window. getAttributes().token = preservedWindow.getAttributes().token; mProxyOnBackInvokedDispatcher.setActualDispatcher( preservedWindow.getOnBackInvokedDispatcher()); } // Even though the device doesn't support picture-in-picture mode, // an user can force using it through developer options. Loading