Loading core/java/android/app/ActivityOptions.java +19 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.app; import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; Loading Loading @@ -126,6 +128,12 @@ public class ActivityOptions { */ public static final String KEY_ANIM_START_LISTENER = "android:activity.animStartListener"; /** * Where the docked stack should be positioned. * @hide */ private static final String KEY_DOCK_CREATE_MODE = "android:activity.dockCreateMode"; /** * For Activity transitions, the calling Activity's TransitionListener used to * notify the called Activity when the shared element and the exit transitions Loading Loading @@ -190,6 +198,7 @@ public class ActivityOptions { private int mResultCode; private int mExitCoordinatorIndex; private PendingIntent mUsageTimeReport; private int mDockCreateMode = DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT; /** * Create an ActivityOptions specifying a custom animation to run when Loading Loading @@ -688,6 +697,7 @@ public class ActivityOptions { mExitCoordinatorIndex = opts.getInt(KEY_EXIT_COORDINATOR_INDEX); break; } mDockCreateMode = opts.getInt(KEY_DOCK_CREATE_MODE, DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT); } /** @hide */ Loading Loading @@ -806,6 +816,14 @@ public class ActivityOptions { } } /** @hide */ public int getDockCreateMode() { return mDockCreateMode; } /** @hide */ public void setDockCreateMode(int dockCreateMode) { mDockCreateMode = dockCreateMode; } /** * Update the current values in this ActivityOptions from those supplied * in <var>otherOptions</var>. Any values Loading Loading @@ -945,6 +963,7 @@ public class ActivityOptions { b.putInt(KEY_EXIT_COORDINATOR_INDEX, mExitCoordinatorIndex); break; } b.putInt(KEY_DOCK_CREATE_MODE, mDockCreateMode); return b; } Loading packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -422,7 +422,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub SystemServicesProxy ssp = Recents.getSystemServices(); ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask(); if (topTask != null && !ssp.isInHomeStack(topTask.id)) { ssp.moveTaskToDockedStack(topTask.id, ssp.startTaskInDockedMode(topTask.id, ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT); showRecents(false /* triggeredFromAltTab */); } Loading packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +3 −12 Original line number Diff line number Diff line Loading @@ -286,18 +286,9 @@ public class SystemServicesProxy { if (mIam == null) return; try { mIam.startActivityFromRecents(taskId, DOCKED_STACK_ID, null); } catch (RemoteException e) { e.printStackTrace(); } } /** Docks an already resumed task to the side of the screen. */ public void moveTaskToDockedStack(int taskId, int createMode) { if (mIam == null) return; try { mIam.moveTaskToDockedStack(taskId, createMode, true /* onTop */); final ActivityOptions options = ActivityOptions.makeBasic(); options.setDockCreateMode(createMode); mIam.startActivityFromRecents(taskId, DOCKED_STACK_ID, options.toBundle()); } catch (RemoteException e) { e.printStackTrace(); } Loading services/core/java/com/android/server/am/ActivityManagerService.java +19 −8 Original line number Diff line number Diff line Loading @@ -4152,7 +4152,12 @@ public final class ActivityManagerService extends ActivityManagerNative Slog.w(TAG, msg); throw new SecurityException(msg); } final long origId = Binder.clearCallingIdentity(); try { return startActivityFromRecentsInner(taskId, launchStackId, options); } finally { Binder.restoreCallingIdentity(origId); } } final int startActivityFromRecentsInner(int taskId, int launchStackId, Bundle options) { Loading @@ -4174,8 +4179,12 @@ public final class ActivityManagerService extends ActivityManagerNative } if (launchStackId != INVALID_STACK_ID && task.stack.mStackId != launchStackId) { mStackSupervisor.moveTaskToStackUncheckedLocked( task, launchStackId, ON_TOP, FORCE_FOCUS, "startActivityFromRecents"); if (launchStackId == DOCKED_STACK_ID && options != null) { ActivityOptions activityOptions = new ActivityOptions(options); mWindowManager.setDockedStackCreateMode(activityOptions.getDockCreateMode()); } mStackSupervisor.moveTaskToStackLocked( taskId, launchStackId, ON_TOP, FORCE_FOCUS, "startActivityFromRecents"); } if (task.getRootActivity() != null) { Loading Loading @@ -9029,7 +9038,8 @@ public final class ActivityManagerService extends ActivityManagerNative } if (DEBUG_STACK) Slog.d(TAG_STACK, "moveActivityToStack: moving r=" + r + " to stackId=" + stackId); mStackSupervisor.moveTaskToStackLocked(r.task.taskId, stackId, ON_TOP, !FORCE_FOCUS); mStackSupervisor.moveTaskToStackLocked(r.task.taskId, stackId, ON_TOP, !FORCE_FOCUS, "moveActivityToStack"); } finally { Binder.restoreCallingIdentity(ident); } Loading @@ -9049,7 +9059,8 @@ public final class ActivityManagerService extends ActivityManagerNative try { if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToStack: moving task=" + taskId + " to stackId=" + stackId + " toTop=" + toTop); mStackSupervisor.moveTaskToStackLocked(taskId, stackId, toTop, !FORCE_FOCUS); mStackSupervisor.moveTaskToStackLocked(taskId, stackId, toTop, !FORCE_FOCUS, "moveTaskToStack"); } finally { Binder.restoreCallingIdentity(ident); } Loading Loading @@ -9078,7 +9089,7 @@ public final class ActivityManagerService extends ActivityManagerNative + " to createMode=" + createMode + " toTop=" + toTop); mWindowManager.setDockedStackCreateMode(createMode); mStackSupervisor.moveTaskToStackLocked( taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS); taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS, "moveTaskToDockedStack"); } finally { Binder.restoreCallingIdentity(ident); } Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +7 −5 Original line number Diff line number Diff line Loading @@ -3032,7 +3032,7 @@ public final class ActivityStackSupervisor implements DisplayListener { final int count = tasks.size(); for (int i = 0; i < count; i++) { moveTaskToStackLocked(tasks.get(i).taskId, FULLSCREEN_WORKSPACE_STACK_ID, ON_TOP, FORCE_FOCUS); FULLSCREEN_WORKSPACE_STACK_ID, ON_TOP, FORCE_FOCUS, "resizeStack"); } // stack shouldn't contain anymore activities, so nothing to resume. Loading Loading @@ -3267,13 +3267,13 @@ public final class ActivityStackSupervisor implements DisplayListener { return stack; } void moveTaskToStackLocked(int taskId, int stackId, boolean toTop, boolean forceFocus) { void moveTaskToStackLocked(int taskId, int stackId, boolean toTop, boolean forceFocus, String reason) { final TaskRecord task = anyTaskForIdLocked(taskId); if (task == null) { Slog.w(TAG, "moveTaskToStack: no task for id=" + taskId); return; } final String reason = "moveTaskToStack"; if (stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID || stackId == FULLSCREEN_WORKSPACE_STACK_ID) { // We are about to relaunch the activity because its configuration changed due to Loading @@ -3286,7 +3286,8 @@ public final class ActivityStackSupervisor implements DisplayListener { mWindowManager.setReplacingWindow(r.appToken, true /* animate */); } final ActivityStack stack = moveTaskToStackUncheckedLocked(task, stackId, toTop, forceFocus, reason); moveTaskToStackUncheckedLocked(task, stackId, toTop, forceFocus, "moveTaskToStack:" + reason); // Make sure the task has the appropriate bounds/size for the stack it is in. if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) { Loading Loading @@ -3332,7 +3333,8 @@ public final class ActivityStackSupervisor implements DisplayListener { if (task.mActivities.size() == 1) { // There is only one activity in the task. So, we can just move the task over to the // pinned stack without re-parenting the activity in a different task. moveTaskToStackLocked(task.taskId, PINNED_STACK_ID, ON_TOP, FORCE_FOCUS); moveTaskToStackLocked(task.taskId, PINNED_STACK_ID, ON_TOP, FORCE_FOCUS, "moveTopActivityToPinnedStack"); } else { final ActivityStack pinnedStack = getStack(PINNED_STACK_ID, CREATE_IF_NEEDED, ON_TOP); pinnedStack.moveActivityToStack(r); Loading Loading
core/java/android/app/ActivityOptions.java +19 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.app; import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; Loading Loading @@ -126,6 +128,12 @@ public class ActivityOptions { */ public static final String KEY_ANIM_START_LISTENER = "android:activity.animStartListener"; /** * Where the docked stack should be positioned. * @hide */ private static final String KEY_DOCK_CREATE_MODE = "android:activity.dockCreateMode"; /** * For Activity transitions, the calling Activity's TransitionListener used to * notify the called Activity when the shared element and the exit transitions Loading Loading @@ -190,6 +198,7 @@ public class ActivityOptions { private int mResultCode; private int mExitCoordinatorIndex; private PendingIntent mUsageTimeReport; private int mDockCreateMode = DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT; /** * Create an ActivityOptions specifying a custom animation to run when Loading Loading @@ -688,6 +697,7 @@ public class ActivityOptions { mExitCoordinatorIndex = opts.getInt(KEY_EXIT_COORDINATOR_INDEX); break; } mDockCreateMode = opts.getInt(KEY_DOCK_CREATE_MODE, DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT); } /** @hide */ Loading Loading @@ -806,6 +816,14 @@ public class ActivityOptions { } } /** @hide */ public int getDockCreateMode() { return mDockCreateMode; } /** @hide */ public void setDockCreateMode(int dockCreateMode) { mDockCreateMode = dockCreateMode; } /** * Update the current values in this ActivityOptions from those supplied * in <var>otherOptions</var>. Any values Loading Loading @@ -945,6 +963,7 @@ public class ActivityOptions { b.putInt(KEY_EXIT_COORDINATOR_INDEX, mExitCoordinatorIndex); break; } b.putInt(KEY_DOCK_CREATE_MODE, mDockCreateMode); return b; } Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -422,7 +422,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub SystemServicesProxy ssp = Recents.getSystemServices(); ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask(); if (topTask != null && !ssp.isInHomeStack(topTask.id)) { ssp.moveTaskToDockedStack(topTask.id, ssp.startTaskInDockedMode(topTask.id, ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT); showRecents(false /* triggeredFromAltTab */); } Loading
packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +3 −12 Original line number Diff line number Diff line Loading @@ -286,18 +286,9 @@ public class SystemServicesProxy { if (mIam == null) return; try { mIam.startActivityFromRecents(taskId, DOCKED_STACK_ID, null); } catch (RemoteException e) { e.printStackTrace(); } } /** Docks an already resumed task to the side of the screen. */ public void moveTaskToDockedStack(int taskId, int createMode) { if (mIam == null) return; try { mIam.moveTaskToDockedStack(taskId, createMode, true /* onTop */); final ActivityOptions options = ActivityOptions.makeBasic(); options.setDockCreateMode(createMode); mIam.startActivityFromRecents(taskId, DOCKED_STACK_ID, options.toBundle()); } catch (RemoteException e) { e.printStackTrace(); } Loading
services/core/java/com/android/server/am/ActivityManagerService.java +19 −8 Original line number Diff line number Diff line Loading @@ -4152,7 +4152,12 @@ public final class ActivityManagerService extends ActivityManagerNative Slog.w(TAG, msg); throw new SecurityException(msg); } final long origId = Binder.clearCallingIdentity(); try { return startActivityFromRecentsInner(taskId, launchStackId, options); } finally { Binder.restoreCallingIdentity(origId); } } final int startActivityFromRecentsInner(int taskId, int launchStackId, Bundle options) { Loading @@ -4174,8 +4179,12 @@ public final class ActivityManagerService extends ActivityManagerNative } if (launchStackId != INVALID_STACK_ID && task.stack.mStackId != launchStackId) { mStackSupervisor.moveTaskToStackUncheckedLocked( task, launchStackId, ON_TOP, FORCE_FOCUS, "startActivityFromRecents"); if (launchStackId == DOCKED_STACK_ID && options != null) { ActivityOptions activityOptions = new ActivityOptions(options); mWindowManager.setDockedStackCreateMode(activityOptions.getDockCreateMode()); } mStackSupervisor.moveTaskToStackLocked( taskId, launchStackId, ON_TOP, FORCE_FOCUS, "startActivityFromRecents"); } if (task.getRootActivity() != null) { Loading Loading @@ -9029,7 +9038,8 @@ public final class ActivityManagerService extends ActivityManagerNative } if (DEBUG_STACK) Slog.d(TAG_STACK, "moveActivityToStack: moving r=" + r + " to stackId=" + stackId); mStackSupervisor.moveTaskToStackLocked(r.task.taskId, stackId, ON_TOP, !FORCE_FOCUS); mStackSupervisor.moveTaskToStackLocked(r.task.taskId, stackId, ON_TOP, !FORCE_FOCUS, "moveActivityToStack"); } finally { Binder.restoreCallingIdentity(ident); } Loading @@ -9049,7 +9059,8 @@ public final class ActivityManagerService extends ActivityManagerNative try { if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToStack: moving task=" + taskId + " to stackId=" + stackId + " toTop=" + toTop); mStackSupervisor.moveTaskToStackLocked(taskId, stackId, toTop, !FORCE_FOCUS); mStackSupervisor.moveTaskToStackLocked(taskId, stackId, toTop, !FORCE_FOCUS, "moveTaskToStack"); } finally { Binder.restoreCallingIdentity(ident); } Loading Loading @@ -9078,7 +9089,7 @@ public final class ActivityManagerService extends ActivityManagerNative + " to createMode=" + createMode + " toTop=" + toTop); mWindowManager.setDockedStackCreateMode(createMode); mStackSupervisor.moveTaskToStackLocked( taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS); taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS, "moveTaskToDockedStack"); } finally { Binder.restoreCallingIdentity(ident); } Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +7 −5 Original line number Diff line number Diff line Loading @@ -3032,7 +3032,7 @@ public final class ActivityStackSupervisor implements DisplayListener { final int count = tasks.size(); for (int i = 0; i < count; i++) { moveTaskToStackLocked(tasks.get(i).taskId, FULLSCREEN_WORKSPACE_STACK_ID, ON_TOP, FORCE_FOCUS); FULLSCREEN_WORKSPACE_STACK_ID, ON_TOP, FORCE_FOCUS, "resizeStack"); } // stack shouldn't contain anymore activities, so nothing to resume. Loading Loading @@ -3267,13 +3267,13 @@ public final class ActivityStackSupervisor implements DisplayListener { return stack; } void moveTaskToStackLocked(int taskId, int stackId, boolean toTop, boolean forceFocus) { void moveTaskToStackLocked(int taskId, int stackId, boolean toTop, boolean forceFocus, String reason) { final TaskRecord task = anyTaskForIdLocked(taskId); if (task == null) { Slog.w(TAG, "moveTaskToStack: no task for id=" + taskId); return; } final String reason = "moveTaskToStack"; if (stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID || stackId == FULLSCREEN_WORKSPACE_STACK_ID) { // We are about to relaunch the activity because its configuration changed due to Loading @@ -3286,7 +3286,8 @@ public final class ActivityStackSupervisor implements DisplayListener { mWindowManager.setReplacingWindow(r.appToken, true /* animate */); } final ActivityStack stack = moveTaskToStackUncheckedLocked(task, stackId, toTop, forceFocus, reason); moveTaskToStackUncheckedLocked(task, stackId, toTop, forceFocus, "moveTaskToStack:" + reason); // Make sure the task has the appropriate bounds/size for the stack it is in. if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) { Loading Loading @@ -3332,7 +3333,8 @@ public final class ActivityStackSupervisor implements DisplayListener { if (task.mActivities.size() == 1) { // There is only one activity in the task. So, we can just move the task over to the // pinned stack without re-parenting the activity in a different task. moveTaskToStackLocked(task.taskId, PINNED_STACK_ID, ON_TOP, FORCE_FOCUS); moveTaskToStackLocked(task.taskId, PINNED_STACK_ID, ON_TOP, FORCE_FOCUS, "moveTopActivityToPinnedStack"); } else { final ActivityStack pinnedStack = getStack(PINNED_STACK_ID, CREATE_IF_NEEDED, ON_TOP); pinnedStack.moveActivityToStack(r); Loading