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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user