-
Notifications
You must be signed in to change notification settings - Fork 7
/
GsmCdmaPhone.java_e002658140004c67f46d4bdc38209b0b.patch
43 lines (39 loc) · 1.92 KB
/
GsmCdmaPhone.java_e002658140004c67f46d4bdc38209b0b.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
--- /home/haohuang/backup/aosp10-QP1A.190711.019/frameworks/opt/telephony/src/java/com/android/internal/telephony/GsmCdmaPhone.java 2023-02-17 21:57:22.093245977 +0000
+++ /home/haohuang/aosp10-QP1A.190711.019/frameworks/opt/telephony/src/java/com/android/internal/telephony/GsmCdmaPhone.java 2023-02-17 18:52:07.181992361 +0000
@@ -73,6 +73,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;
@@ -99,6 +100,8 @@
import com.android.internal.telephony.uicc.UiccProfile;
import com.android.internal.telephony.uicc.UiccSlot;
import com.android.internal.util.ArrayUtils;
+import com.android.internal.telephony.util.ProcessUtil;
+import com.android.internal.telephony.RILDefender;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -1326,6 +1329,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);