Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

适配LSPosed #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions FakeGapps.iml

This file was deleted.

101 changes: 0 additions & 101 deletions app/app.iml

This file was deleted.

18 changes: 13 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
compileSdkVersion 32

signingConfigs {
TIIEHenry {
keyAlias rootProject.ext.keyAlias
storeFile rootProject.ext.storeFile
storePassword rootProject.ext.storePassword
keyPassword rootProject.ext.keyPassword
}
}
defaultConfig {
applicationId "com.thermatk.android.xf.fakegapps"
minSdkVersion 15
targetSdkVersion 25
versionCode 3
versionName "2.0"
minSdkVersion 21
targetSdkVersion 32
versionCode 4
versionName "2.1"
}
buildTypes {
release {
Expand Down
Binary file added app/release/app-release.apk
Binary file not shown.
20 changes: 20 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.thermatk.android.xf.fakegapps",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 4,
"versionName": "2.1",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}
37 changes: 23 additions & 14 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thermatk.android.xf.fakegapps">

<application android:allowBackup="true" android:label="FakeGapps"
android:icon="@mipmap/ic_launcher" android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="MicroG fake signature helper" />
<meta-data
android:name="xposedminversion"
android:value="54" />
</application>
package="com.thermatk.android.xf.fakegapps">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="FakeGapps"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="MicroG fake signature helper" />
<meta-data
android:name="xposedminversion"
android:value="54" />
<meta-data
android:name="xposedscope"
android:resource="@array/xposed_scope" />
<meta-data
android:name="xposed_init"
android:value="@array/xposed_init" />
</application>

</manifest>
53 changes: 20 additions & 33 deletions app/src/main/java/com/android/server/PackageNameService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,30 @@ public class PackageNameService extends IPackageNameService.Stub {
private final Context context;

public static void inject() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
XposedBridge.hookAllMethods(XposedHelpers.findClass("android.app.ActivityThread", null),
"systemMain",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
XposedBridge.hookAllMethods(XposedHelpers.findClass("android.app.ActivityThread", null),
"systemMain",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();

XposedBridge.hookAllMethods(
XposedHelpers.findClass("com.android.server.am.ActivityManagerService", loader),
"setSystemProcess",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) {
try {
register(getContext(param.thisObject));
} catch (Throwable ex) {
XposedBridge.log("FakeGApps: Adding the package name service failed.");
}
XposedBridge.hookAllMethods(
XposedHelpers.findClass("com.android.server.am.ActivityManagerService", loader),
"setSystemProcess",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) {
try {
register(getContext(param.thisObject));
} catch (Throwable ex) {
XposedBridge.log("FakeGApps: Adding the package name service failed.");
}
}
);
}
}
);
}
);
} else {
XposedBridge.hookAllMethods(
XposedHelpers.findClass("com.android.server.am.ActivityManagerService", null),
"main",
new XC_MethodHook() {
@Override
protected final void afterHookedMethod(final MethodHookParam param) {
register((Context) param.getResult());
}
}
);
}
}
);
}

private static void register(Context context) {
Expand Down
Loading