fix the issue that clearCallingIdentity before appops check
we should restore CallingIndentity when do the appops check for
access device/subscriber identifier
Bug: 187147737
Bug: 183612370
Test: Manual test
Change-Id: Id0abfee602823f56811799a6d5c2bbe8cd5e2cc1
(cherry picked from commit 020d831ced2393aca3b51eb2a9fb805f5757fd87)
Merged-in: Id0abfee602823f56811799a6d5c2bbe8cd5e2cc1
(cherry picked from commit 5fc2375db75129ac458a618c35ede8fb045976c4)
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
index 8a03431..42d9186 100644
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
@@ -887,22 +887,22 @@
// Now that all security checks passes, perform the operation as ourselves.
final long identity = Binder.clearCallingIdentity();
+ List<SubscriptionInfo> subList;
try {
- List<SubscriptionInfo> subList = null;
subList = getSubInfo(null, null);
- if (subList != null) {
- if (VDBG) logd("[getAllSubInfoList]- " + subList.size() + " infos return");
- subList.stream().map(
- subscriptionInfo -> conditionallyRemoveIdentifiers(subscriptionInfo,
- callingPackage, callingFeatureId, "getAllSubInfoList"))
- .collect(Collectors.toList());
- } else {
- if (VDBG) logd("[getAllSubInfoList]- no info return");
- }
- return subList;
} finally {
Binder.restoreCallingIdentity(identity);
}
+ if (subList != null) {
+ if (VDBG) logd("[getAllSubInfoList]- " + subList.size() + " infos return");
+ subList.stream().map(
+ subscriptionInfo -> conditionallyRemoveIdentifiers(subscriptionInfo,
+ callingPackage, callingFeatureId, "getAllSubInfoList"))
+ .collect(Collectors.toList());
+ } else {
+ if (VDBG) logd("[getAllSubInfoList]- no info return");
+ }
+ return subList;
}
private List<SubscriptionInfo> makeCacheListCopyWithLock(List<SubscriptionInfo> cacheSubList) {