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

Commit 45cf37aa authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixing NPE when updating controller state."

parents 161bba61 54f0c655
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -156,6 +156,10 @@ public class PipTouchHandler implements TunerService.Tunable {
        @Override
        public void onListenerRegistered(IPinnedStackController controller) {
            mPinnedStackController = controller;

            // Update the controller with the current tuner state
            setMinimizedState(mIsMinimized);
            setSnapToEdge(mEnableSnapToEdge);
        }

        @Override
@@ -353,24 +357,30 @@ public class PipTouchHandler implements TunerService.Tunable {
     */
    private void setSnapToEdge(boolean snapToEdge) {
        mSnapAlgorithm.setSnapToEdge(snapToEdge);

        if (mPinnedStackController != null) {
            try {
                mPinnedStackController.setSnapToEdge(snapToEdge);
            } catch (RemoteException e) {
                Log.e(TAG, "Could not set snap mode to edge", e);
            }
        }
    }

    /**
     * Sets the minimized state and notifies the controller.
     */
    private void setMinimizedState(boolean isMinimized) {
        mIsMinimized = isMinimized;

        if (mPinnedStackController != null) {
            try {
                mPinnedStackController.setIsMinimized(isMinimized);
            } catch (RemoteException e) {
                Log.e(TAG, "Could not set minimized state", e);
            }
        }
    }

    /**
     * @return whether the given {@param pinnedStackBounds} indicates the PIP should be minimized.