Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80259355 authored by Craig Mautner's avatar Craig Mautner
Browse files

Remove home package name methods.

Do not use the shortcut of the package name to identify the home
activity.

Fixes bug 10963726.
Fixes bug 10920950.

Change-Id: I725781a26672b055a816994aee6ea458a7f07c88
parent adf14902
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -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
+5 −11
Original line number Diff line number Diff line
@@ -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;
+0 −27
Original line number Diff line number Diff line
@@ -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;
@@ -2267,11 +2261,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) {
@@ -2373,12 +2362,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) {
@@ -2635,14 +2618,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);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -418,6 +418,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);
        }