Hide Camera background running time in the battery usage screen
hide camera background running time in the battery usage screen to avoid
users confuse about it, since it will standby in the backgound to sspeed
up launching time, not always running in the background
Bug: 196744910
Test: make SettingsRoboTests
Change-Id: Ia391d661bca44435fc5a68b1c86e5ca32dd0fcfe
Merged-In: Ia391d661bca44435fc5a68b1c86e5ca32dd0fcfe
(cherry picked from commit 4e3f692164
)
This commit is contained in:
committed by
Android Build Coastguard Worker
parent
3b7fccb233
commit
4d67f4c847
@@ -24,6 +24,8 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -288,7 +290,7 @@ public final class ConvertUtils {
|
||||
}
|
||||
insert24HoursData(BatteryChartView.SELECTED_INDEX_ALL, resultMap);
|
||||
if (purgeLowPercentageAndFakeData) {
|
||||
purgeLowPercentageAndFakeData(resultMap);
|
||||
purgeLowPercentageAndFakeData(context, resultMap);
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
@@ -327,7 +329,12 @@ public final class ConvertUtils {
|
||||
|
||||
// Removes low percentage data and fake usage data, which will be zero value.
|
||||
private static void purgeLowPercentageAndFakeData(
|
||||
final Context context,
|
||||
final Map<Integer, List<BatteryDiffEntry>> indexedUsageMap) {
|
||||
final List<CharSequence> backgroundUsageTimeHideList =
|
||||
FeatureFactory.getFactory(context)
|
||||
.getPowerUsageFeatureProvider(context)
|
||||
.getHideBackgroundUsageTimeList(context);
|
||||
for (List<BatteryDiffEntry> entries : indexedUsageMap.values()) {
|
||||
final Iterator<BatteryDiffEntry> iterator = entries.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
@@ -336,6 +343,12 @@ public final class ConvertUtils {
|
||||
|| FAKE_PACKAGE_NAME.equals(entry.getPackageName())) {
|
||||
iterator.remove();
|
||||
}
|
||||
final String packageName = entry.getPackageName();
|
||||
if (packageName != null
|
||||
&& !backgroundUsageTimeHideList.isEmpty()
|
||||
&& backgroundUsageTimeHideList.contains(packageName)) {
|
||||
entry.mBackgroundUsageTimeInMs = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user