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

Commit 511be9a3 authored by Hunsuk Choi's avatar Hunsuk Choi Committed by Android (Google) Code Review
Browse files

Merge "Update ITelephony#registerImsStateCallback"

parents 21527b4f 10e2db6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ public class ImsManager {
            throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId);
        }

        return new ImsMmTelManager(subscriptionId, sTelephonyCache);
        return new ImsMmTelManager(mContext, subscriptionId, sTelephonyCache);
    }

    /**
+22 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SuppressAutoDoc;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.content.Context;
import android.os.Binder;
import android.os.RemoteException;
import android.os.ServiceSpecificException;
@@ -215,6 +216,7 @@ public class ImsMmTelManager implements RegistrationManager {
        }
    }

    private final Context mContext;
    private final int mSubId;
    private final BinderCacheManager<ITelephony> mBinderCache;

@@ -256,6 +258,16 @@ public class ImsMmTelManager implements RegistrationManager {
     */
    @VisibleForTesting
    public ImsMmTelManager(int subId, BinderCacheManager<ITelephony> binderCache) {
        this(null, subId, binderCache);
    }

    /**
     * Only visible for testing, use {@link ImsManager#getImsMmTelManager(int)} instead.
     * @hide
     */
    @VisibleForTesting
    public ImsMmTelManager(Context context, int subId, BinderCacheManager<ITelephony> binderCache) {
        mContext = context;
        mSubId = subId;
        mBinderCache = binderCache;
    }
@@ -1516,7 +1528,8 @@ public class ImsMmTelManager implements RegistrationManager {

        try {
            telephony.registerImsStateCallback(
                    mSubId, ImsFeature.FEATURE_MMTEL, callback.getCallbackBinder());
                    mSubId, ImsFeature.FEATURE_MMTEL,
                    callback.getCallbackBinder(), getOpPackageName());
        } catch (ServiceSpecificException e) {
            throw new ImsException(e.getMessage(), e.errorCode);
        } catch (RemoteException | IllegalStateException e) {
@@ -1542,6 +1555,14 @@ public class ImsMmTelManager implements RegistrationManager {
        }
    }

    private String getOpPackageName() {
        if (mContext != null) {
            return mContext.getOpPackageName();
        } else {
            return null;
        }
    }

    private ITelephony getITelephony() {
        return mBinderCache.getBinder();
    }
+2 −1
Original line number Diff line number Diff line
@@ -572,7 +572,8 @@ public class ImsRcsManager {

        try {
            telephony.registerImsStateCallback(
                    mSubId, ImsFeature.FEATURE_RCS, callback.getCallbackBinder());
                    mSubId, ImsFeature.FEATURE_RCS,
                    callback.getCallbackBinder(), mContext.getOpPackageName());
        } catch (ServiceSpecificException e) {
            throw new ImsException(e.getMessage(), e.errorCode);
        } catch (RemoteException | IllegalStateException e) {
+2 −1
Original line number Diff line number Diff line
@@ -484,7 +484,8 @@ public class SipDelegateManager {

        try {
            telephony.registerImsStateCallback(
                    mSubId, ImsFeature.FEATURE_RCS, callback.getCallbackBinder());
                    mSubId, ImsFeature.FEATURE_RCS,
                    callback.getCallbackBinder(), mContext.getOpPackageName());
        } catch (ServiceSpecificException e) {
            throw new ImsException(e.getMessage(), e.errorCode);
        } catch (RemoteException | IllegalStateException e) {
+2 −1
Original line number Diff line number Diff line
@@ -2497,7 +2497,8 @@ interface ITelephony {
    /**
     * Register an IMS connection state callback
     */
    void registerImsStateCallback(int subId, int feature, in IImsStateCallback cb);
    void registerImsStateCallback(int subId, int feature, in IImsStateCallback cb,
            in String callingPackage);

    /**
     * Unregister an IMS connection state callback