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

Commit 241d9878 authored by Mike Digman's avatar Mike Digman Committed by Android (Google) Code Review
Browse files

Merge "Add route for rotation suggestions from StatusBar to CommandQueue"

parents bf53ba66 93f08349
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -112,6 +112,11 @@ oneway interface IStatusBar
     */
    void showGlobalActionsMenu();

    /**
     * Notifies the status bar that a new rotation suggestion is available.
     */
    void onProposedRotationChanged(int rotation);

    /**
     * Set whether the top app currently hides the statusbar.
     *
+17 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ public class CommandQueue extends IStatusBar.Stub {
    private static final int MSG_TOGGLE_PANEL                  = 35 << MSG_SHIFT;
    private static final int MSG_SHOW_SHUTDOWN_UI              = 36 << MSG_SHIFT;
    private static final int MSG_SET_TOP_APP_HIDES_STATUS_BAR  = 37 << MSG_SHIFT;
    private static final int MSG_ROTATION_PROPOSAL             = 38 << MSG_SHIFT;

    public static final int FLAG_EXCLUDE_NONE = 0;
    public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -142,6 +143,8 @@ public class CommandQueue extends IStatusBar.Stub {
        default void handleSystemKey(int arg1) { }
        default void handleShowGlobalActionsMenu() { }
        default void handleShowShutdownUi(boolean isReboot, String reason) { }

        default void onRotationProposal(int rotation) { }
    }

    @VisibleForTesting
@@ -458,6 +461,15 @@ public class CommandQueue extends IStatusBar.Stub {
        }
    }

    @Override
    public void onProposedRotationChanged(int rotation) {
        synchronized (mLock) {
            mHandler.removeMessages(MSG_ROTATION_PROPOSAL);
            mHandler.obtainMessage(MSG_ROTATION_PROPOSAL, rotation, 0,
                    null).sendToTarget();
        }
    }

    private final class H extends Handler {
        private H(Looper l) {
            super(l);
@@ -654,6 +666,11 @@ public class CommandQueue extends IStatusBar.Stub {
                        mCallbacks.get(i).setTopAppHidesStatusBar(msg.arg1 != 0);
                    }
                    break;
                case MSG_ROTATION_PROPOSAL:
                    for (int i = 0; i < mCallbacks.size(); i++) {
                        mCallbacks.get(i).onRotationProposal(msg.arg1);
                    }
                    break;
            }
        }
    }
+7 −0
Original line number Diff line number Diff line
@@ -90,6 +90,13 @@ public interface StatusBarManagerInternal {

    boolean showShutdownUi(boolean isReboot, String requestString);

    /**
     * Show a rotation suggestion that a user may approve to rotate the screen.
     *
     * @param rotation rotation suggestion
     */
    void onProposedRotationChanged(int rotation);

    public interface GlobalActionsListener {
        /**
         * Called when sysui starts and connects its status bar, or when the status bar binder
+9 −0
Original line number Diff line number Diff line
@@ -406,6 +406,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
            }
            return false;
        }

        @Override
        public void onProposedRotationChanged(int rotation) {
            if (mBar != null){
                try {
                    mBar.onProposedRotationChanged(rotation);
                } catch (RemoteException ex) {}
            }
        }
    };

    // ================================================================================