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

Commit de06c5fa authored by Shawn Lee's avatar Shawn Lee
Browse files

Disable duplicate back handling when a BackInvokedCallback is already registered

Whenever Lockscreen or Shade/QS are visible, we register a callback with back action handling to OnBackInvokedDispatcher. Similarly, whenever we receive a KEYCODE_BACK action (such as the TalkBack back swipe gesture), we call the same back action handling logic. This meant that whenever we were on Lockscreen/Shade, we were always handling back actions twice when we received KEYCODE_BACK.

Bug: 381193919
Test: verified with logging that back handling only triggers once over LS/Shade/QS
Flag: EXEMPT bugfix
Change-Id: Ic92bbb82561a20734a9fb92fa12804d37e4766be
parent ea66d64c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -122,6 +122,10 @@ constructor(
        return false
    }

    fun isBackCallbackRegistered(): Boolean {
        return isCallbackRegistered
    }

    private fun registerBackCallback() {
        if (isCallbackRegistered) {
            return
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ constructor(

        when (event.keyCode) {
            KeyEvent.KEYCODE_BACK -> {
                if (event.handleAction()) {
                if (!backActionInteractor.isBackCallbackRegistered() && event.handleAction()) {
                    backActionInteractor.onBackRequested()
                }
                return true