Use VERSION_CODES instead of raw numbers

This commit is contained in:
topjohnwu
2022-08-23 01:43:53 -07:00
parent c2f96975ce
commit 3f7f6e619a
13 changed files with 33 additions and 26 deletions

View File

@@ -186,7 +186,7 @@ public class DownloadActivity extends Activity {
}
private void loadResources() throws Exception {
if (Build.VERSION.SDK_INT >= 30) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
var fd = Os.memfd_create("res.apk", 0);
try {
decryptResources(new FileOutputStream(fd));

View File

@@ -104,7 +104,7 @@ public class DynLoad {
// Dynamically load APK and create the Application instance from the loaded APK
static Application createAndSetupApp(Application context) {
// On API >= 29, AppComponentFactory will replace the ClassLoader for us
if (Build.VERSION.SDK_INT < 29)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
replaceClassLoader(context);
// noinspection InlinedApi
@@ -145,7 +145,7 @@ public class DynLoad {
.newInstance(data.getObject());
// Create the receiver component factory
if (Build.VERSION.SDK_INT >= 28 && componentFactory != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && componentFactory != null) {
Object factory = cl.loadClass(appInfo.appComponentFactory).newInstance();
var delegate = (DelegateComponentFactory) componentFactory;
delegate.receiver = (AppComponentFactory) factory;