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

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

Merge "Protects query pulse reason exception"

parents 4a137fdb 2d23690e
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ package com.android.systemui.dock;
public interface DockManager {

    /**
     * Uninitialized / unknow dock states
     * Uninitialized / unknown dock states
     */
    int STATE_NONE = 0;
    /**
@@ -37,14 +37,14 @@ public interface DockManager {
    /**
     * Add a dock event listener into manager
     *
     * @param callback A  {@link #DockEventListener} which want to add
     * @param callback A  {@link DockEventListener} which want to add
     */
    void addListener(DockEventListener callback);

    /**
     * Remove the added listener from dock manager
     *
     * @param callback A {@link #DockEventListener} which want to remove
     * @param callback A {@link DockEventListener} which want to remove
     */
    void removeListener(DockEventListener callback);

@@ -52,8 +52,6 @@ public interface DockManager {
    interface DockEventListener {
        /**
         * Override to handle dock events
         *
         * Events reference: {@link #DockState}
         */
        void onEvent(int event);
    }
+6 −6
Original line number Diff line number Diff line
@@ -86,14 +86,14 @@ public class DozeDockHandler implements DozeMachine.Part {

    private void requestPulseOutNow() {
        final DozeMachine.State state = mMachine.getState();
        if (state == DozeMachine.State.DOZE_PULSING
                || state == DozeMachine.State.DOZE_REQUEST_PULSE) {
            final int pulseReason = mMachine.getPulseReason();

        if ((state == DozeMachine.State.DOZE_PULSING
                || state == DozeMachine.State.DOZE_REQUEST_PULSE)
                && pulseReason == DozeLog.PULSE_REASON_DOCKING) {
            if (pulseReason == DozeLog.PULSE_REASON_DOCKING) {
                mDozeHost.stopPulsing();
            }
        }
    }

    @Override
    public void dump(PrintWriter pw) {
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ public class DozeDockHandlerTest extends SysuiTestCase {
    @Test
    public void testOnEvent_undockedWhenDoze_neverRequestPulseOut() throws Exception {
        mDockHandler.transitionTo(DozeMachine.State.UNINITIALIZED, DozeMachine.State.INITIALIZED);
        when(mMachine.getState()).thenReturn(DozeMachine.State.DOZE_PULSING);
        when(mMachine.getState()).thenReturn(DozeMachine.State.DOZE);

        mDockManagerFake.setDockEvent(DockManager.STATE_UNDOCKING);