Merge "Resolve the correct home intent for secondary users" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5fc626639a
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user