Add patches for ThemePicker

This commit is contained in:
Peter Cai 2022-08-17 21:34:16 -04:00
parent 079e45346d
commit bc0032890e
6 changed files with 276 additions and 0 deletions

View File

@ -0,0 +1,65 @@
From d043802a9e21a05b3fda0d2c3c41a69e513248e0 Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Fri, 1 Nov 2019 21:14:29 +0100
Subject: [PATCH 1/6] Add wallpaper privapp whitelist
Change-Id: I044b1d9201ac0b8780fc37a387f401f3dd0ddeac
---
Android.bp | 10 +++++++++
privapp_whitelist_com.android.wallpaper.xml | 24 +++++++++++++++++++++
2 files changed, 34 insertions(+)
create mode 100644 privapp_whitelist_com.android.wallpaper.xml
diff --git a/Android.bp b/Android.bp
index c85fd2b..5c1f487 100644
--- a/Android.bp
+++ b/Android.bp
@@ -104,5 +104,15 @@ android_app {
platform_apis: true,
manifest: "AndroidManifest.xml",
additional_manifests: [":WallpaperPicker2_Manifest"],
+
+ required: ["privapp_whitelist_com.android.wallpaper.xml"],
overrides: ["WallpaperPicker2"],
}
+
+prebuilt_etc_xml {
+ name: "privapp_whitelist_com.android.wallpaper.xml",
+ src: "privapp_whitelist_com.android.wallpaper.xml",
+ system_ext_specific: true,
+ filename_from_src: true,
+ sub_dir: "permissions",
+}
diff --git a/privapp_whitelist_com.android.wallpaper.xml b/privapp_whitelist_com.android.wallpaper.xml
new file mode 100644
index 0000000..e3f3b65
--- /dev/null
+++ b/privapp_whitelist_com.android.wallpaper.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 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
+ -->
+<permissions>
+ <privapp-permissions package="com.android.wallpaper">
+ <permission name="android.permission.SET_WALLPAPER_COMPONENT"/>
+ <permission name="android.permission.MODIFY_DAY_NIGHT_MODE"/>
+ <permission name="android.permission.CHANGE_OVERLAY_PACKAGES"/>
+ <permission name="android.permission.WRITE_SECURE_SETTINGS" />
+ </privapp-permissions>
+</permissions>
--
2.37.2

View File

@ -0,0 +1,26 @@
From 5a3e22296f8de9fa21140cf28f622875928ba8ca Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 19:00:36 -0700
Subject: [PATCH 2/6] Override legacy WallpaperPicker app
Change-Id: I9a1907527eea0e8e7cd10bab64ba79c2c4006c59
---
Android.bp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Android.bp b/Android.bp
index 5c1f487..ce850c5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -106,7 +106,7 @@ android_app {
additional_manifests: [":WallpaperPicker2_Manifest"],
required: ["privapp_whitelist_com.android.wallpaper.xml"],
- overrides: ["WallpaperPicker2"],
+ overrides: ["WallpaperPicker2", "WallpaperPicker"],
}
prebuilt_etc_xml {
--
2.37.2

View File

@ -0,0 +1,87 @@
From 75de47c866b31a8930bc7e58954928712dbcbe60 Mon Sep 17 00:00:00 2001
From: LuK1337 <priv.luk@gmail.com>
Date: Tue, 15 Sep 2020 03:27:19 +0200
Subject: [PATCH 3/6] Add wallpaper default permissions
Change-Id: If43a594da31fbab9280ce45b049737f6c534b620
---
Android.bp | 14 ++++++-
default_permissions_com.android.wallpaper.xml | 37 +++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 default_permissions_com.android.wallpaper.xml
diff --git a/Android.bp b/Android.bp
index ce850c5..8ad98d2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -105,7 +105,11 @@ android_app {
manifest: "AndroidManifest.xml",
additional_manifests: [":WallpaperPicker2_Manifest"],
- required: ["privapp_whitelist_com.android.wallpaper.xml"],
+ required: [
+ "privapp_whitelist_com.android.wallpaper.xml",
+ "default_permissions_com.android.wallpaper.xml",
+ ],
+
overrides: ["WallpaperPicker2", "WallpaperPicker"],
}
@@ -116,3 +120,11 @@ prebuilt_etc_xml {
filename_from_src: true,
sub_dir: "permissions",
}
+
+prebuilt_etc_xml {
+ name: "default_permissions_com.android.wallpaper.xml",
+ src: "default_permissions_com.android.wallpaper.xml",
+ system_ext_specific: true,
+ filename_from_src: true,
+ sub_dir: "default-permissions",
+}
diff --git a/default_permissions_com.android.wallpaper.xml b/default_permissions_com.android.wallpaper.xml
new file mode 100644
index 0000000..41b23ce
--- /dev/null
+++ b/default_permissions_com.android.wallpaper.xml
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
+<!--
+ Copyright (C) 2019-2020 The LineageOS 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.
+-->
+
+<!--
+ This file contains permissions to be granted by default. Default
+ permissions are granted to special platform components and to apps
+ that are approved to get default grants. The special components
+ are apps that are expected to work out-of-the-box as they provide
+ core use cases such as default dialer, default email, etc. These
+ grants are managed by the platform. The apps that are additionally
+ approved for default grants are ones that provide carrier specific
+ functionality, ones legally required at some location, ones providing
+ alternative disclosure and opt-out UI, ones providing highlight features
+ of a dedicated device, etc. This file contains only the latter exceptions.
+ Fixed permissions cannot be controlled by the user and need a special
+ approval. Typically these are to ensure either legally mandated functions
+ or the app is considered a part of the OS.
+-->
+<exceptions>
+ <exception package="com.android.wallpaper">
+ <permission name="android.permission.READ_EXTERNAL_STORAGE" fixed="false"/>
+ </exception>
+</exceptions>
--
2.37.2

View File

@ -0,0 +1,27 @@
From 0d59123442f547d1d3cbd5e4200d6f2ec6d4bed0 Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Fri, 1 Nov 2019 23:17:08 +0100
Subject: [PATCH 4/6] Specify we read and write launcher settings
Change-Id: Ifc8196588443b007602118389ca76d34ab531f14
---
AndroidManifest.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ff8f187..cace7db 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -37,6 +37,9 @@
</intent>
</queries>
+ <uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
+ <uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" />
+
<application
tools:replace="android:icon,android:name"
android:extractNativeLibs="false"
--
2.37.2

View File

@ -0,0 +1,33 @@
From da21218f9905f70f8b83d2a6bbbdc91e322333c5 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 19:12:40 -0700
Subject: [PATCH 5/6] Declare HOME query for launcher discovery
ThemePicker needs to query the current launcher in order to render
launcher/wallpaper previews, toggle themed icons, and change the app
grid size.
Change-Id: Id79fe1eaa4d09f775a37a1dfb1091ed08a1d3422
---
AndroidManifest.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index cace7db..85bf749 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -35,6 +35,11 @@
<intent>
<action android:name="com.android.launcher3.action.PARTNER_CUSTOMIZATION" />
</intent>
+ <!-- Intent filter with action used to discover launcher -->
+ <intent>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.HOME" />
+ </intent>
</queries>
<uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
--
2.37.2

View File

@ -0,0 +1,38 @@
From b7867190ba594edc894d3833746c5af07ad596af Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 22:40:58 -0700
Subject: [PATCH 6/6] Add permission for launcher preview rendering
Change-Id: Ie707dcd98161e8f5993b0504295fddc3f395cd20
---
AndroidManifest.xml | 1 +
privapp_whitelist_com.android.wallpaper.xml | 1 +
2 files changed, 2 insertions(+)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 85bf749..897a21f 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.CHANGE_OVERLAY_PACKAGES"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission android:name="android.permission.SET_WALLPAPER_COMPONENT" />
+ <uses-permission android:name="android.permission.BIND_WALLPAPER" />
<uses-permission android:name="android.permission.MODIFY_DAY_NIGHT_MODE" />
diff --git a/privapp_whitelist_com.android.wallpaper.xml b/privapp_whitelist_com.android.wallpaper.xml
index e3f3b65..5dee99b 100644
--- a/privapp_whitelist_com.android.wallpaper.xml
+++ b/privapp_whitelist_com.android.wallpaper.xml
@@ -17,6 +17,7 @@
<permissions>
<privapp-permissions package="com.android.wallpaper">
<permission name="android.permission.SET_WALLPAPER_COMPONENT"/>
+ <permission name="android.permission.BIND_WALLPAPER"/>
<permission name="android.permission.MODIFY_DAY_NIGHT_MODE"/>
<permission name="android.permission.CHANGE_OVERLAY_PACKAGES"/>
<permission name="android.permission.WRITE_SECURE_SETTINGS" />
--
2.37.2