Add inital framework for reset options settings.

This change adds the top level layouts and preliminary resources. Subsequent changes will implement described functionality of the buttons.

Bug: 77476980

Test: build and deploy, manually navigate through tree.
Change-Id: I9bf7d88d21f2e92e141bb2f71142504a946bc0b4
diff --git a/res/drawable/ic_restore.xml b/res/drawable/ic_restore.xml
new file mode 100644
index 0000000..8faf0a9
--- /dev/null
+++ b/res/drawable/ic_restore.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2018 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24.0dp"
+        android:height="24.0dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0"
+        android:tint="@color/car_tint">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M13.5 7.75v4.5l3.37 2c.34 .2 .46 .65 .25 .99 s-.64 .45 -.98 .24 L12
+13V7.75c0-.41 .34 -.75 .75 -.75s.75 .34 .75 .75 zM13.05 3C8.11 3 4.1 7.02 4.1
+11.95c0 .02 .01 .03 .01 .05H2.05c-.47 0-.71 .57 -.37 .9 l2.95 2.94c.21 .21 .54
+.21 .75 0l2.95-2.94c.33-.33 .1 -.9-.37-.9H5.99c0-.02 .01 -.03 .01 -.05C6 8.06
+9.16 4.9 13.05 4.9S20.1 8.11 20.1 12s-3.16 7.1-7.05 7.1c-1.58
+0-3.08-.51-4.32-1.48a.94 .94 0 0 0-1.32 .16 l-.01 .01 a.94 .94 0 0 0 .16
+1.32l.01 .01 A8.77 8.77 0 0 0 13.05 21c4.94 0 8.95-4.07 8.95-9s-4.02-9-8.95-9z" />
+</vector>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8a46faa..1b5ddc8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -296,6 +296,23 @@
     <!-- About phone settings screen, Open source license dialog title until license is fully loaded -->
     <string name="settings_license_activity_loading">Loading\u2026</string>
 
+    <!-- Reset options --><skip />
+    <!-- Title for a screen containing all device reset options. [CHAR LIMIT=50] -->
+    <string name="reset_options_title">Reset options</string>
+    <!-- Summary text for a screen containing all device reset options. [CHAR LIMIT=None] -->
+    <string name="reset_options_summary">Network, apps, or device reset</string>
+
+    <!-- Reset Network --><skip />
+    <!-- Button title to reset Wi-Fi settings, bluetooth settings. [CHAR LIMIT=40]-->
+    <string name="reset_network_title">Reset Wi-Fi, Bluetooth</string>
+
+    <!-- Reset apps --><skip />
+    <!-- Button title to reset all of user's app preferences. [CHAR LIMIT=40] -->
+    <string name="reset_app_preferences_title">Reset app preferences</string>
+
+    <!-- Master Clear --><skip />
+    <!-- Button title to factory data reset the entire device. The "(factory reset)" part is optional for translation. [CHAR LIMIT=40]-->
+    <string name="master_clear_title">Erase all data (factory reset)</string>
 
     <!-- Date and time settings --><skip />
     <!-- Main Settings screen setting option name to go into the date and time settings-->
diff --git a/src/com/android/car/settings/system/ResetOptionsFragment.java b/src/com/android/car/settings/system/ResetOptionsFragment.java
new file mode 100644
index 0000000..c2df6de
--- /dev/null
+++ b/src/com/android/car/settings/system/ResetOptionsFragment.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+package com.android.car.settings.system;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.annotation.StringRes;
+import androidx.car.widget.ListItem;
+import androidx.car.widget.ListItemProvider;
+import androidx.car.widget.TextListItem;
+
+import com.android.car.settings.R;
+import com.android.car.settings.common.ListItemSettingsFragment;
+
+import java.util.ArrayList;
+
+/**
+ * Shows options to reset network settings, reset app preferences, and factory reset the device.
+ */
+public class ResetOptionsFragment extends ListItemSettingsFragment {
+
+    private ListItemProvider mItemProvider;
+
+    /**
+     * Factory method for creating LanguagePickerFragment.
+     */
+    public static ResetOptionsFragment newInstance() {
+        ResetOptionsFragment fragment = new ResetOptionsFragment();
+        Bundle bundle = ListItemSettingsFragment.getBundle();
+        bundle.putInt(EXTRA_TITLE_ID, R.string.reset_options_title);
+        bundle.putInt(EXTRA_ACTION_BAR_LAYOUT, R.layout.action_bar);
+        fragment.setArguments(bundle);
+        return fragment;
+    }
+
+    @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+        mItemProvider = new ListItemProvider.ListProvider(getListItems());
+    }
+
+    @Override
+    public ListItemProvider getItemProvider() {
+        return mItemProvider;
+    }
+
+    private ArrayList<ListItem> getListItems() {
+        ArrayList<ListItem> lineItems = new ArrayList<>();
+
+        lineItems.add(createListItem(R.string.reset_network_title, v -> {
+            // TODO: launch reset network.
+        }));
+        lineItems.add(createListItem(R.string.reset_app_preferences_title, v -> {
+            // TODO: launch reset app preferences.
+        }));
+        lineItems.add(createListItem(R.string.master_clear_title, v -> {
+            // TODO: launch master clear.
+        }));
+
+        return lineItems;
+    }
+
+    private TextListItem createListItem(@StringRes int titleResId,
+            View.OnClickListener onClickListener) {
+        Context context = getContext();
+        TextListItem item = new TextListItem(context);
+        item.setTitle(context.getString(titleResId));
+        item.setSupplementalIcon(R.drawable.ic_chevron_right, /* showDivider= */ false);
+        item.setOnClickListener(onClickListener);
+        return item;
+    }
+}
diff --git a/src/com/android/car/settings/system/SystemSettingsFragment.java b/src/com/android/car/settings/system/SystemSettingsFragment.java
index 4f39e32..9f9893a 100644
--- a/src/com/android/car/settings/system/SystemSettingsFragment.java
+++ b/src/com/android/car/settings/system/SystemSettingsFragment.java
@@ -11,10 +11,9 @@
  * 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
+ * limitations under the License.
  */
 
-
 package com.android.car.settings.system;
 
 import android.content.Context;
@@ -80,6 +79,7 @@
         lineItems.addAll(createSystemUpdateListItems());
         lineItems.add(createAboutSystemListItem());
         lineItems.add(createLegalInfoListItem());
+        lineItems.add(createResetOptionsListItem());
 
         return lineItems;
     }
@@ -142,4 +142,17 @@
         });
         return legalInfoItem;
     }
+
+    private TextListItem createResetOptionsListItem() {
+        Context context = getContext();
+        TextListItem restoreOptionsItem = new TextListItem(context);
+        restoreOptionsItem.setTitle(context.getString(R.string.reset_options_title));
+        restoreOptionsItem.setBody(context.getString(R.string.reset_options_summary));
+        restoreOptionsItem.setPrimaryActionIcon(R.drawable.ic_restore, /* useLargeIcon= */ false);
+        restoreOptionsItem.setSupplementalIcon(R.drawable.ic_chevron_right, /* showDivider= */
+                false);
+        restoreOptionsItem.setOnClickListener(
+                v -> getFragmentController().launchFragment(ResetOptionsFragment.newInstance()));
+        return restoreOptionsItem;
+    }
 }