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/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>