Fix some bootloop
This commit is contained in:
parent
64953220de
commit
314315180f
|
|
@ -1,3 +1,6 @@
|
|||
[submodule "edxp-core/src/main/cpp/external/Dobby"]
|
||||
path = edxp-core/src/main/cpp/external/Dobby
|
||||
url = https://github.com/jmpews/Dobby.git
|
||||
[submodule "apk-parser"]
|
||||
path = apk-parser
|
||||
url = https://github.com/jaredrummler/APKParser.git
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 4b2590b959df4d669d1b7db25e97d58344def726
|
||||
|
|
@ -25,6 +25,7 @@ dependencies {
|
|||
api project(':xposed-bridge')
|
||||
compileOnly project(':dexmaker')
|
||||
compileOnly 'com.android.support:support-annotations:28.0.0'
|
||||
implementation project(':apk-parser:library')
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,10 @@ import android.content.res.XResources;
|
|||
import com.elderdrivers.riru.edxp.config.ConfigManager;
|
||||
import com.elderdrivers.riru.edxp.util.Hookers;
|
||||
import com.elderdrivers.riru.edxp.util.Utils;
|
||||
import com.jaredrummler.apkparser.ApkParser;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import de.robv.android.xposed.XC_MethodHook;
|
||||
import de.robv.android.xposed.XposedBridge;
|
||||
|
|
@ -55,15 +57,24 @@ public class HandleBindApp extends XC_MethodHook {
|
|||
String processName = (String) XposedHelpers.getObjectField(bindData, "processName");
|
||||
|
||||
|
||||
final ApplicationInfo ai = ActivityThread.currentActivityThread().getSystemContext().getPackageManager().getApplicationInfo(appInfo.packageName, PackageManager.GET_META_DATA);
|
||||
boolean isModule = false;
|
||||
int xposedminversion = -1;
|
||||
try {
|
||||
ApkParser ap = ApkParser.create(new File(appInfo.sourceDir));
|
||||
isModule = ap.getApkMeta().metaData.containsKey("xposedmodule");
|
||||
if(isModule)
|
||||
xposedminversion = Integer.parseInt(ap.getApkMeta().metaData.get("xposedminversion"));
|
||||
} catch (NumberFormatException | IOException e) {
|
||||
Hookers.logE("ApkParser fails", e);
|
||||
}
|
||||
|
||||
if(ai.metaData.getBoolean("xposedmodule") && ai.metaData.getInt("xposedminversion", -1) > 92) {
|
||||
if (isModule && xposedminversion > 92) {
|
||||
Utils.logW("New modules detected, hook preferences");
|
||||
XposedHelpers.findAndHookMethod(ContextImpl.class, "getSharedPreferences", File.class, int.class, new XC_MethodHook() {
|
||||
@Override
|
||||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
||||
String fileName = ((File)param.args[0]).getName();
|
||||
File file = new File(ConfigManager.getPrefsPath(ai.packageName), fileName);
|
||||
String fileName = ((File) param.args[0]).getName();
|
||||
File file = new File(ConfigManager.getPrefsPath(appInfo.packageName), fileName);
|
||||
file.createNewFile();
|
||||
file.setReadable(true, false);
|
||||
param.args[0] = file;
|
||||
|
|
|
|||
|
|
@ -37,15 +37,12 @@ inline constexpr bool is64 = Is64();
|
|||
static const auto kLibArtName = "libart.so"s;
|
||||
static const auto kLibFwName = "libandroidfw.so"s;
|
||||
static const auto kLibSandHookName = "libsandhook.edxp.so"s;
|
||||
static const auto kLibDlName = "libdl.so"s;
|
||||
static const auto kLibSandHookNativeName = "libsandhook-native.so"s;
|
||||
|
||||
static const auto kLibBasePath =
|
||||
LP_SELECT("/system/lib/"s,
|
||||
"/system/lib64/"s);
|
||||
static const auto kLibArtLegacyPath = kLibBasePath + kLibArtName;
|
||||
static const auto kLibSandHookPath = kLibBasePath + kLibSandHookName;
|
||||
static const auto kLibSandHookNativePath = kLibBasePath + kLibSandHookNativeName;
|
||||
static const auto kLibFwPath = kLibBasePath + kLibFwName;
|
||||
|
||||
inline constexpr const char *const BoolToString(bool b) {
|
||||
|
|
|
|||
|
|
@ -227,7 +227,8 @@ namespace edxp {
|
|||
if (!app_pkg_name.empty())
|
||||
scope.emplace(std::move(app_pkg_name));
|
||||
}
|
||||
scope.insert(module_pkg_name); // Always add module itself
|
||||
if(!scope.empty())
|
||||
scope.insert(module_pkg_name); // Always add module itself
|
||||
if (IsInstaller(module_pkg_name)) scope.erase("android");
|
||||
LOGI("scope of %s is:\n%s", module_pkg_name.c_str(), ([&scope = scope]() {
|
||||
std::ostringstream join;
|
||||
|
|
|
|||
|
|
@ -246,7 +246,6 @@ else
|
|||
ui_print "- Extracting arm libraries"
|
||||
extract "$ZIPFILE" 'system/lib/libriru_edxp.so' "$MODPATH"
|
||||
if [[ "${VARIANTS}" == "SandHook" ]]; then
|
||||
extract "$ZIPFILE" 'system/lib/libsandhook-native.so' "$MODPATH"
|
||||
extract "$ZIPFILE" 'system/lib/libsandhook.edxp.so' "$MODPATH"
|
||||
fi
|
||||
|
||||
|
|
@ -254,7 +253,6 @@ else
|
|||
ui_print "- Extracting arm64 libraries"
|
||||
extract "$ZIPFILE" 'system/lib64/libriru_edxp.so' "$MODPATH"
|
||||
if [[ "${VARIANTS}" == "SandHook" ]]; then
|
||||
extract "$ZIPFILE" 'system/lib64/libsandhook-native.so' "$MODPATH"
|
||||
extract "$ZIPFILE" 'system/lib64/libsandhook.edxp.so' "$MODPATH"
|
||||
fi
|
||||
fi
|
||||
|
|
@ -291,11 +289,12 @@ else
|
|||
set_perm_recursive /data/misc/$MISC_PATH root root 0771 0660 "u:object_r:magisk_file:s0" || abort "! Can't set permission"
|
||||
fi
|
||||
fi
|
||||
touch /data/adb/edxp/new_install || abort "! Can't touch new install"
|
||||
set_perm_recursive /data/adb/edxp root root 0700 0600 "u:object_r:magisk_file:s0" || abort "! Can't set permission"
|
||||
mkdir -p /data/misc/$MISC_PATH || abort "! Can't create configuration path"
|
||||
set_perm /data/misc/$MISC_PATH root root 0771 "u:object_r:magisk_file:s0" || abort "! Can't set permission"
|
||||
echo "rm -rf /data/misc/$MISC_PATH" >> "$MODPATH/uninstall.sh" || abort "! Can't write uninstall.sh"
|
||||
echo "rm -rf /data/adb/edxp" >> "$MODPATH/uninstall.sh" || abort "! Can't write uninstall.sh"
|
||||
echo "[[ -f /data/adb/edxp/new_install ]] || rm -rf /data/adb/edxp" >> "$MODPATH/uninstall.sh" || abort "! Can't write uninstall.sh"
|
||||
|
||||
|
||||
ui_print "- Copying framework libraries"
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ sepolicy() {
|
|||
#fi
|
||||
|
||||
DEFAULT_BASE_PATH="${PATH_PREFIX}${EDXP_MANAGER}"
|
||||
BASE_PATH="/data/misc/$(cat /data/adb/edxp/misc_path)"
|
||||
MISC_PATH=$(cat /data/adb/edxp/misc_path)
|
||||
BASE_PATH="/data/misc/$MISC_PATH"
|
||||
|
||||
LOG_PATH="${BASE_PATH}/0/log"
|
||||
CONF_PATH="${BASE_PATH}/0/conf"
|
||||
|
|
@ -166,6 +167,7 @@ fi
|
|||
|
||||
chcon -R u:object_r:system_file:s0 "${MODDIR}"
|
||||
chcon -R ${PATH_CONTEXT} "${LOG_PATH}"
|
||||
chcon -R u:object_r:magisk_file:s0 $BASE_PATH
|
||||
chown -R ${PATH_OWNER} "${LOG_PATH}"
|
||||
chmod -R 666 "${LOG_PATH}"
|
||||
[[ -z "$MISC_PATH" ]] && chcon -R u:object_r:magisk_file:s0 "$BASE_PATH"
|
||||
rm -f /data/adb/edxp/new_install
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -98,11 +98,9 @@ public class PackageReceiver {
|
|||
return result;
|
||||
}
|
||||
|
||||
private void updateModuleList(int uid, String packageName) {
|
||||
private void updateModuleList(int uid) {
|
||||
Map<String, String> enabledModules = loadEnabledModules(uid);
|
||||
|
||||
if (!enabledModules.containsKey(packageName)) return;
|
||||
|
||||
try {
|
||||
File moduleListFile = new File(CONFIG_PATH, uid + "/" + MODULES_LIST_FILENAME);
|
||||
moduleListFile.createNewFile();
|
||||
|
|
@ -157,7 +155,7 @@ public class PackageReceiver {
|
|||
for (Object uh : (List<Object>) m.invoke(um)) {
|
||||
int uid = (int) uh.getClass().getDeclaredField("id").get(uh);
|
||||
Utils.logI("updating uid: " + uid);
|
||||
updateModuleList(uid, packageName);
|
||||
updateModuleList(uid);
|
||||
}
|
||||
Toast.makeText(context, "EdXposed: Updated " + packageName, Toast.LENGTH_SHORT).show();
|
||||
} catch (Throwable e) {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
include ':edxp-core', ':xposed-bridge', ':hiddenapi-stubs', ':dexmaker', ':dalvikdx', ':edxp-common', ':edxp-yahfa', ':edxp-sandhook', ':edxp-service'
|
||||
include ':edxp-core', ':xposed-bridge', ':hiddenapi-stubs', ':dexmaker', ':dalvikdx', ':edxp-common', ':edxp-yahfa', ':edxp-sandhook', ':edxp-service', ':apk-parser:library'
|
||||
|
|
@ -43,6 +43,7 @@ preBuild.doLast {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(':apk-parser:library')
|
||||
compileOnly files(project(":dexmaker").tasks.getByName("makeJarRelease").outputs)
|
||||
compileOnly files(project(":hiddenapi-stubs").tasks.getByName("makeStubJar").outputs)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import android.preference.PreferenceManager;
|
|||
import android.util.Log;
|
||||
|
||||
import com.android.internal.util.XmlUtils;
|
||||
import com.jaredrummler.apkparser.ApkParser;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
|
|
@ -72,8 +73,17 @@ public final class XSharedPreferences implements SharedPreferences {
|
|||
Set<String> modules = XposedInit.getLoadedModules();
|
||||
for (String m : modules) {
|
||||
if (m.contains("/" + packageName + "-")) {
|
||||
PackageInfo packageInfo = ((Context) ActivityThread.currentActivityThread().getSystemContext()).getPackageManager().getPackageArchiveInfo(m, PackageManager.GET_META_DATA);
|
||||
newModule = packageInfo != null && packageInfo.applicationInfo != null && packageInfo.applicationInfo.metaData.getBoolean("xposedmodule") && packageInfo.applicationInfo.metaData.getInt("xposedminversion", -1) > 92;
|
||||
boolean isModule = false;
|
||||
int xposedminversion = -1;
|
||||
try {
|
||||
ApkParser ap = ApkParser.create(new File(m));
|
||||
isModule = ap.getApkMeta().metaData.containsKey("xposedmodule");
|
||||
if(isModule)
|
||||
xposedminversion = Integer.parseInt(ap.getApkMeta().metaData.get("xposedminversion"));
|
||||
} catch (NumberFormatException | IOException e) {
|
||||
Log.w(TAG, "Apk parser fails: " + e);
|
||||
}
|
||||
newModule = isModule && xposedminversion > 92;
|
||||
}
|
||||
}
|
||||
if (newModule && XposedInit.prefsBasePath != null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue