Make battery cycle count configurable and disable it by default
Most devices don't report valid cycle count. Change-Id: I32478dac8ff409cd90506495eca42b9df987919b
This commit is contained in:
parent
38e36b5403
commit
08f05c00ed
3 changed files with 23 additions and 1 deletions
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue