Loading tests/telephonytests/src/com/android/internal/telephony/PhoneSubInfoControllerTest.java +6 −1 Original line number Diff line number Diff line Loading @@ -230,7 +230,12 @@ public class PhoneSubInfoControllerTest extends TelephonyTest { @Test @SmallTest @EnableCompatChanges({TelephonyManager.ENABLE_FEATURE_MAPPING}) public void testGetNai_EnabledEnforceTelephonyFeatureMappingForPublicApis() { public void testGetNai_EnabledEnforceTelephonyFeatureMappingForPublicApis() throws Exception { // Replace field to set SDK version of vendor partition to Android V int vendorApiLevel = Build.VERSION_CODES.VANILLA_ICE_CREAM; replaceInstance(PhoneSubInfoController.class, "mVendorApiLevel", mPhoneSubInfoControllerUT, vendorApiLevel); // FeatureFlags enabled, System has required feature doReturn(true).when(mFeatureFlags).enforceTelephonyFeatureMappingForPublicApis(); doReturn(true).when(mPm).hasSystemFeature( Loading tests/telephonytests/src/com/android/internal/telephony/SmsControllerTest.java +6 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import static org.mockito.Mockito.verify; import android.compat.testing.PlatformCompatChangeRule; import android.content.pm.PackageManager; import android.os.Build; import android.telephony.TelephonyManager; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; Loading Loading @@ -295,11 +296,15 @@ public class SmsControllerTest extends TelephonyTest { @Test @EnableCompatChanges({TelephonyManager.ENABLE_FEATURE_MAPPING}) public void sendTextForSubscriberTestEnabledTelephonyFeature() { public void sendTextForSubscriberTestEnabledTelephonyFeature() throws Exception { int subId = 1; doReturn(true).when(mSubscriptionManager) .isSubscriptionAssociatedWithUser(eq(subId), any()); // Replace field to set SDK version of vendor partition to Android V int vendorApiLevel = Build.VERSION_CODES.VANILLA_ICE_CREAM; replaceInstance(SmsController.class, "mVendorApiLevel", mSmsControllerUT, vendorApiLevel); // Feature enabled, device does not have required telephony feature. doReturn(true).when(mFeatureFlags).enforceTelephonyFeatureMappingForPublicApis(); doReturn(false).when(mPackageManager).hasSystemFeature( Loading tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +7 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.Signature; import android.os.Build; import android.os.Parcelable; import android.os.RemoteException; import android.os.UserManager; Loading Loading @@ -1682,7 +1683,12 @@ public class EuiccControllerTest extends TelephonyTest { @Test @EnableCompatChanges({EuiccManager.INACTIVE_PORT_AVAILABILITY_CHECK, TelephonyManager.ENABLE_FEATURE_MAPPING}) public void testIsSimPortAvailable_WithTelephonyFeatureMapping() { public void testIsSimPortAvailable_WithTelephonyFeatureMapping() throws Exception { // Replace field to set SDK version of vendor partition to Android V int vendorApiLevel = Build.VERSION_CODES.VANILLA_ICE_CREAM; replaceInstance(EuiccController.class, "mVendorApiLevel", (EuiccController) mController, vendorApiLevel); // Feature flag enabled, device has required telephony feature. doReturn(true).when(mFeatureFlags).enforceTelephonyFeatureMappingForPublicApis(); doReturn(true).when(mPackageManager).hasSystemFeature( Loading tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionManagerServiceTest.java +7 −1 Original line number Diff line number Diff line Loading @@ -497,7 +497,8 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { @Test @EnableCompatChanges({TelephonyManager.ENABLE_FEATURE_MAPPING}) public void testSetPhoneNumber_EnabledEnforceTelephonyFeatureMappingForPublicApis() { public void testSetPhoneNumber_EnabledEnforceTelephonyFeatureMappingForPublicApis() throws Exception { mContextFixture.addCallingOrSelfPermission(Manifest.permission.MODIFY_PHONE_STATE); mSubscriptionManagerServiceUT.addSubInfo(FAKE_ICCID1, FAKE_CARRIER_NAME1, 0, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); Loading @@ -509,6 +510,11 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { // Grant carrier privilege setCarrierPrivilegesForSubId(true, 1); // Replace field to set SDK version of vendor partition to Android V int vendorApiLevel = Build.VERSION_CODES.VANILLA_ICE_CREAM; replaceInstance(SubscriptionManagerService.class, "mVendorApiLevel", mSubscriptionManagerServiceUT, vendorApiLevel); // Enabled FeatureFlags and ENABLE_FEATURE_MAPPING, telephony features are defined doReturn(true).when(mFlags).enforceTelephonyFeatureMappingForPublicApis(); doReturn(true).when(mPackageManager).hasSystemFeature( Loading Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneSubInfoControllerTest.java +6 −1 Original line number Diff line number Diff line Loading @@ -230,7 +230,12 @@ public class PhoneSubInfoControllerTest extends TelephonyTest { @Test @SmallTest @EnableCompatChanges({TelephonyManager.ENABLE_FEATURE_MAPPING}) public void testGetNai_EnabledEnforceTelephonyFeatureMappingForPublicApis() { public void testGetNai_EnabledEnforceTelephonyFeatureMappingForPublicApis() throws Exception { // Replace field to set SDK version of vendor partition to Android V int vendorApiLevel = Build.VERSION_CODES.VANILLA_ICE_CREAM; replaceInstance(PhoneSubInfoController.class, "mVendorApiLevel", mPhoneSubInfoControllerUT, vendorApiLevel); // FeatureFlags enabled, System has required feature doReturn(true).when(mFeatureFlags).enforceTelephonyFeatureMappingForPublicApis(); doReturn(true).when(mPm).hasSystemFeature( Loading
tests/telephonytests/src/com/android/internal/telephony/SmsControllerTest.java +6 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import static org.mockito.Mockito.verify; import android.compat.testing.PlatformCompatChangeRule; import android.content.pm.PackageManager; import android.os.Build; import android.telephony.TelephonyManager; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; Loading Loading @@ -295,11 +296,15 @@ public class SmsControllerTest extends TelephonyTest { @Test @EnableCompatChanges({TelephonyManager.ENABLE_FEATURE_MAPPING}) public void sendTextForSubscriberTestEnabledTelephonyFeature() { public void sendTextForSubscriberTestEnabledTelephonyFeature() throws Exception { int subId = 1; doReturn(true).when(mSubscriptionManager) .isSubscriptionAssociatedWithUser(eq(subId), any()); // Replace field to set SDK version of vendor partition to Android V int vendorApiLevel = Build.VERSION_CODES.VANILLA_ICE_CREAM; replaceInstance(SmsController.class, "mVendorApiLevel", mSmsControllerUT, vendorApiLevel); // Feature enabled, device does not have required telephony feature. doReturn(true).when(mFeatureFlags).enforceTelephonyFeatureMappingForPublicApis(); doReturn(false).when(mPackageManager).hasSystemFeature( Loading
tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +7 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.Signature; import android.os.Build; import android.os.Parcelable; import android.os.RemoteException; import android.os.UserManager; Loading Loading @@ -1682,7 +1683,12 @@ public class EuiccControllerTest extends TelephonyTest { @Test @EnableCompatChanges({EuiccManager.INACTIVE_PORT_AVAILABILITY_CHECK, TelephonyManager.ENABLE_FEATURE_MAPPING}) public void testIsSimPortAvailable_WithTelephonyFeatureMapping() { public void testIsSimPortAvailable_WithTelephonyFeatureMapping() throws Exception { // Replace field to set SDK version of vendor partition to Android V int vendorApiLevel = Build.VERSION_CODES.VANILLA_ICE_CREAM; replaceInstance(EuiccController.class, "mVendorApiLevel", (EuiccController) mController, vendorApiLevel); // Feature flag enabled, device has required telephony feature. doReturn(true).when(mFeatureFlags).enforceTelephonyFeatureMappingForPublicApis(); doReturn(true).when(mPackageManager).hasSystemFeature( Loading
tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionManagerServiceTest.java +7 −1 Original line number Diff line number Diff line Loading @@ -497,7 +497,8 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { @Test @EnableCompatChanges({TelephonyManager.ENABLE_FEATURE_MAPPING}) public void testSetPhoneNumber_EnabledEnforceTelephonyFeatureMappingForPublicApis() { public void testSetPhoneNumber_EnabledEnforceTelephonyFeatureMappingForPublicApis() throws Exception { mContextFixture.addCallingOrSelfPermission(Manifest.permission.MODIFY_PHONE_STATE); mSubscriptionManagerServiceUT.addSubInfo(FAKE_ICCID1, FAKE_CARRIER_NAME1, 0, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); Loading @@ -509,6 +510,11 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { // Grant carrier privilege setCarrierPrivilegesForSubId(true, 1); // Replace field to set SDK version of vendor partition to Android V int vendorApiLevel = Build.VERSION_CODES.VANILLA_ICE_CREAM; replaceInstance(SubscriptionManagerService.class, "mVendorApiLevel", mSubscriptionManagerServiceUT, vendorApiLevel); // Enabled FeatureFlags and ENABLE_FEATURE_MAPPING, telephony features are defined doReturn(true).when(mFlags).enforceTelephonyFeatureMappingForPublicApis(); doReturn(true).when(mPackageManager).hasSystemFeature( Loading