Skip to content

Commit

Permalink
再再次修改了应用选择器的原理,以便兼容MIUI android 7.0+,这次应该真真兼容了
Browse files Browse the repository at this point in the history
AppSelector now use MemoryFile, compatible with MIUI android 7.0+
  • Loading branch information
monkeylord committed Dec 29, 2018
1 parent ddc8f1a commit 40cd02a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/monkeylord/XServer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void onClick(View view) {
"XServer will listen on 2 ports when target app start: 8000 and PID \n" +
"To connect XServer, ADB command can be used like:\n" +
" adb forward tcp:8000 tcp:8000\n" +
"Or" +
" adb forward tcp:8000 tcp:[PID]\n" +
"Then you can open http://127.0.0.1:8000 in browser to interact with XServer");
tips.setTextSize(15f);
Expand Down
13 changes: 9 additions & 4 deletions app/src/main/java/monkeylord/XServer/XposedEntry.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package monkeylord.XServer;

import android.content.BroadcastReceiver;
import android.content.pm.ApplicationInfo;
import android.content.res.XModuleResources;
import android.os.MemoryFile;
Expand Down Expand Up @@ -48,7 +49,7 @@ public class XposedEntry implements IXposedHookLoadPackage, IXposedHookZygoteIni
public static XModuleResources res;
static File sharedFile;
static MemoryFile memFile;
String targetApp = new XSharedPreferences(this.getClass().getPackage().getName().toLowerCase(), "XServer").getString("targetApp", "monkeylord.demoapp");
String targetApp = new XSharedPreferences(this.getClass().getPackage().getName().toLowerCase(), "XServer").getString("targetApp", "MadMode");
String packageName;
Boolean isFirstApplication;
String processName;
Expand All @@ -66,8 +67,12 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
if(loadPackageParam.packageName.equals("android")){
//systemServer();
return;
}else targetApp=new netUtil("http://127.0.0.1:7999/","",null).getRet();
//XposedBridge.log(targetApp);
}else {
String App=new netUtil("http://127.0.0.1:7999/","",null).getRet();
if(App.length()>0)targetApp=App;
}
XposedBridge.log("[XServer Debug]:ThisApp->"+loadPackageParam.packageName);
XposedBridge.log("[XServer Debug]:TargetApp->"+targetApp);
//刷新目标APP名称
//从共享文件中刷新目标APP名称(For Android 7.0, MIUI not compatible, sad...)
/*
Expand All @@ -79,7 +84,7 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
//targetApp=new BufferedReader(new FileReader(sharedFile)).readLine();
//从XPreferences中刷新目标APP名称(Unavailable in Android 7.0)
//targetApp = new XSharedPreferences(this.getClass().getPackage().getName().toLowerCase(), "XServer").getString("targetApp", "monkeylord.demoapp");
if (!loadPackageParam.packageName.equals(targetApp)) return;
if (!targetApp.equals("MadMode")&&!loadPackageParam.packageName.equals(targetApp)) return;
gatherInfo(loadPackageParam);
//启动XServer
new XServer(8000);
Expand Down

0 comments on commit 40cd02a

Please sign in to comment.