Loading services/core/java/com/android/server/am/ActivityManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -10254,11 +10254,11 @@ public class ActivityManagerService extends IActivityManager.Stub if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToFront: moving taskId=" + taskId); synchronized(this) { moveTaskToFrontLocked(taskId, flags, bOptions); moveTaskToFrontLocked(taskId, flags, bOptions, false /* fromRecents */); } } void moveTaskToFrontLocked(int taskId, int flags, Bundle bOptions) { void moveTaskToFrontLocked(int taskId, int flags, Bundle bOptions, boolean fromRecents) { ActivityOptions options = ActivityOptions.fromBundle(bOptions); if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(), Loading Loading @@ -10291,7 +10291,7 @@ public class ActivityManagerService extends IActivityManager.Stub // We are reshowing a task, use a starting window to hide the initial draw delay // so the transition can start earlier. topActivity.showStartingWindow(null /* prev */, false /* newTask */, true /* taskSwitch */); true /* taskSwitch */, fromRecents); } } finally { Binder.restoreCallingIdentity(origId); services/core/java/com/android/server/am/ActivityRecord.java +7 −1 Original line number Diff line number Diff line Loading @@ -2153,6 +2153,11 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo } void showStartingWindow(ActivityRecord prev, boolean newTask, boolean taskSwitch) { showStartingWindow(prev, newTask, taskSwitch, false /* fromRecents */); } void showStartingWindow(ActivityRecord prev, boolean newTask, boolean taskSwitch, boolean fromRecents) { if (mWindowContainerController == null) { return; } Loading @@ -2167,7 +2172,8 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo compatInfo, nonLocalizedLabel, labelRes, icon, logo, windowFlags, prev != null ? prev.appToken : null, newTask, taskSwitch, isProcessRunning(), allowTaskSnapshot(), state.ordinal() >= RESUMED.ordinal() && state.ordinal() <= STOPPED.ordinal()); state.ordinal() >= RESUMED.ordinal() && state.ordinal() <= STOPPED.ordinal(), fromRecents); if (shown) { mStartingWindowState = STARTING_WINDOW_SHOWN; } Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +1 −1 Original line number Diff line number Diff line Loading @@ -5131,7 +5131,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D && task.getRootActivity() != null) { mService.mActivityStarter.sendPowerHintForLaunchStartIfNeeded(true /* forceSend */); mActivityMetricsLogger.notifyActivityLaunching(); mService.moveTaskToFrontLocked(task.taskId, 0, bOptions); mService.moveTaskToFrontLocked(task.taskId, 0, bOptions, true /* fromRecents */); mActivityMetricsLogger.notifyActivityLaunched(ActivityManager.START_TASK_TO_FRONT, task.getTopActivity()); Loading services/core/java/com/android/server/wm/AppWindowContainerController.java +31 −10 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.Trace; import android.util.Slog; import android.view.DisplayInfo; import android.view.IApplicationToken; import android.view.WindowManagerPolicy.StartingSurface; Loading Loading @@ -481,7 +482,7 @@ public class AppWindowContainerController public boolean addStartingWindow(String pkg, int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags, IBinder transferFrom, boolean newTask, boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot, boolean activityCreated) { boolean allowTaskSnapshot, boolean activityCreated, boolean fromRecents) { synchronized(mWindowMap) { if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "setAppStartingWindow: token=" + mToken + " pkg=" + pkg + " transferFrom=" + transferFrom + " newTask=" + newTask Loading Loading @@ -510,11 +511,14 @@ public class AppWindowContainerController return false; } final TaskSnapshot snapshot = mService.mTaskSnapshotController.getSnapshot( mContainer.getTask().mTaskId, mContainer.getTask().mUserId, false /* restoreFromDisk */, false /* reducedResolution */); final int type = getStartingWindowType(newTask, taskSwitch, processRunning, allowTaskSnapshot, activityCreated); allowTaskSnapshot, activityCreated, fromRecents, snapshot); if (type == STARTING_WINDOW_TYPE_SNAPSHOT) { return createSnapshot(); return createSnapshot(snapshot); } // If this is a translucent window, then don't show a starting window -- the current Loading Loading @@ -582,7 +586,8 @@ public class AppWindowContainerController } private int getStartingWindowType(boolean newTask, boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot, boolean activityCreated) { boolean allowTaskSnapshot, boolean activityCreated, boolean fromRecents, TaskSnapshot snapshot) { if (mService.mAppTransition.getAppTransition() == TRANSIT_DOCK_TASK_FROM_RECENTS) { // TODO(b/34099271): Remove this statement to add back the starting window and figure // out why it causes flickering, the starting window appears over the thumbnail while Loading @@ -591,7 +596,9 @@ public class AppWindowContainerController } else if (newTask || !processRunning || (taskSwitch && !activityCreated)) { return STARTING_WINDOW_TYPE_SPLASH_SCREEN; } else if (taskSwitch && allowTaskSnapshot) { return STARTING_WINDOW_TYPE_SNAPSHOT; return snapshot == null ? STARTING_WINDOW_TYPE_NONE : snapshotFillsWidth(snapshot) || fromRecents ? STARTING_WINDOW_TYPE_SNAPSHOT : STARTING_WINDOW_TYPE_SPLASH_SCREEN; } else { return STARTING_WINDOW_TYPE_NONE; } Loading @@ -605,11 +612,7 @@ public class AppWindowContainerController mService.mAnimationHandler.postAtFrontOfQueue(mAddStartingWindow); } private boolean createSnapshot() { final TaskSnapshot snapshot = mService.mTaskSnapshotController.getSnapshot( mContainer.getTask().mTaskId, mContainer.getTask().mUserId, false /* restoreFromDisk */, false /* reducedResolution */); private boolean createSnapshot(TaskSnapshot snapshot) { if (snapshot == null) { return false; } Loading @@ -620,6 +623,24 @@ public class AppWindowContainerController return true; } private boolean snapshotFillsWidth(TaskSnapshot snapshot) { if (snapshot == null) { return false; } final Rect rect = new Rect(0, 0, snapshot.getSnapshot().getWidth(), snapshot.getSnapshot().getHeight()); rect.inset(snapshot.getContentInsets()); final Rect taskBoundsWithoutInsets = new Rect(); mContainer.getTask().getBounds(taskBoundsWithoutInsets); final DisplayInfo di = mContainer.getDisplayContent().getDisplayInfo(); final Rect displayBounds = new Rect(0, 0, di.logicalWidth, di.logicalHeight); final Rect stableInsets = new Rect(); mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, stableInsets); displayBounds.inset(stableInsets); return rect.width() >= displayBounds.width(); } public void removeStartingWindow() { synchronized (mWindowMap) { if (mHandler.hasCallbacks(mRemoveStartingWindow)) { Loading services/core/java/com/android/server/wm/WindowManagerService.java +0 −8 Original line number Diff line number Diff line Loading @@ -1270,14 +1270,6 @@ public class WindowManagerService extends IWindowManager.Stub + token + ". Aborting."); return WindowManagerGlobal.ADD_APP_EXITING; } if (rootType == TYPE_APPLICATION_STARTING && (attrs.privateFlags & PRIVATE_FLAG_TASK_SNAPSHOT) == 0 && atoken.firstWindowDrawn) { // No need for this guy! if (DEBUG_STARTING_WINDOW || localLOGV) Slog.v( TAG_WM, "**** NO NEED TO START: " + attrs.getTitle()); return WindowManagerGlobal.ADD_STARTING_NOT_NEEDED; } } else if (rootType == TYPE_INPUT_METHOD) { if (token.windowType != TYPE_INPUT_METHOD) { Slog.w(TAG_WM, "Attempted to add input method window with bad token " Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -10254,11 +10254,11 @@ public class ActivityManagerService extends IActivityManager.Stub if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToFront: moving taskId=" + taskId); synchronized(this) { moveTaskToFrontLocked(taskId, flags, bOptions); moveTaskToFrontLocked(taskId, flags, bOptions, false /* fromRecents */); } } void moveTaskToFrontLocked(int taskId, int flags, Bundle bOptions) { void moveTaskToFrontLocked(int taskId, int flags, Bundle bOptions, boolean fromRecents) { ActivityOptions options = ActivityOptions.fromBundle(bOptions); if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(), Loading Loading @@ -10291,7 +10291,7 @@ public class ActivityManagerService extends IActivityManager.Stub // We are reshowing a task, use a starting window to hide the initial draw delay // so the transition can start earlier. topActivity.showStartingWindow(null /* prev */, false /* newTask */, true /* taskSwitch */); true /* taskSwitch */, fromRecents); } } finally { Binder.restoreCallingIdentity(origId);
services/core/java/com/android/server/am/ActivityRecord.java +7 −1 Original line number Diff line number Diff line Loading @@ -2153,6 +2153,11 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo } void showStartingWindow(ActivityRecord prev, boolean newTask, boolean taskSwitch) { showStartingWindow(prev, newTask, taskSwitch, false /* fromRecents */); } void showStartingWindow(ActivityRecord prev, boolean newTask, boolean taskSwitch, boolean fromRecents) { if (mWindowContainerController == null) { return; } Loading @@ -2167,7 +2172,8 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo compatInfo, nonLocalizedLabel, labelRes, icon, logo, windowFlags, prev != null ? prev.appToken : null, newTask, taskSwitch, isProcessRunning(), allowTaskSnapshot(), state.ordinal() >= RESUMED.ordinal() && state.ordinal() <= STOPPED.ordinal()); state.ordinal() >= RESUMED.ordinal() && state.ordinal() <= STOPPED.ordinal(), fromRecents); if (shown) { mStartingWindowState = STARTING_WINDOW_SHOWN; } Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +1 −1 Original line number Diff line number Diff line Loading @@ -5131,7 +5131,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D && task.getRootActivity() != null) { mService.mActivityStarter.sendPowerHintForLaunchStartIfNeeded(true /* forceSend */); mActivityMetricsLogger.notifyActivityLaunching(); mService.moveTaskToFrontLocked(task.taskId, 0, bOptions); mService.moveTaskToFrontLocked(task.taskId, 0, bOptions, true /* fromRecents */); mActivityMetricsLogger.notifyActivityLaunched(ActivityManager.START_TASK_TO_FRONT, task.getTopActivity()); Loading
services/core/java/com/android/server/wm/AppWindowContainerController.java +31 −10 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.Trace; import android.util.Slog; import android.view.DisplayInfo; import android.view.IApplicationToken; import android.view.WindowManagerPolicy.StartingSurface; Loading Loading @@ -481,7 +482,7 @@ public class AppWindowContainerController public boolean addStartingWindow(String pkg, int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags, IBinder transferFrom, boolean newTask, boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot, boolean activityCreated) { boolean allowTaskSnapshot, boolean activityCreated, boolean fromRecents) { synchronized(mWindowMap) { if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "setAppStartingWindow: token=" + mToken + " pkg=" + pkg + " transferFrom=" + transferFrom + " newTask=" + newTask Loading Loading @@ -510,11 +511,14 @@ public class AppWindowContainerController return false; } final TaskSnapshot snapshot = mService.mTaskSnapshotController.getSnapshot( mContainer.getTask().mTaskId, mContainer.getTask().mUserId, false /* restoreFromDisk */, false /* reducedResolution */); final int type = getStartingWindowType(newTask, taskSwitch, processRunning, allowTaskSnapshot, activityCreated); allowTaskSnapshot, activityCreated, fromRecents, snapshot); if (type == STARTING_WINDOW_TYPE_SNAPSHOT) { return createSnapshot(); return createSnapshot(snapshot); } // If this is a translucent window, then don't show a starting window -- the current Loading Loading @@ -582,7 +586,8 @@ public class AppWindowContainerController } private int getStartingWindowType(boolean newTask, boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot, boolean activityCreated) { boolean allowTaskSnapshot, boolean activityCreated, boolean fromRecents, TaskSnapshot snapshot) { if (mService.mAppTransition.getAppTransition() == TRANSIT_DOCK_TASK_FROM_RECENTS) { // TODO(b/34099271): Remove this statement to add back the starting window and figure // out why it causes flickering, the starting window appears over the thumbnail while Loading @@ -591,7 +596,9 @@ public class AppWindowContainerController } else if (newTask || !processRunning || (taskSwitch && !activityCreated)) { return STARTING_WINDOW_TYPE_SPLASH_SCREEN; } else if (taskSwitch && allowTaskSnapshot) { return STARTING_WINDOW_TYPE_SNAPSHOT; return snapshot == null ? STARTING_WINDOW_TYPE_NONE : snapshotFillsWidth(snapshot) || fromRecents ? STARTING_WINDOW_TYPE_SNAPSHOT : STARTING_WINDOW_TYPE_SPLASH_SCREEN; } else { return STARTING_WINDOW_TYPE_NONE; } Loading @@ -605,11 +612,7 @@ public class AppWindowContainerController mService.mAnimationHandler.postAtFrontOfQueue(mAddStartingWindow); } private boolean createSnapshot() { final TaskSnapshot snapshot = mService.mTaskSnapshotController.getSnapshot( mContainer.getTask().mTaskId, mContainer.getTask().mUserId, false /* restoreFromDisk */, false /* reducedResolution */); private boolean createSnapshot(TaskSnapshot snapshot) { if (snapshot == null) { return false; } Loading @@ -620,6 +623,24 @@ public class AppWindowContainerController return true; } private boolean snapshotFillsWidth(TaskSnapshot snapshot) { if (snapshot == null) { return false; } final Rect rect = new Rect(0, 0, snapshot.getSnapshot().getWidth(), snapshot.getSnapshot().getHeight()); rect.inset(snapshot.getContentInsets()); final Rect taskBoundsWithoutInsets = new Rect(); mContainer.getTask().getBounds(taskBoundsWithoutInsets); final DisplayInfo di = mContainer.getDisplayContent().getDisplayInfo(); final Rect displayBounds = new Rect(0, 0, di.logicalWidth, di.logicalHeight); final Rect stableInsets = new Rect(); mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, stableInsets); displayBounds.inset(stableInsets); return rect.width() >= displayBounds.width(); } public void removeStartingWindow() { synchronized (mWindowMap) { if (mHandler.hasCallbacks(mRemoveStartingWindow)) { Loading
services/core/java/com/android/server/wm/WindowManagerService.java +0 −8 Original line number Diff line number Diff line Loading @@ -1270,14 +1270,6 @@ public class WindowManagerService extends IWindowManager.Stub + token + ". Aborting."); return WindowManagerGlobal.ADD_APP_EXITING; } if (rootType == TYPE_APPLICATION_STARTING && (attrs.privateFlags & PRIVATE_FLAG_TASK_SNAPSHOT) == 0 && atoken.firstWindowDrawn) { // No need for this guy! if (DEBUG_STARTING_WINDOW || localLOGV) Slog.v( TAG_WM, "**** NO NEED TO START: " + attrs.getTitle()); return WindowManagerGlobal.ADD_STARTING_NOT_NEEDED; } } else if (rootType == TYPE_INPUT_METHOD) { if (token.windowType != TYPE_INPUT_METHOD) { Slog.w(TAG_WM, "Attempted to add input method window with bad token " Loading