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

Commit f27d0c29 authored by ykhung's avatar ykhung Committed by Automerger Merge Worker
Browse files

Move allowed list definition in the battery usage to feature provider am: b62cdecc am: bb535f4b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15785737

Change-Id: I4a19dcc41b14af235c3e1d94675d14fc8f05e3a0
parents 4304572a bb535f4b
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -1536,11 +1536,6 @@
        <item>@string/enhanced_4g_lte_mode_summary_4g_calling</item>
    </string-array>

    <!-- An allowlist which packages won't show summary in battery usage screen.
         [CHAR LIMIT=NONE] -->
    <string-array name="allowlist_hide_summary_in_battery_usage" translatable="false">
    </string-array>

    <!-- Array of titles palette list for accessibility. -->
    <string-array name="setting_palette_data" translatable="false" >
        <item>@string/color_red</item>
+5 −2
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -440,8 +441,10 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
    }

    private boolean shouldShowSummary(BatteryEntry entry) {
        final CharSequence[] allowlistPackages = mContext.getResources()
                .getTextArray(R.array.allowlist_hide_summary_in_battery_usage);
        final CharSequence[] allowlistPackages =
                FeatureFactory.getFactory(mContext)
                        .getPowerUsageFeatureProvider(mContext)
                        .getHideApplicationSummary(mContext);
        final String target = entry.getDefaultPackageName();

        for (CharSequence packageName : allowlistPackages) {
+6 −4
Original line number Diff line number Diff line
@@ -121,14 +121,16 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
        mFragment = fragment;
        mPreferenceKey = preferenceKey;
        mIs24HourFormat = DateFormat.is24HourFormat(context);
        mNotAllowShowSummaryPackages = context.getResources()
            .getTextArray(R.array.allowlist_hide_summary_in_battery_usage);
        mMetricsFeatureProvider =
            FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
        mNotAllowShowEntryPackages =
            FeatureFactory.getFactory(mContext)
            FeatureFactory.getFactory(context)
                .getPowerUsageFeatureProvider(context)
                .getHideApplicationEntries(context);
        mNotAllowShowSummaryPackages =
            FeatureFactory.getFactory(context)
                .getPowerUsageFeatureProvider(context)
                .getHideApplicationEntries(mContext);
                .getHideApplicationSummary(context);
        if (lifecycle != null) {
            lifecycle.addObserver(this);
        }
+5 −0
Original line number Diff line number Diff line
@@ -157,4 +157,9 @@ public interface PowerUsageFeatureProvider {
     * Returns package names for hidding application in the usage screen.
     */
    CharSequence[] getHideApplicationEntries(Context context);

    /**
     * Returns package names for hidding summary in the usage screen.
     */
    CharSequence[] getHideApplicationSummary(Context context);
}
+5 −0
Original line number Diff line number Diff line
@@ -171,4 +171,9 @@ public class PowerUsageFeatureProviderImpl implements PowerUsageFeatureProvider
    public CharSequence[] getHideApplicationEntries(Context context) {
        return new CharSequence[0];
    }

    @Override
    public CharSequence[] getHideApplicationSummary(Context context) {
        return new CharSequence[0];
    }
}
Loading