Merge branch 'security-aosp-qt-release' into int/10/fp2

* security-aosp-qt-release:
  filter deviceIdentifiers for subscriptionInfo if callers without perm

Change-Id: I6ee05b7810a03ac5b13285bdb7bbe43175a73998
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
index 784300c..eefdc9f 100644
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
@@ -692,6 +692,19 @@
      */
     @Override
     public List<SubscriptionInfo> getAllSubInfoList(String callingPackage) {
+        return getAllSubInfoList(callingPackage, false);
+    }
+
+    /**
+     * @param callingPackage The package making the IPC.
+     * @param callingFeatureId The feature in the package
+     * @param skipConditionallyRemoveIdentifier if set, skip removing identifier conditionally
+     * @return List of all SubscriptionInfo records in database,
+     * include those that were inserted before, maybe empty but not null.
+     * @hide
+     */
+    public List<SubscriptionInfo> getAllSubInfoList(String callingPackage,
+            boolean skipConditionallyRemoveIdentifier) {
         if (VDBG) logd("[getAllSubInfoList]+");
 
         // This API isn't public, so no need to provide a valid subscription ID - we're not worried
@@ -710,9 +723,9 @@
         } finally {
             Binder.restoreCallingIdentity(identity);
         }
-        if (subList != null) {
+        if (subList != null && !skipConditionallyRemoveIdentifier) {
             if (VDBG) logd("[getAllSubInfoList]- " + subList.size() + " infos return");
-            subList.stream().map(
+            subList = subList.stream().map(
                     subscriptionInfo -> conditionallyRemoveIdentifiers(subscriptionInfo,
                             callingPackage, "getAllSubInfoList"))
                     .collect(Collectors.toList());
@@ -3357,7 +3370,9 @@
         List<SubscriptionInfo> subInfoList;
 
         try {
-            subInfoList = getAllSubInfoList(mContext.getOpPackageName());
+            // need to bypass removing identifier check because that will remove the subList without
+            // group id.
+            subInfoList = getAllSubInfoList(mContext.getOpPackageName(), true);
             if (groupUuid == null || subInfoList == null || subInfoList.isEmpty()) {
                 return new ArrayList<>();
             }