Merge "Support logging chained WorkSources from JobScheduler."

This commit is contained in:
Narayan Kamath
2018-01-25 15:13:19 +00:00
committed by Android (Google) Code Review
7 changed files with 71 additions and 10 deletions

View File

@@ -1,7 +1,10 @@
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;

View File

@@ -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