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

Commit ae0647b7 authored by Zhao Wei Liew's avatar Zhao Wei Liew Committed by Arne Coucheron
Browse files

Revert "Settings: Display percentage power"

CM has its own customisations for battery icons and percentage.
Revert the unnecessary CAF patch.

This reverts commit 7140288c.

Change-Id: Id4c34a4cc4400490a8a82ebd5a3654232377650e
parent 459eec68
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -3254,8 +3254,6 @@
    <string name="profiles_settings_title">情景模式</string>

    <string name="mbn_version">MBN 版本</string>
    <string name="show_battery_percentage">显示电池电量百分比</string>
    <string name="show_battery_percentage_summary">在状态栏中显示电池电量百分比</string>

    <string name="qtifeedback_settings_title">硬件反馈</string>
    <string name="qtifeedback_settings_subtitle">Qualcomm Technologies 报告</string>
+0 −3
Original line number Diff line number Diff line
@@ -33,7 +33,4 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    <!-- Whether to show_kernel version name -->
    <bool name="def_hide_kernel_version_name">false</bool>
    <!-- Whether to show a preference item for battery percentage
        in ("Battery") for India RJIL -->
    <bool name="config_show_battery_percentage">false</bool>
</resources>
+0 −3
Original line number Diff line number Diff line
@@ -7847,9 +7847,6 @@
    <string name="turn_off_wifi_dialog_title">Turn off Wi-Fi</string>
    <string name="turn_off_wifi_dialog_text">Wi-Fi is turned off when Mobile HotSpot is active. To turn on Wi-Fi, please turn off Mobile HotSpot.</string>
    <string name="show_battery_percentage">Show battery percentage</string>
    <string name="show_battery_percentage_summary">Show battery level percentage inside the status bar</string>
    <string name="learn_usb_dialog_title">USB tethering is activated</string>
    <string name="learn_usb_dialog_text">Would you like to learn more about USB Tethering on your phone?</string>
    <string name="mobile_tether_help_dialog_title">Mobile HotSpot Help</string>
+0 −6
Original line number Diff line number Diff line
@@ -23,12 +23,6 @@
            android:title="@string/battery_saver"
            android:fragment="com.android.settings.fuelgauge.BatterySaverSettings" />

        <SwitchPreference
            android:key="battery_pct"
            android:title="@string/show_battery_percentage"
            android:summary="@string/show_battery_percentage_summary"
            android:persistent="false" />

        <com.android.settings.fuelgauge.BatteryHistoryPreference
            android:key="battery_history" />

+0 −34
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@ import android.os.Process;
import android.os.UserHandle;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceGroup;
import android.support.v14.preference.SwitchPreference;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.SparseArray;
import android.util.TypedValue;
@@ -58,7 +56,6 @@ import java.util.List;
 */
public class PowerUsageSummary extends PowerUsageBase {

    public static final String SHOW_PERCENT_SETTING = "status_bar_show_battery_percent";
    private static final boolean DEBUG = false;

    private static final boolean USE_FAKE_DATA = false;
@@ -67,7 +64,6 @@ public class PowerUsageSummary extends PowerUsageBase {

    private static final String KEY_APP_LIST = "app_list";
    private static final String KEY_BATTERY_HISTORY = "battery_history";
    private static final String KEY_BATTERY_PCT = "battery_pct";

    private static final int MENU_STATS_TYPE = Menu.FIRST;
    private static final int MENU_HIGH_POWER_APPS = Menu.FIRST + 3;
@@ -75,10 +71,8 @@ public class PowerUsageSummary extends PowerUsageBase {

    private BatteryHistoryPreference mHistPref;
    private PreferenceGroup mAppListGroup;
    private SwitchPreference mBatteryPct;

    private int mStatsType = BatteryStats.STATS_SINCE_CHARGED;
    private boolean isShowBatteryPct;

    private static final int MIN_POWER_THRESHOLD_MILLI_AMP = 5;
    private static final int MAX_ITEMS_TO_LIST = USE_FAKE_DATA ? 30 : 10;
@@ -93,11 +87,6 @@ public class PowerUsageSummary extends PowerUsageBase {
        addPreferencesFromResource(R.xml.power_usage_summary);
        mHistPref = (BatteryHistoryPreference) findPreference(KEY_BATTERY_HISTORY);
        mAppListGroup = (PreferenceGroup) findPreference(KEY_APP_LIST);
        mBatteryPct = (SwitchPreference) findPreference(KEY_BATTERY_PCT);
        isShowBatteryPct = getResources().getBoolean(R.bool.config_show_battery_percentage);
        if (!isShowBatteryPct) {
            getPreferenceScreen().removePreference(mBatteryPct);
        }
    }

    @Override
@@ -108,9 +97,6 @@ public class PowerUsageSummary extends PowerUsageBase {
    @Override
    public void onResume() {
        super.onResume();
        if (isShowBatteryPct) {
            updateBatteryPct();
        }
        refreshStats();
    }

@@ -493,24 +479,4 @@ public class PowerUsageSummary extends PowerUsageBase {
            return new SummaryProvider(activity, summaryLoader);
        }
    };

    private void updateBatteryPct() {
        if (mBatteryPct != null) {
            mBatteryPct.setChecked(
                Settings.System.getInt(getContext().getContentResolver(),
                SHOW_PERCENT_SETTING, 0) != 0);
            mBatteryPct.setOnPreferenceChangeListener(mBatteryPctChange);
        }
    }

    private final Preference.OnPreferenceChangeListener mBatteryPctChange =
            new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            final boolean v = (Boolean) newValue;
            Settings.System.putInt(getContext().getContentResolver(),
                    SHOW_PERCENT_SETTING, v ? 1 : 0);
            return true;
        }
    };
}