From 00c0a92877531aee6a58085884054802a9df73ef Mon Sep 17 00:00:00 2001 From: Kholoud Mohamed Date: Wed, 11 May 2022 19:15:49 +0000 Subject: [PATCH] Revert "RESTRICT AUTOMERGE Add feature flag to disable resource updatability APIs" This reverts commit 50f529a1e141a103410df6da1aefba8c7506f21a. Reason for revert: b/232270123 Change-Id: Iddf33e62e733bfeafc93e15c90c4978087a28829 --- .../admin/DevicePolicyResourcesManager.java | 41 ++++--------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/core/java/android/app/admin/DevicePolicyResourcesManager.java b/core/java/android/app/admin/DevicePolicyResourcesManager.java index 2cc189f87cedb..e8eb792f7fd78 100644 --- a/core/java/android/app/admin/DevicePolicyResourcesManager.java +++ b/core/java/android/app/admin/DevicePolicyResourcesManager.java @@ -26,7 +26,6 @@ import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; import android.os.RemoteException; -import android.provider.DeviceConfig; import android.util.DisplayMetrics; import android.util.Log; @@ -41,9 +40,6 @@ import java.util.function.Supplier; public class DevicePolicyResourcesManager { private static String TAG = "DevicePolicyResourcesManager"; - private static String DISABLE_RESOURCES_UPDATABILITY_FLAG = "disable_resources_updatability"; - private static boolean DEFAULT_DISABLE_RESOURCES_UPDATABILITY = false; - private final Context mContext; private final IDevicePolicyManager mService; @@ -198,20 +194,16 @@ public class DevicePolicyResourcesManager { Objects.requireNonNull(drawableSource, "drawableSource can't be null"); Objects.requireNonNull(defaultDrawableLoader, "defaultDrawableLoader can't be null"); - if (drawableId.equals(DevicePolicyResources.UNDEFINED) - || DeviceConfig.getBoolean( - DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER, - DISABLE_RESOURCES_UPDATABILITY_FLAG, - DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) { + if (drawableId.equals(DevicePolicyResources.UNDEFINED)) { return ParcelableResource.loadDefaultDrawable(defaultDrawableLoader); } - if (mService != null) { try { ParcelableResource resource = mService.getDrawable( drawableId, drawableStyle, drawableSource); if (resource == null) { - return ParcelableResource.loadDefaultDrawable(defaultDrawableLoader); + return ParcelableResource.loadDefaultDrawable( + defaultDrawableLoader); } return resource.getDrawable( mContext, @@ -295,20 +287,16 @@ public class DevicePolicyResourcesManager { Objects.requireNonNull(drawableSource, "drawableSource can't be null"); Objects.requireNonNull(defaultDrawableLoader, "defaultDrawableLoader can't be null"); - if (drawableId.equals(DevicePolicyResources.UNDEFINED) - || DeviceConfig.getBoolean( - DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER, - DISABLE_RESOURCES_UPDATABILITY_FLAG, - DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) { + if (drawableId.equals(DevicePolicyResources.UNDEFINED)) { return ParcelableResource.loadDefaultDrawable(defaultDrawableLoader); } - if (mService != null) { try { ParcelableResource resource = mService.getDrawable( drawableId, drawableStyle, drawableSource); if (resource == null) { - return ParcelableResource.loadDefaultDrawable(defaultDrawableLoader); + return ParcelableResource.loadDefaultDrawable( + defaultDrawableLoader); } return resource.getDrawable(mContext, density, defaultDrawableLoader); } catch (RemoteException e) { @@ -342,14 +330,9 @@ public class DevicePolicyResourcesManager { Objects.requireNonNull(drawableSource, "drawableSource can't be null"); Objects.requireNonNull(defaultIcon, "defaultIcon can't be null"); - if (drawableId.equals(DevicePolicyResources.UNDEFINED) - || DeviceConfig.getBoolean( - DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER, - DISABLE_RESOURCES_UPDATABILITY_FLAG, - DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) { + if (drawableId.equals(DevicePolicyResources.UNDEFINED)) { return defaultIcon; } - if (mService != null) { try { ParcelableResource resource = mService.getDrawable( @@ -480,10 +463,7 @@ public class DevicePolicyResourcesManager { Objects.requireNonNull(stringId, "stringId can't be null"); Objects.requireNonNull(defaultStringLoader, "defaultStringLoader can't be null"); - if (stringId.equals(DevicePolicyResources.UNDEFINED) || DeviceConfig.getBoolean( - DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER, - DISABLE_RESOURCES_UPDATABILITY_FLAG, - DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) { + if (stringId.equals(DevicePolicyResources.UNDEFINED)) { return ParcelableResource.loadDefaultString(defaultStringLoader); } if (mService != null) { @@ -528,10 +508,7 @@ public class DevicePolicyResourcesManager { Objects.requireNonNull(stringId, "stringId can't be null"); Objects.requireNonNull(defaultStringLoader, "defaultStringLoader can't be null"); - if (stringId.equals(DevicePolicyResources.UNDEFINED) || DeviceConfig.getBoolean( - DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER, - DISABLE_RESOURCES_UPDATABILITY_FLAG, - DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) { + if (stringId.equals(DevicePolicyResources.UNDEFINED)) { return ParcelableResource.loadDefaultString(defaultStringLoader); } if (mService != null) {