diff options
6 files changed, 12 insertions, 52 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index a14d729a805d..c88100c839bd 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -2705,18 +2705,6 @@ public final class ActivityManagerService extends ActivityManagerNative return intent; } - String getHomePackageName() { - Intent intent = getHomeIntent(); - ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, mCurrentUserId); - if (aInfo != null) { - final String homePackageName = aInfo.applicationInfo.packageName; - if (!ResolverActivity.class.getName().equals(homePackageName)) { - return homePackageName; - } - } - return null; - } - boolean startHomeActivityLocked(int userId) { if (mHeadless) { // Added because none of the other calls to ensureBootCompleted seem to fire @@ -6786,6 +6774,10 @@ public final class ActivityManagerService extends ActivityManagerNative // Kill the running processes. for (int i=0; i<procs.size(); i++) { ProcessRecord pr = procs.get(i); + if (pr == mHomeProcess) { + // Don't kill the home process along with tasks from the same package. + continue; + } if (pr.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) { killUnneededProcessLocked(pr, "remove task"); } else { diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java index 43598954d32c..2c0b83bef0b8 100644 --- a/services/java/com/android/server/am/ActivityRecord.java +++ b/services/java/com/android/server/am/ActivityRecord.java @@ -58,6 +58,7 @@ import java.util.HashSet; final class ActivityRecord { static final String TAG = ActivityManagerService.TAG; static final boolean DEBUG_SAVED_STATE = ActivityStackSupervisor.DEBUG_SAVED_STATE; + final public static String RECENTS_PACKAGE_NAME = "com.android.systemui.recent"; final ActivityManagerService service; // owner final IApplicationToken.Stub appToken; // window manager token @@ -443,25 +444,18 @@ final class ActivityRecord { noDisplay = ent != null && ent.array.getBoolean( com.android.internal.R.styleable.Window_windowNoDisplay, false); - // If we know the system has determined the component, then - // we can consider this to be a home activity... - String homePackageName = supervisor.getHomePackageName(); - if (homePackageName != null && homePackageName.equals(packageName)) { - mActivityType = HOME_ACTIVITY_TYPE; - } else if ((!_componentSpecified || _launchedFromUid == Process.myUid() + if ((!_componentSpecified || _launchedFromUid == Process.myUid() || _launchedFromUid == 0) && Intent.ACTION_MAIN.equals(_intent.getAction()) && _intent.hasCategory(Intent.CATEGORY_HOME) && _intent.getCategories().size() == 1 && _intent.getData() == null && _intent.getType() == null && - (intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) { + (intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0 && + isNotResolverActivity()) { // This sure looks like a home activity! mActivityType = HOME_ACTIVITY_TYPE; - if (isNotResolverActivity()) { - supervisor.setHomePackageName(userId, packageName); - } - } else if (realActivity.getClassName().contains("com.android.systemui.recent")) { + } else if (realActivity.getClassName().contains(RECENTS_PACKAGE_NAME)) { mActivityType = RECENTS_ACTIVITY_TYPE; } else { mActivityType = APPLICATION_ACTIVITY_TYPE; diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java index bf9190435d2b..f71870633fdc 100644 --- a/services/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/java/com/android/server/am/ActivityStackSupervisor.java @@ -203,12 +203,6 @@ public final class ActivityStackSupervisor { */ final PowerManager.WakeLock mGoingToSleep; - /** - * The name of the current home activity for each user. - * TODO: Remove entries when user is deleted. - */ - final SparseArray<String> mHomePackageNames = new SparseArray<String>(); - public ActivityStackSupervisor(ActivityManagerService service, Context context, Looper looper) { mService = service; @@ -2285,11 +2279,6 @@ public final class ActivityStackSupervisor { boolean switchUserLocked(int userId, UserStartedState uss) { mCurrentUser = userId; - final String homePackageName = mService.getHomePackageName(); - if (homePackageName != null) { - setHomePackageName(mCurrentUser, homePackageName); - } - mStartingUsers.add(uss); boolean haveActivities = false; for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) { @@ -2391,12 +2380,6 @@ public final class ActivityStackSupervisor { pw.print(prefix); pw.print("mStackState="); pw.println(stackStateToString(mStackState)); pw.print(prefix); pw.println("mSleepTimeout: " + mSleepTimeout); pw.print(prefix); pw.println("mCurTaskId: " + mCurTaskId); - pw.print(prefix); pw.print("mHomePackageNames:"); - for (int i = 0; i < mHomePackageNames.size(); ++i) { - pw.print(" ("); pw.print(mHomePackageNames.keyAt(i)); pw.print(","); - pw.print(mHomePackageNames.valueAt(i)); pw.print(")"); - } - pw.println(); } ArrayList<ActivityRecord> getDumpActivitiesLocked(String name) { @@ -2653,14 +2636,4 @@ public final class ActivityStackSupervisor { } } } - - String getHomePackageName() { - return mHomePackageNames.get(mCurrentUser); - } - - void setHomePackageName(int userId, String homePackageName) { - if (DEBUG_SWITCH) Slog.d(TAG, "setHomePackageName: user=" + userId + " package=" - + homePackageName); - mHomePackageNames.put(userId, homePackageName); - } } diff --git a/services/java/com/android/server/am/TaskRecord.java b/services/java/com/android/server/am/TaskRecord.java index 8a9324ce0d2b..385253ef5bce 100644 --- a/services/java/com/android/server/am/TaskRecord.java +++ b/services/java/com/android/server/am/TaskRecord.java @@ -428,6 +428,7 @@ final class TaskRecord extends ThumbnailHolder { pw.print(prefix); pw.print("numActivities="); pw.print(numActivities); pw.print(" rootWasReset="); pw.print(rootWasReset); pw.print(" userId="); pw.print(userId); + pw.print(" mTaskType="); pw.print(mTaskType); pw.print(" numFullscreen="); pw.print(numFullscreen); pw.print(" mOnTopOfHome="); pw.println(mOnTopOfHome); } diff --git a/services/java/com/android/server/wm/DisplayContent.java b/services/java/com/android/server/wm/DisplayContent.java index beeb899e8e2c..2798104a99ac 100644 --- a/services/java/com/android/server/wm/DisplayContent.java +++ b/services/java/com/android/server/wm/DisplayContent.java @@ -162,6 +162,7 @@ class DisplayContent { void moveStack(TaskStack stack, boolean toTop) { mStackHistory.remove(stack); mStackHistory.add(toTop ? mStackHistory.size() : 0, stack); + mService.moveStackWindowsLocked(stack); } public boolean isPrivate() { diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 680b44ed29df..80c50cc2b2ff 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -4715,7 +4715,7 @@ public class WindowManagerService extends IWindowManager.Stub } } - private void moveStackWindowsLocked(TaskStack stack) { + void moveStackWindowsLocked(TaskStack stack) { DisplayContent displayContent = stack.getDisplayContent(); // First remove all of the windows from the list. @@ -4782,7 +4782,6 @@ public class WindowManagerService extends IWindowManager.Stub } stack.moveTaskToTop(task); displayContent.moveStack(stack, true); - moveStackWindowsLocked(stack); } } finally { Binder.restoreCallingIdentity(origId); |