Loading packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +8 −27 Original line number Diff line number Diff line Loading @@ -33,10 +33,10 @@ import android.app.PictureInPictureParams; import android.content.Context; import android.graphics.Rect; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.util.Log; import android.view.DisplayInfo; import android.view.ITaskOrganizer; import android.view.IWindowContainer; import android.view.SurfaceControl; Loading @@ -47,7 +47,9 @@ import com.android.systemui.R; import com.android.systemui.pip.phone.PipUpdateThread; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Consumer; Loading Loading @@ -76,9 +78,9 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub { private final PipBoundsHandler mPipBoundsHandler; private final PipAnimationController mPipAnimationController; private final List<PipTransitionCallback> mPipTransitionCallbacks = new ArrayList<>(); private final Rect mDisplayBounds = new Rect(); private final Rect mLastReportedBounds = new Rect(); private final int mCornerRadius; private final Map<IBinder, Rect> mBoundsToRestore = new HashMap<>(); // These callbacks are called on the update thread private final PipAnimationController.PipAnimationCallback mPipAnimationCallback = Loading Loading @@ -200,29 +202,6 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub { mOneShotAnimationType = animationType; } /** * Updates the display dimension with given {@link DisplayInfo} */ @SuppressWarnings("unchecked") public void onDisplayInfoChanged(DisplayInfo displayInfo) { final Rect newDisplayBounds = new Rect(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); if (!mDisplayBounds.equals(newDisplayBounds)) { // Updates the exiting PiP animation in case the screen rotation changes in the middle. // It's a legit case that PiP window is in portrait mode on home screen and // the application requests landscape once back to fullscreen mode. final PipAnimationController.PipTransitionAnimator animator = mPipAnimationController.getCurrentAnimator(); if (animator != null && animator.getAnimationType() == ANIM_TYPE_BOUNDS && animator.getDestinationBounds().equals(mDisplayBounds)) { animator.updateEndValue(newDisplayBounds); animator.setDestinationBounds(newDisplayBounds); } } mDisplayBounds.set(newDisplayBounds); } /** * Callback to issue the final {@link WindowContainerTransaction} on end of movements. * @param destinationBounds the final bounds. Loading Loading @@ -252,8 +231,9 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub { } catch (RemoteException e) { throw new RuntimeException("Unable to get leash", e); } if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds(); mBoundsToRestore.put(mToken.asBinder(), currentBounds); if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { scheduleAnimateResizePip(currentBounds, destinationBounds, TRANSITION_DIRECTION_TO_PIP, DURATION_DEFAULT_MS, null); } else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) { Loading @@ -277,7 +257,8 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub { Log.wtf(TAG, "Unrecognized token: " + token); return; } scheduleAnimateResizePip(mLastReportedBounds, mDisplayBounds, final Rect boundsToRestore = mBoundsToRestore.remove(mToken.asBinder()); scheduleAnimateResizePip(mLastReportedBounds, boundsToRestore, TRANSITION_DIRECTION_TO_FULLSCREEN, DURATION_DEFAULT_MS, null); mInPip = false; } Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +1 −5 Original line number Diff line number Diff line Loading @@ -185,10 +185,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio @Override public void onDisplayInfoChanged(DisplayInfo displayInfo) { mHandler.post(() -> { mPipBoundsHandler.onDisplayInfoChanged(displayInfo); mPipTaskOrganizer.onDisplayInfoChanged(displayInfo); }); mHandler.post(() -> mPipBoundsHandler.onDisplayInfoChanged(displayInfo)); } @Override Loading Loading @@ -352,7 +349,6 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, animatingBounds, fromImeAdjustment, fromShelfAdjustment, mTmpDisplayInfo.rotation); mPipTaskOrganizer.onDisplayInfoChanged(mTmpDisplayInfo); } public void dump(PrintWriter pw) { Loading Loading
packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +8 −27 Original line number Diff line number Diff line Loading @@ -33,10 +33,10 @@ import android.app.PictureInPictureParams; import android.content.Context; import android.graphics.Rect; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.util.Log; import android.view.DisplayInfo; import android.view.ITaskOrganizer; import android.view.IWindowContainer; import android.view.SurfaceControl; Loading @@ -47,7 +47,9 @@ import com.android.systemui.R; import com.android.systemui.pip.phone.PipUpdateThread; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Consumer; Loading Loading @@ -76,9 +78,9 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub { private final PipBoundsHandler mPipBoundsHandler; private final PipAnimationController mPipAnimationController; private final List<PipTransitionCallback> mPipTransitionCallbacks = new ArrayList<>(); private final Rect mDisplayBounds = new Rect(); private final Rect mLastReportedBounds = new Rect(); private final int mCornerRadius; private final Map<IBinder, Rect> mBoundsToRestore = new HashMap<>(); // These callbacks are called on the update thread private final PipAnimationController.PipAnimationCallback mPipAnimationCallback = Loading Loading @@ -200,29 +202,6 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub { mOneShotAnimationType = animationType; } /** * Updates the display dimension with given {@link DisplayInfo} */ @SuppressWarnings("unchecked") public void onDisplayInfoChanged(DisplayInfo displayInfo) { final Rect newDisplayBounds = new Rect(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); if (!mDisplayBounds.equals(newDisplayBounds)) { // Updates the exiting PiP animation in case the screen rotation changes in the middle. // It's a legit case that PiP window is in portrait mode on home screen and // the application requests landscape once back to fullscreen mode. final PipAnimationController.PipTransitionAnimator animator = mPipAnimationController.getCurrentAnimator(); if (animator != null && animator.getAnimationType() == ANIM_TYPE_BOUNDS && animator.getDestinationBounds().equals(mDisplayBounds)) { animator.updateEndValue(newDisplayBounds); animator.setDestinationBounds(newDisplayBounds); } } mDisplayBounds.set(newDisplayBounds); } /** * Callback to issue the final {@link WindowContainerTransaction} on end of movements. * @param destinationBounds the final bounds. Loading Loading @@ -252,8 +231,9 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub { } catch (RemoteException e) { throw new RuntimeException("Unable to get leash", e); } if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds(); mBoundsToRestore.put(mToken.asBinder(), currentBounds); if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { scheduleAnimateResizePip(currentBounds, destinationBounds, TRANSITION_DIRECTION_TO_PIP, DURATION_DEFAULT_MS, null); } else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) { Loading @@ -277,7 +257,8 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub { Log.wtf(TAG, "Unrecognized token: " + token); return; } scheduleAnimateResizePip(mLastReportedBounds, mDisplayBounds, final Rect boundsToRestore = mBoundsToRestore.remove(mToken.asBinder()); scheduleAnimateResizePip(mLastReportedBounds, boundsToRestore, TRANSITION_DIRECTION_TO_FULLSCREEN, DURATION_DEFAULT_MS, null); mInPip = false; } Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +1 −5 Original line number Diff line number Diff line Loading @@ -185,10 +185,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio @Override public void onDisplayInfoChanged(DisplayInfo displayInfo) { mHandler.post(() -> { mPipBoundsHandler.onDisplayInfoChanged(displayInfo); mPipTaskOrganizer.onDisplayInfoChanged(displayInfo); }); mHandler.post(() -> mPipBoundsHandler.onDisplayInfoChanged(displayInfo)); } @Override Loading Loading @@ -352,7 +349,6 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, animatingBounds, fromImeAdjustment, fromShelfAdjustment, mTmpDisplayInfo.rotation); mPipTaskOrganizer.onDisplayInfoChanged(mTmpDisplayInfo); } public void dump(PrintWriter pw) { Loading