Setting: batteryinfo: Add config to enable/disable battery design & maximum capacity info
* Legacy devices like the Pixel 2 Series do not support this feature, only show Unavailable for design capacity and maximum capacity in battery information. * Enabled by default Test: Build & flash Signed-off-by: Asriadi Rahim <asriadirahim03@gmail.com>
This commit is contained in:
@@ -32,6 +32,12 @@
|
|||||||
<!-- Show battery cycle count -->
|
<!-- Show battery cycle count -->
|
||||||
<bool name="config_show_battery_cycle_count" translatable="false">false</bool>
|
<bool name="config_show_battery_cycle_count" translatable="false">false</bool>
|
||||||
|
|
||||||
|
<!-- Show battery Design Capacity -->
|
||||||
|
<bool name="config_show_battery_design_capacity">true</bool>
|
||||||
|
|
||||||
|
<!-- Show battery Maximum Capacity -->
|
||||||
|
<bool name="config_show_battery_maximum_capacity">true</bool>
|
||||||
|
|
||||||
<!-- Whether to show peak refresh rate in display settings -->
|
<!-- Whether to show peak refresh rate in display settings -->
|
||||||
<bool name="config_show_peak_refresh_rate_switch">false</bool>
|
<bool name="config_show_peak_refresh_rate_switch">false</bool>
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ public class BatteryDesignCapacityPreferenceController extends BasePreferenceCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
return AVAILABLE;
|
boolean isFeatureEnabled = mContext.getResources().getBoolean(R.bool.config_show_battery_design_capacity);
|
||||||
|
return isFeatureEnabled ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ public class BatteryMaximumCapacityPreferenceController extends BasePreferenceCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
return AVAILABLE;
|
boolean isFeatureEnabled = mContext.getResources().getBoolean(R.bool.config_show_battery_maximum_capacity);
|
||||||
|
return isFeatureEnabled ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user