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

am: b809d1cb79

Change-Id: Ia19c62e34dc1c64be600641c31f9825b1fe0e788
This commit is contained in:
Andrii Kulian
2016-06-21 05:33:59 +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 found.
*/
ActivityRecord findActivityLocked(Intent intent, ActivityInfo info) {
ActivityRecord findActivityLocked(Intent intent, ActivityInfo info,
boolean compareIntentFilters) {
ComponentName cls = intent.getComponent();
if (info.targetActivity != null) {
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) {
continue;
}
if (!r.finishing && r.intent.getComponent().equals(cls) && r.userId == userId) {
return r;
if (!r.finishing && r.userId == userId) {
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;
}
ActivityRecord findActivityLocked(Intent intent, ActivityInfo info) {
ActivityRecord findActivityLocked(Intent intent, ActivityInfo info,
boolean compareIntentFilters) {
for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
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) {
return ar;
}

View File

@@ -1438,11 +1438,11 @@ class ActivityStarter {
if (mLaunchSingleInstance) {
// 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.
intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info);
intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info, false);
} else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) {
// For the launch adjacent case we only want to put the activity in an existing
// task if the activity already exists in the history.
intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info);
intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info, true);
} else {
// Otherwise find the best task to put the activity in.
intentActivity = mSupervisor.findTaskLocked(mStartActivity);