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

Unverified Commit 8cc3dec9 authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
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 eb9bb7d0
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -327,7 +327,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
@@ -801,6 +802,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;