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

Commit 7c40cd0d authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Remove the sending of IMS_SERVICE_UP/_DOWN from ImsManager

ImsManager should not be sending IMS_SERVICE_UP/_DOWN
since it runs in the process that is using it and
may not have the correct permissions to do so.

Bug: 35736451
Test: Telephony Unit Tests
Change-Id: If89122d7218a0a5309a582837ccc97724c6f511e
parent ffc69362
Loading
Loading
Loading
Loading
+0 −38
Original line number Diff line number Diff line
@@ -885,32 +885,9 @@ public class ImsManager {
        mPhoneId = phoneId;
        mConfigDynamicBind = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_dynamic_bind_ims);
        addNotifyStatusChangedCallback(this::sendImsServiceIntent);
        createImsService();
    }

    /**
     * Provide backwards compatibility using deprecated service UP/DOWN intents.
     */
    private void sendImsServiceIntent() {
        int status = mImsServiceProxy.getFeatureStatus();
        Intent intent;
        switch (status) {
            case ImsFeature.STATE_NOT_AVAILABLE:
            case ImsFeature.STATE_INITIALIZING:
                intent = new Intent(ACTION_IMS_SERVICE_DOWN);
                break;
            case ImsFeature.STATE_READY:
                intent = new Intent(ACTION_IMS_SERVICE_UP);
                break;
            default:
                intent = new Intent(ACTION_IMS_SERVICE_DOWN);
        }
        intent.putExtra(EXTRA_PHONE_ID, mPhoneId);
        mContext.sendBroadcast(new Intent(intent));
    }


    /**
     * @return Whether or not ImsManager is configured to Dynamically bind or not to support legacy
     * devices.
@@ -1482,15 +1459,6 @@ public class ImsManager {
                            ImsServiceProxy.INotifyStatusChanged::notifyStatusChanged));
            // Trigger the cache to be updated for feature status.
            serviceProxy.getFeatureStatus();
            // In order to keep backwards compatibility with other services such as RcsService,
            // we must broadcast the IMS_SERVICE_UP intent here. If it is not ready, IMS_SERVICE_UP
            // will be called in this::sendImsServiceIntent. IMS_SERVICE_UP is sent by ImsService
            // in the old ImsService implementation.
            if (serviceProxy.isBinderAlive()) {
                Intent intent = new Intent(ACTION_IMS_SERVICE_UP);
                intent.putExtra(EXTRA_PHONE_ID, mPhoneId);
                mContext.sendBroadcast(new Intent(intent));
            }
        } else {
            Rlog.w(TAG, "getServiceProxy: b is null! Phone Id: " + mPhoneId);
        }
@@ -1626,12 +1594,6 @@ public class ImsManager {
            mConfig = null;
            mEcbm = null;
            mMultiEndpoint = null;

            if (mContext != null && !isDynamicBinding()) {
                Intent intent = new Intent(ACTION_IMS_SERVICE_DOWN);
                intent.putExtra(EXTRA_PHONE_ID, mPhoneId);
                mContext.sendBroadcast(new Intent(intent));
            }
        }
    }