Fork a new about phone layout

- Used a feature flag to hide the new about phone page

Bug: 36458278
Test: make RunSettingsRoboTests -j40
Change-Id: Ie7b6afa58b301128d1c60513ae4ee48d6ec6679b
This commit is contained in:
jeffreyhuang
2017-10-19 13:36:40 -07:00
parent d50363b496
commit d81622e790
2 changed files with 34 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
<?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"
android:key="device_info_pref_screen"
android:title="@string/about_settings">
</PreferenceScreen>

View File

@@ -21,6 +21,7 @@ import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.provider.SearchIndexableResource; import android.provider.SearchIndexableResource;
import android.util.FeatureFlagUtils;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.dashboard.DashboardFragment; 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 LOG_TAG = "DeviceInfoSettings";
private static final String KEY_LEGAL_CONTAINER = "legal_container"; private static final String KEY_LEGAL_CONTAINER = "legal_container";
private static final String DEVICE_INFO_V2_FEATURE_FLAG = "device_info_v2";
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
@@ -79,7 +81,8 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
@Override @Override
protected int getPreferenceScreenResId() { 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 @Override
@@ -115,6 +118,11 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Activity activity, Fragment fragment, Lifecycle lifecycle) { Activity activity, Fragment fragment, Lifecycle lifecycle) {
if (FeatureFlagUtils.isEnabled(DEVICE_INFO_V2_FEATURE_FLAG)) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
return controllers;
}
final List<AbstractPreferenceController> controllers = new ArrayList<>(); final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add( controllers.add(
new BuildNumberPreferenceController(context, activity, fragment, lifecycle)); new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
@@ -147,7 +155,8 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
} }
@Override @Override
public List<AbstractPreferenceController> getPreferenceControllers(Context context) { public List<AbstractPreferenceController> getPreferenceControllers(
Context context) {
return buildPreferenceControllers(context, null /*activity */, return buildPreferenceControllers(context, null /*activity */,
null /* fragment */, null /* lifecycle */); null /* fragment */, null /* lifecycle */);
} }