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

Unverified Commit a5971064 authored by Michael Bestas's avatar Michael Bestas
Browse files

Make battery cycle count configurable and disable it by default

Most devices don't report valid cycle count.

Change-Id: I32478dac8ff409cd90506495eca42b9df987919b
parent ff000afc
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@
    <!-- Show battery information -->
    <bool name="config_show_battery_info" translatable="false">true</bool>

    <!-- Show battery cycle count -->
    <bool name="config_show_battery_cycle_count" translatable="false">false</bool>

    <!-- Whether to show peak refresh rate in display settings -->
    <bool name="config_show_peak_refresh_rate_switch">false</bool>

+2 −1
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@ public class BatteryCycleCountPreferenceController extends BasePreferenceControl

    @Override
    public int getAvailabilityStatus() {
        return AVAILABLE;
        return mContext.getResources().getBoolean(R.bool.config_show_battery_cycle_count)
                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }

    @Override
+18 −0
Original line number Diff line number Diff line
@@ -18,18 +18,23 @@ package com.android.settings.deviceinfo.batteryinfo;

import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.Bundle;

import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.widget.FooterPreference;

/** A fragment that shows battery hardware information. */
@SearchIndexable
public class BatteryInfoFragment extends DashboardFragment {

    public static final String TAG = "BatteryInfo";
    private static final String KEY_BATTERY_INFO_FOOTER = "battery_info_footer";

    private FooterPreference mFooterPreference;

    @Override
    public int getMetricsCategory() {
@@ -41,6 +46,19 @@ public class BatteryInfoFragment extends DashboardFragment {
        return R.xml.battery_info;
    }

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        mFooterPreference = findPreference(KEY_BATTERY_INFO_FOOTER);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        mFooterPreference.setVisible(
                getContext().getResources().getBoolean(R.bool.config_show_battery_cycle_count));
    }

    @Override
    protected String getLogTag() {
        return TAG;