Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e74e32ab authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Get PiP round corner radius from WMShell" into sc-dev

parents b32fd46c 9d1514b4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1211,6 +1211,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                TaskInfoCompat.getWindowConfigurationBounds(taskInfo),
                startBounds,
                destinationBounds,
                mRecentsView.getPipCornerRadius(),
                mRecentsView);
        // We would assume home and app window always in the same rotation While homeRotation
        // is not ROTATION_0 (which implies the rotation is turned on in launcher settings).
+26 −0
Original line number Diff line number Diff line
@@ -68,6 +68,12 @@ public class SystemUiProxy implements ISystemUiProxy,
        MAIN_EXECUTOR.execute(() -> clearProxy());
    };

    // Save the listeners passed into the proxy since when set/register these listeners,
    // setProxy may not have been called, eg. OverviewProxyService is not connected yet.
    private IPipAnimationListener mPendingPipAnimationListener;
    private ISplitScreenListener mPendingSplitScreenListener;
    private IStartingWindowListener mPendingStartingWindowListener;

    // Used to dedupe calls to SystemUI
    private int mLastShelfHeight;
    private boolean mLastShelfVisible;
@@ -116,6 +122,19 @@ public class SystemUiProxy implements ISystemUiProxy,
        mShellTransitions = shellTransitions;
        mStartingWindow = startingWindow;
        linkToDeath();
        // re-attach the listeners once missing due to setProxy has not been initialized yet.
        if (mPendingPipAnimationListener != null && mPip != null) {
            setPinnedStackAnimationListener(mPendingPipAnimationListener);
            mPendingPipAnimationListener = null;
        }
        if (mPendingSplitScreenListener != null && mSplitScreen != null) {
            registerSplitScreenListener(mPendingSplitScreenListener);
            mPendingSplitScreenListener = null;
        }
        if (mPendingStartingWindowListener != null && mStartingWindow != null) {
            setStartingWindowListener(mPendingStartingWindowListener);
            mPendingStartingWindowListener = null;
        }
    }

    public void clearProxy() {
@@ -390,6 +409,8 @@ public class SystemUiProxy implements ISystemUiProxy,
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call setPinnedStackAnimationListener", e);
            }
        } else {
            mPendingPipAnimationListener = listener;
        }
    }

@@ -427,6 +448,8 @@ public class SystemUiProxy implements ISystemUiProxy,
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call registerSplitScreenListener");
            }
        } else {
            mPendingSplitScreenListener = listener;
        }
    }

@@ -438,6 +461,7 @@ public class SystemUiProxy implements ISystemUiProxy,
                Log.w(TAG, "Failed call unregisterSplitScreenListener");
            }
        }
        mPendingSplitScreenListener = null;
    }

    public void setSideStageVisibility(boolean visible) {
@@ -590,6 +614,8 @@ public class SystemUiProxy implements ISystemUiProxy,
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call setStartingWindowListener", e);
            }
        } else {
            mPendingStartingWindowListener = listener;
        }
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ public class SwipePipToHomeAnimator extends ValueAnimator {
     *                    different from the appBounds if user has swiped a certain distance and
     *                    Launcher has performed transform on the leash.
     * @param destinationBounds Bounds of the destination this animator ends to
     * @param cornerRadius Corner radius in pixel value for PiP window
     */
    public SwipePipToHomeAnimator(int taskId,
            @NonNull ComponentName componentName,
@@ -97,6 +98,7 @@ public class SwipePipToHomeAnimator extends ValueAnimator {
            @NonNull Rect appBounds,
            @NonNull Rect startBounds,
            @NonNull Rect destinationBounds,
            int cornerRadius,
            @NonNull View view) {
        mTaskId = taskId;
        mComponentName = componentName;
@@ -106,7 +108,7 @@ public class SwipePipToHomeAnimator extends ValueAnimator {
        mDestinationBounds.set(destinationBounds);
        mDestinationBoundsTransformed.set(mDestinationBounds);
        mDestinationBoundsAnimation.set(mDestinationBounds);
        mSurfaceTransactionHelper = new PipSurfaceTransactionHelper();
        mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius);

        if (sourceRectHint == null) {
            mSourceHintRectInsets = null;
+21 −3
Original line number Diff line number Diff line
@@ -494,6 +494,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T

    private final PinnedStackAnimationListener mIPipAnimationListener =
            new PinnedStackAnimationListener();
    private int mPipCornerRadius;

    // Used to keep track of the last requested task list id, so that we do not request to load the
    // tasks again if we have already requested it and the task list has not changed
@@ -795,7 +796,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        mSyncTransactionApplier = new SurfaceTransactionApplier(this);
        mLiveTileParams.setSyncTransactionApplier(mSyncTransactionApplier);
        RecentsModel.INSTANCE.get(getContext()).addThumbnailChangeListener(this);
        mIPipAnimationListener.setActivity(mActivity);
        mIPipAnimationListener.setActivityAndRecentsView(mActivity, this);
        SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener(
                mIPipAnimationListener);
        mOrientationState.initListeners();
@@ -815,7 +816,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        RecentsModel.INSTANCE.get(getContext()).removeThumbnailChangeListener(this);
        SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener(null);
        SplitScreenBounds.INSTANCE.removeOnChangeListener(this);
        mIPipAnimationListener.setActivity(null);
        mIPipAnimationListener.setActivityAndRecentsView(null, null);
        mOrientationState.destroyListeners();
        mTaskOverlayFactory.removeListeners();
    }
@@ -3760,6 +3761,14 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        mScrollListeners.remove(listener);
    }

    /**
     * @return Corner radius in pixel value for PiP window, which is updated via
     *         {@link #mIPipAnimationListener}
     */
    public int getPipCornerRadius() {
        return mPipCornerRadius;
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
@@ -3776,9 +3785,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    private static class PinnedStackAnimationListener<T extends BaseActivity> extends
            IPipAnimationListener.Stub {
        private T mActivity;
        private RecentsView mRecentsView;

        public void setActivity(T activity) {
        public void setActivityAndRecentsView(T activity, RecentsView recentsView) {
            mActivity = activity;
            mRecentsView = recentsView;
        }

        @Override
@@ -3791,6 +3802,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
                }
            });
        }

        @Override
        public void onPipCornerRadiusChanged(int cornerRadius) {
            if (mRecentsView != null) {
                mRecentsView.mPipCornerRadius = cornerRadius;
            }
        }
    }

    /** Get the color used for foreground scrimming the RecentsView for sharing. */