Set about phone subtext to device model string.
Also remove useless custom preference Fix: 36395109 Test: robotests Change-Id: I07297e6ade6991a8262473c9f59c21d914300244
This commit is contained in:
@@ -943,8 +943,6 @@
|
|||||||
android:value="com.android.settings.category.ia.system" />
|
android:value="com.android.settings.category.ia.system" />
|
||||||
<meta-data android:name="com.android.settings.title"
|
<meta-data android:name="com.android.settings.title"
|
||||||
android:resource="@string/about_settings" />
|
android:resource="@string/about_settings" />
|
||||||
<meta-data android:name="com.android.settings.summary"
|
|
||||||
android:resource="@string/summary_empty"/>
|
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.DeviceInfoSettings" />
|
android:value="com.android.settings.DeviceInfoSettings" />
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
|
@@ -15,25 +15,24 @@
|
|||||||
~ limitations under the License
|
~ limitations under the License
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:title="@string/settings_label">
|
android:title="@string/settings_label">
|
||||||
|
|
||||||
<com.android.settings.TimeoutListPreference
|
<com.android.settings.TimeoutListPreference
|
||||||
android:key="lock_after_timeout"
|
android:key="lock_after_timeout"
|
||||||
android:title="@string/lock_after_timeout"
|
android:title="@string/lock_after_timeout"
|
||||||
android:summary="@string/lock_after_timeout_summary"
|
android:summary="@string/lock_after_timeout_summary"
|
||||||
android:entries="@array/lock_after_timeout_entries"
|
android:entries="@array/lock_after_timeout_entries"
|
||||||
android:entryValues="@array/lock_after_timeout_values" />
|
android:entryValues="@array/lock_after_timeout_values" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="power_button_instantly_locks"
|
android:key="power_button_instantly_locks"
|
||||||
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
|
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />
|
||||||
|
|
||||||
<com.android.settings.SingleLineSummaryPreference
|
|
||||||
android:key="owner_info_settings"
|
|
||||||
android:title="@string/owner_info_settings_title"
|
|
||||||
android:summary="@string/owner_info_settings_summary"/>
|
|
||||||
|
|
||||||
|
<com.android.settingslib.RestrictedPreference
|
||||||
|
android:key="owner_info_settings"
|
||||||
|
android:title="@string/owner_info_settings_title"
|
||||||
|
android:summary="@string/owner_info_settings_summary" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -15,29 +15,28 @@
|
|||||||
~ limitations under the License
|
~ limitations under the License
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:title="@string/settings_label">
|
android:title="@string/settings_label">
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="visiblepattern"
|
android:key="visiblepattern"
|
||||||
android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>
|
android:title="@string/lockpattern_settings_enable_visible_pattern_title" />
|
||||||
|
|
||||||
<com.android.settings.TimeoutListPreference
|
<com.android.settings.TimeoutListPreference
|
||||||
android:key="lock_after_timeout"
|
android:key="lock_after_timeout"
|
||||||
android:title="@string/lock_after_timeout"
|
android:title="@string/lock_after_timeout"
|
||||||
android:summary="@string/lock_after_timeout_summary"
|
android:summary="@string/lock_after_timeout_summary"
|
||||||
android:entries="@array/lock_after_timeout_entries"
|
android:entries="@array/lock_after_timeout_entries"
|
||||||
android:entryValues="@array/lock_after_timeout_values" />
|
android:entryValues="@array/lock_after_timeout_values" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="power_button_instantly_locks"
|
android:key="power_button_instantly_locks"
|
||||||
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
|
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />
|
||||||
|
|
||||||
<com.android.settings.SingleLineSummaryPreference
|
|
||||||
android:key="owner_info_settings"
|
|
||||||
android:title="@string/owner_info_settings_title"
|
|
||||||
android:summary="@string/owner_info_settings_summary"/>
|
|
||||||
|
|
||||||
|
<com.android.settingslib.RestrictedPreference
|
||||||
|
android:key="owner_info_settings"
|
||||||
|
android:title="@string/owner_info_settings_title"
|
||||||
|
android:summary="@string/owner_info_settings_summary" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -15,25 +15,24 @@
|
|||||||
~ limitations under the License
|
~ limitations under the License
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:title="@string/settings_label">
|
android:title="@string/settings_label">
|
||||||
|
|
||||||
<com.android.settings.TimeoutListPreference
|
<com.android.settings.TimeoutListPreference
|
||||||
android:key="lock_after_timeout"
|
android:key="lock_after_timeout"
|
||||||
android:title="@string/lock_after_timeout"
|
android:title="@string/lock_after_timeout"
|
||||||
android:summary="@string/lock_after_timeout_summary"
|
android:summary="@string/lock_after_timeout_summary"
|
||||||
android:entries="@array/lock_after_timeout_entries"
|
android:entries="@array/lock_after_timeout_entries"
|
||||||
android:entryValues="@array/lock_after_timeout_values" />
|
android:entryValues="@array/lock_after_timeout_values" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="power_button_instantly_locks"
|
android:key="power_button_instantly_locks"
|
||||||
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
|
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />
|
||||||
|
|
||||||
<com.android.settings.SingleLineSummaryPreference
|
|
||||||
android:key="owner_info_settings"
|
|
||||||
android:title="@string/owner_info_settings_title"
|
|
||||||
android:summary="@string/owner_info_settings_summary"/>
|
|
||||||
|
|
||||||
|
<com.android.settingslib.RestrictedPreference
|
||||||
|
android:key="owner_info_settings"
|
||||||
|
android:title="@string/owner_info_settings_title"
|
||||||
|
android:summary="@string/owner_info_settings_summary" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -15,13 +15,13 @@
|
|||||||
~ limitations under the License
|
~ limitations under the License
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:title="@string/settings_label">
|
android:title="@string/settings_label">
|
||||||
|
|
||||||
<com.android.settings.SingleLineSummaryPreference
|
<com.android.settingslib.RestrictedPreference
|
||||||
android:key="owner_info_settings"
|
android:key="owner_info_settings"
|
||||||
android:title="@string/owner_info_settings_title"
|
android:title="@string/owner_info_settings_title"
|
||||||
android:summary="@string/owner_info_settings_summary"/>
|
android:summary="@string/owner_info_settings_summary" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -26,6 +26,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
|||||||
import com.android.settings.core.PreferenceController;
|
import com.android.settings.core.PreferenceController;
|
||||||
import com.android.settings.core.lifecycle.Lifecycle;
|
import com.android.settings.core.lifecycle.Lifecycle;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
|
import com.android.settings.dashboard.SummaryLoader;
|
||||||
import com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController;
|
import com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController;
|
||||||
import com.android.settings.deviceinfo.BasebandVersionPreferenceController;
|
import com.android.settings.deviceinfo.BasebandVersionPreferenceController;
|
||||||
import com.android.settings.deviceinfo.BuildNumberPreferenceController;
|
import com.android.settings.deviceinfo.BuildNumberPreferenceController;
|
||||||
@@ -86,6 +87,31 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
|
|||||||
getLifecycle());
|
getLifecycle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
= new SummaryLoader.SummaryProviderFactory() {
|
||||||
|
@Override
|
||||||
|
public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
|
||||||
|
SummaryLoader summaryLoader) {
|
||||||
|
return new SummaryProvider(summaryLoader);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private static List<PreferenceController> buildPreferenceControllers(Context context,
|
private static List<PreferenceController> buildPreferenceControllers(Context context,
|
||||||
Activity activity, Fragment fragment, Lifecycle lifecycle) {
|
Activity activity, Fragment fragment, Lifecycle lifecycle) {
|
||||||
final List<PreferenceController> controllers = new ArrayList<>();
|
final List<PreferenceController> controllers = new ArrayList<>();
|
||||||
|
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2015 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;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.support.v7.preference.Preference;
|
|
||||||
import android.support.v7.preference.PreferenceViewHolder;
|
|
||||||
import android.text.TextUtils.TruncateAt;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.android.settingslib.RestrictedPreference;
|
|
||||||
|
|
||||||
public class SingleLineSummaryPreference extends RestrictedPreference {
|
|
||||||
|
|
||||||
public SingleLineSummaryPreference(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(PreferenceViewHolder view) {
|
|
||||||
super.onBindViewHolder(view);
|
|
||||||
|
|
||||||
final TextView summaryView = (TextView) view.findViewById(
|
|
||||||
com.android.internal.R.id.summary);
|
|
||||||
summaryView.setSingleLine();
|
|
||||||
summaryView.setEllipsize(TruncateAt.END);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -49,13 +49,13 @@ import com.android.internal.view.RotationPolicy;
|
|||||||
import com.android.internal.view.RotationPolicy.RotationPolicyListener;
|
import com.android.internal.view.RotationPolicy.RotationPolicyListener;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.settings.SingleLineSummaryPreference;
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
import com.android.settings.search.SearchIndexableRaw;
|
import com.android.settings.search.SearchIndexableRaw;
|
||||||
import com.android.settingslib.RestrictedLockUtils;
|
import com.android.settingslib.RestrictedLockUtils;
|
||||||
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||||
|
import com.android.settingslib.RestrictedPreference;
|
||||||
import com.android.settingslib.accessibility.AccessibilityUtils;
|
import com.android.settingslib.accessibility.AccessibilityUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -524,8 +524,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
for (int i = 0, count = installedServices.size(); i < count; ++i) {
|
for (int i = 0, count = installedServices.size(); i < count; ++i) {
|
||||||
AccessibilityServiceInfo info = installedServices.get(i);
|
AccessibilityServiceInfo info = installedServices.get(i);
|
||||||
|
|
||||||
SingleLineSummaryPreference preference =
|
RestrictedPreference preference =
|
||||||
new SingleLineSummaryPreference(downloadedServicesCategory.getContext(), null);
|
new RestrictedPreference(downloadedServicesCategory.getContext());
|
||||||
String title = info.getResolveInfo().loadLabel(getPackageManager()).toString();
|
String title = info.getResolveInfo().loadLabel(getPackageManager()).toString();
|
||||||
|
|
||||||
Drawable icon = info.getResolveInfo().loadIcon(getPackageManager());
|
Drawable icon = info.getResolveInfo().loadIcon(getPackageManager());
|
||||||
|
@@ -46,7 +46,7 @@ public class DeviceModelPreferenceController extends PreferenceController {
|
|||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
final Preference pref = screen.findPreference(KEY_DEVICE_MODEL);
|
final Preference pref = screen.findPreference(KEY_DEVICE_MODEL);
|
||||||
if (pref != null) {
|
if (pref != null) {
|
||||||
pref.setSummary(Build.MODEL + DeviceInfoUtils.getMsvSuffix());
|
pref.setSummary(getDeviceModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,4 +64,8 @@ public class DeviceModelPreferenceController extends PreferenceController {
|
|||||||
fragment.show(mHost.getFragmentManager(), HardwareInfoDialogFragment.TAG);
|
fragment.show(mHost.getFragmentManager(), HardwareInfoDialogFragment.TAG);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getDeviceModel() {
|
||||||
|
return Build.MODEL + DeviceInfoUtils.getMsvSuffix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package com.android.settings.deviceinfo;
|
|||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
@@ -30,7 +29,6 @@ import android.widget.TextView;
|
|||||||
import com.android.internal.logging.nano.MetricsProto;
|
import com.android.internal.logging.nano.MetricsProto;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||||
import com.android.settingslib.DeviceInfoUtils;
|
|
||||||
|
|
||||||
public class HardwareInfoDialogFragment extends InstrumentedDialogFragment {
|
public class HardwareInfoDialogFragment extends InstrumentedDialogFragment {
|
||||||
|
|
||||||
@@ -55,7 +53,7 @@ public class HardwareInfoDialogFragment extends InstrumentedDialogFragment {
|
|||||||
.inflate(R.layout.dialog_hardware_info, null /* parent */);
|
.inflate(R.layout.dialog_hardware_info, null /* parent */);
|
||||||
// Model
|
// Model
|
||||||
setText(content, R.id.model_label, R.id.model_value,
|
setText(content, R.id.model_label, R.id.model_value,
|
||||||
Build.MODEL + DeviceInfoUtils.getMsvSuffix());
|
DeviceModelPreferenceController.getDeviceModel());
|
||||||
// Hardware rev
|
// Hardware rev
|
||||||
setText(content, R.id.hardware_rev_label, R.id.hardware_rev_value,
|
setText(content, R.id.hardware_rev_label, R.id.hardware_rev_value,
|
||||||
SystemProperties.get("ro.boot.hardware.revision"));
|
SystemProperties.get("ro.boot.hardware.revision"));
|
||||||
|
@@ -16,10 +16,20 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
import static org.mockito.Mockito.spy;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.support.v7.preference.PreferenceScreen;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
|
|
||||||
|
import com.android.settings.dashboard.SummaryLoader;
|
||||||
|
import com.android.settingslib.DeviceInfoUtils;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -28,11 +38,6 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
import static org.mockito.Mockito.doReturn;
|
|
||||||
import static org.mockito.Mockito.spy;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
public class DeviceInfoSettingsTest {
|
public class DeviceInfoSettingsTest {
|
||||||
@@ -43,6 +48,8 @@ public class DeviceInfoSettingsTest {
|
|||||||
private PreferenceScreen mScreen;
|
private PreferenceScreen mScreen;
|
||||||
@Mock
|
@Mock
|
||||||
private UserManager mUserManager;
|
private UserManager mUserManager;
|
||||||
|
@Mock
|
||||||
|
private SummaryLoader mSummaryLoader;
|
||||||
|
|
||||||
private DeviceInfoSettings mSettings;
|
private DeviceInfoSettings mSettings;
|
||||||
|
|
||||||
@@ -58,4 +65,14 @@ public class DeviceInfoSettingsTest {
|
|||||||
public void getPrefXml_shouldReturnDeviceInfoXml() {
|
public void getPrefXml_shouldReturnDeviceInfoXml() {
|
||||||
assertThat(mSettings.getPreferenceScreenResId()).isEqualTo(R.xml.device_info_settings);
|
assertThat(mSettings.getPreferenceScreenResId()).isEqualTo(R.xml.device_info_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSummary_shouldReturnDeviceModel() {
|
||||||
|
final SummaryLoader.SummaryProvider mProvider = DeviceInfoSettings.SUMMARY_PROVIDER_FACTORY
|
||||||
|
.createSummaryProvider(null, mSummaryLoader);
|
||||||
|
|
||||||
|
mProvider.setListening(true);
|
||||||
|
|
||||||
|
verify(mSummaryLoader).setSummary(mProvider, Build.MODEL + DeviceInfoUtils.getMsvSuffix());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user