Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +13 −8 Original line number Diff line number Diff line Loading @@ -403,9 +403,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, @Override public void onTransactionReady(int id, SurfaceControl.Transaction t) { t.apply(); scheduleAnimateResizePip(mPipBoundsState.getBounds(), destinationBounds, getValidSourceHintRect(mTaskInfo, destinationBounds), direction, animationDurationMs, null /* updateBoundsCallback */); // Make sure to grab the latest source hint rect as it could have been updated // right after applying the windowing mode change. final Rect sourceHintRect = getValidSourceHintRect(mPictureInPictureParams, destinationBounds); scheduleAnimateResizePip(mPipBoundsState.getBounds(), destinationBounds, sourceHintRect, direction, animationDurationMs, null /* updateBoundsCallback */); mState = State.EXITING_PIP; } }); Loading Loading @@ -501,7 +505,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds(); if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { final Rect sourceHintRect = getValidSourceHintRect(info, currentBounds); final Rect sourceHintRect = getValidSourceHintRect(info.pictureInPictureParams, currentBounds); scheduleAnimateResizePip(currentBounds, destinationBounds, sourceHintRect, TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration, null /* updateBoundsCallback */); Loading @@ -518,10 +523,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, * Returns the source hint rect if it is valid (if provided and is contained by the current * task bounds). */ private Rect getValidSourceHintRect(ActivityManager.RunningTaskInfo info, Rect sourceBounds) { final Rect sourceHintRect = info.pictureInPictureParams != null && info.pictureInPictureParams.hasSourceBoundsHint() ? info.pictureInPictureParams.getSourceRectHint() private Rect getValidSourceHintRect(PictureInPictureParams params, Rect sourceBounds) { final Rect sourceHintRect = params != null && params.hasSourceBoundsHint() ? params.getSourceRectHint() : null; if (sourceHintRect != null && sourceBounds.contains(sourceHintRect)) { return sourceHintRect; Loading services/core/java/com/android/server/wm/TaskOrganizerController.java +21 −22 Original line number Diff line number Diff line Loading @@ -161,17 +161,18 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { return; } ProtoLog.v(WM_DEBUG_WINDOW_ORGANIZER, "Task info changed taskId=%d", task.mTaskId); mDeferTaskOrgCallbacksConsumer.accept(() -> { if (!task.isOrganized()) { // This is safe to ignore if the task is no longer organized return; } try { // Purposely notify of task info change immediately instead of deferring (like // appear and vanish) to allow info changes (such as new PIP params) to flow // without waiting. mTaskOrganizer.onTaskInfoChanged(taskInfo); } catch (RemoteException e) { Slog.e(TAG, "Exception sending onTaskInfoChanged callback", e); } }); } void onBackPressedOnTaskRoot(Task task) { Loading @@ -182,7 +183,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { // by the organizer that don't receive that signal return; } mDeferTaskOrgCallbacksConsumer.accept(() -> { if (!task.isOrganized()) { // This is safe to ignore if the task is no longer organized return; Loading @@ -192,7 +192,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { } catch (Exception e) { Slog.e(TAG, "Exception sending onBackPressedOnTaskRoot callback", e); } }); } } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +13 −8 Original line number Diff line number Diff line Loading @@ -403,9 +403,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, @Override public void onTransactionReady(int id, SurfaceControl.Transaction t) { t.apply(); scheduleAnimateResizePip(mPipBoundsState.getBounds(), destinationBounds, getValidSourceHintRect(mTaskInfo, destinationBounds), direction, animationDurationMs, null /* updateBoundsCallback */); // Make sure to grab the latest source hint rect as it could have been updated // right after applying the windowing mode change. final Rect sourceHintRect = getValidSourceHintRect(mPictureInPictureParams, destinationBounds); scheduleAnimateResizePip(mPipBoundsState.getBounds(), destinationBounds, sourceHintRect, direction, animationDurationMs, null /* updateBoundsCallback */); mState = State.EXITING_PIP; } }); Loading Loading @@ -501,7 +505,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds(); if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { final Rect sourceHintRect = getValidSourceHintRect(info, currentBounds); final Rect sourceHintRect = getValidSourceHintRect(info.pictureInPictureParams, currentBounds); scheduleAnimateResizePip(currentBounds, destinationBounds, sourceHintRect, TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration, null /* updateBoundsCallback */); Loading @@ -518,10 +523,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, * Returns the source hint rect if it is valid (if provided and is contained by the current * task bounds). */ private Rect getValidSourceHintRect(ActivityManager.RunningTaskInfo info, Rect sourceBounds) { final Rect sourceHintRect = info.pictureInPictureParams != null && info.pictureInPictureParams.hasSourceBoundsHint() ? info.pictureInPictureParams.getSourceRectHint() private Rect getValidSourceHintRect(PictureInPictureParams params, Rect sourceBounds) { final Rect sourceHintRect = params != null && params.hasSourceBoundsHint() ? params.getSourceRectHint() : null; if (sourceHintRect != null && sourceBounds.contains(sourceHintRect)) { return sourceHintRect; Loading
services/core/java/com/android/server/wm/TaskOrganizerController.java +21 −22 Original line number Diff line number Diff line Loading @@ -161,17 +161,18 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { return; } ProtoLog.v(WM_DEBUG_WINDOW_ORGANIZER, "Task info changed taskId=%d", task.mTaskId); mDeferTaskOrgCallbacksConsumer.accept(() -> { if (!task.isOrganized()) { // This is safe to ignore if the task is no longer organized return; } try { // Purposely notify of task info change immediately instead of deferring (like // appear and vanish) to allow info changes (such as new PIP params) to flow // without waiting. mTaskOrganizer.onTaskInfoChanged(taskInfo); } catch (RemoteException e) { Slog.e(TAG, "Exception sending onTaskInfoChanged callback", e); } }); } void onBackPressedOnTaskRoot(Task task) { Loading @@ -182,7 +183,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { // by the organizer that don't receive that signal return; } mDeferTaskOrgCallbacksConsumer.accept(() -> { if (!task.isOrganized()) { // This is safe to ignore if the task is no longer organized return; Loading @@ -192,7 +192,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { } catch (Exception e) { Slog.e(TAG, "Exception sending onBackPressedOnTaskRoot callback", e); } }); } } Loading