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

Commit 3bf23ff5 authored by Ben Lin's avatar Ben Lin
Browse files

Introduce boolean flags to show/hide battery/memory in App info.

This adds two flags:
config_show_app_info_settings_memory
config_show_app_info_settings_battery

Which when individually set to false, will hide them item from "App
info" which is accessed from clicking on an application in Apps &
notifications -> App info.

Bug: 62379413
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=com.android.settings.applications

Change-Id: Ifb3b644901728dc7ea04d13198abddaa7b230538
parent 12970297
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -57,6 +57,12 @@
    <!-- Whether toggle_airplane is available or not. -->
    <bool name="config_show_toggle_airplane">true</bool>

    <!-- Whether memory from app_info_settings is available or not. -->
    <bool name="config_show_app_info_settings_memory">true</bool>

    <!-- Whether battery from app_info_settings is available or not. -->
    <bool name="config_show_app_info_settings_battery">true</bool>

    <!-- Whether location mode is available or not. -->
    <bool name="config_location_mode_available">true</bool>

+3 −1
Original line number Diff line number Diff line
@@ -76,7 +76,9 @@ public class AppBatteryPreferenceController extends BasePreferenceController

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

    @Override
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ public class AppMemoryPreferenceController extends BasePreferenceController

    @Override
    public int getAvailabilityStatus() {
        if (!mContext.getResources().getBoolean(R.bool.config_show_app_info_settings_memory)) {
            return DISABLED_UNSUPPORTED;
        }

        return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)
                ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
    }
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@
    <bool name="config_additional_system_update_setting_enable">true</bool>
    <bool name="config_show_wifi_settings">false</bool>
    <bool name="config_show_toggle_airplane">false</bool>
    <bool name="config_show_app_info_settings_memory">false</bool>
    <bool name="config_show_app_info_settings_battery">false</bool>
    <bool name="config_show_high_power_apps">false</bool>
    <bool name="config_show_alarm_volume">false</bool>
    <bool name="config_show_charging_sounds">false</bool>
+8 −2
Original line number Diff line number Diff line
@@ -109,8 +109,14 @@ public class AppBatteryPreferenceControllerTest {
    }

    @Test
    public void getAvailabilityStatus_shouldAlwaysReturnAvailable() {
        assertThat(mController.getAvailabilityStatus()).isEqualTo(mController.AVAILABLE);
    public void testAppBattery_byDefault_shouldBeShown() {
        assertThat(mController.isAvailable()).isTrue();
    }

    @Test
    @Config(qualifiers = "mcc999")
    public void testAppBattery_ifDisabled_shouldNotBeShown() {
        assertThat(mController.isAvailable()).isFalse();
    }

    @Test
Loading