Support some phone information in Settings slice
- Android version - Device model Test: robo test, manual test Change-Id: Ic047caaf4ab699082f6420ad8fa1d2f455abfcb0 Fixes: 74900516
This commit is contained in:
@@ -96,6 +96,7 @@
|
||||
android:title="@string/hardware_info"
|
||||
settings:keywords="@string/keywords_model_and_hardware"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:allowDynamicSummaryInSlice="true"
|
||||
settings:controller=
|
||||
"com.android.settings.deviceinfo.DeviceModelPreferenceController" />
|
||||
|
||||
@@ -109,11 +110,12 @@
|
||||
|
||||
<!-- Android version -->
|
||||
<Preference
|
||||
android:key="my_device_firmware_version"
|
||||
android:key="firmware_version"
|
||||
android:order="32"
|
||||
android:title="@string/firmware_version"
|
||||
settings:keywords="@string/keywords_android_version"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:allowDynamicSummaryInSlice="true"
|
||||
settings:controller=
|
||||
"com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceController" />
|
||||
|
||||
|
@@ -73,6 +73,11 @@ public class DeviceModelPreferenceController extends BasePreferenceController {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String getDeviceModel() {
|
||||
FutureTask<String> msvSuffixTask = new FutureTask<String>(new Callable<String>() {
|
||||
@Override
|
||||
|
@@ -56,4 +56,9 @@ public class FirmwareVersionPreferenceController extends BasePreferenceControlle
|
||||
FirmwareVersionDialogFragment.show(mFragment);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ import org.robolectric.annotation.Config;
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class DeviceModelPreferenceControllerTest {
|
||||
|
||||
private final String KEY = "device_model_key";
|
||||
private final String KEY = "device_model";
|
||||
|
||||
@Mock
|
||||
private Fragment mFragment;
|
||||
@@ -101,6 +101,11 @@ public class DeviceModelPreferenceControllerTest {
|
||||
.add(any(HardwareInfoDialogFragment.class), eq(HardwareInfoDialogFragment.TAG));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceable_shouldBeTrue() {
|
||||
assertThat(mController.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
private boolean containBuildModel(CharSequence result) {
|
||||
final String oracle = mContext.getResources().getString(R.string.model_summary,
|
||||
Build.MODEL);
|
||||
|
@@ -44,7 +44,7 @@ import org.robolectric.annotation.Resetter;
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class FirmwareVersionPreferenceControllerTest {
|
||||
|
||||
private final String KEY = "firmware_key";
|
||||
private final String KEY = "firmware_version";
|
||||
|
||||
@Mock
|
||||
private Fragment mFragment;
|
||||
@@ -103,6 +103,11 @@ public class FirmwareVersionPreferenceControllerTest {
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceable_shouldBeTrue() {
|
||||
assertThat(mController.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Implements(FirmwareVersionDialogFragment.class)
|
||||
public static class ShadowFirmwareVersionDialogFragment {
|
||||
|
||||
|
Reference in New Issue
Block a user