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

Commit e52fee8b authored by Fengjiang Li's avatar Fengjiang Li
Browse files

Opt-in predicitive back before register the back button

The predictive back infra checks the opt-in status when a callback is registered, and drops the registration if the Application / Activity is not opted-in

Fix: 326627953
Test: manual
Flag: ACONFIG launcher.enable_predictive_back_gesture DISABLED
Change-Id: I8f2e2378d0bf966b3784cf08c12045509b6d5682
parent 08a4e68b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -647,10 +647,13 @@ public class QuickstepLauncher extends Launcher {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Back dispatcher is registered in {@link BaseActivity#onCreate}. For predictive back to
        // work, we must opt-in BEFORE registering back dispatcher. So we need to call
        // setEnableOnBackInvokedCallback() before super.onCreate()
        if (Utilities.ATLEAST_U && enablePredictiveBackGesture()) {
            getApplicationInfo().setEnableOnBackInvokedCallback(true);
        }
        super.onCreate(savedInstanceState);
        if (savedInstanceState != null) {
            mPendingSplitSelectInfo = ObjectWrapper.unwrap(
                    savedInstanceState.getIBinder(PENDING_SPLIT_SELECT_INFO));