Enable color functions for ThemePicker

- Add color section for ThemePicker.
- Define theme stub apk with rainbow colors.
- Video:
  https://drive.google.com/file/d/1s_cpn1OegbD1Lof2PxaUVV08BTwpzimp/view

Flag: No impact to existing product: just moves code to AOSP for reference
Bug: 218396282
Test: Push apks with paths below & test.
 /system_ext/priv-app/ThemePicker/ThemePicker.apk
 /product/app/ThemesStub/ThemesStub.apk
Change-Id: I25130573ffb37075b4b71c6b83b7b903b6421ce3
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ff8f187..ee96ae3 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -13,6 +13,8 @@
 
     <queries>
         <!-- Specific intents Wallpaper picker query for -->
+        <!-- Package for theme stub -->
+        <package android:name="com.android.customization.themes" />
         <!-- Intent filter with action SET_WALLPAPER -->
         <intent>
             <action android:name="android.intent.action.SET_WALLPAPER" />
diff --git a/res/values/override.xml b/res/values/override.xml
index a070dbe..addebd4 100644
--- a/res/values/override.xml
+++ b/res/values/override.xml
@@ -16,7 +16,10 @@
      limitations under the License.
 -->
 <resources>
-    <string name="themes_stub_package" translatable="false"/>
+    <!-- Package of the stub apk containing the themes descriptions -->
+    <string name="themes_stub_package" translatable="false">com.android.customization.themes
+    </string>
+
     <string name="clocks_stub_package" translatable="false"/>
     <!-- Authority of a provider in System UI that will provide preview info for available clockfaces. -->
     <string name="clocks_provider_authority" translatable="false">com.android.keyguard.clock</string>
diff --git a/src/com/android/customization/module/DefaultCustomizationSections.java b/src/com/android/customization/module/DefaultCustomizationSections.java
index a4510ea..21f2c84 100644
--- a/src/com/android/customization/module/DefaultCustomizationSections.java
+++ b/src/com/android/customization/module/DefaultCustomizationSections.java
@@ -6,6 +6,7 @@
 import androidx.annotation.Nullable;
 import androidx.lifecycle.LifecycleOwner;
 
+import com.android.customization.model.color.ColorSectionController;
 import com.android.customization.model.grid.GridOptionsManager;
 import com.android.customization.model.grid.GridSectionController;
 import com.android.customization.model.mode.DarkModeSectionController;
@@ -41,6 +42,10 @@
                 workspaceViewModel, sectionNavigationController, wallpaperPreviewNavigator,
                 savedInstanceState));
 
+        // Theme color section.
+        sectionControllers.add(new ColorSectionController(
+                activity, wallpaperColorsViewModel, lifecycleOwner, savedInstanceState));
+
         // Dark/Light theme section.
         sectionControllers.add(new DarkModeSectionController(activity,
                 lifecycleOwner.getLifecycle()));
diff --git a/themes/Android.bp b/themes/Android.bp
new file mode 100644
index 0000000..fb3d9be
--- /dev/null
+++ b/themes/Android.bp
@@ -0,0 +1,38 @@
+// Copyright (C) 2022 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 {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+android_app {
+
+    name: "ThemesStub",
+    optimize: {
+        enabled: false,
+    },
+
+    aaptflags: ["--auto-add-overlay"],
+
+    sdk_version: "current",
+
+    product_specific: true,
+
+}
+
+// ==================================================
diff --git a/themes/AndroidManifest.xml b/themes/AndroidManifest.xml
new file mode 100755
index 0000000..68ead89
--- /dev/null
+++ b/themes/AndroidManifest.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.customization.themes"
+    android:versionCode="1">
+
+    <uses-sdk
+      android:minSdkVersion="31"
+      android:targetSdkVersion="31"/>
+
+    <application
+        android:hasCode="false"
+        android:label="@string/app_name"/>
+
+</manifest>
diff --git a/themes/res/values/color-bundles.xml b/themes/res/values/color-bundles.xml
new file mode 100644
index 0000000..4d7cc63
--- /dev/null
+++ b/themes/res/values/color-bundles.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2022 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.
+  -->
+<resources>
+    <array name="color_bundles">
+        <item>rainbow1</item>
+        <item>rainbow2</item>
+        <item>rainbow3</item>
+        <item>rainbow4</item>
+        <item>rainbow5</item>
+        <item>rainbow6</item>
+        <item>rainbow7</item>
+    </array>
+</resources>
diff --git a/themes/res/values/colors.xml b/themes/res/values/colors.xml
new file mode 100644
index 0000000..3ffb9fc
--- /dev/null
+++ b/themes/res/values/colors.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2022 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.
+  -->
+<resources>
+    <color name="color_secondary_rainbow1">#FFB2B5</color>
+    <color name="color_secondary_rainbow2">#FFB868</color>
+    <color name="color_secondary_rainbow3">#E9C44A</color>
+    <color name="color_secondary_rainbow4">#BAF293</color>
+    <color name="color_secondary_rainbow5">#96CBFF</color>
+    <color name="color_secondary_rainbow6">#CBBFFF</color>
+    <color name="color_secondary_rainbow7">#F5ACFB</color>
+</resources>
diff --git a/themes/res/values/strings.xml b/themes/res/values/strings.xml
new file mode 100644
index 0000000..8bc04bd
--- /dev/null
+++ b/themes/res/values/strings.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2022 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.
+  -->
+<resources>
+    <string name="app_name" translatable="false">Themes</string>
+    <string name="rainbow_color_name_red">Red</string>
+    <string name="rainbow_color_name_orange">Orange</string>
+    <string name="rainbow_color_name_yellow">Yellow</string>
+    <string name="rainbow_color_name_green">Green</string>
+    <string name="rainbow_color_name_blue">Blue</string>
+    <string name="rainbow_color_name_purple">Purple</string>
+    <string name="rainbow_color_name_magenta">Magenta</string>
+
+    <string name="bundle_name_rainbow1" translatable="false">@string/rainbow_color_name_red</string>
+    <string name="bundle_name_rainbow2" translatable="false">@string/rainbow_color_name_orange</string>
+    <string name="bundle_name_rainbow3" translatable="false">@string/rainbow_color_name_yellow</string>
+    <string name="bundle_name_rainbow4" translatable="false">@string/rainbow_color_name_green</string>
+    <string name="bundle_name_rainbow5" translatable="false">@string/rainbow_color_name_blue</string>
+    <string name="bundle_name_rainbow6" translatable="false">@string/rainbow_color_name_purple</string>
+    <string name="bundle_name_rainbow7" translatable="false">@string/rainbow_color_name_magenta</string>
+
+    <string name="color_style_rainbow1" translatable="false">RAINBOW</string>
+    <string name="color_style_rainbow2" translatable="false">RAINBOW</string>
+    <string name="color_style_rainbow3" translatable="false">RAINBOW</string>
+    <string name="color_style_rainbow4" translatable="false">RAINBOW</string>
+    <string name="color_style_rainbow5" translatable="false">RAINBOW</string>
+    <string name="color_style_rainbow6" translatable="false">RAINBOW</string>
+    <string name="color_style_rainbow7" translatable="false">RAINBOW</string>
+</resources>