summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-09-25 21:49:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-09-25 21:49:49 +0000
commit78bf0031d04bd20b9101defff38d121ebe15c5ca (patch)
treeb95cf34c6d0a0beed0a35aba9114c7a51689b57e
parent69242de0a1b3bbc2e0ab170cc09bbb04049c2564 (diff)
parent928938ff3da0cb507dca7569ac71b4ccd1193954 (diff)
downloadStorageManager-78bf0031d04bd20b9101defff38d121ebe15c5ca.tar.gz
Merge "Use @UsesReflection for FeatureFactory keep rule" into main
-rw-r--r--Android.bp11
-rw-r--r--proguard.cfg5
-rw-r--r--src/com/android/storagemanager/overlay/FeatureFactory.java15
3 files changed, 15 insertions, 16 deletions
diff --git a/Android.bp b/Android.bp
index 3fa4ea5..e5b91f4 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,10 +22,6 @@ android_app {
platform_apis: true,
certificate: "platform",
- optimize: {
- proguard_flags_files: ["proguard.cfg"],
- },
-
system_ext_specific: true,
privileged: true,
required: ["privapp_whitelist_com.android.storagemanager"],
@@ -37,6 +33,8 @@ android_app {
"androidx.recyclerview_recyclerview",
],
+ libs: ["keepanno-annotations"],
+
uses_libs: ["org.apache.http.legacy"],
resource_dirs: ["res"],
@@ -44,11 +42,6 @@ android_app {
srcs: ["src/**/*.java"],
}
-filegroup {
- name: "StorageManager_proguard_flags",
- srcs: ["proguard.cfg"],
-}
-
// The sources for StorageManager need to be exposed to StorageManagerGoogle.
filegroup {
name: "StorageManager_srcs",
diff --git a/proguard.cfg b/proguard.cfg
deleted file mode 100644
index 25f2c47..0000000
--- a/proguard.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
--keepclassmembers class * extends android.app.Activity {
- public void *(android.view.View);
-}
-
--keep class com.android.storagemanager.overlay.FeatureFactoryImpl
diff --git a/src/com/android/storagemanager/overlay/FeatureFactory.java b/src/com/android/storagemanager/overlay/FeatureFactory.java
index 59eaa20..d1464b6 100644
--- a/src/com/android/storagemanager/overlay/FeatureFactory.java
+++ b/src/com/android/storagemanager/overlay/FeatureFactory.java
@@ -21,6 +21,9 @@ import android.text.TextUtils;
import android.util.Log;
import com.android.storagemanager.R;
+import com.android.tools.r8.keepanno.annotations.KeepItemKind;
+import com.android.tools.r8.keepanno.annotations.KeepTarget;
+import com.android.tools.r8.keepanno.annotations.UsesReflection;
/**
* Abstract class for creating feature controllers. Allows OEM implementations to define their own
@@ -36,9 +39,17 @@ public abstract class FeatureFactory {
/**
* Returns a factory for creating feature controllers. Creates the factory if it does not
- * already exist. Uses the value of {@link R.string#config_featureFactory} to instantiate
- * a factory implementation.
+ * already exist. Uses the value of {@link R.string#config_featureFactory} to instantiate a
+ * factory implementation.
*/
+ @UsesReflection(
+ description = "This method instantiates subclasses of FeatureFactory via reflection.",
+ value = {
+ @KeepTarget(
+ kind = KeepItemKind.CLASS_AND_MEMBERS,
+ extendsClassConstant = FeatureFactory.class,
+ methodName = "<init>")
+ })
public static FeatureFactory getFactory(Context context) {
if (sFactory != null) {
return sFactory;