Merge changes Icddb9d35,I36f76f93,Ie7b6afa5

* changes:
  Add existing controllers in about phone to v2 fork
  Create XML layout for about phone v2
  Fork a new about phone layout
This commit is contained in:
Jeffrey Huang
2017-10-20 16:45:51 +00:00
committed by Android (Google) Code Review
3 changed files with 141 additions and 3 deletions

View File

@@ -2661,7 +2661,7 @@
<!-- About tablet, status item title. The Mobile Directory Number [CHAR LIMIT=30] -->
<string name="status_number" product="tablet">MDN</string>
<!-- About phone, status item title. The phone number of the current device [CHAR LIMIT=30] -->
<string name="status_number" product="default">My phone number</string>
<string name="status_number" product="default">Phone number</string>
<!-- About phone, status item title. The phone MIN number of the current device.-->
<string name="status_min_number">MIN</string>
<!-- About phone, status item title. The phone MSID number of the current device.-->

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:key="device_info_pref_screen"
android:title="@string/about_settings"
settings:initialExpandedChildrenCount="6">
<!-- Phone number -->
<Preference
android:key="phone_number"
android:title="@string/status_number"
android:summary="@string/summary_placeholder"/>
<!-- SIM status -->
<Preference
android:key="sim_status"
android:title="@string/sim_status_title"
android:summary="@string/summary_placeholder"/>
<!-- Model & hardware -->
<Preference
android:key="model_and_hardware"
android:title="@string/hardware_info"
android:summary="@string/summary_placeholder"/>
<!-- IMEI -->
<Preference
android:key="imei_info"
android:title="@string/status_imei"
android:summary="@string/summary_placeholder"/>
<!-- Android version -->
<Preference
android:key="firmware_version"
android:title="@string/firmware_version"
android:summary="@string/summary_placeholder"/>
<!--IP address -->
<Preference
android:key="ip_address"
android:title="@string/wifi_ip_address"
android:summary="@string/summary_placeholder"
settings:allowDividerAbove="true"/>
<!-- Wi-Fi MAC address -->
<Preference
android:key="mac_address"
android:title="@string/status_wifi_mac_address"
android:summary="@string/summary_placeholder"/>
<!-- Bluetooth address -->
<Preference
android:key="bluetooth_address"
android:title="@string/status_bt_address"
android:summary="@string/summary_placeholder"/>
<!-- Legal information -->
<Preference
android:key="legal_container"
android:title="@string/legal_information"
android:fragment="com.android.settings.LegalSettings"
settings:allowDividerAbove="true"/>
<!-- Regulatory labels -->
<Preference
android:key="regulatory_info"
android:title="@string/regulatory_labels">
<intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
</Preference>
<!-- Safety & regulatory manual -->
<Preference
android:key="safety_info"
android:title="@string/safety_and_regulatory_info">
<intent android:action="android.settings.SHOW_SAFETY_AND_REGULATORY_INFO"/>
</Preference>
<!-- Build number -->
<Preference
android:key="build_number"
android:title="@string/build_number"
android:summary="@string/summary_placeholder"
settings:allowDividerAbove="true"/>
</PreferenceScreen>

View File

@@ -21,6 +21,7 @@ import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.provider.SearchIndexableResource;
import android.util.FeatureFlagUtils;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.dashboard.DashboardFragment;
@@ -51,6 +52,7 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
private static final String LOG_TAG = "DeviceInfoSettings";
private static final String KEY_LEGAL_CONTAINER = "legal_container";
private static final String DEVICE_INFO_V2_FEATURE_FLAG = "device_info_v2";
@Override
public int getMetricsCategory() {
@@ -79,7 +81,8 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
@Override
protected int getPreferenceScreenResId() {
return R.xml.device_info_settings;
return FeatureFlagUtils.isEnabled(DEVICE_INFO_V2_FEATURE_FLAG)
? R.xml.device_info_settings_v2 : R.xml.device_info_settings;
}
@Override
@@ -115,6 +118,37 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Activity activity, Fragment fragment, Lifecycle lifecycle) {
if (FeatureFlagUtils.isEnabled(DEVICE_INFO_V2_FEATURE_FLAG)) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
// Device name
// Phone number
// SIM status
// Model & hardware
// IMEI
// Android version
// IP address
// Wifi MAC address
// Bluetooth Address
controllers.add(new RegulatoryInfoPreferenceController(context));
controllers.add(new SafetyInfoPreferenceController(context));
controllers.add(
new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
return controllers;
}
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(
new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
@@ -147,7 +181,8 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
}
@Override
public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
public List<AbstractPreferenceController> getPreferenceControllers(
Context context) {
return buildPreferenceControllers(context, null /*activity */,
null /* fragment */, null /* lifecycle */);
}