diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 98adebb25e3..eb3be0e37d1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -922,14 +922,6 @@
-
-
-
-
-
-
+
+
msvSuffixTask = new FutureTask(new Callable() {
- @Override
- public String call() {
- return DeviceInfoUtils.getMsvSuffix();
- }
- });
+ FutureTask msvSuffixTask = new FutureTask<>(() -> DeviceInfoUtils.getMsvSuffix());
msvSuffixTask.run();
try {
diff --git a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
index 37f80b736ea..8c6c5aea0c9 100644
--- a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
+++ b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
@@ -181,25 +181,6 @@ public class MyDeviceInfoFragment extends DashboardFragment
controller.updateDeviceName(confirm);
}
- private static class SummaryProvider implements SummaryLoader.SummaryProvider {
-
- private final SummaryLoader mSummaryLoader;
-
- public SummaryProvider(SummaryLoader summaryLoader) {
- mSummaryLoader = summaryLoader;
- }
-
- @Override
- public void setListening(boolean listening) {
- if (listening) {
- mSummaryLoader.setSummary(this, DeviceModelPreferenceController.getDeviceModel());
- }
- }
- }
-
- public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
- = (activity, summaryLoader) -> new SummaryProvider(summaryLoader);
-
/**
* For Search.
*/
diff --git a/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceController.java b/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceController.java
new file mode 100644
index 00000000000..ba28f3a1b48
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceController.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.aboutphone;
+
+import android.content.Context;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.deviceinfo.DeviceModelPreferenceController;
+
+public class TopLevelAboutDevicePreferenceController extends BasePreferenceController {
+
+ public TopLevelAboutDevicePreferenceController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+
+ @Override
+ public CharSequence getSummary() {
+ return DeviceModelPreferenceController.getDeviceModel();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/deviceinfo/DeviceNameWarningDialogTest.java b/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/DeviceNameWarningDialogTest.java
similarity index 72%
rename from tests/robotests/src/com/android/settings/deviceinfo/deviceinfo/DeviceNameWarningDialogTest.java
rename to tests/robotests/src/com/android/settings/deviceinfo/aboutphone/DeviceNameWarningDialogTest.java
index 0be0ac23762..6ea36a06836 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/deviceinfo/DeviceNameWarningDialogTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/DeviceNameWarningDialogTest.java
@@ -1,4 +1,20 @@
-package com.android.settings.deviceinfo.deviceinfo;
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.aboutphone;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -6,8 +22,6 @@ import static org.mockito.Mockito.verify;
import android.content.DialogInterface;
-import com.android.settings.deviceinfo.aboutphone.DeviceNameWarningDialog;
-import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Test;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/MyDeviceInfoFragmentTest.java b/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragmentTest.java
similarity index 97%
rename from tests/robotests/src/com/android/settings/deviceinfo/MyDeviceInfoFragmentTest.java
rename to tests/robotests/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragmentTest.java
index 4a741cffb6a..e304a1e710d 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/MyDeviceInfoFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragmentTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.settings.deviceinfo;
+package com.android.settings.deviceinfo.aboutphone;
import static com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY;
@@ -35,7 +35,7 @@ import android.util.ArrayMap;
import androidx.fragment.app.FragmentActivity;
import androidx.preference.PreferenceScreen;
-import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
+import com.android.settings.deviceinfo.BuildNumberPreferenceController;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceControllerTest.java
new file mode 100644
index 00000000000..ae3007c9d84
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceControllerTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.aboutphone;
+
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.os.Build;
+
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+public class TopLevelAboutDevicePreferenceControllerTest {
+
+ private Context mContext;
+ private TopLevelAboutDevicePreferenceController mController;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ mController = new TopLevelAboutDevicePreferenceController(mContext, "test_key");
+ }
+
+ @Test
+ public void getAvailabilityState_shouldBeAvailable() {
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+ }
+
+ @Test
+ public void getSummary_shouldReturnDeviceModel() {
+ assertThat(mController.getSummary().toString()).isEqualTo(Build.MODEL);
+ }
+}