-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
283c0f7
commit f05862f
Showing
6 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
me.aap.fermata.auto.Xposed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package me.aap.fermata.auto; | ||
|
||
import static de.robv.android.xposed.XposedBridge.log; | ||
|
||
import android.content.pm.InstallSourceInfo; | ||
import android.content.pm.PackageManager; | ||
import android.os.Build; | ||
|
||
import de.robv.android.xposed.IXposedHookLoadPackage; | ||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedHelpers; | ||
import de.robv.android.xposed.callbacks.XC_LoadPackage; | ||
|
||
/** | ||
* @author Andrey Pavlenko | ||
*/ | ||
public class Xposed implements IXposedHookLoadPackage { | ||
private static final String AA_PKG = "com.google.android.projection.gearhead"; | ||
private static final String GPLAY_PKG = "com.android.vending"; | ||
|
||
@Override | ||
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) { | ||
if (!AA_PKG.equals(lpparam.packageName)) return; | ||
log("Hooking package " + AA_PKG); | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||
XposedHelpers.findAndHookMethod(InstallSourceInfo.class, "getInitiatingPackageName", new XC_MethodHook() { | ||
|
||
@Override | ||
protected void afterHookedMethod(MethodHookParam param) { | ||
param.setResult(GPLAY_PKG); | ||
} | ||
}); | ||
} else { | ||
XposedHelpers.findAndHookMethod(PackageManager.class, "getInstallerPackageName", new XC_MethodHook() { | ||
@Override | ||
protected void afterHookedMethod(MethodHookParam param) { | ||
param.setResult(GPLAY_PKG); | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string-array name="xposedscope"> | ||
<item>com.google.android.projection.gearhead</item> | ||
</string-array> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters