Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +4 −16 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ import static com.android.server.wm.WindowManagerPolicyProto.WINDOW_MANAGER_DRAW import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.ActivityOptions; import android.app.ActivityTaskManager; import android.app.AppOpsManager; import android.app.IUiModeManager; Loading Loading @@ -5114,6 +5113,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { awakenDreams(); } // Start dock. Intent dock = createHomeDockIntent(); if (dock != null) { try { Loading @@ -5126,21 +5126,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } Intent intent; if (fromHomeKey) { intent = new Intent(mHomeIntent); intent.putExtra(WindowManagerPolicy.EXTRA_FROM_HOME_KEY, fromHomeKey); } else { intent = mHomeIntent; } final Bundle bundle = getLaunchDisplayIdBundle(displayId); startActivityAsUser(intent, bundle, UserHandle.CURRENT); } private @Nullable Bundle getLaunchDisplayIdBundle(int displayId) { return (displayId == INVALID_DISPLAY) ? null : ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle(); // Start home. mActivityTaskManagerInternal.startHomeOnDisplay(mCurrentUserId, "startDockOrHome", displayId, fromHomeKey); } /** Loading services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +13 −0 Original line number Diff line number Diff line Loading @@ -352,6 +352,19 @@ public abstract class ActivityTaskManagerInternal { /** @return The intent used to launch the home activity. */ public abstract Intent getHomeIntent(); public abstract boolean startHomeActivity(int userId, String reason); /** * This starts home activity on displays that can have system decorations based on displayId - * Default display always use primary home component. * For Secondary displays, the home activity must have category SECONDARY_HOME and then resolves * according to the priorities listed below. * - If default home is not set, always use the secondary home defined in the config. * - Use currently selected primary home activity. * - Use the activity in the same package as currently selected primary home activity. * If there are multiple activities matched, use first one. * - Use the secondary home defined in the config. */ public abstract boolean startHomeOnDisplay(int userId, String reason, int displayId, boolean fromHomeKey); /** Start home activities on all displays that support system decorations. */ public abstract boolean startHomeOnAllDisplays(int userId, String reason); /** @return true if the given process is the factory test process. */ Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -6490,6 +6490,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } @Override public boolean startHomeOnDisplay(int userId, String reason, int displayId, boolean fromHomeKey) { return mRootActivityContainer.startHomeOnDisplay(userId, reason, displayId, fromHomeKey); } @Override public boolean startHomeOnAllDisplays(int userId, String reason) { synchronized (mGlobalLock) { Loading services/core/java/com/android/server/wm/RootActivityContainer.java +15 −1 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ import com.android.server.LocalServices; import com.android.server.am.ActivityManagerService; import com.android.server.am.AppTimeTracker; import com.android.server.am.UserState; import com.android.server.policy.WindowManagerPolicy; import java.io.FileDescriptor; import java.io.PrintWriter; Loading Loading @@ -345,6 +346,10 @@ class RootActivityContainer extends ConfigurationContainer } } boolean startHomeOnDisplay(int userId, String reason, int displayId) { return startHomeOnDisplay(userId, reason, displayId, false /*fromHomeKey*/); } /** * This starts home activity on displays that can have system decorations based on displayId - * Default display always use primary home component. Loading @@ -356,7 +361,12 @@ class RootActivityContainer extends ConfigurationContainer * If there are multiple activities matched, use first one. * - Use the secondary home defined in the config. */ boolean startHomeOnDisplay(int userId, String reason, int displayId) { boolean startHomeOnDisplay(int userId, String reason, int displayId, boolean fromHomeKey) { // Fallback to top focused display if the displayId is invalid. if (displayId == INVALID_DISPLAY) { displayId = getTopDisplayFocusedStack().mDisplayId; } Intent homeIntent; ActivityInfo aInfo; if (displayId == DEFAULT_DISPLAY) { Loading @@ -380,6 +390,10 @@ class RootActivityContainer extends ConfigurationContainer // Updates the home component of the intent. homeIntent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name)); homeIntent.setFlags(homeIntent.getFlags() | FLAG_ACTIVITY_NEW_TASK); // Updates the extra information of the intent. if (fromHomeKey) { homeIntent.putExtra(WindowManagerPolicy.EXTRA_FROM_HOME_KEY, true); } // Update the reason for ANR debugging to verify if the user activity is the one that // actually launched. final String myReason = reason + ":" + userId + ":" + UserHandle.getUserId( Loading Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +4 −16 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ import static com.android.server.wm.WindowManagerPolicyProto.WINDOW_MANAGER_DRAW import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.ActivityOptions; import android.app.ActivityTaskManager; import android.app.AppOpsManager; import android.app.IUiModeManager; Loading Loading @@ -5114,6 +5113,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { awakenDreams(); } // Start dock. Intent dock = createHomeDockIntent(); if (dock != null) { try { Loading @@ -5126,21 +5126,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } Intent intent; if (fromHomeKey) { intent = new Intent(mHomeIntent); intent.putExtra(WindowManagerPolicy.EXTRA_FROM_HOME_KEY, fromHomeKey); } else { intent = mHomeIntent; } final Bundle bundle = getLaunchDisplayIdBundle(displayId); startActivityAsUser(intent, bundle, UserHandle.CURRENT); } private @Nullable Bundle getLaunchDisplayIdBundle(int displayId) { return (displayId == INVALID_DISPLAY) ? null : ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle(); // Start home. mActivityTaskManagerInternal.startHomeOnDisplay(mCurrentUserId, "startDockOrHome", displayId, fromHomeKey); } /** Loading
services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +13 −0 Original line number Diff line number Diff line Loading @@ -352,6 +352,19 @@ public abstract class ActivityTaskManagerInternal { /** @return The intent used to launch the home activity. */ public abstract Intent getHomeIntent(); public abstract boolean startHomeActivity(int userId, String reason); /** * This starts home activity on displays that can have system decorations based on displayId - * Default display always use primary home component. * For Secondary displays, the home activity must have category SECONDARY_HOME and then resolves * according to the priorities listed below. * - If default home is not set, always use the secondary home defined in the config. * - Use currently selected primary home activity. * - Use the activity in the same package as currently selected primary home activity. * If there are multiple activities matched, use first one. * - Use the secondary home defined in the config. */ public abstract boolean startHomeOnDisplay(int userId, String reason, int displayId, boolean fromHomeKey); /** Start home activities on all displays that support system decorations. */ public abstract boolean startHomeOnAllDisplays(int userId, String reason); /** @return true if the given process is the factory test process. */ Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -6490,6 +6490,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } @Override public boolean startHomeOnDisplay(int userId, String reason, int displayId, boolean fromHomeKey) { return mRootActivityContainer.startHomeOnDisplay(userId, reason, displayId, fromHomeKey); } @Override public boolean startHomeOnAllDisplays(int userId, String reason) { synchronized (mGlobalLock) { Loading
services/core/java/com/android/server/wm/RootActivityContainer.java +15 −1 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ import com.android.server.LocalServices; import com.android.server.am.ActivityManagerService; import com.android.server.am.AppTimeTracker; import com.android.server.am.UserState; import com.android.server.policy.WindowManagerPolicy; import java.io.FileDescriptor; import java.io.PrintWriter; Loading Loading @@ -345,6 +346,10 @@ class RootActivityContainer extends ConfigurationContainer } } boolean startHomeOnDisplay(int userId, String reason, int displayId) { return startHomeOnDisplay(userId, reason, displayId, false /*fromHomeKey*/); } /** * This starts home activity on displays that can have system decorations based on displayId - * Default display always use primary home component. Loading @@ -356,7 +361,12 @@ class RootActivityContainer extends ConfigurationContainer * If there are multiple activities matched, use first one. * - Use the secondary home defined in the config. */ boolean startHomeOnDisplay(int userId, String reason, int displayId) { boolean startHomeOnDisplay(int userId, String reason, int displayId, boolean fromHomeKey) { // Fallback to top focused display if the displayId is invalid. if (displayId == INVALID_DISPLAY) { displayId = getTopDisplayFocusedStack().mDisplayId; } Intent homeIntent; ActivityInfo aInfo; if (displayId == DEFAULT_DISPLAY) { Loading @@ -380,6 +390,10 @@ class RootActivityContainer extends ConfigurationContainer // Updates the home component of the intent. homeIntent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name)); homeIntent.setFlags(homeIntent.getFlags() | FLAG_ACTIVITY_NEW_TASK); // Updates the extra information of the intent. if (fromHomeKey) { homeIntent.putExtra(WindowManagerPolicy.EXTRA_FROM_HOME_KEY, true); } // Update the reason for ANR debugging to verify if the user activity is the one that // actually launched. final String myReason = reason + ":" + userId + ":" + UserHandle.getUserId( Loading