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

Commit b6dc1d7b authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Fix UP button not working in preference activity

When pressing the UP button in a preference activity, some
implementations call Activity#onBackPressed. In case, predictive back is
enabled, this may not behave correctly. If no back callback is
registered, the activity should be finished in that case.

Bug: 391752210
Flag: EXEMPT bugfix
Test: Manual, i.e. enable predictive back in Dialer app and verify correct UP button behaviour.
Test: CtsPreferenceTestCases
Change-Id: If1a80a4d2c8c7f9e21e0b695059e942ee1f1ce4c
parent 03d6b1fc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -749,6 +749,10 @@ public abstract class PreferenceActivity extends ListActivity implements
            getListView().clearChoices();
        } else if (!WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(this)) {
            super.onBackPressed();
        } else if (!mIsBackCallbackRegistered) {
            // If predictive back is enabled and no callback is registered, finish the activity.
            // This ensures correct back navigation behaviour when onBackPressed is called manually.
            finish();
        }
        updateBackCallbackRegistrationState();
    }