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

Commit d4e0fe7f authored by Meng Wang's avatar Meng Wang
Browse files

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
parent 713e4f65
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -1365,25 +1365,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);
        }
    };