Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 730012ff authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Automerger Merge Worker
Browse files

Merge changes from topic "sms-attributeTag-2-rvc-dev" into rvc-dev am: 3d828d41

Change-Id: Iacdf8056370275cdf1458476b29362b680baaa27
parents b9f0f06d 3d828d41
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -113,8 +113,8 @@ public class SmsPermissions {
    public boolean checkCallingCanSendSms(String callingPackage, String callingAttributionTag,
            String message) {
        mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, message);
        return mAppOps.noteOp(AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), callingPackage)
                == AppOpsManager.MODE_ALLOWED;
        return mAppOps.noteOp(AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), callingPackage,
                callingAttributionTag, null) == AppOpsManager.MODE_ALLOWED;
    }

    /**
+9 −6
Original line number Diff line number Diff line
@@ -124,8 +124,9 @@ public class SmsPermissionsTest extends TelephonyTest {

    @Test
    public void testCheckCallingSendTextPermissions_persist_noAppOps() {
        Mockito.when(mMockAppOps.noteOp(
                AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), PACKAGE))
        Mockito.when(
                mMockAppOps.noteOp(AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), PACKAGE,
                        ATTRIBUTION_TAG, null))
                .thenReturn(AppOpsManager.MODE_ERRORED);
        assertFalse(mSmsPermissionsTest.checkCallingCanSendText(
                true /* persistMessageForNonDefaultSmsApp */, PACKAGE, ATTRIBUTION_TAG, MESSAGE));
@@ -139,8 +140,9 @@ public class SmsPermissionsTest extends TelephonyTest {
                .enforceCallingPermission(Manifest.permission.MODIFY_PHONE_STATE, MESSAGE);
        Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext)
                .enforceCallingPermission(Manifest.permission.SEND_SMS, MESSAGE);
        Mockito.when(mMockAppOps.noteOp(
                AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), PACKAGE))
        Mockito.when(
                mMockAppOps.noteOp(AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), PACKAGE,
                        ATTRIBUTION_TAG, null))
                .thenReturn(AppOpsManager.MODE_ERRORED);

        assertTrue(mSmsPermissionsTest.checkCallingCanSendText(
@@ -183,8 +185,9 @@ public class SmsPermissionsTest extends TelephonyTest {

    @Test
    public void testCheckCallingSendTextPermissions_noPersist_noAppOps() {
        Mockito.when(mMockAppOps.noteOp(
                AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), PACKAGE))
        Mockito.when(
                mMockAppOps.noteOp(AppOpsManager.OPSTR_SEND_SMS, Binder.getCallingUid(), PACKAGE,
                        ATTRIBUTION_TAG, null))
                .thenReturn(AppOpsManager.MODE_ERRORED);
        assertFalse(mSmsPermissionsTest.checkCallingCanSendText(
                false /* persistMessageForNonDefaultSmsApp */, PACKAGE, ATTRIBUTION_TAG, MESSAGE));