Merge "Add ability to show/hide different device information."
This commit is contained in:
committed by
Android (Google) Code Review
commit
d1afc3e42e
@@ -158,4 +158,13 @@
|
|||||||
|
|
||||||
<!-- Whether system_update_settings should be shown or not. -->
|
<!-- Whether system_update_settings should be shown or not. -->
|
||||||
<bool name="config_show_system_update_settings">true</bool>
|
<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>
|
</resources>
|
||||||
|
@@ -41,7 +41,7 @@ public class DeviceModelPreferenceController extends AbstractPreferenceControlle
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
return true;
|
return mContext.getResources().getBoolean(R.bool.config_show_device_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -19,6 +19,8 @@ package com.android.settings.deviceinfo;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
|
import com.android.settings.R;
|
||||||
|
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||||
import com.android.settingslib.deviceinfo.AbstractIpAddressPreferenceController;
|
import com.android.settingslib.deviceinfo.AbstractIpAddressPreferenceController;
|
||||||
|
|
||||||
@@ -31,5 +33,10 @@ public class IpAddressPreferenceController extends AbstractIpAddressPreferenceCo
|
|||||||
super(context, lifecycle);
|
super(context, lifecycle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable() {
|
||||||
|
return mContext.getResources().getBoolean(R.bool.config_show_wifi_ip_address);
|
||||||
|
}
|
||||||
|
|
||||||
// This space intentionally left blank
|
// This space intentionally left blank
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.deviceinfo;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
|
import com.android.settings.R;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||||
import com.android.settingslib.deviceinfo.AbstractWifiMacAddressPreferenceController;
|
import com.android.settingslib.deviceinfo.AbstractWifiMacAddressPreferenceController;
|
||||||
|
|
||||||
@@ -31,5 +32,10 @@ public class WifiMacAddressPreferenceController extends AbstractWifiMacAddressPr
|
|||||||
super(context, lifecycle);
|
super(context, lifecycle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable() {
|
||||||
|
return mContext.getResources().getBoolean(R.bool.config_show_wifi_mac_address);
|
||||||
|
}
|
||||||
|
|
||||||
// This space intentionally left blank
|
// This space intentionally left blank
|
||||||
}
|
}
|
||||||
|
@@ -57,4 +57,7 @@
|
|||||||
<bool name="config_show_color_inversion_preference">false</bool>
|
<bool name="config_show_color_inversion_preference">false</bool>
|
||||||
<bool name="config_show_system_update_settings">false</bool>
|
<bool name="config_show_system_update_settings">false</bool>
|
||||||
<bool name="config_wifi_support_connected_mac_randomization">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>
|
</resources>
|
||||||
|
@@ -69,10 +69,16 @@ public class DeviceModelPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isAlwaysAvailable() {
|
public void isAvailable_returnTrueIfVisible() {
|
||||||
assertThat(mController.isAvailable()).isTrue();
|
assertThat(mController.isAvailable()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Config(qualifiers = "mcc999")
|
||||||
|
public void isAvailable_returnFalseIfNotVisible() {
|
||||||
|
assertThat(mController.isAvailable()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void displayPref_shouldSetSummary() {
|
public void displayPref_shouldSetSummary() {
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
|
Reference in New Issue
Block a user