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

Commit 8d270ccc authored by LuK1337's avatar LuK1337 Committed by Bruno Martins
Browse files

UsbDeviceManager: Delay MSG_UPDATE_SCREEN_LOCK message

In case we send it twice in a very short time, only the first one will
arrive. This change fixes that.

Change-Id: I52faad1ecc067db2b01dd09edcdfc5aff8ed19cb
parent c1d50567
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -282,7 +282,8 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
                    + " user:" + userHandle);
        }
        // We are unlocked when the keyguard is down or non-secure.
        mHandler.sendMessage(MSG_UPDATE_SCREEN_LOCK, isShowing, secure);
        mHandler.removeMessages(MSG_UPDATE_SCREEN_LOCK);
        mHandler.sendMessageDelayed(MSG_UPDATE_SCREEN_LOCK, isShowing, secure, 250);
    }

    @Override
@@ -669,6 +670,14 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
            sendMessageDelayed(m, delayMillis);
        }

        public void sendMessageDelayed(int what, boolean arg1, boolean arg2, long delayMillis) {
            removeMessages(what);
            Message m = Message.obtain(this, what);
            m.arg1 = (arg1 ? 1 : 0);
            m.arg2 = (arg2 ? 1 : 0);
            sendMessageDelayed(m, delayMillis);
        }

        public void updateState(String state) {
            int connected, configured;