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

Commit 15e24221 authored by Yifei Zhang's avatar Yifei Zhang
Browse files

uimode: don't start dock app during SUW on watch

- Starting dock activity on watch during SetupWizard can cause user not
  being able to go back to the previous activity, due to how navigation
  works during set up.
- This fixes a problem for settings activity is started as part of the
  setup process.

Test: manual
Bug: 388435736
Flag: EXEMPT, bugfix
Change-Id: Icfc6d879760dde4097497938aeb80da1c7a9a745
parent 9bd83451
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

package com.android.server;

import static android.app.Flags.modesApi;
import static android.app.Flags.enableCurrentModeTypeBinderCache;
import static android.app.Flags.enableNightModeBinderCache;
import static android.app.Flags.modesApi;
import static android.app.UiModeManager.ContrastUtils.CONTRAST_DEFAULT_VALUE;
import static android.app.UiModeManager.DEFAULT_PRIORITY;
import static android.app.UiModeManager.MODE_ATTENTION_THEME_OVERLAY_OFF;
@@ -1967,6 +1967,14 @@ final class UiModeManagerService extends SystemService {
        sendConfigurationAndStartDreamOrDockAppLocked(category);
    }

    private boolean shouldStartDockApp(Context context, Intent homeIntent) {
        if (mWatch && !mSetupWizardComplete) {
            // Do not ever start dock app when setup is not complete on a watch.
            return false;
        }
        return Sandman.shouldStartDockApp(context, homeIntent);
    }

    private void sendConfigurationAndStartDreamOrDockAppLocked(String category) {
        // Update the configuration but don't send it yet.
        mHoldingConfiguration = false;
@@ -1983,7 +1991,7 @@ final class UiModeManagerService extends SystemService {
            // activity manager take care of both the start and config
            // change.
            Intent homeIntent = buildHomeIntent(category);
            if (Sandman.shouldStartDockApp(getContext(), homeIntent)) {
            if (shouldStartDockApp(getContext(), homeIntent)) {
                try {
                    int result = ActivityTaskManager.getService().startActivityWithConfig(
                            null, getContext().getBasePackageName(),