Loading tests/telephonytests/src/com/android/internal/telephony/PhoneSubInfoControllerTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import static android.Manifest.permission.READ_SMS; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.doReturn; Loading Loading @@ -60,7 +59,7 @@ public class PhoneSubInfoControllerTest extends TelephonyTest { doReturn(true).when(mSubscriptionController).isActiveSubId(0, TAG, FEATURE_ID); doReturn(true).when(mSubscriptionController).isActiveSubId(1, TAG, FEATURE_ID); doReturn(new int[]{0, 1}).when(mSubscriptionManager) .getActiveSubscriptionIdList(anyBoolean()); .getCompleteActiveSubscriptionIdList(); mServiceManagerMockedServices.put("isub", mSubscriptionController); doReturn(mSubscriptionController).when(mSubscriptionController) Loading tests/telephonytests/src/com/android/internal/telephony/TelephonyPermissionsTest.java +7 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; Loading Loading @@ -105,7 +104,7 @@ public class TelephonyPermissionsTest { mMockSubscriptionManager); when(mMockContext.getSystemService(Context.DEVICE_POLICY_SERVICE)).thenReturn( mMockDevicePolicyManager); when(mMockSubscriptionManager.getActiveSubscriptionIdList(anyBoolean())).thenReturn( when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[] {SUB_ID}); // By default, assume we have no permissions or app-ops bits. Loading Loading @@ -354,7 +353,7 @@ public class TelephonyPermissionsTest { @Test public void testCheckReadDeviceIdentifiers_hasCarrierPrivilegesOnOtherSubscription() throws Exception { when(mMockSubscriptionManager.getActiveSubscriptionIdList(anyBoolean())).thenReturn( when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[]{SUB_ID, SUB_ID_2}); when(mTelephonyManagerMock.createForSubscriptionId(eq(SUB_ID_2))).thenReturn( mTelephonyManagerMockForSub2); Loading @@ -368,9 +367,7 @@ public class TelephonyPermissionsTest { @Test public void testCheckReadDeviceIdentifiers_hasCarrierPrivilegesOnInvisibleSubscription() throws Exception { when(mMockSubscriptionManager.getActiveSubscriptionIdList(true)).thenReturn( new int[]{SUB_ID}); when(mMockSubscriptionManager.getActiveSubscriptionIdList(false)).thenReturn( when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[]{SUB_ID, SUB_ID_2}); when(mTelephonyManagerMock.createForSubscriptionId(eq(SUB_ID_2))).thenReturn( mTelephonyManagerMockForSub2); Loading @@ -387,7 +384,8 @@ public class TelephonyPermissionsTest { // SubscriptionManager returns a null array for the active subscription IDs this check can // still proceed to check if the calling package has the appop and any subsequent checks // without a NullPointerException. when(mMockSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(null); when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[]{}); when(mMockAppOps.noteOpNoThrow(AppOpsManager.OPSTR_READ_DEVICE_IDENTIFIERS, UID, PACKAGE)).thenReturn(AppOpsManager.MODE_ALLOWED); assertTrue( Loading Loading @@ -454,7 +452,7 @@ public class TelephonyPermissionsTest { when(mMockContext.checkPermission( eq(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE), anyInt(), anyInt())).thenReturn(PackageManager.PERMISSION_DENIED); when(mMockSubscriptionManager.getActiveSubscriptionIdList(anyBoolean())).thenReturn( when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[]{SUB_ID, SUB_ID_2}); when(mTelephonyManagerMock.createForSubscriptionId(eq(SUB_ID_2))).thenReturn( mTelephonyManagerMockForSub2); Loading Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneSubInfoControllerTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import static android.Manifest.permission.READ_SMS; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.doReturn; Loading Loading @@ -60,7 +59,7 @@ public class PhoneSubInfoControllerTest extends TelephonyTest { doReturn(true).when(mSubscriptionController).isActiveSubId(0, TAG, FEATURE_ID); doReturn(true).when(mSubscriptionController).isActiveSubId(1, TAG, FEATURE_ID); doReturn(new int[]{0, 1}).when(mSubscriptionManager) .getActiveSubscriptionIdList(anyBoolean()); .getCompleteActiveSubscriptionIdList(); mServiceManagerMockedServices.put("isub", mSubscriptionController); doReturn(mSubscriptionController).when(mSubscriptionController) Loading
tests/telephonytests/src/com/android/internal/telephony/TelephonyPermissionsTest.java +7 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; Loading Loading @@ -105,7 +104,7 @@ public class TelephonyPermissionsTest { mMockSubscriptionManager); when(mMockContext.getSystemService(Context.DEVICE_POLICY_SERVICE)).thenReturn( mMockDevicePolicyManager); when(mMockSubscriptionManager.getActiveSubscriptionIdList(anyBoolean())).thenReturn( when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[] {SUB_ID}); // By default, assume we have no permissions or app-ops bits. Loading Loading @@ -354,7 +353,7 @@ public class TelephonyPermissionsTest { @Test public void testCheckReadDeviceIdentifiers_hasCarrierPrivilegesOnOtherSubscription() throws Exception { when(mMockSubscriptionManager.getActiveSubscriptionIdList(anyBoolean())).thenReturn( when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[]{SUB_ID, SUB_ID_2}); when(mTelephonyManagerMock.createForSubscriptionId(eq(SUB_ID_2))).thenReturn( mTelephonyManagerMockForSub2); Loading @@ -368,9 +367,7 @@ public class TelephonyPermissionsTest { @Test public void testCheckReadDeviceIdentifiers_hasCarrierPrivilegesOnInvisibleSubscription() throws Exception { when(mMockSubscriptionManager.getActiveSubscriptionIdList(true)).thenReturn( new int[]{SUB_ID}); when(mMockSubscriptionManager.getActiveSubscriptionIdList(false)).thenReturn( when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[]{SUB_ID, SUB_ID_2}); when(mTelephonyManagerMock.createForSubscriptionId(eq(SUB_ID_2))).thenReturn( mTelephonyManagerMockForSub2); Loading @@ -387,7 +384,8 @@ public class TelephonyPermissionsTest { // SubscriptionManager returns a null array for the active subscription IDs this check can // still proceed to check if the calling package has the appop and any subsequent checks // without a NullPointerException. when(mMockSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(null); when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[]{}); when(mMockAppOps.noteOpNoThrow(AppOpsManager.OPSTR_READ_DEVICE_IDENTIFIERS, UID, PACKAGE)).thenReturn(AppOpsManager.MODE_ALLOWED); assertTrue( Loading Loading @@ -454,7 +452,7 @@ public class TelephonyPermissionsTest { when(mMockContext.checkPermission( eq(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE), anyInt(), anyInt())).thenReturn(PackageManager.PERMISSION_DENIED); when(mMockSubscriptionManager.getActiveSubscriptionIdList(anyBoolean())).thenReturn( when(mMockSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn( new int[]{SUB_ID, SUB_ID_2}); when(mTelephonyManagerMock.createForSubscriptionId(eq(SUB_ID_2))).thenReturn( mTelephonyManagerMockForSub2); Loading