Merge "Remove home package name methods." into klp-dev
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index a14d729..75f2fcd 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -2705,18 +2705,6 @@
         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
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index 4359895..2c0b83b 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -58,6 +58,7 @@
 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 @@
             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 bf91904..f718706 100644
--- a/services/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/java/com/android/server/am/ActivityStackSupervisor.java
@@ -203,12 +203,6 @@
      */
     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 @@
     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 @@
         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 @@
             }
         }
     }
-
-    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 8a9324c..385253e 100644
--- a/services/java/com/android/server/am/TaskRecord.java
+++ b/services/java/com/android/server/am/TaskRecord.java
@@ -428,6 +428,7 @@
             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);
         }