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

Commit 1f27a264 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Count modifications to user's power allowlist" into udc-dev am: 91355ffc am: 77d9d100

parents cc581a2c 77d9d100
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ import com.android.internal.util.ArrayUtils;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.XmlUtils;
import com.android.modules.expresslog.Counter;
import com.android.server.am.BatteryStatsService;
import com.android.server.deviceidle.ConstraintController;
import com.android.server.deviceidle.DeviceIdleConstraintTracker;
@@ -300,6 +301,12 @@ public class DeviceIdleController extends SystemService
        implements AnyMotionDetector.DeviceIdleCallback {
    private static final String TAG = "DeviceIdleController";

    private static final String USER_ALLOWLIST_ADDITION_METRIC_ID =
            "battery.value_app_added_to_power_allowlist";

    private static final String USER_ALLOWLIST_REMOVAL_METRIC_ID =
            "battery.value_app_removed_from_power_allowlist";

    private static final boolean DEBUG = false;

    private static final boolean COMPRESS_TIME = false;
@@ -2805,6 +2812,7 @@ public class DeviceIdleController extends SystemService
                    if (mPowerSaveWhitelistUserApps.put(name, UserHandle.getAppId(ai.uid))
                            == null) {
                        numAdded++;
                        Counter.logIncrement(USER_ALLOWLIST_ADDITION_METRIC_ID);
                    }
                } catch (PackageManager.NameNotFoundException e) {
                    Slog.e(TAG, "Tried to add unknown package to power save whitelist: " + name);
@@ -2826,6 +2834,7 @@ public class DeviceIdleController extends SystemService
                reportPowerSaveWhitelistChangedLocked();
                updateWhitelistAppIdsLocked();
                writeConfigFileLocked();
                Counter.logIncrement(USER_ALLOWLIST_REMOVAL_METRIC_ID);
                return true;
            }
        }