This introduces 3 boolean flags:
config_show_device_model
config_show_wifi_ip_address
config_show_wifi_mac_address
Which when set to false will hide their individual panes from "About
Phone" page.
Bug:
62414913
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=com.android.settings.deviceinfo
Change-Id: Iaaf91ef41c9ec7b5bf233344e6a48d4b87fad291
<!-- Whether system_update_settings should be shown or not. -->
<bool name="config_show_system_update_settings">true</bool>
+
+ <!-- Whether device_model should be shown or not. -->
+ <bool name="config_show_device_model">true</bool>
+
+ <!-- Whether wifi_ip_address should be shown or not. -->
+ <bool name="config_show_wifi_ip_address">true</bool>
+
+ <!-- Whether wifi_mac_address should be shown or not. -->
+ <bool name="config_show_wifi_mac_address">true</bool>
</resources>
@Override
public boolean isAvailable() {
- return true;
+ return mContext.getResources().getBoolean(R.bool.config_show_device_model);
}
@Override
import android.content.Context;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.R;
+
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.deviceinfo.AbstractIpAddressPreferenceController;
super(context, lifecycle);
}
+ @Override
+ public boolean isAvailable() {
+ return mContext.getResources().getBoolean(R.bool.config_show_wifi_ip_address);
+ }
+
// This space intentionally left blank
}
import android.content.Context;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.deviceinfo.AbstractWifiMacAddressPreferenceController;
super(context, lifecycle);
}
+ @Override
+ public boolean isAvailable() {
+ return mContext.getResources().getBoolean(R.bool.config_show_wifi_mac_address);
+ }
+
// This space intentionally left blank
}
<bool name="config_show_color_inversion_preference">false</bool>
<bool name="config_show_system_update_settings">false</bool>
<bool name="config_wifi_support_connected_mac_randomization">false</bool>
+ <bool name="config_show_device_model">false</bool>
+ <bool name="config_show_wifi_ip_address">false</bool>
+ <bool name="config_show_wifi_mac_address">false</bool>
</resources>
}
@Test
- public void isAlwaysAvailable() {
+ public void isAvailable_returnTrueIfVisible() {
assertThat(mController.isAvailable()).isTrue();
}
@Test
+ @Config(qualifiers = "mcc999")
+ public void isAvailable_returnFalseIfNotVisible() {
+ assertThat(mController.isAvailable()).isFalse();
+ }
+
+ @Test
public void displayPref_shouldSetSummary() {
mController.displayPreference(mPreferenceScreen);