Merge "Removed duplicated permission check in getRadioAccessFamily()." into udc-dev
diff --git a/src/com/android/phone/slice/SlicePurchaseController.java b/src/com/android/phone/slice/SlicePurchaseController.java
index 471f80b..4166b1e 100644
--- a/src/com/android/phone/slice/SlicePurchaseController.java
+++ b/src/com/android/phone/slice/SlicePurchaseController.java
@@ -784,7 +784,8 @@
         filter.addAction(ACTION_SLICE_PURCHASE_APP_RESPONSE_SUCCESS);
         filter.addAction(ACTION_SLICE_PURCHASE_APP_RESPONSE_NOTIFICATION_SHOWN);
         mPhone.getContext().registerReceiver(
-                mSlicePurchaseControllerBroadcastReceivers.get(capability), filter);
+                mSlicePurchaseControllerBroadcastReceivers.get(capability), filter,
+                Context.RECEIVER_NOT_EXPORTED);
     }
 
     /**
diff --git a/src/com/android/phone/vvm/RemoteVvmTaskManager.java b/src/com/android/phone/vvm/RemoteVvmTaskManager.java
index 6b60303..7329854 100644
--- a/src/com/android/phone/vvm/RemoteVvmTaskManager.java
+++ b/src/com/android/phone/vvm/RemoteVvmTaskManager.java
@@ -32,6 +32,7 @@
 import android.os.Messenger;
 import android.os.PersistableBundle;
 import android.os.RemoteException;
+import android.os.UserHandle;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
 import android.telephony.CarrierConfigManager;
@@ -239,6 +240,7 @@
         PhoneAccountHandle phoneAccountHandle = intent.getExtras()
                 .getParcelable(VisualVoicemailService.DATA_PHONE_ACCOUNT_HANDLE);
         int subId = PhoneAccountHandleConverter.toSubId(phoneAccountHandle);
+        UserHandle userHandle = phoneAccountHandle.getUserHandle();
         ComponentName remotePackage = getRemotePackage(this, subId,
                 intent.getStringExtra(EXTRA_TARGET_PACKAGE));
         if (remotePackage == null) {
@@ -250,13 +252,15 @@
         switch (intent.getAction()) {
             case ACTION_START_CELL_SERVICE_CONNECTED:
                 send(remotePackage, VisualVoicemailService.MSG_ON_CELL_SERVICE_CONNECTED,
-                        intent.getExtras());
+                        intent.getExtras(), userHandle);
                 break;
             case ACTION_START_SMS_RECEIVED:
-                send(remotePackage, VisualVoicemailService.MSG_ON_SMS_RECEIVED, intent.getExtras());
+                send(remotePackage, VisualVoicemailService.MSG_ON_SMS_RECEIVED, intent.getExtras(),
+                        userHandle);
                 break;
             case ACTION_START_SIM_REMOVED:
-                send(remotePackage, VisualVoicemailService.MSG_ON_SIM_REMOVED, intent.getExtras());
+                send(remotePackage, VisualVoicemailService.MSG_ON_SIM_REMOVED, intent.getExtras(),
+                        userHandle);
                 break;
             default:
                 Assert.fail("Unexpected action +" + intent.getAction());
@@ -335,7 +339,7 @@
         }
     }
 
-    private void send(ComponentName remotePackage, int what, Bundle extras) {
+    private void send(ComponentName remotePackage, int what, Bundle extras, UserHandle userHandle) {
         Assert.isMainThread();
 
         if (getBroadcastPackage(this) != null) {
@@ -351,7 +355,7 @@
             intent.putExtras(extras);
             intent.putExtra(EXTRA_WHAT, what);
             intent.setComponent(remotePackage);
-            sendBroadcast(intent);
+            sendBroadcastAsUser(intent, userHandle);
             return;
         }
 
@@ -367,7 +371,7 @@
             Intent intent = newBindIntent(this);
             intent.setComponent(remotePackage);
             VvmLog.i(TAG, "Binding to " + intent.getComponent());
-            bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
+            bindServiceAsUser(intent, mConnection, Context.BIND_AUTO_CREATE, userHandle);
         }
     }
 
diff --git a/tests/src/com/android/phone/slice/SlicePurchaseControllerTest.java b/tests/src/com/android/phone/slice/SlicePurchaseControllerTest.java
index 94b9c7c..a29ed09 100644
--- a/tests/src/com/android/phone/slice/SlicePurchaseControllerTest.java
+++ b/tests/src/com/android/phone/slice/SlicePurchaseControllerTest.java
@@ -728,7 +728,8 @@
                 mContext.getBroadcast().getAction());
         assertTrue(mSlicePurchaseController.hasMessages(4 /* EVENT_PURCHASE_TIMEOUT */,
                 TelephonyManager.PREMIUM_CAPABILITY_PRIORITIZE_LATENCY));
-        verify(mContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class));
+        verify(mContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class),
+                eq(Context.RECEIVER_NOT_EXPORTED));
     }
 
     private void sendNetworkSlicingConfig(int capability, boolean configActive) {