From 321d11c2c676aff54f9acf1b21243755f333fd3d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 28 Oct 2019 01:15:27 -0400 Subject: [PATCH] Move Mapping class --- .../topjohnwu/magisk/DelegateApplication.java | 1 + .../magisk/DelegateComponentFactory.java | 1 + .../magisk/{ => obfuscate}/Mapping.java | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 9 deletions(-) rename stub/src/main/java/com/topjohnwu/magisk/{ => obfuscate}/Mapping.java (68%) diff --git a/stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java b/stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java index 817d4da40..a19a400a1 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java @@ -9,6 +9,7 @@ import android.content.res.Configuration; import android.os.Build; import android.util.Log; +import com.topjohnwu.magisk.obfuscate.Mapping; import com.topjohnwu.magisk.utils.DynamicClassLoader; import java.io.File; diff --git a/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java b/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java index 89874c93f..c62806aad 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java @@ -14,6 +14,7 @@ import com.topjohnwu.magisk.dummy.DummyActivity; import com.topjohnwu.magisk.dummy.DummyProvider; import com.topjohnwu.magisk.dummy.DummyReceiver; import com.topjohnwu.magisk.dummy.DummyService; +import com.topjohnwu.magisk.obfuscate.Mapping; import static com.topjohnwu.magisk.DownloadActivity.TAG; diff --git a/stub/src/main/java/com/topjohnwu/magisk/Mapping.java b/stub/src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java similarity index 68% rename from stub/src/main/java/com/topjohnwu/magisk/Mapping.java rename to stub/src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java index b069c145d..65e7eec82 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/Mapping.java +++ b/stub/src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java @@ -1,15 +1,16 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.obfuscate; import java.util.HashMap; import java.util.Map; import static com.topjohnwu.magisk.DynAPK.*; +import static com.topjohnwu.magisk.R.drawable.*; -class Mapping { +public class Mapping { private static Map map = new HashMap<>(); // This mapping will be sent into the guest app - static Data data = new Data(); + public static Data data = new Data(); static { map.put(a.z.class.getName(), "a.c"); @@ -25,15 +26,15 @@ class Mapping { data.componentMap.put(e.getValue(), e.getKey()); } int[] res = new int[5]; - res[NOTIFICATION] = R.drawable.ic_magisk_outline; - res[SUPERUSER] = R.drawable.sc_superuser; - res[MAGISKHIDE] = R.drawable.sc_magiskhide; - res[DOWNLOAD] = R.drawable.sc_cloud_download; - res[MODULES] = R.drawable.sc_extension; + res[NOTIFICATION] = ic_magisk_outline; + res[SUPERUSER] = sc_superuser; + res[MAGISKHIDE] = sc_magiskhide; + res[DOWNLOAD] = sc_cloud_download; + res[MODULES] = sc_extension; data.resourceMap = res; } - static String get(String name) { + public static String get(String name) { String n = map.get(name); return n != null ? n : name; }