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

Commit b900e0e4 authored by Wesley Wang's avatar Wesley Wang
Browse files

Revert "Add PowerSaveWhitelistExceptIdle as Optimizted modes condition"

This reverts commit 3f7839ca.

Reason for revert: This fix will cause a side effect which makes app switch state from Unrestricted to Optimize then it will lock at Optimize mode only, will prepare other cl to fix the previous issue

Change-Id: Ic5232eb0099fa1591f15e72747eca4d08b9af9b9
parent 3f7839ca
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@ package com.android.settings.fuelgauge;
import android.annotation.UserIdInt;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.backup.BackupManager;
import android.app.settings.SettingsEnums;
import android.app.backup.BackupManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -362,10 +362,8 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
        final String stateString;
        final String footerString;

        if (!mBatteryOptimizeUtils.isValidPackageName()
                || mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()) {
            // Present optimized only string when the package name is invalid or
            // it's in allow list not idle app.
        if (!mBatteryOptimizeUtils.isValidPackageName()) {
            //Present optimized only string when the package name is invalid.
            stateString = context.getString(R.string.manager_battery_usage_optimized_only);
            footerString = context.getString(
                    R.string.manager_battery_usage_footer_limited, stateString);
+0 −7
Original line number Diff line number Diff line
@@ -130,13 +130,6 @@ public class BatteryOptimizeUtils {
                || mPowerAllowListBackend.isDefaultActiveApp(mPackageName);
    }

    /**
     * Return {@code true} if this package is in allow list except idle app.
     */
    public boolean isAllowlistedExceptIdleApp() {
        return mPowerAllowListBackend.isAllowlistedExceptIdle(mPackageName);
    }

    String getPackageName() {
        return mPackageName == null ? UNKNOWN_PACKAGE : mPackageName;
    }
+0 −4
Original line number Diff line number Diff line
@@ -57,10 +57,6 @@ public class OptimizedPreferenceController extends AbstractPreferenceController
            Log.d(TAG, "is system or default app, disable pref");
            ((SelectorWithWidgetPreference) preference).setChecked(false);
            preference.setEnabled(false);
        } else if (mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()) {
            Log.d(TAG, "in allow list not idle app, optimized states only");
            preference.setEnabled(true);
            ((SelectorWithWidgetPreference) preference).setChecked(true);
        } else if (mBatteryOptimizeUtils.getAppOptimizationMode()
                == BatteryOptimizeUtils.MODE_OPTIMIZED) {
            Log.d(TAG, "is optimized states");
+0 −3
Original line number Diff line number Diff line
@@ -55,9 +55,6 @@ public class RestrictedPreferenceController extends AbstractPreferenceController
            Log.d(TAG, "is system or default app, disable pref");
            ((SelectorWithWidgetPreference) preference).setChecked(false);
            preference.setEnabled(false);
        } else if (mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()) {
            Log.d(TAG, "in allow list not idle app, disable perf");
            preference.setEnabled(false);
        } else if (mBatteryOptimizeUtils.getAppOptimizationMode()
                == BatteryOptimizeUtils.MODE_RESTRICTED) {
            Log.d(TAG, "is restricted states");
+0 −3
Original line number Diff line number Diff line
@@ -53,9 +53,6 @@ public class UnrestrictedPreferenceController extends AbstractPreferenceControll
        if (mBatteryOptimizeUtils.isSystemOrDefaultApp()) {
            Log.d(TAG, "is system or default app, unrestricted states only");
            ((SelectorWithWidgetPreference) preference).setChecked(true);
        } else if (mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()) {
            Log.d(TAG, "in allow list not idle app, disable perf");
            preference.setEnabled(false);
        } else if (mBatteryOptimizeUtils.getAppOptimizationMode()
                == BatteryOptimizeUtils.MODE_UNRESTRICTED) {
            Log.d(TAG, "is unrestricted states");
Loading