Loading services/core/java/com/android/server/wm/ActivityStartController.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.content.pm.ResolveInfo; import android.os.Binder; import android.os.Binder; import android.os.Bundle; import android.os.Bundle; import android.os.IBinder; import android.os.IBinder; import android.os.Trace; import android.os.UserHandle; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings; import android.util.Slog; import android.util.Slog; Loading Loading @@ -554,7 +555,25 @@ public class ActivityStartController { .execute(); .execute(); } } /** * A quick path (skip general intent/task resolving) to start recents animation if the recents * (or home) activity is available in background. * @return {@code true} if the recents activity is moved to front. */ boolean startExistingRecentsIfPossible(Intent intent, ActivityOptions options) { boolean startExistingRecentsIfPossible(Intent intent, ActivityOptions options) { try { Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "startExistingRecents"); if (startExistingRecents(intent, options)) { return true; } // Else follow the standard launch procedure. } finally { Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); } return false; } private boolean startExistingRecents(Intent intent, ActivityOptions options) { final int activityType = mService.getRecentTasks().getRecentsComponent() final int activityType = mService.getRecentTasks().getRecentsComponent() .equals(intent.getComponent()) ? ACTIVITY_TYPE_RECENTS : ACTIVITY_TYPE_HOME; .equals(intent.getComponent()) ? ACTIVITY_TYPE_RECENTS : ACTIVITY_TYPE_HOME; final Task rootTask = mService.mRootWindowContainer.getDefaultTaskDisplayArea() final Task rootTask = mService.mRootWindowContainer.getDefaultTaskDisplayArea() Loading @@ -563,6 +582,7 @@ public class ActivityStartController { final ActivityRecord r = rootTask.topRunningActivity(); final ActivityRecord r = rootTask.topRunningActivity(); if (r == null || r.isVisibleRequested() || !r.attachedToProcess() if (r == null || r.isVisibleRequested() || !r.attachedToProcess() || !r.mActivityComponent.equals(intent.getComponent()) || !r.mActivityComponent.equals(intent.getComponent()) || !mService.isCallerRecents(r.getUid()) // Recents keeps invisible while device is locked. // Recents keeps invisible while device is locked. || r.mDisplayContent.isKeyguardLocked()) { || r.mDisplayContent.isKeyguardLocked()) { return false; return false; Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +0 −17 Original line number Original line Diff line number Diff line Loading @@ -5753,23 +5753,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, BackgroundStartPrivileges backgroundStartPrivileges) { BackgroundStartPrivileges backgroundStartPrivileges) { assertPackageMatchesCallingUid(callingPackage); assertPackageMatchesCallingUid(callingPackage); // A quick path (skip general intent/task resolving) to start recents animation if the // recents (or home) activity is available in background. if (options != null && options.getOriginalOptions() != null && options.getOriginalOptions().getTransientLaunch() && isCallerRecents(uid)) { try { synchronized (mGlobalLock) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "startExistingRecents"); if (mActivityStartController.startExistingRecentsIfPossible( intent, options.getOriginalOptions())) { return ActivityManager.START_TASK_TO_FRONT; } // Else follow the standard launch procedure. } } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } return getActivityStartController().startActivityInPackage(uid, realCallingPid, return getActivityStartController().startActivityInPackage(uid, realCallingPid, realCallingUid, callingPackage, callingFeatureId, intent, resolvedType, realCallingUid, callingPackage, callingFeatureId, intent, resolvedType, resultTo, resultWho, requestCode, startFlags, options, userId, inTask, resultTo, resultWho, requestCode, startFlags, options, userId, inTask, Loading services/core/java/com/android/server/wm/WindowOrganizerController.java +15 −4 Original line number Original line Diff line number Diff line Loading @@ -972,19 +972,30 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub switch (type) { switch (type) { case HIERARCHY_OP_TYPE_PENDING_INTENT: { case HIERARCHY_OP_TYPE_PENDING_INTENT: { final Bundle launchOpts = hop.getLaunchOptions(); ActivityOptions activityOptions = launchOpts != null ? new ActivityOptions(launchOpts) : null; if (activityOptions != null && activityOptions.getTransientLaunch() && mService.isCallerRecents(hop.getPendingIntent().getCreatorUid())) { if (mService.getActivityStartController().startExistingRecentsIfPossible( hop.getActivityIntent(), activityOptions)) { // Start recents successfully. break; } } String resolvedType = hop.getActivityIntent() != null String resolvedType = hop.getActivityIntent() != null ? hop.getActivityIntent().resolveTypeIfNeeded( ? hop.getActivityIntent().resolveTypeIfNeeded( mService.mContext.getContentResolver()) mService.mContext.getContentResolver()) : null; : null; ActivityOptions activityOptions = null; if (hop.getPendingIntent().isActivity()) { if (hop.getPendingIntent().isActivity()) { // Set the context display id as preferred for this activity launches, so that // Set the context display id as preferred for this activity launches, so that // it can land on caller's display. Or just brought the task to front at the // it can land on caller's display. Or just brought the task to front at the // display where it was on since it has higher preference. // display where it was on since it has higher preference. activityOptions = hop.getLaunchOptions() != null if (activityOptions == null) { ? new ActivityOptions(hop.getLaunchOptions()) activityOptions = ActivityOptions.makeBasic(); : ActivityOptions.makeBasic(); } activityOptions.setCallerDisplayId(DEFAULT_DISPLAY); activityOptions.setCallerDisplayId(DEFAULT_DISPLAY); } } final Bundle options = activityOptions != null ? activityOptions.toBundle() : null; final Bundle options = activityOptions != null ? activityOptions.toBundle() : null; Loading Loading
services/core/java/com/android/server/wm/ActivityStartController.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.content.pm.ResolveInfo; import android.os.Binder; import android.os.Binder; import android.os.Bundle; import android.os.Bundle; import android.os.IBinder; import android.os.IBinder; import android.os.Trace; import android.os.UserHandle; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings; import android.util.Slog; import android.util.Slog; Loading Loading @@ -554,7 +555,25 @@ public class ActivityStartController { .execute(); .execute(); } } /** * A quick path (skip general intent/task resolving) to start recents animation if the recents * (or home) activity is available in background. * @return {@code true} if the recents activity is moved to front. */ boolean startExistingRecentsIfPossible(Intent intent, ActivityOptions options) { boolean startExistingRecentsIfPossible(Intent intent, ActivityOptions options) { try { Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "startExistingRecents"); if (startExistingRecents(intent, options)) { return true; } // Else follow the standard launch procedure. } finally { Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); } return false; } private boolean startExistingRecents(Intent intent, ActivityOptions options) { final int activityType = mService.getRecentTasks().getRecentsComponent() final int activityType = mService.getRecentTasks().getRecentsComponent() .equals(intent.getComponent()) ? ACTIVITY_TYPE_RECENTS : ACTIVITY_TYPE_HOME; .equals(intent.getComponent()) ? ACTIVITY_TYPE_RECENTS : ACTIVITY_TYPE_HOME; final Task rootTask = mService.mRootWindowContainer.getDefaultTaskDisplayArea() final Task rootTask = mService.mRootWindowContainer.getDefaultTaskDisplayArea() Loading @@ -563,6 +582,7 @@ public class ActivityStartController { final ActivityRecord r = rootTask.topRunningActivity(); final ActivityRecord r = rootTask.topRunningActivity(); if (r == null || r.isVisibleRequested() || !r.attachedToProcess() if (r == null || r.isVisibleRequested() || !r.attachedToProcess() || !r.mActivityComponent.equals(intent.getComponent()) || !r.mActivityComponent.equals(intent.getComponent()) || !mService.isCallerRecents(r.getUid()) // Recents keeps invisible while device is locked. // Recents keeps invisible while device is locked. || r.mDisplayContent.isKeyguardLocked()) { || r.mDisplayContent.isKeyguardLocked()) { return false; return false; Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +0 −17 Original line number Original line Diff line number Diff line Loading @@ -5753,23 +5753,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, BackgroundStartPrivileges backgroundStartPrivileges) { BackgroundStartPrivileges backgroundStartPrivileges) { assertPackageMatchesCallingUid(callingPackage); assertPackageMatchesCallingUid(callingPackage); // A quick path (skip general intent/task resolving) to start recents animation if the // recents (or home) activity is available in background. if (options != null && options.getOriginalOptions() != null && options.getOriginalOptions().getTransientLaunch() && isCallerRecents(uid)) { try { synchronized (mGlobalLock) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "startExistingRecents"); if (mActivityStartController.startExistingRecentsIfPossible( intent, options.getOriginalOptions())) { return ActivityManager.START_TASK_TO_FRONT; } // Else follow the standard launch procedure. } } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } } return getActivityStartController().startActivityInPackage(uid, realCallingPid, return getActivityStartController().startActivityInPackage(uid, realCallingPid, realCallingUid, callingPackage, callingFeatureId, intent, resolvedType, realCallingUid, callingPackage, callingFeatureId, intent, resolvedType, resultTo, resultWho, requestCode, startFlags, options, userId, inTask, resultTo, resultWho, requestCode, startFlags, options, userId, inTask, Loading
services/core/java/com/android/server/wm/WindowOrganizerController.java +15 −4 Original line number Original line Diff line number Diff line Loading @@ -972,19 +972,30 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub switch (type) { switch (type) { case HIERARCHY_OP_TYPE_PENDING_INTENT: { case HIERARCHY_OP_TYPE_PENDING_INTENT: { final Bundle launchOpts = hop.getLaunchOptions(); ActivityOptions activityOptions = launchOpts != null ? new ActivityOptions(launchOpts) : null; if (activityOptions != null && activityOptions.getTransientLaunch() && mService.isCallerRecents(hop.getPendingIntent().getCreatorUid())) { if (mService.getActivityStartController().startExistingRecentsIfPossible( hop.getActivityIntent(), activityOptions)) { // Start recents successfully. break; } } String resolvedType = hop.getActivityIntent() != null String resolvedType = hop.getActivityIntent() != null ? hop.getActivityIntent().resolveTypeIfNeeded( ? hop.getActivityIntent().resolveTypeIfNeeded( mService.mContext.getContentResolver()) mService.mContext.getContentResolver()) : null; : null; ActivityOptions activityOptions = null; if (hop.getPendingIntent().isActivity()) { if (hop.getPendingIntent().isActivity()) { // Set the context display id as preferred for this activity launches, so that // Set the context display id as preferred for this activity launches, so that // it can land on caller's display. Or just brought the task to front at the // it can land on caller's display. Or just brought the task to front at the // display where it was on since it has higher preference. // display where it was on since it has higher preference. activityOptions = hop.getLaunchOptions() != null if (activityOptions == null) { ? new ActivityOptions(hop.getLaunchOptions()) activityOptions = ActivityOptions.makeBasic(); : ActivityOptions.makeBasic(); } activityOptions.setCallerDisplayId(DEFAULT_DISPLAY); activityOptions.setCallerDisplayId(DEFAULT_DISPLAY); } } final Bundle options = activityOptions != null ? activityOptions.toBundle() : null; final Bundle options = activityOptions != null ? activityOptions.toBundle() : null; Loading