-
Notifications
You must be signed in to change notification settings - Fork 183
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
Showing
7 changed files
with
66 additions
and
3 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
44 changes: 44 additions & 0 deletions
44
...src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/DisablePersistent.java
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,44 @@ | ||
package com.sevtinge.hyperceiler.module.hook.systemframework; | ||
|
||
import com.hchen.hooktool.callback.IAction; | ||
import com.hchen.hooktool.tool.ParamTool; | ||
import com.sevtinge.hyperceiler.module.base.BaseTool; | ||
|
||
public class DisablePersistent extends BaseTool { | ||
private boolean isInstall = false; | ||
|
||
@Override | ||
public void doHook() { | ||
hcHook.findClass("pl", "com.android.server.pm.parsing.pkg.PackageImpl") | ||
.getMethod("isPersistent") | ||
.hook(new IAction() { | ||
@Override | ||
public void after(ParamTool param) { | ||
// String pkg = param.getField("packageName"); | ||
boolean isPersistent = param.getResult(); | ||
if (isPersistent) { | ||
if (isInstall) { | ||
param.setResult(false); | ||
} | ||
} | ||
// logI(TAG, "pkg: " + pkg + " isPersistent: " + param.getResult()); | ||
} | ||
}) | ||
.findClass("iph", "com.android.server.pm.InstallPackageHelper") | ||
.getMethod("preparePackageLI", "com.android.server.pm.InstallRequest") | ||
.hook(new IAction() { | ||
@Override | ||
public void before(ParamTool param) { | ||
isInstall = true; | ||
// logI(TAG, "start install: " + param.first()); | ||
} | ||
|
||
@Override | ||
public void after(ParamTool param) { | ||
isInstall = false; | ||
// logI(TAG, "end install: " + param.first()); | ||
} | ||
}) | ||
; | ||
} | ||
} |
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
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