Remove "Allow persistent changes to the vendor overlay theme"
This reverts commit 2dc804be11444565e3d1d151c2a693db3ade94c0.
It also removes the related calls from UiModeManager.
Fixes: 32721178
Test: make & flash
Change-Id: Id371bccec611155cc6910e46b3277c3d27fc1c79
diff --git a/core/java/android/app/IUiModeManager.aidl b/core/java/android/app/IUiModeManager.aidl
index 7f0b6fb..cae54b6 100644
--- a/core/java/android/app/IUiModeManager.aidl
+++ b/core/java/android/app/IUiModeManager.aidl
@@ -53,21 +53,6 @@
int getNightMode();
/**
- * Sets whith theme overlays to use within /vendor/overlay.
- */
- void setTheme(String theme);
-
- /**
- * Gets which theme overlays to use within /vendor/overlay.
- */
- String getTheme();
-
- /**
- * Gets the themes available in /vendor/overlay.
- */
- String[] getAvailableThemes();
-
- /**
* Tells if UI mode is locked or not.
*/
boolean isUiModeLocked();
diff --git a/core/java/android/app/UiModeManager.java b/core/java/android/app/UiModeManager.java
index af41a7d..07e2570 100644
--- a/core/java/android/app/UiModeManager.java
+++ b/core/java/android/app/UiModeManager.java
@@ -242,50 +242,6 @@
}
/**
- * Sets the vendor theme overlay property, then triggers a reboot.
- * @hide
- */
- public void setTheme(String theme) {
- if (mService != null) {
- try {
- mService.setTheme(theme);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
- }
-
- /**
- * Gets the vendor theme overlay property.
- * @hide
- */
- public String getTheme() {
- if (mService != null) {
- try {
- return mService.getTheme();
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
- return null;
- }
-
- /**
- * Gets the valid inputs to {@link #setTheme(String)}.
- * @hide
- */
- public String[] getAvailableThemes() {
- if (mService != null) {
- try {
- return mService.getAvailableThemes();
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
- return null;
- }
-
- /**
* Returns the currently configured night mode.
* <p>
* May be one of:
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 373bda9..90aee9e 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -178,11 +178,7 @@
// Directories to scan for overlays: if OVERLAY_THEME_DIR_PROPERTY is defined,
// use OVERLAY_DIR/<value of OVERLAY_THEME_DIR_PROPERTY> in addition to OVERLAY_DIR.
char subdir[PROP_VALUE_MAX];
- int len = __system_property_get(AssetManager::OVERLAY_THEME_DIR_PERSIST_PROPERTY,
- subdir);
- if (len == 0) {
- len = __system_property_get(AssetManager::OVERLAY_THEME_DIR_PROPERTY, subdir);
- }
+ int len = __system_property_get(AssetManager::OVERLAY_THEME_DIR_PROPERTY, subdir);
if (len > 0) {
String8 overlayPath = String8(AssetManager::OVERLAY_DIR) + "/" + subdir;
if (stat(overlayPath.string(), &st) == 0) {
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index acacd76..5603508 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -74,7 +74,6 @@
const char* AssetManager::IDMAP_BIN = "/system/bin/idmap";
const char* AssetManager::OVERLAY_DIR = "/vendor/overlay";
const char* AssetManager::OVERLAY_THEME_DIR_PROPERTY = "ro.boot.vendor.overlay.theme";
-const char* AssetManager::OVERLAY_THEME_DIR_PERSIST_PROPERTY = "persist.vendor.overlay.theme";
const char* AssetManager::TARGET_PACKAGE_NAME = "android";
const char* AssetManager::TARGET_APK_PATH = "/system/framework/framework-res.apk";
const char* AssetManager::IDMAP_DIR = "/data/resource-cache";
diff --git a/libs/androidfw/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h
index becd307..0441b9d 100644
--- a/libs/androidfw/include/androidfw/AssetManager.h
+++ b/libs/androidfw/include/androidfw/AssetManager.h
@@ -66,11 +66,6 @@
* OVERLAY_DIR.
*/
static const char* OVERLAY_THEME_DIR_PROPERTY;
- /**
- * If OVERLAY_THEME_DIR_PERSIST_PROPERTY, use it to override
- * OVERLAY_THEME_DIR_PROPERTY.
- */
- static const char* OVERLAY_THEME_DIR_PERSIST_PROPERTY;
static const char* TARGET_PACKAGE_NAME;
static const char* TARGET_APK_PATH;
static const char* IDMAP_DIR;
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java
index 5115fde..e4f4687 100644
--- a/services/core/java/com/android/server/UiModeManagerService.java
+++ b/services/core/java/com/android/server/UiModeManagerService.java
@@ -323,52 +323,6 @@
}
@Override
- public void setTheme(String theme) {
- if (getContext().checkCallingOrSelfPermission(
- android.Manifest.permission.MODIFY_THEME_OVERLAY)
- != PackageManager.PERMISSION_GRANTED) {
- Slog.e(TAG, "setTheme requires MODIFY_THEME_OVERLAY permission");
- return;
- }
- SystemProperties.set("persist.vendor.overlay.theme", theme);
- mHandler.post(() -> ShutdownThread.reboot(getContext(),
- PowerManager.SHUTDOWN_USER_REQUESTED, false));
- }
-
- @Override
- public String getTheme() {
- if (getContext().checkCallingOrSelfPermission(
- android.Manifest.permission.MODIFY_THEME_OVERLAY)
- != PackageManager.PERMISSION_GRANTED) {
- Slog.e(TAG, "setTheme requires MODIFY_THEME_OVERLAY permission");
- return null;
- }
- return SystemProperties.get("persist.vendor.overlay.theme");
- }
-
- @Override
- public String[] getAvailableThemes() {
- if (getContext().checkCallingOrSelfPermission(
- android.Manifest.permission.MODIFY_THEME_OVERLAY)
- != PackageManager.PERMISSION_GRANTED) {
- Slog.e(TAG, "getAvailableThemes requires MODIFY_THEME_OVERLAY permission");
- return null;
- }
- String def = SystemProperties.get("ro.boot.vendor.overlay.theme");
- if (TextUtils.isEmpty(def)) {
- def = null;
- }
- String[] fileList = new File("/vendor/overlay").list();
- if (fileList == null) return new String[0];
- ArrayList<String> options = new ArrayList(fileList.length + 1);
- Collections.addAll(options, fileList);
- if (!options.contains(def)) {
- options.add(0, def);
- }
- return options.toArray(new String[options.size()]);
- }
-
- @Override
public int getNightMode() {
synchronized (mLock) {
return mNightMode;