Skip to content

Commit

Permalink
fix isEnabled() hook on LOS 20
Browse files Browse the repository at this point in the history
Signed-off-by: Tommy Alex <iptux7@gmail.com>
  • Loading branch information
iptux committed Jan 8, 2023
1 parent 79f3613 commit bcab21a
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ void hookDialer(LoadPackageParam lpparam) throws Throwable {
callButtonFragment = CALL_BUTTON_FRAGMENT;
}

findAndHookMethod(callRecordingServiceName, lpparam.classLoader, "isEnabled", Context.class, new IsEnabledHook());
try {
findAndHookMethod(callRecordingServiceName, lpparam.classLoader, "isEnabled", Context.class, new IsEnabledHook());
} catch (Throwable e) {
// CallRecorderService.isEnabled(context) may get inlined and not present
}

try {
findAndHookMethod(callRecordingListener, lpparam.classLoader, "isEnabled", new IsEnabledHook());
} catch (Throwable e) {
// instead, try to hook CallRecorder.isEnabled()
}

try {
// This method is used in place of isEnabled in later versions
Expand Down

0 comments on commit bcab21a

Please # to comment.