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

Commit e575ad10 authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Merge "Refactor ImsService to AIDL"

am: 8a02c63f

Change-Id: I195d7ccff8498241b6c7be819d2ee96b661d51e1
parents c6dc6baf 8a02c63f
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -517,10 +517,12 @@ LOCAL_SRC_FILES += \
	telephony/java/com/android/ims/internal/IImsEcbmListener.aidl \
	telephony/java/com/android/ims/internal/IImsEcbmListener.aidl \
        telephony/java/com/android/ims/internal/IImsExternalCallStateListener.aidl \
        telephony/java/com/android/ims/internal/IImsExternalCallStateListener.aidl \
        telephony/java/com/android/ims/internal/IImsFeatureStatusCallback.aidl \
        telephony/java/com/android/ims/internal/IImsFeatureStatusCallback.aidl \
        telephony/java/com/android/ims/internal/IImsMMTelFeature.aidl \
        telephony/java/com/android/ims/internal/IImsMultiEndpoint.aidl \
        telephony/java/com/android/ims/internal/IImsMultiEndpoint.aidl \
	telephony/java/com/android/ims/internal/IImsRcsFeature.aidl \
	telephony/java/com/android/ims/internal/IImsService.aidl \
	telephony/java/com/android/ims/internal/IImsService.aidl \
	telephony/java/com/android/ims/internal/IImsServiceController.aidl \
	telephony/java/com/android/ims/internal/IImsServiceController.aidl \
	telephony/java/com/android/ims/internal/IImsServiceFeatureListener.aidl \
	telephony/java/com/android/ims/internal/IImsServiceFeatureCallback.aidl \
	telephony/java/com/android/ims/internal/IImsStreamMediaSession.aidl \
	telephony/java/com/android/ims/internal/IImsStreamMediaSession.aidl \
	telephony/java/com/android/ims/internal/IImsUt.aidl \
	telephony/java/com/android/ims/internal/IImsUt.aidl \
	telephony/java/com/android/ims/internal/IImsUtListener.aidl \
	telephony/java/com/android/ims/internal/IImsUtListener.aidl \
+1 −1
Original line number Original line Diff line number Diff line
@@ -5273,7 +5273,7 @@ com.android.ims.internal.IImsRegistrationListener$Stub
com.android.ims.internal.IImsService
com.android.ims.internal.IImsService
com.android.ims.internal.IImsService$Stub
com.android.ims.internal.IImsService$Stub
com.android.ims.internal.IImsServiceController
com.android.ims.internal.IImsServiceController
com.android.ims.internal.IImsServiceFeatureListener
com.android.ims.internal.IImsServiceFeatureCallback
com.android.ims.internal.IImsUt
com.android.ims.internal.IImsUt
com.android.ims.internal.IImsUt$Stub
com.android.ims.internal.IImsUt$Stub
com.android.ims.internal.IImsUtListener
com.android.ims.internal.IImsUtListener
+65 −13
Original line number Original line Diff line number Diff line
@@ -52,8 +52,9 @@ import android.telephony.VisualVoicemailService.VisualVoicemailTask;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.ImsFeature;
import android.util.Log;
import android.util.Log;


import com.android.ims.internal.IImsServiceController;
import com.android.ims.internal.IImsMMTelFeature;
import com.android.ims.internal.IImsServiceFeatureListener;
import com.android.ims.internal.IImsRcsFeature;
import com.android.ims.internal.IImsServiceFeatureCallback;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telecom.ITelecomService;
import com.android.internal.telecom.ITelecomService;
import com.android.internal.telephony.CellNetworkScanResult;
import com.android.internal.telephony.CellNetworkScanResult;
@@ -4638,27 +4639,78 @@ public class TelephonyManager {
    public @interface Feature {}
    public @interface Feature {}


    /**
    /**
     * Returns the {@link IImsServiceController} that corresponds to the given slot Id and IMS
     * Returns the {@link IImsMMTelFeature} that corresponds to the given slot Id and MMTel
     * feature or {@link null} if the service is not available. If an ImsServiceController is
     * feature or {@link null} if the service is not available. If an MMTelFeature is available, the
     * available, the {@link IImsServiceFeatureListener} callback is registered as a listener for
     * {@link IImsServiceFeatureCallback} callback is registered as a listener for feature updates.
     * feature updates.
     * @param slotIndex The SIM slot that we are requesting the {@link IImsMMTelFeature} for.
     * @param slotIndex The SIM slot that we are requesting the {@link IImsServiceController} for.
     * @param feature The IMS Feature we are requesting, corresponding to {@link ImsFeature}.
     * @param callback Listener that will send updates to ImsManager when there are updates to
     * @param callback Listener that will send updates to ImsManager when there are updates to
     * ImsServiceController.
     * ImsServiceController.
     * @return {@link IImsServiceController} interface for the feature specified or {@link null} if
     * @return {@link IImsMMTelFeature} interface for the feature specified or {@code null} if
     * it is unavailable.
     * it is unavailable.
     * @hide
     * @hide
     */
     */
    public IImsServiceController getImsServiceControllerAndListen(int slotIndex, @Feature int feature,
    public @Nullable IImsMMTelFeature getImsMMTelFeatureAndListen(int slotIndex,
            IImsServiceFeatureListener callback) {
            IImsServiceFeatureCallback callback) {
        try {
        try {
            ITelephony telephony = getITelephony();
            ITelephony telephony = getITelephony();
            if (telephony != null) {
            if (telephony != null) {
                return telephony.getImsServiceControllerAndListen(slotIndex, feature, callback);
                return telephony.getMMTelFeatureAndListen(slotIndex, callback);
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Rlog.e(TAG, "getImsServiceControllerAndListen, RemoteException: " + e.getMessage());
            Rlog.e(TAG, "getImsMMTelFeatureAndListen, RemoteException: "
                    + e.getMessage());
        }
        return null;
    }

    /**
     * Returns the {@link IImsMMTelFeature} that corresponds to the given slot Id and MMTel
     * feature for emergency calling or {@link null} if the service is not available. If an
     * MMTelFeature is available, the {@link IImsServiceFeatureCallback} callback is registered as a
     * listener for feature updates.
     * @param slotIndex The SIM slot that we are requesting the {@link IImsMMTelFeature} for.
     * @param callback Listener that will send updates to ImsManager when there are updates to
     * ImsServiceController.
     * @return {@link IImsMMTelFeature} interface for the feature specified or {@code null} if
     * it is unavailable.
     * @hide
     */
    public @Nullable IImsMMTelFeature getImsEmergencyMMTelFeatureAndListen(int slotIndex,
            IImsServiceFeatureCallback callback) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.getEmergencyMMTelFeatureAndListen(slotIndex, callback);
            }
        } catch (RemoteException e) {
            Rlog.e(TAG, "getImsEmergencyMMTelFeatureAndListen, RemoteException: "
                    + e.getMessage());
        }
        return null;
    }

    /**
     * Returns the {@link IImsRcsFeature} that corresponds to the given slot Id and RCS
     * feature for emergency calling or {@link null} if the service is not available. If an
     * RcsFeature is available, the {@link IImsServiceFeatureCallback} callback is registered as a
     * listener for feature updates.
     * @param slotIndex The SIM slot that we are requesting the {@link IImsRcsFeature} for.
     * @param callback Listener that will send updates to ImsManager when there are updates to
     * ImsServiceController.
     * @return {@link IImsRcsFeature} interface for the feature specified or {@code null} if
     * it is unavailable.
     * @hide
     */
    public @Nullable IImsRcsFeature getImsRcsFeatureAndListen(int slotIndex,
            IImsServiceFeatureCallback callback) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.getRcsFeatureAndListen(slotIndex, callback);
            }
        } catch (RemoteException e) {
            Rlog.e(TAG, "getImsRcsFeatureAndListen, RemoteException: "
                    + e.getMessage());
        }
        }
        return null;
        return null;
    }
    }
+82 −336

File changed.

Preview size limit exceeded, changes collapsed.

+6 −25
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package android.telephony.ims.feature;
import android.annotation.IntDef;
import android.annotation.IntDef;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.os.IInterface;
import android.os.RemoteException;
import android.os.RemoteException;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager;
import android.util.Log;
import android.util.Log;
@@ -91,17 +92,12 @@ public abstract class ImsFeature {
    public static final int STATE_INITIALIZING = 1;
    public static final int STATE_INITIALIZING = 1;
    public static final int STATE_READY = 2;
    public static final int STATE_READY = 2;


    private List<INotifyFeatureRemoved> mRemovedListeners = new ArrayList<>();
    private final Set<IImsFeatureStatusCallback> mStatusCallbacks = Collections.newSetFromMap(
    private final Set<IImsFeatureStatusCallback> mStatusCallbacks = Collections.newSetFromMap(
            new WeakHashMap<IImsFeatureStatusCallback, Boolean>());
            new WeakHashMap<IImsFeatureStatusCallback, Boolean>());
    private @ImsState int mState = STATE_NOT_AVAILABLE;
    private @ImsState int mState = STATE_NOT_AVAILABLE;
    private int mSlotId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
    private int mSlotId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
    private Context mContext;
    private Context mContext;


    public interface INotifyFeatureRemoved {
        void onFeatureRemoved(int slotId);
    }

    public void setContext(Context context) {
    public void setContext(Context context) {
        mContext = context;
        mContext = context;
    }
    }
@@ -110,26 +106,6 @@ public abstract class ImsFeature {
        mSlotId = slotId;
        mSlotId = slotId;
    }
    }


    public void addFeatureRemovedListener(INotifyFeatureRemoved listener) {
        synchronized (mRemovedListeners) {
            mRemovedListeners.add(listener);
        }
    }

    public void removeFeatureRemovedListener(INotifyFeatureRemoved listener) {
        synchronized (mRemovedListeners) {
            mRemovedListeners.remove(listener);
        }
    }

    // Not final for testing.
    public void notifyFeatureRemoved(int slotId) {
        synchronized (mRemovedListeners) {
            mRemovedListeners.forEach(l -> l.onFeatureRemoved(slotId));
            onFeatureRemoved();
        }
    }

    public int getFeatureState() {
    public int getFeatureState() {
        return mState;
        return mState;
    }
    }
@@ -215,4 +191,9 @@ public abstract class ImsFeature {
     * Called when the feature is being removed and must be cleaned up.
     * Called when the feature is being removed and must be cleaned up.
     */
     */
    public abstract void onFeatureRemoved();
    public abstract void onFeatureRemoved();

    /**
     * @return Binder instance
     */
    public abstract IInterface getBinder();
}
}
Loading