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

Commit 5b0a350a authored by Govinda Wasserman's avatar Govinda Wasserman
Browse files

Suppress Assistant handles when device is not provisioned

Test: Tested locally
BUG: 155723880
FIX: 155723880
Change-Id: I10c35ef9af7a2ea9e61772d84fec41d6f839aef4
parent dbae26e4
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.os.Handler;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.Log;
import android.view.accessibility.AccessibilityManager;

@@ -61,6 +62,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac

    private static final long DEFAULT_SHOWN_FREQUENCY_THRESHOLD_MS = 0;
    private static final long DEFAULT_SHOW_AND_GO_DURATION_MS = TimeUnit.SECONDS.toMillis(3);
    private static final String SETTINGS_SECURE_USER_SETUP_COMPLETE = "user_setup_complete";

    /**
     * This is the default behavior that will be used once the system is up. It will be set once the
@@ -203,6 +205,10 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac
    }

    private boolean handlesUnblocked(boolean ignoreThreshold) {
        if (!isUserSetupComplete()) {
            return false;
        }

        long timeSinceHidden = SystemClock.elapsedRealtime() - mHandlesLastHiddenAt;
        boolean notThrottled = ignoreThreshold || timeSinceHidden >= getShownFrequencyThreshold();
        ComponentName assistantComponent =
@@ -284,6 +290,11 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac
        mShowAndGoEndsAt = 0;
    }

    private boolean isUserSetupComplete() {
        return Settings.Secure.getInt(
                mContext.getContentResolver(), SETTINGS_SECURE_USER_SETUP_COMPLETE, 0) == 1;
    }

    @VisibleForTesting
    void setInGesturalModeForTest(boolean inGesturalMode) {
        mInGesturalMode = inGesturalMode;