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

Commit a08cc830 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "ims_cc"

* changes:
  ims: API to update ims carreir configs
  CarrierConfig: get configs by prefix
  Add new carrier config for supporting WPS over IMS
parents a0c949d5 6b589789
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -42107,6 +42107,7 @@ package android.telephony {
  public class CarrierConfigManager {
    method @Nullable public android.os.PersistableBundle getConfig();
    method @Nullable public android.os.PersistableBundle getConfigByComponentForSubId(String, int);
    method @Nullable public android.os.PersistableBundle getConfigForSubId(int);
    method public static boolean isConfigForIdentifiedCarrier(android.os.PersistableBundle);
    method public void notifyConfigChangedForSubId(int);
@@ -42284,6 +42285,10 @@ package android.telephony {
    field public static final String KEY_WORLD_PHONE_BOOL = "world_phone_bool";
  }
  public static final class CarrierConfigManager.Ims {
    field public static final String KEY_PREFIX = "ims.";
  }
  public abstract class CellIdentity implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public CharSequence getOperatorAlphaLong();
+99 −0
Original line number Diff line number Diff line
@@ -2803,6 +2803,23 @@ public class CarrierConfigManager {
    public static final String KEY_IS_OPPORTUNISTIC_SUBSCRIPTION_BOOL =
            "is_opportunistic_subscription_bool";

    /**
     * Configs used by the IMS stack.
     */
    public static final class Ims {
        /** Prefix of all Ims.KEY_* constants. */
        public static final String KEY_PREFIX = "ims.";

        //TODO: Add configs related to IMS.

        private Ims() {}

        private static PersistableBundle getDefaults() {
            PersistableBundle defaults = new PersistableBundle();
            return defaults;
        }
    }

    /**
     * A list of 4 GSM RSSI thresholds above which a signal level is considered POOR,
     * MODERATE, GOOD, or EXCELLENT, to be used in SignalStrength reporting.
@@ -2817,6 +2834,15 @@ public class CarrierConfigManager {
    public static final String KEY_GSM_RSSI_THRESHOLDS_INT_ARRAY =
            "gsm_rssi_thresholds_int_array";

    /**
     * Determines whether Wireless Priority Service call is supported over IMS.
     *
     * See Wireless Priority Service from https://www.fcc.gov/general/wireless-priority-service-wps
     * @hide
     */
    public static final String KEY_SUPPORT_WPS_OVER_IMS_BOOL =
            "support_wps_over_ims_bool";

    /** The default value for every variable. */
    private final static PersistableBundle sDefaults;

@@ -3217,6 +3243,8 @@ public class CarrierConfigManager {
                        -97, /* SIGNAL_STRENGTH_GOOD */
                        -89,  /* SIGNAL_STRENGTH_GREAT */
                });
        sDefaults.putBoolean(KEY_SUPPORT_WPS_OVER_IMS_BOOL, true);
        sDefaults.putAll(Ims.getDefaults());
    }

    /**
@@ -3413,4 +3441,75 @@ public class CarrierConfigManager {
        return ICarrierConfigLoader.Stub
                .asInterface(ServiceManager.getService(Context.CARRIER_CONFIG_SERVICE));
    }

    /**
     * Gets the configuration values for a component using its prefix.
     *
     * <p>Requires Permission:
     * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     * @param prefix prefix of the component.
     * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}.
     *
     * @see #getConfigForSubId
     */
    @Nullable
    public PersistableBundle getConfigByComponentForSubId(String prefix, int subId) {
        PersistableBundle configs = getConfigForSubId(subId);

        if (configs == null) {
            return null;
        }

        PersistableBundle ret = new PersistableBundle();
        for (String configKey : configs.keySet()) {
            if (configKey.startsWith(prefix)) {
                addConfig(configKey, configs.get(configKey), ret);
            }
        }

        return ret;
    }

    private void addConfig(String key, Object value, PersistableBundle configs) {
        if (value instanceof String) {
            configs.putString(key, (String) value);
        }

        if (value instanceof String[]) {
            configs.putStringArray(key, (String[]) value);
        }

        if (value instanceof Integer) {
            configs.putInt(key, (Integer) value);
        }

        if (value instanceof Long) {
            configs.putLong(key, (Long) value);
        }

        if (value instanceof Double) {
            configs.putDouble(key, (Double) value);
        }

        if (value instanceof Boolean) {
            configs.putBoolean(key, (Boolean) value);
        }

        if (value instanceof int[]) {
            configs.putIntArray(key, (int[]) value);
        }

        if (value instanceof double[]) {
            configs.putDoubleArray(key, (double[]) value);
        }

        if (value instanceof boolean[]) {
            configs.putBooleanArray(key, (boolean[]) value);
        }

        if (value instanceof long[]) {
            configs.putLongArray(key, (long[]) value);
        }
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@

package android.telephony.ims.aidl;

import android.os.PersistableBundle;

import android.telephony.ims.aidl.IImsConfigCallback;

import com.android.ims.ImsConfigListener;
@@ -37,4 +39,5 @@ interface IImsConfig {
    int setConfigInt(int item, int value);
    // Return result code defined in ImsConfig#OperationStatusConstants
    int setConfigString(int item, String value);
    void updateImsCarrierConfigs(in PersistableBundle bundle);
}
+13 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.telephony.ims.stub;
import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.content.Context;
import android.os.PersistableBundle;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.telephony.ims.aidl.IImsConfig;
@@ -182,6 +183,11 @@ public class ImsConfigImplBase {
            return retVal;
        }

        @Override
        public void updateImsCarrierConfigs(PersistableBundle bundle) throws RemoteException {
            getImsConfigImpl().updateImsCarrierConfigs(bundle);
        }

        private ImsConfigImplBase getImsConfigImpl() throws RemoteException {
            ImsConfigImplBase ref = mImsConfigImplBaseWeakReference.get();
            if (ref == null) {
@@ -398,4 +404,11 @@ public class ImsConfigImplBase {
        // Base Implementation - To be overridden.
        return null;
    }

    /**
     * @hide
     */
    public void updateImsCarrierConfigs(PersistableBundle bundle) {
        // Base Implementation - Should be overridden
    }
}