Misc fixes for User page and my device info page

- Rename UserAndAccountDashboard* to AccountDashboard*
- Move emergency info from account to device info page

- Move auto sync data toggles (4 of them) from Account page to user page
   - Move the controllers too. UserSettings is a not a DashboardFragment
     so I had to manually call each controller method.
     TODO: refactor UserSettings to a DashboardFragment

- Move legal information/regulatory info above advance button within device info page.

Fixes: 72523158
Bug: 71871075
Test: robotests
Change-Id: I1b8af8af61e49d17926f984978a09a974b6c62e1
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 65d7b0f..fe05e6f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6663,8 +6663,8 @@
     <string name="app_and_notification_dashboard_title">Apps &amp; notifications</string>
     <!-- Summary for Apps & Notification settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
     <string name="app_and_notification_dashboard_summary">Permissions, default apps</string>
-    <!-- Title for setting tile leading to User and accounts settings [CHAR LIMIT=40]-->
-    <string name="account_dashboard_title">Users &amp; accounts</string>
+    <!-- Title for setting tile leading to account settings [CHAR LIMIT=40]-->
+    <string name="account_dashboard_title">Accounts</string>
     <!-- Title for setting tile leading to setting UI which allows user set default app to
     handle actions such as open web page, making phone calls, default SMS apps [CHAR  LIMIT=40]-->
     <string name="app_default_dashboard_title">Default apps</string>
diff --git a/res/xml/accounts_dashboard_settings.xml b/res/xml/accounts_dashboard_settings.xml
new file mode 100644
index 0000000..1e29d0a
--- /dev/null
+++ b/res/xml/accounts_dashboard_settings.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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="user_and_account_settings_screen"
+    android:title="@string/account_dashboard_title"
+    settings:keywords="@string/keywords_accounts">
+
+    <PreferenceCategory
+        android:key="dashboard_tile_placeholder"
+        android:order="200"/>
+
+</PreferenceScreen>
diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml
index 4988b16..dabed8a 100644
--- a/res/xml/my_device_info.xml
+++ b/res/xml/my_device_info.xml
@@ -20,7 +20,7 @@
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="my_device_info_pref_screen"
     android:title="@string/my_device_info_title"
-    settings:initialExpandedChildrenCount="4">
+    settings:initialExpandedChildrenCount="7">
 
     <com.android.settings.applications.LayoutPreference
         android:key="my_device_info_header"
@@ -49,10 +49,31 @@
         android:title="@string/my_device_info_device_name_preference_title"
         android:summary="@string/summary_placeholder"/>
 
+    <Preference
+        android:key="emergency_info"
+        android:order="4"
+        android:title="@string/emergency_info_title"
+        android:summary="@string/summary_placeholder"/>
+
+    <!-- Legal information -->
+    <Preference
+        android:key="legal_container"
+        android:order="5"
+        android:title="@string/legal_information"
+        android:fragment="com.android.settings.LegalSettings" />
+
+    <!-- Regulatory labels -->
+    <Preference
+        android:key="regulatory_info"
+        android:order="6"
+        android:title="@string/regulatory_labels">
+        <intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
+    </Preference>
+
     <!-- SIM status -->
     <Preference
         android:key="sim_status"
-        android:order="4"
+        android:order="7"
         android:title="@string/sim_status_title"
         settings:keywords="@string/keywords_sim_status"
         android:summary="@string/summary_placeholder"/>
@@ -110,23 +131,6 @@
         android:title="@string/status_bt_address"
         android:summary="@string/summary_placeholder"/>
 
-
-    <!-- Legal information -->
-    <Preference
-        android:key="legal_container"
-        android:order="37"
-        android:title="@string/legal_information"
-        android:fragment="com.android.settings.LegalSettings"
-        settings:allowDividerAbove="true"/>
-
-    <!-- Regulatory labels -->
-    <Preference
-        android:key="regulatory_info"
-        android:order="38"
-        android:title="@string/regulatory_labels">
-        <intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
-    </Preference>
-
     <!-- Safety & regulatory manual -->
     <Preference
         android:key="safety_info"
diff --git a/res/xml/user_and_accounts_settings.xml b/res/xml/user_and_accounts_settings.xml
deleted file mode 100644
index 7f82f43..0000000
--- a/res/xml/user_and_accounts_settings.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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="user_and_account_settings_screen"
-    android:title="@string/account_dashboard_title"
-    settings:keywords="@string/keywords_accounts">
-
-    <Preference
-        android:key="emergency_info"
-        android:title="@string/emergency_info_title"
-        android:order="100"
-        settings:allowDividerAbove="true"/>
-
-    <SwitchPreference
-        android:key="auto_sync_account_data"
-        android:title="@string/auto_sync_account_title"
-        android:summary="@string/auto_sync_account_summary"
-        android:order="102"
-        settings:allowDividerAbove="true"/>
-
-    <SwitchPreference
-        android:key="auto_sync_work_account_data"
-        android:title="@string/account_settings_menu_auto_sync_work"
-        android:summary="@string/auto_sync_account_summary"
-        android:order="103"/>
-
-    <SwitchPreference
-        android:key="auto_sync_personal_account_data"
-        android:title="@string/account_settings_menu_auto_sync_personal"
-        android:summary="@string/auto_sync_account_summary"
-        android:order="104"/>
-
-    <com.android.settingslib.RestrictedSwitchPreference
-        android:key="user_settings_add_users_when_locked"
-        android:title="@string/user_add_on_lockscreen_menu"
-        android:singleLineTitle="false"
-        android:order="105"/>
-
-    <PreferenceCategory
-        android:key="dashboard_tile_placeholder"
-        android:order="200"/>
-
-</PreferenceScreen>
diff --git a/res/xml/user_settings.xml b/res/xml/user_settings.xml
index cf68344..32b46d9 100644
--- a/res/xml/user_settings.xml
+++ b/res/xml/user_settings.xml
@@ -14,18 +14,47 @@
      limitations under the License.
 -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:settings="http://schemas.android.com/apk/res-auto"
-        android:title="@string/user_settings_title">
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:key="user_settings_screen"
+    android:title="@string/user_settings_title">
 
     <PreferenceCategory
-            android:key="user_list"
-            android:title="@string/user_list_title">
+        android:key="user_list"
+        android:title="@string/user_list_title"
+        android:order="10">
     </PreferenceCategory>
 
     <com.android.settingslib.RestrictedPreference
-            android:key="user_add"
-            android:title="@string/user_add_user_or_profile_menu"
-            android:icon="@drawable/ic_menu_add" />
+        android:key="user_add"
+        android:title="@string/user_add_user_or_profile_menu"
+        android:icon="@drawable/ic_menu_add"
+        android:order="20"/>
+
+    <SwitchPreference
+        android:key="auto_sync_account_data"
+        android:title="@string/auto_sync_account_title"
+        android:summary="@string/auto_sync_account_summary"
+        android:order="102"
+        settings:allowDividerAbove="true"/>
+
+    <SwitchPreference
+        android:key="auto_sync_work_account_data"
+        android:title="@string/account_settings_menu_auto_sync_work"
+        android:summary="@string/auto_sync_account_summary"
+        android:order="103"/>
+
+    <SwitchPreference
+        android:key="auto_sync_personal_account_data"
+        android:title="@string/account_settings_menu_auto_sync_personal"
+        android:summary="@string/auto_sync_account_summary"
+        android:order="104"/>
+
+    <com.android.settingslib.RestrictedSwitchPreference
+        android:key="user_settings_add_users_when_locked"
+        android:title="@string/user_add_on_lockscreen_menu"
+        android:singleLineTitle="false"
+        android:order="105"/>
 
 </PreferenceScreen>