Enforce all the SliceBackgroundWorkers being singletons at syntax level

- Create workers via reflection in SliceBackgroundWorker
- Store the workers in a static container and release then at shutdown()

Fixes: 118228009
Test: robolectric
Change-Id: I564277d3a12b2d7d3b50cef091bdfedb3397c145
This commit is contained in:
Jason Chiu
2018-10-29 17:58:55 +08:00
committed by Fan Zhang
parent 7ebb059ea5
commit a68f81540e
6 changed files with 124 additions and 90 deletions

View File

@@ -60,4 +60,9 @@
# Keep classes that implements CustomSliceable, which are used by reflection.
-keepclasseswithmembers class * implements com.android.settings.slices.CustomSliceable {
public <init>(android.content.Context);
}
}
# Keep classes that extends SliceBackgroundWorker, which are used by reflection.
-keepclasseswithmembers class * extends com.android.settings.slices.SliceBackgroundWorker {
public <init>(android.content.Context, android.net.Uri);
}