Rearrange System settings

- Fork system_dashboard_fragment_v2 for dev.
- Reorder the preference
- Remove summary

Bug: 174965365
Test: manual & robotest
Change-Id: Icc994f3b2e38ad54958deb5c9f80b6cd085029f0
diff --git a/res/xml/system_dashboard_fragment_v2.xml b/res/xml/system_dashboard_fragment_v2.xml
new file mode 100644
index 0000000..57174e9
--- /dev/null
+++ b/res/xml/system_dashboard_fragment_v2.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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-auto"
+    android:key="system_dashboard_screen"
+    android:title="@string/header_category_system">
+
+    <Preference
+        android:key="language_input_settings"
+        android:title="@string/language_settings"
+        android:icon="@drawable/ic_settings_language"
+        android:order="-260"
+        android:fragment="com.android.settings.language.LanguageAndInputSettings"/>
+
+    <Preference
+        android:key="gesture_settings"
+        android:title="@string/gesture_preference_title"
+        android:icon="@drawable/ic_settings_gestures"
+        android:order="-250"
+        android:fragment="com.android.settings.gestures.GestureSettings"
+        settings:controller="com.android.settings.gestures.GesturesSettingPreferenceController"/>
+
+    <Preference
+        android:key="date_time_settings"
+        android:title="@string/date_and_time"
+        android:icon="@drawable/ic_settings_date_time"
+        android:order="-240"
+        android:fragment="com.android.settings.datetime.DateTimeSettings"
+        settings:controller="com.android.settings.datetime.DateTimePreferenceController"/>
+
+    <!-- System updates -->
+    <Preference
+        android:key="system_update_settings"
+        android:title="@string/system_update_settings_list_item_title"
+        android:summary="@string/summary_placeholder"
+        android:icon="@drawable/ic_system_update"
+        android:order="-58"
+        settings:keywords="@string/keywords_system_update_settings"
+        settings:controller="com.android.settings.system.SystemUpdatePreferenceController">
+        <intent android:action="android.settings.SYSTEM_UPDATE_SETTINGS"/>
+    </Preference>
+
+    <Preference
+        android:key="additional_system_update_settings"
+        android:title="@string/additional_system_update_settings_list_item_title"
+        android:order="-59"
+        settings:controller="com.android.settings.system.AdditionalSystemUpdatePreferenceController">
+        <intent android:action="android.intent.action.MAIN"
+                android:targetPackage="@string/additional_system_update"
+                android:targetClass="@string/additional_system_update_menu"/>
+    </Preference>
+
+    <Preference
+        android:key="reset_dashboard"
+        android:title="@string/reset_dashboard_title"
+        android:icon="@drawable/ic_restore"
+        android:order="-30"
+        android:fragment="com.android.settings.system.ResetDashboardFragment"
+        settings:controller="com.android.settings.system.ResetPreferenceController"/>
+</PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/backup/BackupSettingsHelper.java b/src/com/android/settings/backup/BackupSettingsHelper.java
index 1483714..cc010f0 100644
--- a/src/com/android/settings/backup/BackupSettingsHelper.java
+++ b/src/com/android/settings/backup/BackupSettingsHelper.java
@@ -26,12 +26,14 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.text.TextUtils;
+import android.util.FeatureFlagUtils;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
 
 import com.android.settings.R;
 import com.android.settings.Settings.PrivacySettingsActivity;
+import com.android.settings.core.FeatureFlags;
 
 import java.net.URISyntaxException;
 
@@ -55,6 +57,9 @@
      * Otherwise, show nothing.
      */
     public String getSummary() {
+        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
+            return null;
+        }
         UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
         if (userManager.getUserProfiles().size() == 1) {
             try {
diff --git a/src/com/android/settings/gestures/GesturesSettingPreferenceController.java b/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
index 9d4d538..e01bc88 100644
--- a/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
+++ b/src/com/android/settings/gestures/GesturesSettingPreferenceController.java
@@ -21,12 +21,14 @@
 import android.hardware.display.AmbientDisplayConfiguration;
 import android.provider.Settings;
 import android.text.TextUtils;
+import android.util.FeatureFlagUtils;
 
 import androidx.annotation.NonNull;
 
 import com.android.settings.R;
 import com.android.settings.aware.AwareFeatureProvider;
 import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settingslib.core.AbstractPreferenceController;
 
@@ -86,6 +88,10 @@
 
     @Override
     public CharSequence getSummary() {
+        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
+            return null;
+        }
+
         if (!mFeatureProvider.isSensorAvailable(mContext)) {
             return "";
         }
diff --git a/src/com/android/settings/system/ResetPreferenceController.java b/src/com/android/settings/system/ResetPreferenceController.java
index 09db32f..ad33d30 100644
--- a/src/com/android/settings/system/ResetPreferenceController.java
+++ b/src/com/android/settings/system/ResetPreferenceController.java
@@ -17,9 +17,11 @@
 
 import android.content.Context;
 import android.os.UserManager;
+import android.util.FeatureFlagUtils;
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.network.NetworkResetPreferenceController;
 
 public class ResetPreferenceController extends BasePreferenceController {
@@ -43,6 +45,10 @@
 
     @Override
     public CharSequence getSummary() {
+        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
+            return null;
+        }
+
         if (!mNetworkReset.isAvailable() && !mFactpruReset.isAvailable()) {
             return mContext.getText(R.string.reset_dashboard_summary_onlyApps);
         }
diff --git a/src/com/android/settings/system/SystemDashboardFragment.java b/src/com/android/settings/system/SystemDashboardFragment.java
index a766fec..997678b 100644
--- a/src/com/android/settings/system/SystemDashboardFragment.java
+++ b/src/com/android/settings/system/SystemDashboardFragment.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.os.Bundle;
 import android.provider.SearchIndexableResource;
+import android.util.FeatureFlagUtils;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
@@ -26,10 +27,10 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.search.Indexable;
 import com.android.settingslib.search.SearchIndexable;
 
 import java.util.Arrays;
@@ -40,8 +41,6 @@
 
     private static final String TAG = "SystemDashboardFrag";
 
-    private static final String KEY_RESET = "reset_dashboard";
-
     public static final String EXTRA_SHOW_AWARE_DISABLED = "show_aware_dialog_disabled";
 
     @Override
@@ -78,6 +77,9 @@
 
     @Override
     protected int getPreferenceScreenResId() {
+        if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
+            return R.xml.system_dashboard_fragment_v2;
+        }
         return R.xml.system_dashboard_fragment;
     }
 
@@ -108,7 +110,8 @@
                 public List<SearchIndexableResource> getXmlResourcesToIndex(
                         Context context, boolean enabled) {
                     final SearchIndexableResource sir = new SearchIndexableResource(context);
-                    sir.xmlResId = R.xml.system_dashboard_fragment;
+                    sir.xmlResId = FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME)
+                            ? R.xml.system_dashboard_fragment_v2 : R.xml.system_dashboard_fragment;
                     return Arrays.asList(sir);
                 }
             };