├── app ├── .gitignore ├── src │ ├── main │ │ ├── assets │ │ │ └── xposed_init │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable │ │ │ │ ├── switch_thumb.xml │ │ │ │ ├── switch_track.xml │ │ │ │ ├── gray_track.xml │ │ │ │ ├── green_track.xml │ │ │ │ ├── gray_thumb.xml │ │ │ │ └── green_thumb.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── lanshifu │ │ │ │ └── xposeddemo │ │ │ │ ├── Constants.java │ │ │ │ ├── Config.java │ │ │ │ ├── utils │ │ │ │ ├── ClassUtil.java │ │ │ │ ├── LogUtil.java │ │ │ │ ├── PreferenceUtils.java │ │ │ │ └── AliUtil.java │ │ │ │ ├── bean │ │ │ │ ├── CollectionBean.java │ │ │ │ ├── FriendRankBean.java │ │ │ │ ├── CollectionResultBean.java │ │ │ │ └── FriendDetailBean.java │ │ │ │ ├── module │ │ │ │ ├── BaseModule.java │ │ │ │ ├── MainModule.java │ │ │ │ ├── JianShuModule.java │ │ │ │ ├── TomatoModule.java │ │ │ │ └── AliPayModule.java │ │ │ │ ├── Main.java │ │ │ │ └── ui │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── lanshifu │ │ │ └── xposeddemo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── lanshifu │ │ └── xposeddemo │ │ └── ExampleInstrumentedTest.java ├── release │ └── output.json ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── key ├── .idea ├── copyright │ └── profiles_settings.xml ├── caches │ └── build_file_checksums.ser ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew ├── README.md └── tomato.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /app/src/main/assets/xposed_init: -------------------------------------------------------------------------------- 1 | com.lanshifu.xposeddemo.Main -------------------------------------------------------------------------------- /key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/key -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanshifu/XposedDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 番茄模块 by 蓝师傅 3 | 支持支付宝版本:10.1.32、10.1.33 4 | 5 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/release/output.json: -------------------------------------------------------------------------------- 1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Sep 29 22:40:53 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/Constants.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo; 2 | 3 | public class Constants { 4 | 5 | public static final String PACKAGE_NAME_MOMATO = "com.one.tomato"; 6 | public static final String PACKAGE_NAME_ALIPAY = "com.eg.android.AlipayGphone"; 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/Config.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo; 2 | 3 | /** 4 | * Created by lanxiaobin on 2018/2/3. 5 | */ 6 | 7 | public class Config { 8 | 9 | public static boolean isDebug = true; 10 | 11 | /** 12 | * 蚂蚁森林 13 | */ 14 | public static boolean isMayiSenlinOpen = true; 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/switch_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/switch_track.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #00ff00 8 | #ff0000 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/gray_track.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/green_track.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/test/java/com/lanshifu/xposeddemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/gray_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/green_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/utils/ClassUtil.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo.utils; 2 | 3 | /** 4 | * 保存类名 5 | * Created by lanshifu on 2018/10/1. 6 | */ 7 | 8 | public class ClassUtil { 9 | 10 | 11 | //默认 10.1.32 版本,需要适配混淆的字段 12 | 13 | 14 | //支付宝安全校验 15 | public static String class_CI = "com.alipay.mobile.base.security.CI"; 16 | public static String method_CI_dialog = "a"; 17 | 18 | 19 | public static String class_H5FragmentManager = "com.alipay.mobile.nebulacore.ui.H5FragmentManager"; 20 | public static String class_H5Fragment = "com.alipay.mobile.nebulacore.ui.H5Fragment"; 21 | public static String H5ViewHolder = "a"; 22 | public static String H5PageImpl = "h"; 23 | 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/lanshifu/xposeddemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.lanshifu.xposeddemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/utils/LogUtil.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo.utils; 2 | 3 | import android.util.Log; 4 | 5 | import de.robv.android.xposed.XposedBridge; 6 | 7 | /** 8 | * Created by lanshifu on 2018/9/29. 9 | */ 10 | 11 | public class LogUtil { 12 | 13 | public static void d(String tag,String content){ 14 | Log.d("lxb-xposed->" + tag, content); 15 | XposedBridge.log("lxb******************************"); 16 | XposedBridge.log(content); 17 | XposedBridge.log("lxb------------------------------"); 18 | } 19 | 20 | public static void d(String content){ 21 | Log.d("lxb-xposed->", content); 22 | XposedBridge.log("lxb******************************"); 23 | XposedBridge.log(content); 24 | XposedBridge.log("lxb------------------------------"); 25 | } 26 | 27 | public static void e(String content){ 28 | Log.e("lxb-xposed->", content); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/bean/CollectionBean.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo.bean; 2 | 3 | /** 4 | * Created by lanshifu on 2018/9/30. 5 | * 6 | * 用户id 跟能量id对应 7 | */ 8 | 9 | public class CollectionBean { 10 | 11 | public CollectionBean(String userId, long bubbleIds) { 12 | this.userId = userId; 13 | this.bubbleIds = bubbleIds; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return "{" + 19 | "userId='" + userId + '\'' + 20 | ", bubbleIds=" + bubbleIds + 21 | '}'; 22 | } 23 | 24 | public String userId; 25 | public long bubbleIds; 26 | 27 | @Override 28 | public boolean equals(Object obj) { 29 | if (obj instanceof CollectionBean) { 30 | return ((((CollectionBean) obj).bubbleIds == bubbleIds) && 31 | ((CollectionBean) obj).userId.equals(userId)); 32 | } 33 | return super.equals(obj); 34 | } 35 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in e:\Users\Administrator\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | #实体类不参与混淆 27 | -keep class com.lanshifu.xposeddemo.bean.** { *; } 28 | -keep class com.lanshifu.xposeddemo.ui.** { *; } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/module/BaseModule.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo.module; 2 | 3 | import android.util.Log; 4 | 5 | import com.lanshifu.xposeddemo.BuildConfig; 6 | 7 | import de.robv.android.xposed.XposedBridge; 8 | import de.robv.android.xposed.XposedHelpers; 9 | 10 | public class BaseModule { 11 | 12 | protected static void hook_method(String className, ClassLoader classLoader, String methodName, 13 | Object... parameterTypesAndCallback) { 14 | try { 15 | XposedHelpers.findAndHookMethod(className, classLoader, methodName, parameterTypesAndCallback); 16 | } catch (Exception e) { 17 | XposedBridge.log(e); 18 | xLog(e.getMessage()); 19 | } 20 | } 21 | 22 | 23 | protected static void xLog(String content) { 24 | XposedBridge.log("lxb*******************************************************************************************************************************"); 25 | XposedBridge.log(content); 26 | XposedBridge.log("lxb----------------------------------------------------------------------------------------------------------------------"); 27 | 28 | if (BuildConfig.DEBUG) { 29 | Log.d("lxb", content); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/module/MainModule.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo.module; 2 | 3 | import android.content.Context; 4 | import android.os.Handler; 5 | import android.util.Log; 6 | import android.widget.Toast; 7 | 8 | import com.lanshifu.xposeddemo.Constants; 9 | import com.lanshifu.xposeddemo.utils.LogUtil; 10 | 11 | import de.robv.android.xposed.XC_MethodHook; 12 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 13 | 14 | /** 15 | * Created by lanxiaobin on 2018/1/29. 16 | */ 17 | 18 | public class MainModule extends BaseModule{ 19 | 20 | 21 | public static Handler mHandler = new Handler(); 22 | 23 | 24 | /** 25 | * 入口,通过反射调用 26 | * 27 | * @param param 28 | */ 29 | public static void handleMyHandleLoadPackage(final XC_LoadPackage.LoadPackageParam param) throws ClassNotFoundException { 30 | 31 | LogUtil.d(" handle packageName = " + param.packageName); 32 | 33 | if (param.packageName.equals("com.lanshifu.xposeddemo")) { 34 | hook_method("com.lanshifu.xposeddemo.ui.MainActivity", param.classLoader, "isOpen", new XC_MethodHook() { 35 | @Override 36 | protected void afterHookedMethod(MethodHookParam param) throws Throwable { 37 | Log.d("lxb", "hookMainActivity -- >initView"); 38 | param.setResult(true); 39 | 40 | Toast.makeText((Context) param.thisObject, "模块已经启动", Toast.LENGTH_SHORT).show(); 41 | } 42 | }); 43 | } 44 | 45 | 46 | //番茄开始 47 | TomatoModule.hookClassLoader(param); 48 | 49 | 50 | //支付宝偷能量开始 51 | // AliPayModule.handle(param); 52 | 53 | 54 | 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.lanshifu.xposeddemo" 7 | minSdkVersion 15 8 | targetSdkVersion 28 9 | versionCode 2 10 | versionName "1.1" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | // minifyEnabled true 16 | // shrinkResources true 17 | // zipAlignEnabled true 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | signingConfigs { 23 | // debug { 24 | // keyAlias '123456' 25 | // keyPassword '123456' 26 | // storeFile file("../key.jks")//这里我放在project根目录下,根据路径配置 27 | // storePassword '123456' 28 | // } 29 | release { 30 | keyAlias '123456' 31 | keyPassword '123456' 32 | storeFile file("../key") 33 | storePassword '123456' 34 | } 35 | } 36 | 37 | dexOptions { 38 | preDexLibraries = false 39 | } 40 | 41 | lintOptions { 42 | disable 'InvalidPackage' 43 | disable "ResourceType" 44 | abortOnError false 45 | } 46 | } 47 | 48 | dependencies { 49 | compile fileTree(include: ['*.jar'], dir: 'libs') 50 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 51 | exclude group: 'com.android.support', module: 'support-annotations' 52 | }) 53 | 54 | compile 'com.android.support:appcompat-v7:26.0.0-alpha1' 55 | testCompile 'junit:junit:4.12' 56 | provided 'de.robv.android.xposed:api:82' 57 | 58 | api 'com.google.code.gson:gson:2.8.2' 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/utils/PreferenceUtils.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo.utils; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.SharedPreferences; 6 | 7 | import de.robv.android.xposed.XSharedPreferences; 8 | 9 | /** 10 | * Created by lanshifu on 2018/10/1. 11 | */ 12 | 13 | public class PreferenceUtils { 14 | public static final String AUTO_ALL ="auto_all"; 15 | public static final String REPLY_CONTENT ="reply_content"; 16 | public static final String REPLY_ORDER ="reply_order"; 17 | public static final String REPLY_ROBOT ="reply_robot"; 18 | public static final String REPLY_DESCRIBE ="reply_describe"; 19 | 20 | //自动收(偷)能量开关 21 | public static final String ZHIFUBAO_OPEN ="zhifubao_open"; 22 | 23 | //自动通知好友驱赶小鸡开关 24 | public static final String OPEN_NOTICE_STEAL ="zhifubao_open"; 25 | 26 | private static XSharedPreferences intance = null; 27 | 28 | public static XSharedPreferences getIntance(){ 29 | if (intance == null){ 30 | intance = new XSharedPreferences("com.lanshifu.xposeddemo","config"); 31 | intance.makeWorldReadable(); 32 | }else { 33 | intance.reload(); 34 | } 35 | return intance; 36 | } 37 | 38 | 39 | public static void putBool(Context context,String key,boolean val){ 40 | SharedPreferences mSharedPreferences = context.getSharedPreferences("config", Activity.MODE_WORLD_READABLE); 41 | SharedPreferences.Editor mEditor = mSharedPreferences.edit(); 42 | mEditor.putBoolean(PreferenceUtils.ZHIFUBAO_OPEN, val).commit(); 43 | } 44 | 45 | 46 | public static boolean isZhifubaoOpen(){ 47 | // return getIntance().getBoolean(ZHIFUBAO_OPEN,true); 48 | return true; 49 | } 50 | 51 | public static boolean isNoticeStealOpen(){ 52 | // return getIntance().getBoolean(OPEN_NOTICE_STEAL,false); 53 | return true; 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 23 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 1.8 45 | 46 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/lanshifu/xposeddemo/Main.java: -------------------------------------------------------------------------------- 1 | package com.lanshifu.xposeddemo; 2 | 3 | import android.util.Log; 4 | 5 | import com.lanshifu.xposeddemo.module.MainModule; 6 | import com.lanshifu.xposeddemo.utils.LogUtil; 7 | 8 | import java.io.File; 9 | import java.lang.reflect.Method; 10 | 11 | import dalvik.system.PathClassLoader; 12 | import de.robv.android.xposed.IXposedHookLoadPackage; 13 | import de.robv.android.xposed.XposedBridge; 14 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 15 | import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam; 16 | 17 | 18 | public class Main implements IXposedHookLoadPackage { 19 | 20 | 21 | public static final String TAG = "lxb"; 22 | 23 | 24 | @Override 25 | public void handleLoadPackage(final LoadPackageParam param) throws Throwable{ 26 | if (BuildConfig.DEBUG){ 27 | //通过反射实现热更新 28 | final String packageName = MainModule.class.getPackage().getName(); 29 | String filePath = String.format("/data/app/%s-%s.apk", packageName, 1); 30 | if (!new File(filePath).exists()) { 31 | filePath = String.format("/data/app/%s-%s.apk", packageName, 2); 32 | if (!new File(filePath).exists()) { 33 | filePath = String.format("/data/app/%s-%s/base.apk", packageName, 1); 34 | if (!new File(filePath).exists()) { 35 | filePath = String.format("/data/app/%s-%s/base.apk", packageName, 2); 36 | if (!new File(filePath).exists()) { 37 | XposedBridge.log("lxb-Error:在/data/app找不到APK文件" + packageName); 38 | return; 39 | } 40 | } 41 | } 42 | } 43 | final PathClassLoader pathClassLoader = new PathClassLoader(filePath, ClassLoader.getSystemClassLoader()); 44 | final Class aClass = Class.forName(packageName + "." + MainModule.class.getSimpleName(), true, pathClassLoader); 45 | final Method aClassMethod = aClass.getMethod("handle", XC_LoadPackage.LoadPackageParam.class); 46 | aClassMethod.invoke(aClass.newInstance(), param); 47 | 48 | LogUtil.d("pkg:"+param.packageName); 49 | }else { 50 | Log.d(TAG, "not hot fix - >handleLoadPackage: " + param.packageName); 51 | MainModule module = new MainModule(); 52 | try { 53 | module.handleMyHandleLoadPackage(param); 54 | } catch (ClassNotFoundException e) { 55 | Log.e(TAG, "handleLoadPackage: "+ e.getMessage()); 56 | } 57 | } 58 | 59 | 60 | 61 | } 62 | 63 | } 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 19 | 24 | 25 | 36 | 37 | 49 | 50 | 51 | 52 | 58 | 59 | 70 | 71 | 72 |