Skip to content

Commit

Permalink
录音
Browse files Browse the repository at this point in the history
  • Loading branch information
247321453 committed Oct 23, 2016
1 parent 1b56d48 commit 423eb77
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,45 @@

/**
* @author Lody
*
*
* @see android.os.Vibrator
*/
public class VibratorPatch extends PatchDelegate<VibratorBinderDelegate> {

@Override
protected VibratorBinderDelegate createHookDelegate() {
return new VibratorBinderDelegate();
}

@Override
public void inject() throws Throwable {
getHookDelegate().replaceService(Context.VIBRATOR_SERVICE);
}

@Override
protected void onBindHooks() {
addHook(new ReplaceCallingPkgHook("vibrate"));
addHook(new ReplaceCallingPkgHook("vibratePattern") {
@Override
public boolean beforeCall(Object who, Method method, Object... args) {
args[0] = getRealUid();
return super.beforeCall(who, method, args);
}
});
}

@Override
public boolean isEnvBad() {
return getHookDelegate() != ServiceManager.getService.call(Context.VIBRATOR_SERVICE);
}
@Override
protected VibratorBinderDelegate createHookDelegate() {
return new VibratorBinderDelegate();
}

@Override
public void inject() throws Throwable {
getHookDelegate().replaceService(Context.VIBRATOR_SERVICE);
}

@Override
protected void onBindHooks() {
addHook(new ReplaceCallingPkgHook("vibrate") {
@Override
public boolean beforeCall(Object who, Method method, Object... args) {
if (args[0] instanceof Integer) {
args[0] = getRealUid();
}
return super.beforeCall(who, method, args);
}
});
addHook(new ReplaceCallingPkgHook("vibratePattern") {
@Override
public boolean beforeCall(Object who, Method method, Object... args) {
if (args[0] instanceof Integer) {
args[0] = getRealUid();
}
return super.beforeCall(who, method, args);
}
});
}

@Override
public boolean isEnvBad() {
return getHookDelegate() != ServiceManager.getService.call(Context.VIBRATOR_SERVICE);
}

}
2 changes: 2 additions & 0 deletions VirtualApp/lib/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<resources>
<string name="virtual_installer">VirtualPackage Installer</string>
<string name="owner_name">Admin</string>
<string name="choose">Choose</string>
<string name="choose_empty">Chooser is Empty</string>
</resources>

0 comments on commit 423eb77

Please sign in to comment.