Skip to content

Commit fe4387b

Browse files
committed
Dialer: fixed call recording for 3T OOS beta 28
1 parent 4fac1bb commit fe4387b

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/com/ceco/oreo/gravitybox/ModDialerOOS.java

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,20 @@ public class ModDialerOOS {
2929
private static final String TAG = "GB:ModDialerOOS";
3030
private static final boolean DEBUG = false;
3131

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+
}
3640

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 */
3946
};
4047

4148
private static void log(String message) {
@@ -50,16 +57,15 @@ public static void initInCallUi(final XSharedPreferences prefs, final ClassLoade
5057
mPrefs = prefs;
5158

5259
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);
5562
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;
6369
}
6470
}
6571
}

0 commit comments

Comments
 (0)