@@ -29,13 +29,20 @@ public class ModDialerOOS {
29
29
private static final String TAG = "GB:ModDialerOOS" ;
30
30
private static final boolean DEBUG = false ;
31
31
32
- private static final String [] CLASS_PHONE_UTILS = new String [] {
33
- "com.android.incallui.oneplus.OPPhoneUtils" , "com.android.incallui.oneplus.s" ,
34
- "com.android.incallui.oneplus.f"
35
- };
32
+ private static class CallRecordingInfo {
33
+ String className ;
34
+ String methodName ;
35
+ CallRecordingInfo (String cn , String mn ) {
36
+ className = cn ;
37
+ methodName = mn ;
38
+ }
39
+ }
36
40
37
- private static final String [] METHOD_SUPPORTS_CALL_RECORDING = new String [] {
38
- "isSupportCallRecorder" , "AN" , "SI"
41
+ private static final CallRecordingInfo [] CALL_RECORDING_INFO = new CallRecordingInfo [] {
42
+ new CallRecordingInfo ("com.android.incallui.oneplus.r" , "Om" ), /* OP3T Beta 28 */
43
+ new CallRecordingInfo ("com.android.incallui.oneplus.f" , "SI" ), /* OP5T Beta 8 */
44
+ new CallRecordingInfo ("com.android.incallui.oneplus.s" , "AN" ), /* OP3T Beta 27 */
45
+ new CallRecordingInfo ("com.android.incallui.oneplus.OPPhoneUtils" , "isSupportCallRecorder" ) /* OOS 5.0.2 */
39
46
};
40
47
41
48
private static void log (String message ) {
@@ -50,16 +57,15 @@ public static void initInCallUi(final XSharedPreferences prefs, final ClassLoade
50
57
mPrefs = prefs ;
51
58
52
59
Method method = null ;
53
- for (String cName : CLASS_PHONE_UTILS ) {
54
- Class <?> clazz = XposedHelpers .findClassIfExists (cName , classLoader );
60
+ for (CallRecordingInfo crInfo : CALL_RECORDING_INFO ) {
61
+ Class <?> clazz = XposedHelpers .findClassIfExists (crInfo . className , classLoader );
55
62
if (clazz != null ) {
56
- for (String mName : METHOD_SUPPORTS_CALL_RECORDING ) {
57
- method = XposedHelpers .findMethodExactIfExists (
58
- cName , classLoader , mName , Context .class );
59
- if (method != null ) {
60
- XposedBridge .hookMethod (method , supportsCallRecordingHook );
61
- if (DEBUG ) log ("isSupportCallRecorder found in " + cName + " as " + mName );
62
- }
63
+ method = XposedHelpers .findMethodExactIfExists (
64
+ clazz , crInfo .methodName , Context .class );
65
+ if (method != null ) {
66
+ XposedBridge .hookMethod (method , supportsCallRecordingHook );
67
+ if (DEBUG ) log ("isSupportCallRecorder found in " + crInfo .className + " as " + crInfo .methodName );
68
+ break ;
63
69
}
64
70
}
65
71
}
0 commit comments