Move Notifications to the homepage group

- Add Notifications to the homepage group.
- Apply an existing notification icon for demo.
- Duplicate new apps xml for the silky home.
- Remove Notifications from the new apps xml.

Bug: 168166015
Test: robotest & visual with turning on/off silky home
Change-Id: I54323b8af3e5115bb11eb77bb15f2f4169707010
diff --git a/res/xml/apps.xml b/res/xml/apps.xml
new file mode 100644
index 0000000..3ec4a29
--- /dev/null
+++ b/res/xml/apps.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2020 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="apps_and_notification_screen"
+    android:title="@string/app_and_notification_dashboard_title"
+    settings:initialExpandedChildrenCount="4">
+    <!-- the initial count should include the dynamic tiles -->
+
+    <Preference
+        android:key="all_app_info"
+        android:title="@string/applications_settings"
+        android:order="-999"
+        android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
+        settings:controller="com.android.settings.applications.AllAppsInfoPreferenceController"
+        settings:keywords="@string/keywords_applications_settings"/>
+
+    <com.android.settingslib.widget.LayoutPreference
+        android:key="recent_open_apps"
+        android:title="@string/recent_app_category_title"
+        android:layout="@layout/app_entities_header"
+        android:selectable="false"
+        android:order="-998"
+        settings:allowDividerBelow="true"
+        settings:controller="com.android.settings.applications.RecentAppsPreferenceController"/>
+
+    <!-- Empty category to draw divider -->
+    <PreferenceCategory
+        android:key="recent_apps_divider"
+        android:layout="@layout/preference_category_no_label"
+        android:order="-997"/>
+
+    <Preference
+        android:key="conversations"
+        android:title="@string/conversations_category_title"
+        android:order="-550"
+        settings:controller="com.android.settings.notification.ConversationListSummaryPreferenceController"
+        android:fragment="com.android.settings.notification.app.ConversationListSettings"
+    />
+
+    <!-- Notifications (appears before manage_perms), default apps (appears after) -->
+    <PreferenceCategory
+        android:key="dashboard_tile_placeholder"
+        android:order="10"/>
+
+    <Preference
+        android:key="default_apps"
+        android:title="@string/app_default_dashboard_title"
+        android:order="11"
+        settings:controller="com.android.settings.applications.DefaultAppsPreferenceController">
+        <intent android:action="android.settings.MANAGE_DEFAULT_APPS_SETTINGS"/>
+    </Preference>
+
+    <Preference
+        android:key="manage_perms"
+        android:title="@string/app_permissions"
+        android:summary="@string/runtime_permissions_summary_control_app_access"
+        android:order="12"
+        settings:keywords="@string/keywords_app_permissions">
+        <intent android:action="android.intent.action.MANAGE_PERMISSIONS"/>
+    </Preference>
+
+    <com.android.settingslib.RestrictedPreference
+        android:key="app_and_notif_cell_broadcast_settings"
+        android:title="@string/cell_broadcast_settings"
+        android:order="15"
+        settings:useAdminDisabledSummary="true">
+        <intent
+            android:action="android.intent.action.MAIN"
+            android:targetPackage="@string/cell_broadcast_receiver_package"
+            android:targetClass="com.android.cellbroadcastreceiver.CellBroadcastSettings"/>
+    </com.android.settingslib.RestrictedPreference>
+
+    <Preference
+        android:key="special_access"
+        android:fragment="com.android.settings.applications.specialaccess.SpecialAccessSettings"
+        android:title="@string/special_access"
+        android:order="20"
+        settings:controller="com.android.settings.applications.SpecialAppAccessPreferenceController"/>
+
+</PreferenceScreen>
diff --git a/res/xml/top_level_settings_grouped.xml b/res/xml/top_level_settings_grouped.xml
index dc78f47..8f4c68b 100644
--- a/res/xml/top_level_settings_grouped.xml
+++ b/res/xml/top_level_settings_grouped.xml
@@ -22,13 +22,13 @@
 
     <PreferenceCategory
         android:key="connectivity"
-        android:order="-120"
+        android:order="-130"
         settings:allowDividerAbove="false">
         <Preference
             android:fragment="com.android.settings.network.NetworkDashboardFragment"
             android:icon="@drawable/ic_homepage_network"
             android:key="top_level_network"
-            android:order="-120"
+            android:order="-130"
             android:title="@string/network_dashboard_title"
             settings:controller="com.android.settings.network.TopLevelNetworkEntryPreferenceController"/>
 
@@ -36,21 +36,30 @@
             android:fragment="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"
             android:icon="@drawable/ic_homepage_connected_device"
             android:key="top_level_connected_devices"
-            android:order="-110"
+            android:order="-120"
             android:title="@string/connected_devices_dashboard_title"
             settings:controller="com.android.settings.connecteddevice.TopLevelConnectedDevicesPreferenceController"/>
     </PreferenceCategory>
 
     <PreferenceCategory
         android:key="apps"
-        android:order="-100"
+        android:order="-110"
         settings:allowDividerAbove="false">
         <Preference
             android:fragment="com.android.settings.applications.AppAndNotificationDashboardFragment"
             android:icon="@drawable/ic_homepage_apps"
             android:key="top_level_apps_and_notifs"
-            android:order="-100"
+            android:order="-110"
             android:title="@string/app_and_notification_dashboard_title"/>
+
+        <Preference
+            android:fragment="com.android.settings.notification.ConfigureNotificationSettings"
+            android:icon="@drawable/ic_homepage_notification"
+            android:key="top_level_notification"
+            android:order="-100"
+            android:title="@string/configure_notification_settings"/>
+
+
     </PreferenceCategory>
 
     <PreferenceCategory
diff --git a/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java b/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
index 8b0f851..84e7bf7 100644
--- a/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
+++ b/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
@@ -21,12 +21,14 @@
 import android.content.Context;
 import android.os.Bundle;
 import android.provider.SearchIndexableResource;
+import android.util.FeatureFlagUtils;
 import android.view.View;
 
 import androidx.annotation.NonNull;
 
 import com.android.settings.R;
 import com.android.settings.Utils;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.notification.EmergencyBroadcastPreferenceController;
 import com.android.settings.search.BaseSearchIndexProvider;
@@ -65,6 +67,10 @@
 
     @Override
     protected int getPreferenceScreenResId() {
+        // TODO(b/168166015): Remove this when the new Apps page ready.
+        if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
+            return R.xml.apps;
+        }
         return R.xml.app_and_notification;
     }