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

Commit 8c13414d authored by Brad Ebinger's avatar Brad Ebinger
Browse files

MSIM support for hidden IMS capability and registration query APIs.

Modifies TelephonyManager APIs to better support MSIM devices
and adds a method to query MMTEL IMS Registration technology.

Test: Manual, telephony unit tests.
Bug: 35128252
Merged-In: Ie37185bd3477635094a0db998918ba5ad59842be
Change-Id: Ie37185bd3477635094a0db998918ba5ad59842be
parent 927afd1e
Loading
Loading
Loading
Loading
+65 −42
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import android.telephony.ims.aidl.IImsMmTelFeature;
import android.telephony.ims.aidl.IImsRcsFeature;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;

import com.android.ims.internal.IImsServiceFeatureCallback;
@@ -6248,83 +6249,105 @@ public class TelephonyManager {
    }

    /**
    * Returns the IMS Registration Status
     * Returns the IMS Registration Status for a particular Subscription ID.
     *
     * @param subId Subscription ID
     * @return true if IMS status is registered, false if the IMS status is not registered or a
     * RemoteException occurred.
     * @hide
     */
   public boolean isImsRegistered() {
    public boolean isImsRegistered(int subId) {
        try {
           ITelephony telephony = getITelephony();
           if (telephony == null)
               return false;
           return telephony.isImsRegistered();
       } catch (RemoteException ex) {
           return false;
       } catch (NullPointerException ex) {
            return getITelephony().isImsRegistered(subId);
        } catch (RemoteException | NullPointerException ex) {
            return false;
        }
    }

    /**
     * Returns the IMS Registration Status for a particular Subscription ID
     * Returns the IMS Registration Status for a particular Subscription ID, which is determined
     * when the TelephonyManager is created using {@link #createForSubscriptionId(int)}. If an
     * invalid subscription ID is used during creation, will the default subscription ID will be
     * used.
     *
     * @param subId Subscription ID
     * @return true if IMS status is registered, false if the IMS status is not registered or a
     * RemoteException occurred.
     *
     * @see SubscriptionManager#getDefaultSubscriptionId()
     * @hide
     */
    public boolean isImsRegistered(int subId) {
    public boolean isImsRegistered() {
       try {
           return getITelephony().isImsRegisteredForSubscriber(subId);
       } catch (RemoteException ex) {
           return false;
       } catch (NullPointerException ex) {
           return getITelephony().isImsRegistered(getSubId());
       } catch (RemoteException | NullPointerException ex) {
           return false;
       }
    }

    /**
     * Returns the Status of Volte
     * The current status of Voice over LTE for the subscription associated with this instance when
     * it was created using {@link #createForSubscriptionId(int)}. If an invalid subscription ID was
     * used during creation, the default subscription ID will be used.
     * @return true if Voice over LTE is available or false if it is unavailable or unknown.
     * @see SubscriptionManager#getDefaultSubscriptionId()
     * @hide
     */
    public boolean isVolteAvailable() {
        try {
           return getITelephony().isVolteAvailable();
       } catch (RemoteException ex) {
           return false;
       } catch (NullPointerException ex) {
            return getITelephony().isVolteAvailable(getSubId());
        } catch (RemoteException | NullPointerException ex) {
            return false;
        }
    }

    /**
     * Returns the Status of video telephony (VT)
     * The availability of Video Telephony (VT) for the subscription ID specified when this instance
     * was created using {@link #createForSubscriptionId(int)}. If an invalid subscription ID was
     * used during creation, the default subscription ID will be used. To query the
     * underlying technology that VT is available on, use {@link #getImsRegTechnologyForMmTel}.
     * @return true if VT is available, or false if it is unavailable or unknown.
     * @hide
     */
    public boolean isVideoTelephonyAvailable() {
        try {
            return getITelephony().isVideoTelephonyAvailable();
        } catch (RemoteException ex) {
            return false;
        } catch (NullPointerException ex) {
            return getITelephony().isVideoTelephonyAvailable(getSubId());
        } catch (RemoteException | NullPointerException ex) {
            return false;
        }
    }

    /**
     * Returns the Status of Wi-Fi Calling
     * Returns the Status of Wi-Fi calling (Voice over WiFi) for the subscription ID specified.
     * @param subId the subscription ID.
     * @return true if VoWiFi is available, or false if it is unavailable or unknown.
     * @hide
     */
    public boolean isWifiCallingAvailable() {
       try {
           return getITelephony().isWifiCallingAvailable();
       } catch (RemoteException ex) {
           return false;
       } catch (NullPointerException ex) {
           return getITelephony().isWifiCallingAvailable(getSubId());
       } catch (RemoteException | NullPointerException ex) {
           return false;
       }
   }

    /**
     * The technology that IMS is registered for for the MMTEL feature.
     * @param subId subscription ID to get IMS registration technology for.
     * @return The IMS registration technology that IMS is registered to for the MMTEL feature.
     * Valid return results are:
     *  - {@link ImsRegistrationImplBase#REGISTRATION_TECH_LTE} for LTE registration,
     *  - {@link ImsRegistrationImplBase#REGISTRATION_TECH_IWLAN} for IWLAN registration, or
     *  - {@link ImsRegistrationImplBase#REGISTRATION_TECH_NONE} if we are not registered or the
     *  result is unavailable.
     *  @hide
     */
    public @ImsRegistrationImplBase.ImsRegistrationTech int getImsRegTechnologyForMmTel() {
        try {
            return getITelephony().getImsRegTechnologyForMmTel(getSubId());
        } catch (RemoteException ex) {
            return ImsRegistrationImplBase.REGISTRATION_TECH_NONE;
        }
    }

   /**
    * Set TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC for the default phone.
    *
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ public abstract class ImsFeature {
    public static final String EXTRA_PHONE_ID = "android:phone_id";

    /**
     * Invalid feature value\
     * Invalid feature value
     * @hide
     */
    public static final int FEATURE_INVALID = -1;
+12 −12
Original line number Diff line number Diff line
@@ -1122,11 +1122,6 @@ interface ITelephony {
     */
    boolean isHearingAidCompatibilitySupported();

    /**
     * Get IMS Registration Status
     */
    boolean isImsRegistered();

    /**
     * Get IMS Registration Status on a particular subid.
     *
@@ -1134,22 +1129,27 @@ interface ITelephony {
     *
     * @return {@code true} if the IMS status is registered.
     */
    boolean isImsRegisteredForSubscriber(int subId);
    boolean isImsRegistered(int subId);

    /**
     * Returns the Status of Wi-Fi Calling for the subscription id specified.
     */
    boolean isWifiCallingAvailable(int subId);

    /**
     * Returns the Status of Wi-Fi Calling
     * Returns the Status of VoLTE for the subscription ID specified.
     */
    boolean isWifiCallingAvailable();
    boolean isVolteAvailable(int subId);

     /**
     * Returns the Status of Volte
     * Returns the Status of VT (video telephony) for the subscription ID specified.
     */
    boolean isVolteAvailable();
    boolean isVideoTelephonyAvailable(int subId);

    /**
     * Returns the Status of VT (video telephony)
    * Returns the MMTEL IMS registration technology for the subsciption ID specified.
    */
    boolean isVideoTelephonyAvailable();
    int getImsRegTechnologyForMmTel(int subId);

    /**
      * Returns the unique device ID of phone, for example, the IMEI for