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

Commit 14cba5e0 authored by Tony Wickham's avatar Tony Wickham
Browse files

Show back button in SUW

- Listen for USER_SETUP_COMPLETE
- Recreate taskbar, forcing nav buttons to be visible

Test: Run setup wizard and ensure back button is present, then is replaced with taskbar when setup is complete
adb shell am start -a android.intent.action.MAIN -n com.google.android.setupwizard/.SetupWizardTestActivity

Fixes: 191846922
Change-Id: I789186dcc23a2db7cc4637b1cb0486f0d2add784
parent b862d2c3
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.Region.Op;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.provider.Settings;
import android.util.Property;
import android.view.View;
import android.view.View.OnClickListener;
@@ -54,6 +55,7 @@ import com.android.launcher3.taskbar.TaskbarNavButtonController.TaskbarButton;
import com.android.launcher3.taskbar.contextual.RotationButton;
import com.android.launcher3.taskbar.contextual.RotationButtonController;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.SettingsCache;
import com.android.quickstep.AnimatedFloat;

import java.util.ArrayList;
@@ -145,7 +147,10 @@ public class NavbarButtonsViewController {
                .getKeyguardBgTaskbar(),
                flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, AnimatedFloat.VALUE, 1, 0));

        if (mContext.isThreeButtonNav()) {
        // Force nav buttons (specifically back button) to be visible during setup wizard.
        boolean areButtonsForcedVisible = !SettingsCache.INSTANCE.get(mContext).getValue(
                Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0);
        if (mContext.isThreeButtonNav() || areButtonsForcedVisible) {
            initButtons(mNavButtonContainer, mEndContextualContainer,
                    mControllers.navButtonController);

+13 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import static com.android.launcher3.util.DisplayController.CHANGE_SUPPORTED_BOUN

import android.content.Context;
import android.hardware.display.DisplayManager;
import android.net.Uri;
import android.provider.Settings;
import android.view.Display;

import androidx.annotation.NonNull;
@@ -35,6 +37,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.DisplayController.Info;
import com.android.launcher3.util.SettingsCache;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.SystemUiProxy;
@@ -46,10 +49,14 @@ import com.android.quickstep.TouchInteractionService;
public class TaskbarManager implements DisplayController.DisplayInfoChangeListener,
        SysUINavigationMode.NavigationModeChangeListener {

    private static final Uri USER_SETUP_COMPLETE_URI = Settings.Secure.getUriFor(
            Settings.Secure.USER_SETUP_COMPLETE);

    private final Context mContext;
    private final DisplayController mDisplayController;
    private final SysUINavigationMode mSysUINavigationMode;
    private final TaskbarNavButtonController mNavButtonController;
    private final SettingsCache.OnChangeListener mUserSetupCompleteListener;

    private TaskbarActivityContext mTaskbarActivityContext;
    private BaseQuickstepLauncher mLauncher;
@@ -71,9 +78,13 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
                service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY);
        mContext = service.createWindowContext(display, TYPE_APPLICATION_OVERLAY, null);
        mNavButtonController = new TaskbarNavButtonController(service);
        mUserSetupCompleteListener = isUserSetupComplete -> recreateTaskbar();

        mDisplayController.addChangeListener(this);
        mSysUINavigationMode.addModeChangeListener(this);
        SettingsCache.INSTANCE.get(mContext).register(USER_SETUP_COMPLETE_URI,
                mUserSetupCompleteListener);

        recreateTaskbar();
    }

@@ -188,6 +199,8 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
        destroyExistingTaskbar();
        mDisplayController.removeChangeListener(this);
        mSysUINavigationMode.removeModeChangeListener(this);
        SettingsCache.INSTANCE.get(mContext).unregister(USER_SETUP_COMPLETE_URI,
                mUserSetupCompleteListener);
    }

    public @Nullable TaskbarActivityContext getCurrentActivityContext() {