Merge "Move legacy hide applications in usage screen list to SettingsGoogle" into sc-v2-dev am: 11d6ba6f57
am: 0d4e7a27e4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15737567 Change-Id: I0a749bf60f06c8c9aa06ad8bc2a3ae222229d4e3
This commit is contained in:
@@ -1541,12 +1541,6 @@
|
||||
<string-array name="allowlist_hide_summary_in_battery_usage" translatable="false">
|
||||
</string-array>
|
||||
|
||||
<!-- An allowlist which packages won't show entry in battery usage screen.
|
||||
[CHAR LIMIT=NONE] -->
|
||||
<string-array name="allowlist_hide_entry_in_battery_usage" translatable="false">
|
||||
<item>"com.google.android.gms.persistent"</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Array of titles palette list for accessibility. -->
|
||||
<string-array name="setting_palette_data" translatable="false" >
|
||||
<item>@string/color_red</item>
|
||||
|
@@ -123,10 +123,12 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
|
||||
mIs24HourFormat = DateFormat.is24HourFormat(context);
|
||||
mNotAllowShowSummaryPackages = context.getResources()
|
||||
.getTextArray(R.array.allowlist_hide_summary_in_battery_usage);
|
||||
mNotAllowShowEntryPackages = context.getResources()
|
||||
.getTextArray(R.array.allowlist_hide_entry_in_battery_usage);
|
||||
mMetricsFeatureProvider =
|
||||
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
|
||||
mNotAllowShowEntryPackages =
|
||||
FeatureFactory.getFactory(mContext)
|
||||
.getPowerUsageFeatureProvider(context)
|
||||
.getHideApplicationEntries(mContext);
|
||||
if (lifecycle != null) {
|
||||
lifecycle.addObserver(this);
|
||||
}
|
||||
|
@@ -302,10 +302,10 @@ public final class ConvertUtils {
|
||||
private static void purgeLowPercentageAndFakeData(
|
||||
final Context context,
|
||||
final Map<Integer, List<BatteryDiffEntry>> indexedUsageMap) {
|
||||
final List<CharSequence> backgroundUsageTimeHideList =
|
||||
final Set<CharSequence> backgroundUsageTimeHideList =
|
||||
FeatureFactory.getFactory(context)
|
||||
.getPowerUsageFeatureProvider(context)
|
||||
.getHideBackgroundUsageTimeList(context);
|
||||
.getHideBackgroundUsageTimeSet(context);
|
||||
for (List<BatteryDiffEntry> entries : indexedUsageMap.values()) {
|
||||
final Iterator<BatteryDiffEntry> iterator = entries.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
@@ -23,8 +23,8 @@ import android.util.SparseIntArray;
|
||||
|
||||
import com.android.settingslib.fuelgauge.Estimate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Feature Provider used in power usage
|
||||
@@ -144,7 +144,12 @@ public interface PowerUsageFeatureProvider {
|
||||
Uri getBatteryHistoryUri();
|
||||
|
||||
/**
|
||||
* Returns {@link List} for hidding applications background usage time.
|
||||
* Returns {@link Set} for hidding applications background usage time.
|
||||
*/
|
||||
List<CharSequence> getHideBackgroundUsageTimeList(Context context);
|
||||
Set<CharSequence> getHideBackgroundUsageTimeSet(Context context);
|
||||
|
||||
/**
|
||||
* Returns package names for hidding application in the usage screen.
|
||||
*/
|
||||
CharSequence[] getHideApplicationEntries(Context context);
|
||||
}
|
||||
|
@@ -26,9 +26,9 @@ import android.util.SparseIntArray;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.settingslib.fuelgauge.Estimate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class PowerUsageFeatureProviderImpl implements PowerUsageFeatureProvider {
|
||||
|
||||
@@ -158,7 +158,12 @@ public class PowerUsageFeatureProviderImpl implements PowerUsageFeatureProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CharSequence> getHideBackgroundUsageTimeList(Context context) {
|
||||
return new ArrayList<>();
|
||||
public Set<CharSequence> getHideBackgroundUsageTimeSet(Context context) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence[] getHideApplicationEntries(Context context) {
|
||||
return new CharSequence[0];
|
||||
}
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -339,8 +340,8 @@ public final class ConvertUtilsTest {
|
||||
"package3", "label3", 500, 5L, 3600000L, 7200000L);
|
||||
entryMap.put(entry.getKey(), entry);
|
||||
batteryHistoryMap.put(Long.valueOf(batteryHistoryKeys[2]), entryMap);
|
||||
when(mPowerUsageFeatureProvider.getHideBackgroundUsageTimeList(mContext))
|
||||
.thenReturn(Arrays.asList((CharSequence) "package3"));
|
||||
when(mPowerUsageFeatureProvider.getHideBackgroundUsageTimeSet(mContext))
|
||||
.thenReturn(new HashSet(Arrays.asList((CharSequence) "package3")));
|
||||
|
||||
final Map<Integer, List<BatteryDiffEntry>> purgedResultMap =
|
||||
ConvertUtils.getIndexedUsageMap(
|
||||
|
Reference in New Issue
Block a user