Loading core/java/android/view/Display.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -454,6 +454,19 @@ public final class Display { return mDisplayId; return mDisplayId; } } /** * Gets the display unique id. * <p> * Unique id is different from display id because physical displays have stable unique id across * reboots. * * @see com.android.service.display.DisplayDevice#hasStableUniqueId(). * @hide */ public String getUniqueId() { return mDisplayInfo.uniqueId; } /** /** * Returns true if this display is still valid, false if the display has been removed. * Returns true if this display is still valid, false if the display has been removed. * * Loading services/core/java/com/android/server/wm/ActivityStack.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -5184,12 +5184,14 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai /** /** * Removes the input task from this stack. * Removes the input task from this stack. * * @param task to remove. * @param task to remove. * @param reason for removal. * @param reason for removal. * @param mode task removal mode. Either {@link #REMOVE_TASK_MODE_DESTROYING}, * @param mode task removal mode. Either {@link #REMOVE_TASK_MODE_DESTROYING}, * {@link #REMOVE_TASK_MODE_MOVING}, {@link #REMOVE_TASK_MODE_MOVING_TO_TOP}. * {@link #REMOVE_TASK_MODE_MOVING}, {@link #REMOVE_TASK_MODE_MOVING_TO_TOP}. */ */ void removeTask(TaskRecord task, String reason, int mode) { void removeTask(TaskRecord task, String reason, int mode) { // TODO(b/119259346): Move some logic below to TaskRecord. See bug for more context. for (ActivityRecord record : task.mActivities) { for (ActivityRecord record : task.mActivities) { onActivityRemovedFromStack(record); onActivityRemovedFromStack(record); } } Loading @@ -5204,6 +5206,9 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai updateTaskMovement(task, true); updateTaskMovement(task, true); if (mode == REMOVE_TASK_MODE_DESTROYING && task.mActivities.isEmpty()) { if (mode == REMOVE_TASK_MODE_DESTROYING && task.mActivities.isEmpty()) { // This task is going away, so save the last state if necessary. task.saveLaunchingStateIfNeeded(); // TODO: VI what about activity? // TODO: VI what about activity? final boolean isVoiceSession = task.voiceSession != null; final boolean isVoiceSession = task.voiceSession != null; if (isVoiceSession) { if (isVoiceSession) { Loading services/core/java/com/android/server/wm/ActivityStackSupervisor.java +30 −1 Original line number Original line Diff line number Diff line Loading @@ -174,6 +174,7 @@ import android.util.SparseIntArray; import android.util.TimeUtils; import android.util.TimeUtils; import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream; import android.view.Display; import android.view.Display; import android.view.DisplayInfo; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -327,6 +328,9 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D WindowManagerService mWindowManager; WindowManagerService mWindowManager; DisplayManager mDisplayManager; DisplayManager mDisplayManager; /** Common synchronization logic used to save things to disks. */ PersisterQueue mPersisterQueue; LaunchParamsPersister mLaunchParamsPersister; private LaunchParamsController mLaunchParamsController; private LaunchParamsController mLaunchParamsController; /** /** Loading Loading @@ -631,10 +635,16 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D mActivityMetricsLogger = new ActivityMetricsLogger(this, mService.mContext, mHandler.getLooper()); mActivityMetricsLogger = new ActivityMetricsLogger(this, mService.mContext, mHandler.getLooper()); mKeyguardController = new KeyguardController(mService, this); mKeyguardController = new KeyguardController(mService, this); mLaunchParamsController = new LaunchParamsController(mService); mPersisterQueue = new PersisterQueue(); mLaunchParamsPersister = new LaunchParamsPersister(mPersisterQueue, this); mLaunchParamsController = new LaunchParamsController(mService, mLaunchParamsPersister); mLaunchParamsController.registerDefaultModifiers(this); mLaunchParamsController.registerDefaultModifiers(this); } } void onSystemReady() { mPersisterQueue.startPersisting(); mLaunchParamsPersister.onSystemReady(); } public ActivityMetricsLogger getActivityMetricsLogger() { public ActivityMetricsLogger getActivityMetricsLogger() { return mActivityMetricsLogger; return mActivityMetricsLogger; Loading Loading @@ -4249,6 +4259,25 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D return activityDisplay; return activityDisplay; } } /** * Get an existing instance of {@link ActivityDisplay} that has the given uniqueId. Unique ID is * defined in {@link DisplayInfo#uniqueId}. * * @param uniqueId the unique ID of the display * @return the {@link ActivityDisplay} or {@code null} if nothing is found. */ ActivityDisplay getActivityDisplay(String uniqueId) { for (int i = mActivityDisplays.size() - 1; i >= 0; --i) { final ActivityDisplay display = mActivityDisplays.get(i); final boolean isValid = display.mDisplay.isValid(); if (isValid && display.mDisplay.getUniqueId().equals(uniqueId)) { return display; } } return null; } boolean startHomeOnAllDisplays(int userId, String reason) { boolean startHomeOnAllDisplays(int userId, String reason) { boolean homeStarted = false; boolean homeStarted = false; for (int i = mActivityDisplays.size() - 1; i >= 0; i--) { for (int i = mActivityDisplays.size() - 1; i >= 0; i--) { Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -653,6 +653,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { mAssistUtils = new AssistUtils(mContext); mAssistUtils = new AssistUtils(mContext); mVrController.onSystemReady(); mVrController.onSystemReady(); mRecentTasks.onSystemReadyLocked(); mRecentTasks.onSystemReadyLocked(); mStackSupervisor.onSystemReady(); } } } } Loading Loading @@ -910,6 +911,20 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { mService.start(); mService.start(); } } @Override public void onUnlockUser(int userId) { synchronized (mService.getGlobalLock()) { mService.mStackSupervisor.mLaunchParamsPersister.onUnlockUser(userId); } } @Override public void onCleanupUser(int userId) { synchronized (mService.getGlobalLock()) { mService.mStackSupervisor.mLaunchParamsPersister.onCleanupUser(userId); } } public ActivityTaskManagerService getService() { public ActivityTaskManagerService getService() { return mService; return mService; } } Loading services/core/java/com/android/server/wm/LaunchParamsController.java +19 −5 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,7 @@ import java.util.List; */ */ class LaunchParamsController { class LaunchParamsController { private final ActivityTaskManagerService mService; private final ActivityTaskManagerService mService; private final LaunchParamsPersister mPersister; private final List<LaunchParamsModifier> mModifiers = new ArrayList<>(); private final List<LaunchParamsModifier> mModifiers = new ArrayList<>(); // Temporary {@link LaunchParams} for internal calculations. This is kept separate from // Temporary {@link LaunchParams} for internal calculations. This is kept separate from Loading @@ -49,8 +50,9 @@ class LaunchParamsController { private final LaunchParams mTmpCurrent = new LaunchParams(); private final LaunchParams mTmpCurrent = new LaunchParams(); private final LaunchParams mTmpResult = new LaunchParams(); private final LaunchParams mTmpResult = new LaunchParams(); LaunchParamsController(ActivityTaskManagerService service) { LaunchParamsController(ActivityTaskManagerService service, LaunchParamsPersister persister) { mService = service; mService = service; mPersister = persister; } } /** /** Loading @@ -75,6 +77,10 @@ class LaunchParamsController { ActivityRecord source, ActivityOptions options, LaunchParams result) { ActivityRecord source, ActivityOptions options, LaunchParams result) { result.reset(); result.reset(); if (task != null || activity != null) { mPersister.getLaunchParams(task, activity, result); } // We start at the last registered {@link LaunchParamsModifier} as this represents // We start at the last registered {@link LaunchParamsModifier} as this represents // The modifier closest to the product level. Moving back through the list moves closer to // The modifier closest to the product level. Moving back through the list moves closer to // the platform logic. // the platform logic. Loading Loading @@ -139,12 +145,20 @@ class LaunchParamsController { task.getStack().setWindowingMode(mTmpParams.mWindowingMode); task.getStack().setWindowingMode(mTmpParams.mWindowingMode); } } if (!mTmpParams.mBounds.isEmpty()) { if (mTmpParams.mBounds.isEmpty()) { return false; } if (task.getStack().inFreeformWindowingMode()) { // Only set bounds if it's in freeform mode. task.updateOverrideConfiguration(mTmpParams.mBounds); task.updateOverrideConfiguration(mTmpParams.mBounds); return true; return true; } else { return false; } } // Setting last non-fullscreen bounds to the bounds so next time the task enters // freeform windowing mode it can be in this bounds. task.setLastNonFullscreenBounds(mTmpParams.mBounds); return false; } finally { } finally { mService.mWindowManager.continueSurfaceLayout(); mService.mWindowManager.continueSurfaceLayout(); } } Loading Loading
core/java/android/view/Display.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -454,6 +454,19 @@ public final class Display { return mDisplayId; return mDisplayId; } } /** * Gets the display unique id. * <p> * Unique id is different from display id because physical displays have stable unique id across * reboots. * * @see com.android.service.display.DisplayDevice#hasStableUniqueId(). * @hide */ public String getUniqueId() { return mDisplayInfo.uniqueId; } /** /** * Returns true if this display is still valid, false if the display has been removed. * Returns true if this display is still valid, false if the display has been removed. * * Loading
services/core/java/com/android/server/wm/ActivityStack.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -5184,12 +5184,14 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai /** /** * Removes the input task from this stack. * Removes the input task from this stack. * * @param task to remove. * @param task to remove. * @param reason for removal. * @param reason for removal. * @param mode task removal mode. Either {@link #REMOVE_TASK_MODE_DESTROYING}, * @param mode task removal mode. Either {@link #REMOVE_TASK_MODE_DESTROYING}, * {@link #REMOVE_TASK_MODE_MOVING}, {@link #REMOVE_TASK_MODE_MOVING_TO_TOP}. * {@link #REMOVE_TASK_MODE_MOVING}, {@link #REMOVE_TASK_MODE_MOVING_TO_TOP}. */ */ void removeTask(TaskRecord task, String reason, int mode) { void removeTask(TaskRecord task, String reason, int mode) { // TODO(b/119259346): Move some logic below to TaskRecord. See bug for more context. for (ActivityRecord record : task.mActivities) { for (ActivityRecord record : task.mActivities) { onActivityRemovedFromStack(record); onActivityRemovedFromStack(record); } } Loading @@ -5204,6 +5206,9 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai updateTaskMovement(task, true); updateTaskMovement(task, true); if (mode == REMOVE_TASK_MODE_DESTROYING && task.mActivities.isEmpty()) { if (mode == REMOVE_TASK_MODE_DESTROYING && task.mActivities.isEmpty()) { // This task is going away, so save the last state if necessary. task.saveLaunchingStateIfNeeded(); // TODO: VI what about activity? // TODO: VI what about activity? final boolean isVoiceSession = task.voiceSession != null; final boolean isVoiceSession = task.voiceSession != null; if (isVoiceSession) { if (isVoiceSession) { Loading
services/core/java/com/android/server/wm/ActivityStackSupervisor.java +30 −1 Original line number Original line Diff line number Diff line Loading @@ -174,6 +174,7 @@ import android.util.SparseIntArray; import android.util.TimeUtils; import android.util.TimeUtils; import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream; import android.view.Display; import android.view.Display; import android.view.DisplayInfo; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -327,6 +328,9 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D WindowManagerService mWindowManager; WindowManagerService mWindowManager; DisplayManager mDisplayManager; DisplayManager mDisplayManager; /** Common synchronization logic used to save things to disks. */ PersisterQueue mPersisterQueue; LaunchParamsPersister mLaunchParamsPersister; private LaunchParamsController mLaunchParamsController; private LaunchParamsController mLaunchParamsController; /** /** Loading Loading @@ -631,10 +635,16 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D mActivityMetricsLogger = new ActivityMetricsLogger(this, mService.mContext, mHandler.getLooper()); mActivityMetricsLogger = new ActivityMetricsLogger(this, mService.mContext, mHandler.getLooper()); mKeyguardController = new KeyguardController(mService, this); mKeyguardController = new KeyguardController(mService, this); mLaunchParamsController = new LaunchParamsController(mService); mPersisterQueue = new PersisterQueue(); mLaunchParamsPersister = new LaunchParamsPersister(mPersisterQueue, this); mLaunchParamsController = new LaunchParamsController(mService, mLaunchParamsPersister); mLaunchParamsController.registerDefaultModifiers(this); mLaunchParamsController.registerDefaultModifiers(this); } } void onSystemReady() { mPersisterQueue.startPersisting(); mLaunchParamsPersister.onSystemReady(); } public ActivityMetricsLogger getActivityMetricsLogger() { public ActivityMetricsLogger getActivityMetricsLogger() { return mActivityMetricsLogger; return mActivityMetricsLogger; Loading Loading @@ -4249,6 +4259,25 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D return activityDisplay; return activityDisplay; } } /** * Get an existing instance of {@link ActivityDisplay} that has the given uniqueId. Unique ID is * defined in {@link DisplayInfo#uniqueId}. * * @param uniqueId the unique ID of the display * @return the {@link ActivityDisplay} or {@code null} if nothing is found. */ ActivityDisplay getActivityDisplay(String uniqueId) { for (int i = mActivityDisplays.size() - 1; i >= 0; --i) { final ActivityDisplay display = mActivityDisplays.get(i); final boolean isValid = display.mDisplay.isValid(); if (isValid && display.mDisplay.getUniqueId().equals(uniqueId)) { return display; } } return null; } boolean startHomeOnAllDisplays(int userId, String reason) { boolean startHomeOnAllDisplays(int userId, String reason) { boolean homeStarted = false; boolean homeStarted = false; for (int i = mActivityDisplays.size() - 1; i >= 0; i--) { for (int i = mActivityDisplays.size() - 1; i >= 0; i--) { Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -653,6 +653,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { mAssistUtils = new AssistUtils(mContext); mAssistUtils = new AssistUtils(mContext); mVrController.onSystemReady(); mVrController.onSystemReady(); mRecentTasks.onSystemReadyLocked(); mRecentTasks.onSystemReadyLocked(); mStackSupervisor.onSystemReady(); } } } } Loading Loading @@ -910,6 +911,20 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { mService.start(); mService.start(); } } @Override public void onUnlockUser(int userId) { synchronized (mService.getGlobalLock()) { mService.mStackSupervisor.mLaunchParamsPersister.onUnlockUser(userId); } } @Override public void onCleanupUser(int userId) { synchronized (mService.getGlobalLock()) { mService.mStackSupervisor.mLaunchParamsPersister.onCleanupUser(userId); } } public ActivityTaskManagerService getService() { public ActivityTaskManagerService getService() { return mService; return mService; } } Loading
services/core/java/com/android/server/wm/LaunchParamsController.java +19 −5 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,7 @@ import java.util.List; */ */ class LaunchParamsController { class LaunchParamsController { private final ActivityTaskManagerService mService; private final ActivityTaskManagerService mService; private final LaunchParamsPersister mPersister; private final List<LaunchParamsModifier> mModifiers = new ArrayList<>(); private final List<LaunchParamsModifier> mModifiers = new ArrayList<>(); // Temporary {@link LaunchParams} for internal calculations. This is kept separate from // Temporary {@link LaunchParams} for internal calculations. This is kept separate from Loading @@ -49,8 +50,9 @@ class LaunchParamsController { private final LaunchParams mTmpCurrent = new LaunchParams(); private final LaunchParams mTmpCurrent = new LaunchParams(); private final LaunchParams mTmpResult = new LaunchParams(); private final LaunchParams mTmpResult = new LaunchParams(); LaunchParamsController(ActivityTaskManagerService service) { LaunchParamsController(ActivityTaskManagerService service, LaunchParamsPersister persister) { mService = service; mService = service; mPersister = persister; } } /** /** Loading @@ -75,6 +77,10 @@ class LaunchParamsController { ActivityRecord source, ActivityOptions options, LaunchParams result) { ActivityRecord source, ActivityOptions options, LaunchParams result) { result.reset(); result.reset(); if (task != null || activity != null) { mPersister.getLaunchParams(task, activity, result); } // We start at the last registered {@link LaunchParamsModifier} as this represents // We start at the last registered {@link LaunchParamsModifier} as this represents // The modifier closest to the product level. Moving back through the list moves closer to // The modifier closest to the product level. Moving back through the list moves closer to // the platform logic. // the platform logic. Loading Loading @@ -139,12 +145,20 @@ class LaunchParamsController { task.getStack().setWindowingMode(mTmpParams.mWindowingMode); task.getStack().setWindowingMode(mTmpParams.mWindowingMode); } } if (!mTmpParams.mBounds.isEmpty()) { if (mTmpParams.mBounds.isEmpty()) { return false; } if (task.getStack().inFreeformWindowingMode()) { // Only set bounds if it's in freeform mode. task.updateOverrideConfiguration(mTmpParams.mBounds); task.updateOverrideConfiguration(mTmpParams.mBounds); return true; return true; } else { return false; } } // Setting last non-fullscreen bounds to the bounds so next time the task enters // freeform windowing mode it can be in this bounds. task.setLastNonFullscreenBounds(mTmpParams.mBounds); return false; } finally { } finally { mService.mWindowManager.continueSurfaceLayout(); mService.mWindowManager.continueSurfaceLayout(); } } Loading