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

Commit dd29fd05 authored by Ludvig Hansson's avatar Ludvig Hansson Committed by haiping
Browse files

Add system setting for CW Home Ready

Add a system setting to signal that the Clockwork
Home application has finished initializing.

The setting is marked as transient so it's value
is not persistent during device reboot.

Bug: 149253712
Change-Id: I74e75509dd22b3a1a5cc4c88866d059fed44a347
(cherry picked from commit 3084060da2b4c4fc66a47b75ef85adc11c4de36f)
parent cad96e13
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -14875,6 +14875,17 @@ public final class Settings {
        public static final String CLOCKWORK_SYSUI_MAIN_ACTIVITY_NAME =
                "clockwork_sysui_main_activity_name";
        /**
         * Setting to determine if the Clockwork Home application is ready.
         *
         * <p>
         * Set to 1 when the Clockwork Home application has finished starting up.
         * </p>
         *
         * @hide
         */
        public static final String CLOCKWORK_HOME_READY = "clockwork_home_ready";
        /**
         * Indicates whether aware is available in the current location.
         * @hide
@@ -14933,6 +14944,15 @@ public final class Settings {
         */
        public static final String ONE_HANDED_KEYGUARD_SIDE = "one_handed_keyguard_side";
        /**
         * Global settings that shouldn't be persisted.
         *
         * @hide
         */
        public static final String[] TRANSIENT_SETTINGS = {
                CLOCKWORK_HOME_READY,
        };
        /**
         * Keys we no longer back up under the current schema, but want to continue to
         * process when restoring historical backup datasets.
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public class GlobalSettings {
        Settings.Global.BUGREPORT_IN_POWER_MENU,
        Settings.Global.CLOCKWORK_SYSUI_PACKAGE_NAME,
        Settings.Global.CLOCKWORK_SYSUI_MAIN_ACTIVITY_NAME,
        Settings.Global.CLOCKWORK_HOME_READY,
        Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
        Settings.Global.APP_AUTO_RESTRICTION_ENABLED,
        Settings.Global.AUTO_TIME,
+1 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ public class GlobalSettingsValidators {
        VALIDATORS.put(Global.BLUETOOTH_ON, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Global.CLOCKWORK_SYSUI_MAIN_ACTIVITY_NAME, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Global.CLOCKWORK_SYSUI_PACKAGE_NAME, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Global.CLOCKWORK_HOME_READY, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Global.PRIVATE_DNS_MODE, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Global.PRIVATE_DNS_SPECIFIER, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Global.SOFT_AP_TIMEOUT_ENABLED, BOOLEAN_VALIDATOR);
+17 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.os.Message;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.providers.settings.SettingsOperationProto;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -47,6 +48,7 @@ import android.util.Xml;
import android.util.proto.ProtoOutputStream;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FrameworkStatsLog;

import libcore.io.IoUtils;
@@ -806,7 +808,14 @@ final class SettingsState {

                final int settingCount = settings.size();
                for (int i = 0; i < settingCount; i++) {

                    Setting setting = settings.valueAt(i);
                    if (setting.isTransient()) {
                        if (DEBUG_PERSISTENCE) {
                            Slog.i(LOG_TAG, "[SKIPPED PERSISTING]" + setting.getName());
                        }
                        continue;
                    }

                    if (writeSingleSetting(mVersion, serializer, setting.getId(), setting.getName(),
                            setting.getValue(), setting.getDefaultValue(), setting.getPackageName(),
@@ -1302,6 +1311,14 @@ final class SettingsState {
                    /* resetToDefault */ true);
        }

        public boolean isTransient() {
            switch (getTypeFromKey(getKey())) {
                case SETTINGS_TYPE_GLOBAL:
                    return ArrayUtils.contains(Global.TRANSIENT_SETTINGS, getName());
            }
            return false;
        }

        public boolean update(String value, boolean setDefault, String packageName, String tag,
                boolean forceNonSystemPackage, boolean overrideableByRestore) {
            return update(value, setDefault, packageName, tag, forceNonSystemPackage,