RadioInfo: fix OMADM buttons

1. Use activity context instead of application context to send broadcast
   - the activity is in phone process
2. Fix the target receiver component name
3. Remove receiver permission restrict since it's explict broadcast

Bug: 37993019
Test: manual
Change-Id: I8cf0772f4bb51617c2164aa530daaa4fdec117d2
This commit is contained in:
Meng Wang
2017-08-03 14:34:35 -07:00
parent 975d9a18f1
commit a04449b88a

View File

@@ -1371,25 +1371,21 @@ public class RadioInfo extends Activity {
OnClickListener mCarrierProvisioningButtonHandler = new OnClickListener() {
public void onClick(View v) {
final Intent intent = new Intent();
final ComponentName serviceComponent = new ComponentName("com.android.omadm.service",
"DMIntentReceiver");
final Intent intent = new Intent("com.android.settings.CARRIER_PROVISIONING");
final ComponentName serviceComponent = ComponentName.unflattenFromString(
"com.android.omadm.service/.DMIntentReceiver");
intent.setComponent(serviceComponent);
intent.setAction("com.android.settings.CARRIER_PROVISIONING");
getApplicationContext().sendBroadcast(
intent, android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE);
sendBroadcast(intent);
}
};
OnClickListener mTriggerCarrierProvisioningButtonHandler = new OnClickListener() {
public void onClick(View v) {
final Intent intent = new Intent();
final ComponentName serviceComponent = new ComponentName("com.android.omadm.service",
"DMIntentReceiver");
final Intent intent = new Intent("com.android.settings.TRIGGER_CARRIER_PROVISIONING");
final ComponentName serviceComponent = ComponentName.unflattenFromString(
"com.android.omadm.service/.DMIntentReceiver");
intent.setComponent(serviceComponent);
intent.setAction("com.android.settings.TRIGGER_CARRIER_PROVISIONING");
getApplicationContext().sendBroadcast(
intent, android.Manifest.permission.MODIFY_PHONE_STATE);
sendBroadcast(intent);
}
};