New method that supports CTS test case to check the file contents remains unaltered.
Bug: 276402673
Test: atest tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java#testCarrierRestrictionStatusAllowList also pformed the sanity and all the basic scenarios are working fine.
Change-Id: I2918dd7deeb5f400a164295ed201093c7809ca08
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2a27bb8..d9dd3bf 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -8671,6 +8671,13 @@
}
}
+ @Override
+ public List<String> getShaIdFromAllowList(String pkgName, int carrierId) {
+ enforceReadPrivilegedPermission("checkCarrierRestrictionFileForNoChange");
+ CarrierAllowListInfo allowListInfo = CarrierAllowListInfo.loadInstance(mApp);
+ return allowListInfo.getShaIdList(pkgName, carrierId);
+ }
+
@VisibleForTesting
public int validateCallerAndGetCarrierId(String packageName) {
CarrierAllowListInfo allowListInfo = CarrierAllowListInfo.loadInstance(mApp);
diff --git a/src/com/android/phone/utils/CarrierAllowListInfo.java b/src/com/android/phone/utils/CarrierAllowListInfo.java
index 208eff3..8e22cb9 100644
--- a/src/com/android/phone/utils/CarrierAllowListInfo.java
+++ b/src/com/android/phone/utils/CarrierAllowListInfo.java
@@ -16,12 +16,14 @@
package com.android.phone.utils;
+import android.annotation.TestApi;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.telephony.Rlog;
import android.text.TextUtils;
+import android.util.Log;
import com.android.internal.telephony.uicc.IccUtils;
@@ -34,7 +36,9 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.Set;
public class CarrierAllowListInfo {
@@ -195,4 +199,14 @@
return mSHAIdList;
}
}
+
+ @TestApi
+ public List<String> getShaIdList(String srcPkg, int carrierId) {
+ CarrierInfo carrierInfo = parseJsonForCallerInfo(srcPkg);
+ if (carrierInfo != null && carrierInfo.getCallerCarrierId() == carrierId) {
+ return carrierInfo.getSHAIdList();
+ }
+ Rlog.e(LOG_TAG, "getShaIdList carrierId or shaIdList is empty");
+ return Collections.EMPTY_LIST;
+ }
}