Merge "Change BatteryUtils.isLegacyApp() to isPreOApp()" into pi-dev

am: 138bdf6030

Change-Id: I80fba5f82a2b75a88660478cc91077db648f8204
This commit is contained in:
hughchen
2018-03-20 05:21:34 +00:00
committed by android-build-merger
3 changed files with 5 additions and 5 deletions

View File

@@ -397,7 +397,7 @@ public class BatteryUtils {
public void setForceAppStandby(int uid, String packageName,
int mode) {
final boolean isPreOApp = isLegacyApp(packageName);
final boolean isPreOApp = isPreOApp(packageName);
if (isPreOApp) {
// Control whether app could run in the background if it is pre O app
mAppOpsManager.setMode(AppOpsManager.OP_RUN_IN_BACKGROUND, uid, packageName, mode);
@@ -483,7 +483,7 @@ public class BatteryUtils {
return 0;
}
public boolean isLegacyApp(final String packageName) {
public boolean isPreOApp(final String packageName) {
try {
ApplicationInfo info = mPackageManager.getApplicationInfo(packageName,
PackageManager.GET_META_DATA);

View File

@@ -127,7 +127,7 @@ public class AnomalyDetectionJobService extends JobService {
&& !isSystemUid(uid)) {
if (anomalyType == StatsManagerConfig.AnomalyType.EXCESSIVE_BG) {
// TODO(b/72385333): check battery percentage draining in batterystats
if (batteryUtils.isLegacyApp(packageName) && batteryUtils.isAppHeavilyUsed(
if (batteryUtils.isPreOApp(packageName) && batteryUtils.isAppHeavilyUsed(
batteryStatsHelper, userManager, uid,
policy.excessiveBgDrainPercentage)) {
Log.e(TAG, "Excessive detected uid=" + uid);

View File

@@ -516,12 +516,12 @@ public class BatteryUtilsTest {
@Test
public void testIsLegacyApp_SdkLowerThanO_ReturnTrue() {
assertThat(mBatteryUtils.isLegacyApp(LOW_SDK_PACKAGE)).isTrue();
assertThat(mBatteryUtils.isPreOApp(LOW_SDK_PACKAGE)).isTrue();
}
@Test
public void testIsLegacyApp_SdkLargerOrEqualThanO_ReturnFalse() {
assertThat(mBatteryUtils.isLegacyApp(HIGH_SDK_PACKAGE)).isFalse();
assertThat(mBatteryUtils.isPreOApp(HIGH_SDK_PACKAGE)).isFalse();
}
@Test