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

Commit 5fc62663 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Resolve the correct home intent for secondary users" into jb-mr1-dev

parents dc531fa7 259d5e56
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -2150,8 +2150,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            intent.addCategory(Intent.CATEGORY_HOME);
        }
        ActivityInfo aInfo =
            intent.resolveActivityInfo(mContext.getPackageManager(),
                    STOCK_PM_FLAGS);
            resolveActivityInfo(intent, STOCK_PM_FLAGS, userId);
        if (aInfo != null) {
            intent.setComponent(new ComponentName(
                    aInfo.applicationInfo.packageName, aInfo.name));
@@ -2174,6 +2173,29 @@ public final class ActivityManagerService extends ActivityManagerNative
        return true;
    }
    private ActivityInfo resolveActivityInfo(Intent intent, int flags, int userId) {
        ActivityInfo ai = null;
        ComponentName comp = intent.getComponent();
        try {
            if (comp != null) {
                ai = AppGlobals.getPackageManager().getActivityInfo(comp, flags, userId);
            } else {
                ResolveInfo info = AppGlobals.getPackageManager().resolveIntent(
                        intent,
                        intent.resolveTypeIfNeeded(mContext.getContentResolver()),
                            flags, userId);
    
                if (info != null) {
                    ai = info.activityInfo;
                }
            }
        } catch (RemoteException e) {
            // ignore
        }
        return ai;
    }
    /**
     * Starts the "new version setup screen" if appropriate.
     */
+5 −7
Original line number Diff line number Diff line
@@ -422,11 +422,10 @@ final class ActivityStack {
    }
    
    final ActivityRecord topRunningActivityLocked(ActivityRecord notTop) {
        // TODO: Don't look for any tasks from other users
        int i = mHistory.size()-1;
        while (i >= 0) {
            ActivityRecord r = mHistory.get(i);
            if (!r.finishing && r != notTop) {
            if (!r.finishing && r != notTop && r.userId == mCurrentUser) {
                return r;
            }
            i--;
@@ -435,11 +434,10 @@ final class ActivityStack {
    }

    final ActivityRecord topRunningNonDelayedActivityLocked(ActivityRecord notTop) {
        // TODO: Don't look for any tasks from other users
        int i = mHistory.size()-1;
        while (i >= 0) {
            ActivityRecord r = mHistory.get(i);
            if (!r.finishing && !r.delayedResume && r != notTop) {
            if (!r.finishing && !r.delayedResume && r != notTop && r.userId == mCurrentUser) {
                return r;
            }
            i--;
@@ -457,12 +455,12 @@ final class ActivityStack {
     * @return Returns the HistoryRecord of the next activity on the stack.
     */
    final ActivityRecord topRunningActivityLocked(IBinder token, int taskId) {
        // TODO: Don't look for any tasks from other users
        int i = mHistory.size()-1;
        while (i >= 0) {
            ActivityRecord r = mHistory.get(i);
            // Note: the taskId check depends on real taskId fields being non-zero
            if (!r.finishing && (token != r.appToken) && (taskId != r.task.taskId)) {
            if (!r.finishing && (token != r.appToken) && (taskId != r.task.taskId)
                    && r.userId == mCurrentUser) {
                return r;
            }
            i--;
@@ -1400,7 +1398,7 @@ final class ActivityStack {
            // Launcher...
            if (mMainStack) {
                ActivityOptions.abort(options);
                return mService.startHomeActivityLocked(0, null);
                return mService.startHomeActivityLocked(mCurrentUser, null);
            }
        }