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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23048205

Change-Id: I874a5179498358d17c211ffab0960df4aaeeed2e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2023-05-10 22:57:26 +00:00
committed by Automerger Merge Worker

View File

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