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

Commit 5bc5457a authored by Narayan Kamath's avatar Narayan Kamath Committed by Android (Google) Code Review
Browse files

Merge "Support logging chained WorkSources from JobScheduler."

parents 0cccde6b 8d82825c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
package android.os;

import android.annotation.Nullable;
import android.content.Context;
import android.os.WorkSourceProto;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.util.Log;
import android.util.proto.ProtoOutputStream;

@@ -109,6 +112,17 @@ public class WorkSource implements Parcelable {
        }
    }

    /**
     * Whether system services should create {@code WorkChains} (wherever possible) in the place
     * of flat UID lists.
     *
     * @hide
     */
    public static boolean isChainedBatteryAttributionEnabled(Context context) {
        return Settings.Global.getInt(context.getContentResolver(),
                Global.CHAINED_BATTERY_ATTRIBUTION_ENABLED, 0) == 1;
    }

    /** @hide */
    public int size() {
        return mNum;
+10 −0
Original line number Diff line number Diff line
@@ -11248,6 +11248,16 @@ public final class Settings {
         */
        public static final String OVERRIDE_SETTINGS_PROVIDER_RESTORE_ANY_VERSION =
                "override_settings_provider_restore_any_version";
        /**
         * Flag to toggle whether system services report attribution chains when they attribute
         * battery use via a {@code WorkSource}.
         *
         * Type: int (0 to disable, 1 to enable)
         *
         * @hide
         */
        public static final String CHAINED_BATTERY_ATTRIBUTION_ENABLED =
                "chained_battery_attribution_enabled";

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
+2 −1
Original line number Diff line number Diff line
@@ -394,8 +394,9 @@ message GlobalSettingsProto {
    optional SettingProto wifi_connected_mac_randomization_enabled = 350;
    optional SettingProto show_restart_in_crash_dialog = 351;
    optional SettingProto show_mute_in_crash_dialog = 352;
    optional SettingProto chained_battery_attribution_enabled = 353;

    // Next tag = 353;
    // Next tag = 354;
}

message SecureSettingsProto {
+2 −1
Original line number Diff line number Diff line
@@ -444,7 +444,8 @@ public class SettingsBackupTest {
                    Settings.Global.ZEN_MODE_CONFIG_ETAG,
                    Settings.Global.ZEN_MODE_RINGER_LEVEL,
                    Settings.Global.ZRAM_ENABLED,
                    Settings.Global.OVERRIDE_SETTINGS_PROVIDER_RESTORE_ANY_VERSION);
                    Settings.Global.OVERRIDE_SETTINGS_PROVIDER_RESTORE_ANY_VERSION,
                    Settings.Global.CHAINED_BATTERY_ATTRIBUTION_ENABLED);

    private static final Set<String> BACKUP_BLACKLISTED_SECURE_SETTINGS =
             newHashSet(
+7 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.providers.settings;
import android.annotation.NonNull;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.providers.settings.GlobalSettingsProto;
import android.providers.settings.SecureSettingsProto;
import android.providers.settings.SettingProto;
@@ -1137,6 +1138,12 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
                Settings.Global.SHOW_MUTE_IN_CRASH_DIALOG,
                GlobalSettingsProto.SHOW_MUTE_IN_CRASH_DIALOG);
        dumpSetting(s, p,
                Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED,
                GlobalSettingsProto.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED);
        dumpSetting(s, p,
                Global.CHAINED_BATTERY_ATTRIBUTION_ENABLED,
                GlobalSettingsProto.CHAINED_BATTERY_ATTRIBUTION_ENABLED);
    }

    /** Dump a single {@link SettingsState.Setting} to a proto buf */
Loading