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

Commit 6fc1a2f0 authored by Brad Ebinger's avatar Brad Ebinger Committed by Gerrit Code Review
Browse files

Merge "Support Dynamic ImsService Querying"

parents fdf4dd79 a33eddcd
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -5218,19 +5218,24 @@ package android.telephony.ims.stub {
  }

  public final class ImsFeatureConfiguration implements android.os.Parcelable {
    ctor public ImsFeatureConfiguration();
    method public int describeContents();
    method public int[] getServiceFeatures();
    method public java.util.Set<android.telephony.ims.stub.ImsFeatureConfiguration.FeatureSlotPair> getServiceFeatures();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.ims.stub.ImsFeatureConfiguration> CREATOR;
  }

  public static class ImsFeatureConfiguration.Builder {
    ctor public ImsFeatureConfiguration.Builder();
    method public android.telephony.ims.stub.ImsFeatureConfiguration.Builder addFeature(int);
    method public android.telephony.ims.stub.ImsFeatureConfiguration.Builder addFeature(int, int);
    method public android.telephony.ims.stub.ImsFeatureConfiguration build();
  }

  public static final class ImsFeatureConfiguration.FeatureSlotPair {
    ctor public ImsFeatureConfiguration.FeatureSlotPair(int, int);
    field public final int featureType;
    field public final int slotId;
  }

  public class ImsMultiEndpointImplBase {
    ctor public ImsMultiEndpointImplBase();
    method public final void onImsExternalCallStateUpdate(java.util.List<android.telephony.ims.ImsExternalCallState>);
+17 −0
Original line number Diff line number Diff line
@@ -5242,6 +5242,23 @@ public class TelephonyManager {
        return false;
    }

    /**
     * @return true if the IMS resolver is busy resolving a binding and should not be considered
     * available, false if the IMS resolver is idle.
     * @hide
     */
    public boolean isResolvingImsBinding() {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.isResolvingImsBinding();
            }
        } catch (RemoteException e) {
            Rlog.e(TAG, "isResolvingImsBinding, RemoteException: " + e.getMessage());
        }
        return false;
    }

    /**
     * Set IMS registration state
     *
+3 −3
Original line number Diff line number Diff line
@@ -575,7 +575,7 @@ public class MmTelFeature extends ImsFeature {
     */
    public ImsUtImplBase getUt() {
        // Base Implementation - Should be overridden
        return null;
        return new ImsUtImplBase();
    }

    /**
@@ -584,7 +584,7 @@ public class MmTelFeature extends ImsFeature {
     */
    public ImsEcbmImplBase getEcbm() {
        // Base Implementation - Should be overridden
        return null;
        return new ImsEcbmImplBase();
    }

    /**
@@ -593,7 +593,7 @@ public class MmTelFeature extends ImsFeature {
     */
    public ImsMultiEndpointImplBase getMultiEndpoint() {
        // Base Implementation - Should be overridden
        return null;
        return new ImsMultiEndpointImplBase();
    }

    /**
+83 −33
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.ims.feature.ImsFeature;
import android.util.ArraySet;
import android.util.Pair;

import java.util.Set;

@@ -34,14 +35,57 @@ import java.util.Set;
 */
@SystemApi
public final class ImsFeatureConfiguration implements Parcelable {

    public static final class FeatureSlotPair {
        /**
         * SIM slot that this feature is associated with.
         */
        public final int slotId;
        /**
         * The feature that this slotId supports. Supported values are
         * {@link ImsFeature#FEATURE_EMERGENCY_MMTEL}, {@link ImsFeature#FEATURE_MMTEL}, and
         * {@link ImsFeature#FEATURE_RCS}.
         */
        public final @ImsFeature.FeatureType int featureType;

        /**
         * A mapping from slotId to IMS Feature type.
         * @param slotId the SIM slot ID associated with this feature.
         * @param featureType The feature that this slotId supports. Supported values are
         * {@link ImsFeature#FEATURE_EMERGENCY_MMTEL}, {@link ImsFeature#FEATURE_MMTEL}, and
         * {@link ImsFeature#FEATURE_RCS}.
         */
        public FeatureSlotPair(int slotId, @ImsFeature.FeatureType int featureType) {
            this.slotId = slotId;
            this.featureType = featureType;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            FeatureSlotPair that = (FeatureSlotPair) o;

            if (slotId != that.slotId) return false;
            return featureType == that.featureType;
        }

        @Override
        public int hashCode() {
            int result = slotId;
            result = 31 * result + featureType;
            return result;
        }
    }

    /**
     * Features that this ImsService supports.
     */
    private final Set<Integer> mFeatures;
    private final Set<FeatureSlotPair> mFeatures;

    /**
     * Builder for {@link ImsFeatureConfiguration} that makes adding supported {@link ImsFeature}s
     * easier.
     * Builder for {@link ImsFeatureConfiguration}.
     */
    public static class Builder {
            ImsFeatureConfiguration mConfig;
@@ -50,12 +94,15 @@ public final class ImsFeatureConfiguration implements Parcelable {
        }

        /**
         * @param feature A feature defined in {@link ImsFeature.FeatureType} that this service
         *         supports.
         * Adds an IMS feature associated with a SIM slot ID.
         * @param slotId The slot ID associated with the IMS feature.
         * @param featureType The feature that the slot ID supports. Supported values are
         * {@link ImsFeature#FEATURE_EMERGENCY_MMTEL}, {@link ImsFeature#FEATURE_MMTEL}, and
         * {@link ImsFeature#FEATURE_RCS}.
         * @return a {@link Builder} to continue constructing the ImsFeatureConfiguration.
         */
        public Builder addFeature(@ImsFeature.FeatureType int feature) {
            mConfig.addFeature(feature);
        public Builder addFeature(int slotId, @ImsFeature.FeatureType int featureType) {
            mConfig.addFeature(slotId, featureType);
            return this;
        }

@@ -66,8 +113,7 @@ public final class ImsFeatureConfiguration implements Parcelable {

    /**
     * Creates with all registration features empty.
     *
     * Consider using the provided {@link Builder} to create this configuration instead.
     * @hide
     */
    public ImsFeatureConfiguration() {
        mFeatures = new ArraySet<>();
@@ -76,45 +122,41 @@ public final class ImsFeatureConfiguration implements Parcelable {
    /**
     * Configuration of the ImsService, which describes which features the ImsService supports
     * (for registration).
     * @param features an array of feature integers defined in {@link ImsFeature} that describe
     * which features this ImsService supports. Supported values are
     * {@link ImsFeature#FEATURE_EMERGENCY_MMTEL}, {@link ImsFeature#FEATURE_MMTEL}, and
     * {@link ImsFeature#FEATURE_RCS}.
     * @param features a set of {@link FeatureSlotPair}s that describe which features this
     *         ImsService supports.
     * @hide
     */
    public ImsFeatureConfiguration(int[] features) {
    public ImsFeatureConfiguration(Set<FeatureSlotPair> features) {
        mFeatures = new ArraySet<>();

        if (features != null) {
            for (int i : features) {
                mFeatures.add(i);
            }
            mFeatures.addAll(features);
        }
    }

    /**
     * @return an int[] containing the features that this ImsService supports. Supported values are
     * {@link ImsFeature#FEATURE_EMERGENCY_MMTEL}, {@link ImsFeature#FEATURE_MMTEL}, and
     * {@link ImsFeature#FEATURE_RCS}.
     * @return a set of supported slot ID to feature type pairs contained within a
     * {@link FeatureSlotPair}.
     */
    public int[] getServiceFeatures() {
        return mFeatures.stream().mapToInt(i->i).toArray();
    public Set<FeatureSlotPair> getServiceFeatures() {
        return new ArraySet<>(mFeatures);
    }

    void addFeature(int feature) {
        mFeatures.add(feature);
    /**
     * @hide
     */
    void addFeature(int slotId, int feature) {
        mFeatures.add(new FeatureSlotPair(slotId, feature));
    }

    /** @hide */
    protected ImsFeatureConfiguration(Parcel in) {
        int[] features = in.createIntArray();
        if (features != null) {
            mFeatures = new ArraySet<>(features.length);
            for(Integer i : features) {
                mFeatures.add(i);
            }
        } else {
            mFeatures = new ArraySet<>();
        int featurePairLength = in.readInt();
        // length
        mFeatures = new ArraySet<>(featurePairLength);
        for (int i = 0; i < featurePairLength; i++) {
            // pair of reads for each entry (slotId->featureType)
            mFeatures.add(new FeatureSlotPair(in.readInt(), in.readInt()));
        }
    }

@@ -138,7 +180,15 @@ public final class ImsFeatureConfiguration implements Parcelable {

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeIntArray(mFeatures.stream().mapToInt(i->i).toArray());
        FeatureSlotPair[] featureSlotPairs = new FeatureSlotPair[mFeatures.size()];
        mFeatures.toArray(featureSlotPairs);
        // length of list
        dest.writeInt(featureSlotPairs.length);
        // then pairs of integers for each entry (slotId->featureType).
        for (FeatureSlotPair featureSlotPair : featureSlotPairs) {
            dest.writeInt(featureSlotPair.slotId);
            dest.writeInt(featureSlotPair.featureType);
        }
    }

    /**
+6 −0
Original line number Diff line number Diff line
@@ -822,6 +822,12 @@ interface ITelephony {
    */
    boolean isEmergencyMmTelAvailable(int slotId);

    /**
     * @return true if the IMS resolver is busy resolving a binding and should not be considered
     * available, false if the IMS resolver is idle.
     */
    boolean isResolvingImsBinding();

    /**
     * Set the network selection mode to automatic.
     *