Loading core/java/android/app/ActivityThread.java +9 −4 Original line number Original line Diff line number Diff line Loading @@ -4168,7 +4168,7 @@ public final class ActivityThread { } } IBinder wtoken = v.getWindowToken(); IBinder wtoken = v.getWindowToken(); if (r.activity.mWindowAdded) { if (r.activity.mWindowAdded) { if (r.onlyLocalRequest || r.mPreserveWindow) { if (r.mPreserveWindow) { // Hold off on removing this until the new activity's // Hold off on removing this until the new activity's // window is being added. // window is being added. r.mPendingRemoveWindow = r.window; r.mPendingRemoveWindow = r.window; Loading Loading @@ -4403,15 +4403,20 @@ public final class ActivityThread { // be replaced and defer requests to destroy or hide them. This way we can achieve // be replaced and defer requests to destroy or hide them. This way we can achieve // visual continuity. It's important that we do this here prior to pause and destroy // visual continuity. It's important that we do this here prior to pause and destroy // as that is when we may hide or remove the child views. // as that is when we may hide or remove the child views. // // There is another scenario, if we have decided locally to relaunch the app from a // call to recreate, then none of the windows will be prepared for replacement or // preserved by the server, so we want to notify it that we are preparing to replace // everything try { try { if (r.mPreserveWindow) { if (r.mPreserveWindow || r.onlyLocalRequest) { WindowManagerGlobal.getWindowSession().prepareToReplaceChildren(r.token); WindowManagerGlobal.getWindowSession().prepareToReplaceWindows( r.token, !r.onlyLocalRequest); } } } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } // Need to ensure state is saved. // Need to ensure state is saved. if (!r.paused) { if (!r.paused) { performPauseActivity(r.token, false, r.isPreHoneycomb(), "handleRelaunchActivity"); performPauseActivity(r.token, false, r.isPreHoneycomb(), "handleRelaunchActivity"); Loading core/java/android/view/IWindowSession.aidl +4 −2 Original line number Original line Diff line number Diff line Loading @@ -125,11 +125,13 @@ interface IWindowSession { /* /* * Notify the window manager that an application is relaunching and * Notify the window manager that an application is relaunching and * child windows should be prepared for replacement. * windows should be prepared for replacement. * * * @param appToken The application * @param appToken The application * @param childrenOnly Whether to only prepare child windows for replacement * (for example when main windows are being reused via preservation). */ */ void prepareToReplaceChildren(IBinder appToken); void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly); /** /** * If a call to relayout() asked to have the surface destroy deferred, * If a call to relayout() asked to have the surface destroy deferred, Loading services/core/java/com/android/server/wm/Session.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -201,8 +201,8 @@ final class Session extends IWindowSession.Stub } } @Override @Override public void prepareToReplaceChildren(IBinder appToken) { public void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly) { mService.setReplacingChildren(appToken); mService.setReplacingWindows(appToken, childrenOnly); } } public int relayout(IWindow window, int seq, WindowManager.LayoutParams attrs, public int relayout(IWindow window, int seq, WindowManager.LayoutParams attrs, Loading services/core/java/com/android/server/wm/WindowManagerService.java +13 −4 Original line number Original line Diff line number Diff line Loading @@ -10700,12 +10700,16 @@ public class WindowManagerService extends IWindowManager.Stub } } /** /** * Hint to a token that its children will be replaced across activity relaunch. * Hint to a token that its windows will be replaced across activity relaunch. * The children would otherwise be removed shortly following this as the * The windows would otherwise be removed shortly following this as the * activity is torn down. * activity is torn down. * @param token Application token for which the activity will be relaunched. * @param token Application token for which the activity will be relaunched. * @param childrenOnly Whether to mark only child windows for replacement * (for the case where main windows are being preserved/ * reused rather than replaced). * */ */ public void setReplacingChildren(IBinder token) { public void setReplacingWindows(IBinder token, boolean childrenOnly) { AppWindowToken appWindowToken = null; AppWindowToken appWindowToken = null; synchronized (mWindowMap) { synchronized (mWindowMap) { appWindowToken = findAppWindowToken(token); appWindowToken = findAppWindowToken(token); Loading @@ -10715,7 +10719,12 @@ public class WindowManagerService extends IWindowManager.Stub return; return; } } if (childrenOnly) { appWindowToken.setReplacingChildren(); appWindowToken.setReplacingChildren(); } else { appWindowToken.setReplacingWindows(false /* animate */); } scheduleClearReplacingWindowIfNeeded(token, true /* replacing */); scheduleClearReplacingWindowIfNeeded(token, true /* replacing */); } } } } Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -233,7 +233,7 @@ public final class BridgeWindowSession implements IWindowSession { } } @Override @Override public void prepareToReplaceChildren(IBinder appToken) { public void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly) { // pass for now. // pass for now. } } Loading Loading
core/java/android/app/ActivityThread.java +9 −4 Original line number Original line Diff line number Diff line Loading @@ -4168,7 +4168,7 @@ public final class ActivityThread { } } IBinder wtoken = v.getWindowToken(); IBinder wtoken = v.getWindowToken(); if (r.activity.mWindowAdded) { if (r.activity.mWindowAdded) { if (r.onlyLocalRequest || r.mPreserveWindow) { if (r.mPreserveWindow) { // Hold off on removing this until the new activity's // Hold off on removing this until the new activity's // window is being added. // window is being added. r.mPendingRemoveWindow = r.window; r.mPendingRemoveWindow = r.window; Loading Loading @@ -4403,15 +4403,20 @@ public final class ActivityThread { // be replaced and defer requests to destroy or hide them. This way we can achieve // be replaced and defer requests to destroy or hide them. This way we can achieve // visual continuity. It's important that we do this here prior to pause and destroy // visual continuity. It's important that we do this here prior to pause and destroy // as that is when we may hide or remove the child views. // as that is when we may hide or remove the child views. // // There is another scenario, if we have decided locally to relaunch the app from a // call to recreate, then none of the windows will be prepared for replacement or // preserved by the server, so we want to notify it that we are preparing to replace // everything try { try { if (r.mPreserveWindow) { if (r.mPreserveWindow || r.onlyLocalRequest) { WindowManagerGlobal.getWindowSession().prepareToReplaceChildren(r.token); WindowManagerGlobal.getWindowSession().prepareToReplaceWindows( r.token, !r.onlyLocalRequest); } } } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } // Need to ensure state is saved. // Need to ensure state is saved. if (!r.paused) { if (!r.paused) { performPauseActivity(r.token, false, r.isPreHoneycomb(), "handleRelaunchActivity"); performPauseActivity(r.token, false, r.isPreHoneycomb(), "handleRelaunchActivity"); Loading
core/java/android/view/IWindowSession.aidl +4 −2 Original line number Original line Diff line number Diff line Loading @@ -125,11 +125,13 @@ interface IWindowSession { /* /* * Notify the window manager that an application is relaunching and * Notify the window manager that an application is relaunching and * child windows should be prepared for replacement. * windows should be prepared for replacement. * * * @param appToken The application * @param appToken The application * @param childrenOnly Whether to only prepare child windows for replacement * (for example when main windows are being reused via preservation). */ */ void prepareToReplaceChildren(IBinder appToken); void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly); /** /** * If a call to relayout() asked to have the surface destroy deferred, * If a call to relayout() asked to have the surface destroy deferred, Loading
services/core/java/com/android/server/wm/Session.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -201,8 +201,8 @@ final class Session extends IWindowSession.Stub } } @Override @Override public void prepareToReplaceChildren(IBinder appToken) { public void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly) { mService.setReplacingChildren(appToken); mService.setReplacingWindows(appToken, childrenOnly); } } public int relayout(IWindow window, int seq, WindowManager.LayoutParams attrs, public int relayout(IWindow window, int seq, WindowManager.LayoutParams attrs, Loading
services/core/java/com/android/server/wm/WindowManagerService.java +13 −4 Original line number Original line Diff line number Diff line Loading @@ -10700,12 +10700,16 @@ public class WindowManagerService extends IWindowManager.Stub } } /** /** * Hint to a token that its children will be replaced across activity relaunch. * Hint to a token that its windows will be replaced across activity relaunch. * The children would otherwise be removed shortly following this as the * The windows would otherwise be removed shortly following this as the * activity is torn down. * activity is torn down. * @param token Application token for which the activity will be relaunched. * @param token Application token for which the activity will be relaunched. * @param childrenOnly Whether to mark only child windows for replacement * (for the case where main windows are being preserved/ * reused rather than replaced). * */ */ public void setReplacingChildren(IBinder token) { public void setReplacingWindows(IBinder token, boolean childrenOnly) { AppWindowToken appWindowToken = null; AppWindowToken appWindowToken = null; synchronized (mWindowMap) { synchronized (mWindowMap) { appWindowToken = findAppWindowToken(token); appWindowToken = findAppWindowToken(token); Loading @@ -10715,7 +10719,12 @@ public class WindowManagerService extends IWindowManager.Stub return; return; } } if (childrenOnly) { appWindowToken.setReplacingChildren(); appWindowToken.setReplacingChildren(); } else { appWindowToken.setReplacingWindows(false /* animate */); } scheduleClearReplacingWindowIfNeeded(token, true /* replacing */); scheduleClearReplacingWindowIfNeeded(token, true /* replacing */); } } } } Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -233,7 +233,7 @@ public final class BridgeWindowSession implements IWindowSession { } } @Override @Override public void prepareToReplaceChildren(IBinder appToken) { public void prepareToReplaceWindows(IBinder appToken, boolean childrenOnly) { // pass for now. // pass for now. } } Loading