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

Commit 74f01594 authored by Marco Ballesio's avatar Marco Ballesio
Browse files

Settings option to enable/disable the app freezer

The new setting option allows for a local configuration to override the
Device Config flag. Device Config and experiments will be honored by
default.

Bug: 155465196
Change-Id: I978a7b6bd75d9daab3fafed58b7f3c6417e0adab
Test: the option is correctly read and written by the companion CLs
parent 240bea3f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -14024,6 +14024,14 @@ public final class Settings {
        public static final String ZRAM_ENABLED =
                "zram_enabled";
        /**
         * Whether the app freezer is enabled on this device.
         * The value of "enabled" enables the app freezer, "disabled" disables it and
         * "device_default" will let the system decide whether to enable the freezer or not
         * @hide
         */
        public static final String CACHED_APPS_FREEZER_ENABLED = "cached_apps_freezer";
        /**
         * Configuration flags for smart replies in notifications.
         * This is encoded as a key=value list, separated by commas. Ex:
+2 −1
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ message GlobalSettingsProto {

    optional SettingProto boot_count = 22 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto bugreport_in_power_menu = 23 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto cached_apps_freezer_enabled = 152 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto call_auto_retry = 24 [ (android.privacy).dest = DEST_AUTOMATIC ];

    message CaptivePortal {
@@ -1059,5 +1060,5 @@ message GlobalSettingsProto {

    // Please insert fields in alphabetical order and group them into messages
    // if possible (to avoid reaching the method limit).
    // Next tag = 152;
    // Next tag = 153;
}
+3 −0
Original line number Diff line number Diff line
@@ -375,6 +375,9 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
                Settings.Global.BUGREPORT_IN_POWER_MENU,
                GlobalSettingsProto.BUGREPORT_IN_POWER_MENU);
        dumpSetting(s, p,
                Settings.Global.CACHED_APPS_FREEZER_ENABLED,
                GlobalSettingsProto.CACHED_APPS_FREEZER_ENABLED);
        dumpSetting(s, p,
                Settings.Global.CALL_AUTO_RETRY,
                GlobalSettingsProto.CALL_AUTO_RETRY);
+2 −1
Original line number Diff line number Diff line
@@ -586,7 +586,8 @@ public class SettingsBackupTest {
                    Settings.Global.POWER_BUTTON_LONG_PRESS,
                    Settings.Global.POWER_BUTTON_VERY_LONG_PRESS,
                    Settings.Global.INTEGRITY_CHECK_INCLUDES_RULE_PROVIDER,
                    Settings.Global.ADVANCED_BATTERY_USAGE_AMOUNT);
                    Settings.Global.ADVANCED_BATTERY_USAGE_AMOUNT,
                    Settings.Global.CACHED_APPS_FREEZER_ENABLED);

    private static final Set<String> BACKUP_BLACKLISTED_SECURE_SETTINGS =
             newHashSet(
+8 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.os.Trace;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig.OnPropertiesChangedListener;
import android.provider.DeviceConfig.Properties;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Slog;
@@ -443,7 +444,13 @@ public final class CachedAppOptimizer {
     */
    @GuardedBy("mPhenotypeFlagLock")
    private void updateUseFreezer() {
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT,
        final String configOverride = Settings.Global.getString(mAm.mContext.getContentResolver(),
                Settings.Global.CACHED_APPS_FREEZER_ENABLED);

        if ("disabled".equals(configOverride)) {
            mUseFreezer = false;
        } else if ("enabled".equals(configOverride)
                || DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT,
                    KEY_USE_FREEZER, DEFAULT_USE_FREEZER)) {
            mUseFreezer = isFreezerSupported();
        }