diff --git a/app/src/main/java/im/hoho/alipayInstallB/PluginMain.java b/app/src/main/java/im/hoho/alipayInstallB/PluginMain.java index 12e09e3..b26e007 100644 --- a/app/src/main/java/im/hoho/alipayInstallB/PluginMain.java +++ b/app/src/main/java/im/hoho/alipayInstallB/PluginMain.java @@ -19,6 +19,9 @@ import de.robv.android.xposed.XposedHelpers; import de.robv.android.xposed.callbacks.XC_LoadPackage; +import android.content.Context; +import android.os.Bundle; +import android.database.sqlite.SQLiteDatabase; /** * Created by qzj_ on 2016/5/9. */ @@ -53,6 +56,30 @@ protected void afterHookedMethod(MethodHookParam param1MethodHookParam) throws T } }); + XposedHelpers.findAndHookMethod("android.app.Activity", lpparam.classLoader, "onCreate", Bundle.class, new XC_MethodHook() { + @Override + protected void afterHookedMethod(MethodHookParam param) throws Throwable { + Context context = (Context) param.thisObject; // 获取到Activity作为Context + XposedBridge.log("--------------DATABASE_UPDATER--------------"); + File dbFile = context.getDatabasePath("alipayclient.db"); + if (dbFile.exists()) { + XposedBridge.log("GET DATABASE: " + context.getDatabasePath("alipayclient.db").getParentFile()); + try (SQLiteDatabase db = SQLiteDatabase.openDatabase(dbFile.getPath(), null, SQLiteDatabase.OPEN_READWRITE)) + { + // 将本来的普通会员直接替换为钻石会员 + db.execSQL("UPDATE 'main'.'userinfo' SET 'memberGrade' = 'diamond'"); + XposedBridge.log("Database update successful!"); + } catch (Exception e) { + XposedBridge.log("Database update error: " + e); + } + }else{ + XposedBridge.log("CAN NOT GET DATABASE: " + context.getDatabasePath("alipayclient.db").getParentFile()+",PASS!"); + } + XposedBridge.log("--------------DATABASE_UPDATER--------------"); + } + }); + + //region modify skin // final Class ConfigUtilBiz = lpparam.classLoader.loadClass("com.alipay.mobile.onsitepaystatic.ConfigUtilBiz"); final Class OspSkinModel = lpparam.classLoader.loadClass("com.alipay.mobile.onsitepaystatic.skin.OspSkinModel");