Loading core/java/android/view/IWindowManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -173,7 +173,7 @@ interface IWindowManager in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded); void setAppVisibility(IBinder token, boolean visible); void notifyAppResumed(IBinder token, boolean wasStopped); void notifyAppResumed(IBinder token, boolean wasStopped, boolean allowSavedSurface); void notifyAppStopped(IBinder token); void startAppFreezingScreen(IBinder token, int configChanges); void stopAppFreezingScreen(IBinder token, boolean force); Loading services/core/java/com/android/server/am/ActivityRecord.java +8 −0 Original line number Diff line number Diff line Loading @@ -750,6 +750,14 @@ final class ActivityRecord { && intent.getType() == null; } static boolean isMainIntent(Intent intent) { return Intent.ACTION_MAIN.equals(intent.getAction()) && intent.hasCategory(Intent.CATEGORY_LAUNCHER) && intent.getCategories().size() == 1 && intent.getData() == null && intent.getType() == null; } private boolean canLaunchHomeActivity(int uid, ActivityRecord sourceRecord) { if (uid == Process.myUid() || uid == 0) { // System process can launch home activity. Loading services/core/java/com/android/server/am/ActivityStack.java +13 −1 Original line number Diff line number Diff line Loading @@ -2485,13 +2485,25 @@ final class ActivityStack { } } boolean allowSavedSurface = true; if (next.newIntents != null) { // Restrict saved surface to launcher start, or there is no intent at all // (eg. task being brought to front). If the intent is something else, // likely the app is going to show some specific page or view, instead of // what's left last time. for (int i = next.newIntents.size() - 1; i >= 0; i--) { final Intent intent = next.newIntents.get(i); if (intent != null && !ActivityRecord.isMainIntent(intent)) { allowSavedSurface = false; break; } } next.app.thread.scheduleNewIntent(next.newIntents, next.appToken); } // Well the app will no longer be stopped. // Clear app token stopped state in window manager if needed. mWindowManager.notifyAppResumed(next.appToken, next.stopped); mWindowManager.notifyAppResumed(next.appToken, next.stopped, allowSavedSurface); EventLog.writeEvent(EventLogTags.AM_RESUME_ACTIVITY, next.userId, System.identityHashCode(next), next.task.taskId, next.shortComponentName); Loading services/core/java/com/android/server/wm/AppWindowToken.java +6 −2 Original line number Diff line number Diff line Loading @@ -439,12 +439,16 @@ class AppWindowToken extends WindowToken { * Notify that the app is now resumed, and it was not stopped before, perform a clean * up of the surfaces */ void notifyAppResumed(boolean wasStopped) { if (DEBUG_ADD_REMOVE) Slog.v(TAG, "notifyAppResumed: wasStopped=" + wasStopped + " " + this); void notifyAppResumed(boolean wasStopped, boolean allowSavedSurface) { if (DEBUG_ADD_REMOVE) Slog.v(TAG, "notifyAppResumed: wasStopped=" + wasStopped + " allowSavedSurface=" + allowSavedSurface + " " + this); mAppStopped = false; if (!wasStopped) { destroySurfaces(true /*cleanupOnResume*/); } if (!allowSavedSurface) { destroySavedSurfaces(); } } /** Loading services/core/java/com/android/server/wm/WindowManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -4479,7 +4479,7 @@ public class WindowManagerService extends IWindowManager.Stub } @Override public void notifyAppResumed(IBinder token, boolean wasStopped) { public void notifyAppResumed(IBinder token, boolean wasStopped, boolean allowSavedSurface) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "notifyAppResumed()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); Loading @@ -4492,7 +4492,7 @@ public class WindowManagerService extends IWindowManager.Stub Slog.w(TAG_WM, "Attempted to notify resumed of non-existing app token: " + token); return; } wtoken.notifyAppResumed(wasStopped); wtoken.notifyAppResumed(wasStopped, allowSavedSurface); } } Loading Loading
core/java/android/view/IWindowManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -173,7 +173,7 @@ interface IWindowManager in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded); void setAppVisibility(IBinder token, boolean visible); void notifyAppResumed(IBinder token, boolean wasStopped); void notifyAppResumed(IBinder token, boolean wasStopped, boolean allowSavedSurface); void notifyAppStopped(IBinder token); void startAppFreezingScreen(IBinder token, int configChanges); void stopAppFreezingScreen(IBinder token, boolean force); Loading
services/core/java/com/android/server/am/ActivityRecord.java +8 −0 Original line number Diff line number Diff line Loading @@ -750,6 +750,14 @@ final class ActivityRecord { && intent.getType() == null; } static boolean isMainIntent(Intent intent) { return Intent.ACTION_MAIN.equals(intent.getAction()) && intent.hasCategory(Intent.CATEGORY_LAUNCHER) && intent.getCategories().size() == 1 && intent.getData() == null && intent.getType() == null; } private boolean canLaunchHomeActivity(int uid, ActivityRecord sourceRecord) { if (uid == Process.myUid() || uid == 0) { // System process can launch home activity. Loading
services/core/java/com/android/server/am/ActivityStack.java +13 −1 Original line number Diff line number Diff line Loading @@ -2485,13 +2485,25 @@ final class ActivityStack { } } boolean allowSavedSurface = true; if (next.newIntents != null) { // Restrict saved surface to launcher start, or there is no intent at all // (eg. task being brought to front). If the intent is something else, // likely the app is going to show some specific page or view, instead of // what's left last time. for (int i = next.newIntents.size() - 1; i >= 0; i--) { final Intent intent = next.newIntents.get(i); if (intent != null && !ActivityRecord.isMainIntent(intent)) { allowSavedSurface = false; break; } } next.app.thread.scheduleNewIntent(next.newIntents, next.appToken); } // Well the app will no longer be stopped. // Clear app token stopped state in window manager if needed. mWindowManager.notifyAppResumed(next.appToken, next.stopped); mWindowManager.notifyAppResumed(next.appToken, next.stopped, allowSavedSurface); EventLog.writeEvent(EventLogTags.AM_RESUME_ACTIVITY, next.userId, System.identityHashCode(next), next.task.taskId, next.shortComponentName); Loading
services/core/java/com/android/server/wm/AppWindowToken.java +6 −2 Original line number Diff line number Diff line Loading @@ -439,12 +439,16 @@ class AppWindowToken extends WindowToken { * Notify that the app is now resumed, and it was not stopped before, perform a clean * up of the surfaces */ void notifyAppResumed(boolean wasStopped) { if (DEBUG_ADD_REMOVE) Slog.v(TAG, "notifyAppResumed: wasStopped=" + wasStopped + " " + this); void notifyAppResumed(boolean wasStopped, boolean allowSavedSurface) { if (DEBUG_ADD_REMOVE) Slog.v(TAG, "notifyAppResumed: wasStopped=" + wasStopped + " allowSavedSurface=" + allowSavedSurface + " " + this); mAppStopped = false; if (!wasStopped) { destroySurfaces(true /*cleanupOnResume*/); } if (!allowSavedSurface) { destroySavedSurfaces(); } } /** Loading
services/core/java/com/android/server/wm/WindowManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -4479,7 +4479,7 @@ public class WindowManagerService extends IWindowManager.Stub } @Override public void notifyAppResumed(IBinder token, boolean wasStopped) { public void notifyAppResumed(IBinder token, boolean wasStopped, boolean allowSavedSurface) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "notifyAppResumed()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); Loading @@ -4492,7 +4492,7 @@ public class WindowManagerService extends IWindowManager.Stub Slog.w(TAG_WM, "Attempted to notify resumed of non-existing app token: " + token); return; } wtoken.notifyAppResumed(wasStopped); wtoken.notifyAppResumed(wasStopped, allowSavedSurface); } } Loading