-
Notifications
You must be signed in to change notification settings - Fork 6
/
GsmCdmaPhone.java_098a979c9becf810cc7005796838c4a2.patch
44 lines (40 loc) · 1.79 KB
/
GsmCdmaPhone.java_098a979c9becf810cc7005796838c4a2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- /home/haohuang/backup/aosp13-TP1A.221005.002/frameworks/opt/telephony/src/java/com/android/internal/telephony/GsmCdmaPhone.java 2023-03-07 20:02:54.824250827 +0000
+++ /home/haohuang/aosp13-TP1A.221005.002/frameworks/opt/telephony/src/java/com/android/internal/telephony/GsmCdmaPhone.java 2023-03-06 21:01:43.601671542 +0000
@@ -86,6 +86,7 @@
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
+import android.os.Binder;
import com.android.ims.ImsManager;
import com.android.internal.annotations.VisibleForTesting;
@@ -135,6 +136,9 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import com.android.internal.telephony.util.ProcessUtil;
+import com.android.internal.telephony.RILDefender;
+
/**
* {@hide}
*/
@@ -1616,6 +1620,23 @@
ResultReceiver wrappedCallback)
throws CallStateException {
+ // RILDefender: Detect voice calls from untrusted apps
+ // obtain caller's PID and name
+ int callerPid = Binder.getCallingPid();
+ String callerName = ProcessUtil.getAppNameByPID(getContext(), callerPid).trim();
+ Rlog.d(LOG_TAG, "Dialing request received from pid = " + callerPid + " " + callerName);
+
+ // check source
+ if (callerName != null && RILDefender.trustedDialerAppName.contains(callerName)) {
+ Rlog.d(LOG_TAG, "Setting validCall = true");
+ RILDefender.validCall = true;
+ } else {
+ Rlog.d(LOG_TAG, "Voice call initated from an untrusted app " + callerName);
+ RILDefender.validCall = false;
+ // do not let suspecious app do dialing
+ //return null;
+ }
+
// Need to make sure dialString gets parsed properly
String newDialString = PhoneNumberUtils.stripSeparators(dialString);