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
Change-Id: I3af80b6b3ae3df31ed0f844535793b5fbe4bbc7e
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f118133..d06d929 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(