Merge "Continue the pausing process after automatically entering pip" into sc-qpr1-dev
This commit is contained in:
@@ -3387,9 +3387,15 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
final List<RemoteAction> actions = r.pictureInPictureArgs.getActions();
|
final List<RemoteAction> actions = r.pictureInPictureArgs.getActions();
|
||||||
mRootWindowContainer.moveActivityToPinnedRootTask(
|
mRootWindowContainer.moveActivityToPinnedRootTask(
|
||||||
r, "enterPictureInPictureMode");
|
r, "enterPictureInPictureMode");
|
||||||
final Task rootTask = r.getRootTask();
|
final Task task = r.getTask();
|
||||||
rootTask.setPictureInPictureAspectRatio(aspectRatio);
|
task.setPictureInPictureAspectRatio(aspectRatio);
|
||||||
rootTask.setPictureInPictureActions(actions);
|
task.setPictureInPictureActions(actions);
|
||||||
|
|
||||||
|
// Continue the pausing process after entering pip.
|
||||||
|
if (task.getPausingActivity() == r) {
|
||||||
|
task.schedulePauseActivity(r, false /* userLeaving */,
|
||||||
|
false /* pauseImmediately */, "auto-pip");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5771,23 +5771,8 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
+ "directly: %s", prev);
|
+ "directly: %s", prev);
|
||||||
|
|
||||||
didAutoPip = mAtmService.enterPictureInPictureMode(prev, prev.pictureInPictureArgs);
|
didAutoPip = mAtmService.enterPictureInPictureMode(prev, prev.pictureInPictureArgs);
|
||||||
mPausingActivity = null;
|
|
||||||
} else {
|
} else {
|
||||||
ProtoLog.v(WM_DEBUG_STATES, "Enqueueing pending pause: %s", prev);
|
schedulePauseActivity(prev, userLeaving, pauseImmediately, reason);
|
||||||
try {
|
|
||||||
EventLogTags.writeWmPauseActivity(prev.mUserId, System.identityHashCode(prev),
|
|
||||||
prev.shortComponentName, "userLeaving=" + userLeaving, reason);
|
|
||||||
|
|
||||||
mAtmService.getLifecycleManager().scheduleTransaction(prev.app.getThread(),
|
|
||||||
prev.appToken, PauseActivityItem.obtain(prev.finishing, userLeaving,
|
|
||||||
prev.configChangeFlags, pauseImmediately));
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Ignore exception, if process died other code will cleanup.
|
|
||||||
Slog.w(TAG, "Exception thrown during pause", e);
|
|
||||||
mPausingActivity = null;
|
|
||||||
mLastPausedActivity = null;
|
|
||||||
mTaskSupervisor.mNoHistoryActivities.remove(prev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mPausingActivity = null;
|
mPausingActivity = null;
|
||||||
@@ -5802,7 +5787,7 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If already entered PIP mode, no need to keep pausing.
|
// If already entered PIP mode, no need to keep pausing.
|
||||||
if (mPausingActivity != null && !didAutoPip) {
|
if (mPausingActivity != null) {
|
||||||
// Have the window manager pause its key dispatching until the new
|
// Have the window manager pause its key dispatching until the new
|
||||||
// activity has started. If we're pausing the activity just because
|
// activity has started. If we're pausing the activity just because
|
||||||
// the screen is being turned off and the UI is sleeping, don't interrupt
|
// the screen is being turned off and the UI is sleeping, don't interrupt
|
||||||
@@ -5835,6 +5820,25 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void schedulePauseActivity(ActivityRecord prev, boolean userLeaving,
|
||||||
|
boolean pauseImmediately, String reason) {
|
||||||
|
ProtoLog.v(WM_DEBUG_STATES, "Enqueueing pending pause: %s", prev);
|
||||||
|
try {
|
||||||
|
EventLogTags.writeWmPauseActivity(prev.mUserId, System.identityHashCode(prev),
|
||||||
|
prev.shortComponentName, "userLeaving=" + userLeaving, reason);
|
||||||
|
|
||||||
|
mAtmService.getLifecycleManager().scheduleTransaction(prev.app.getThread(),
|
||||||
|
prev.appToken, PauseActivityItem.obtain(prev.finishing, userLeaving,
|
||||||
|
prev.configChangeFlags, pauseImmediately));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Ignore exception, if process died other code will cleanup.
|
||||||
|
Slog.w(TAG, "Exception thrown during pause", e);
|
||||||
|
mPausingActivity = null;
|
||||||
|
mLastPausedActivity = null;
|
||||||
|
mTaskSupervisor.mNoHistoryActivities.remove(prev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void completePauseLocked(boolean resumeNext, ActivityRecord resuming) {
|
void completePauseLocked(boolean resumeNext, ActivityRecord resuming) {
|
||||||
// Complete the pausing process of a pausing activity, so it doesn't make sense to
|
// Complete the pausing process of a pausing activity, so it doesn't make sense to
|
||||||
|
|||||||
Reference in New Issue
Block a user