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

Commit ab5c226f authored by Roman Birg's avatar Roman Birg
Browse files

Keyguard: switch to cm-specific device provisioned flag



Ticket: CYNGNOS-2431

Change-Id: I2f47031f9fb2cc40e61a5f57d49e985104b14024
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent a1756e05
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

import cyanogenmod.providers.CMSettings;

import static android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN;
import static android.os.BatteryManager.BATTERY_STATUS_FULL;
import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
@@ -1088,8 +1090,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    }

    private boolean isDeviceProvisionedInSettingsDb() {
        return Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.DEVICE_PROVISIONED, 0) != 0;
        return CMSettings.Secure.getInt(mContext.getContentResolver(),
                CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 0) != 0;
    }

    private void watchForDeviceProvisioning() {
@@ -1106,7 +1108,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        };

        mContext.getContentResolver().registerContentObserver(
                Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED),
                CMSettings.System.getUriFor(CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED),
                false, mDeviceProvisionedObserver);

        // prevent a race condition between where we check the flag and where we register the
+6 −4
Original line number Diff line number Diff line
@@ -118,6 +118,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import cyanogenmod.providers.CMSettings;

import static com.android.keyguard.KeyguardHostView.OnDismissAction;

public abstract class BaseStatusBar extends SystemUI implements
@@ -266,8 +268,8 @@ public abstract class BaseStatusBar extends SystemUI implements
    protected final ContentObserver mSettingsObserver = new ContentObserver(mHandler) {
        @Override
        public void onChange(boolean selfChange) {
            final boolean provisioned = 0 != Settings.Global.getInt(
                    mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0);
            final boolean provisioned = 0 != CMSettings.Secure.getInt(
                    mContext.getContentResolver(), CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 0);
            if (provisioned != mDeviceProvisioned) {
                mDeviceProvisioned = provisioned;
                updateNotifications();
@@ -577,8 +579,8 @@ public abstract class BaseStatusBar extends SystemUI implements
        mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);

        mContext.getContentResolver().registerContentObserver(
                Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), true,
                mSettingsObserver);
                CMSettings.Secure.getUriFor(CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED), false,
                mSettingsObserver, UserHandle.USER_ALL);
        mContext.getContentResolver().registerContentObserver(
                Settings.Global.getUriFor(Settings.Global.ZEN_MODE), false,
                mSettingsObserver);
+6 −4
Original line number Diff line number Diff line
@@ -3584,10 +3584,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            } else if (cyanogenmod.content.Intent.ACTION_SCREEN_CAMERA_GESTURE.equals(action)) {
                boolean userSetupComplete = Settings.Secure.getInt(mContext.getContentResolver(),
                        Settings.Secure.USER_SETUP_COMPLETE, 0) != 0;
                if (!userSetupComplete) {
                    if (DEBUG) Log.d(TAG, String.format(
                            "userSetupComplete = %s, ignoring camera launch gesture.",
                            userSetupComplete));
                if (!userSetupComplete || !isDeviceProvisioned()) {
                    if (DEBUG) {
                        Log.d(TAG, String.format("userSetupComplete = $1%s, " +
                                "deviceProvisioned = $2%s, ignoring camera launch gesture.",
                                userSetupComplete, isDeviceProvisioned()));
                    }
                    return;
                }