Clear the caller identity after the permission is verified
For the method requestNetworkScan(...), the caller identity was cleared
after verifying the permission in aosp/722888, but in a later cl
aosp/836166, this logic was removed which is causing issues.
Bug: 128480460
Test: manual test
Merged-In: I1f145e7e63cd7c366f51710896cdd02b0df410ab
Change-Id: I1f145e7e63cd7c366f51710896cdd02b0df410ab
(cherry picked from commit 4bf8f4ed4136ef7346dc349abbad3ef75eb08224)
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 6b5319d..08936f0 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -4448,9 +4448,14 @@
}
}
}
- return mNetworkScanRequestTracker.startNetworkScan(
- request, messenger, binder, getPhone(subId),
- callingPackage);
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return mNetworkScanRequestTracker.startNetworkScan(
+ request, messenger, binder, getPhone(subId),
+ callingPackage);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
}
private SecurityException checkNetworkRequestForSanitizedLocationAccess(