The following boolean flag is added:
config_show_device_name
When set to false, the device name will not be shown in System > About
Device.
Bug:
111653180
Test: Updated robotests
Change-Id: Id9610e2009604c9d9693428adff01adc7d606565
Can be overridden for specific product builds. -->
<bool name="auto_confirm_bluetooth_activation_dialog">false</bool>
+ <!-- Whether the device name is shown in About device or not -->
+ <bool name="config_show_device_name">true</bool>
+
<!-- Whether to show a preference item for the manual in About phone -->
<bool name="config_show_manual">false</bool>
<!-- Whether to show a preference item for regulatory information in About phone -->
import com.android.settings.bluetooth.BluetoothLengthDeviceNameFilter;
import com.android.settings.core.BasePreferenceController;
+import com.android.settings.R;
import com.android.settings.widget.ValidatedEditTextPreference;
import com.android.settings.wifi.tether.WifiDeviceNameTextValidator;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
@Override
public int getAvailabilityStatus() {
- return AVAILABLE;
+ return mContext.getResources().getBoolean(R.bool.config_show_device_name)
+ ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
}
@Override
<bool name="config_show_wifi_ip_address">false</bool>
<bool name="config_show_wifi_mac_address">false</bool>
<bool name="config_disable_uninstall_update">true</bool>
+ <bool name="config_show_device_name">false</bool>
<!-- List of a11y components on the device allowed to be enabled by Settings Slices -->
<string-array name="config_settings_slices_accessibility_components" translatable="false">
package com.android.settings.deviceinfo;
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowApplication;
import androidx.preference.PreferenceScreen;
}
@Test
+ public void getAvailibilityStatus_availableByDefault() {
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+ }
+
+ @Test
+ @Config(qualifiers = "mcc999")
+ public void getAvailabilityStatus_unsupportedWhenSet() {
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+ }
+
+ @Test
public void constructor_defaultDeviceNameIsModelName() {
assertThat(mController.getSummary()).isEqualTo(Build.MODEL);
}