Merge \\"Compare intent filter when launching adjacent\\" into nyc-dev am: 9980514ee0

am: 4f47b392cc

Change-Id: I49d1f1e08d9b917f4ba83316d7e6a37f42b72c8f
This commit is contained in:
Andrii Kulian
2016-06-21 05:33:50 +00:00
committed by android-build-merger
3 changed files with 18 additions and 7 deletions

View File

@@ -825,7 +825,8 @@ final class ActivityStack {
* is the same as the given activity. Returns null if no such activity * is the same as the given activity. Returns null if no such activity
* is found. * is found.
*/ */
ActivityRecord findActivityLocked(Intent intent, ActivityInfo info) { ActivityRecord findActivityLocked(Intent intent, ActivityInfo info,
boolean compareIntentFilters) {
ComponentName cls = intent.getComponent(); ComponentName cls = intent.getComponent();
if (info.targetActivity != null) { if (info.targetActivity != null) {
cls = new ComponentName(info.packageName, info.targetActivity); cls = new ComponentName(info.packageName, info.targetActivity);
@@ -843,8 +844,16 @@ final class ActivityStack {
if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0) { if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0) {
continue; continue;
} }
if (!r.finishing && r.intent.getComponent().equals(cls) && r.userId == userId) { if (!r.finishing && r.userId == userId) {
return r; if (compareIntentFilters) {
if (r.intent.filterEquals(intent)) {
return r;
}
} else {
if (r.intent.getComponent().equals(cls)) {
return r;
}
}
} }
} }
} }

View File

@@ -2621,11 +2621,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
return mTmpFindTaskResult.r; return mTmpFindTaskResult.r;
} }
ActivityRecord findActivityLocked(Intent intent, ActivityInfo info) { ActivityRecord findActivityLocked(Intent intent, ActivityInfo info,
boolean compareIntentFilters) {
for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) { for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks; final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) { for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityRecord ar = stacks.get(stackNdx).findActivityLocked(intent, info); final ActivityRecord ar = stacks.get(stackNdx)
.findActivityLocked(intent, info, compareIntentFilters);
if (ar != null) { if (ar != null) {
return ar; return ar;
} }

View File

@@ -1438,11 +1438,11 @@ class ActivityStarter {
if (mLaunchSingleInstance) { if (mLaunchSingleInstance) {
// There can be one and only one instance of single instance activity in the // There can be one and only one instance of single instance activity in the
// history, and it is always in its own unique task, so we do a special search. // history, and it is always in its own unique task, so we do a special search.
intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info); intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info, false);
} else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) { } else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) {
// For the launch adjacent case we only want to put the activity in an existing // For the launch adjacent case we only want to put the activity in an existing
// task if the activity already exists in the history. // task if the activity already exists in the history.
intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info); intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info, true);
} else { } else {
// Otherwise find the best task to put the activity in. // Otherwise find the best task to put the activity in.
intentActivity = mSupervisor.findTaskLocked(mStartActivity); intentActivity = mSupervisor.findTaskLocked(mStartActivity);