summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java53
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java4
-rw-r--r--telephony/java/android/telephony/RadioAccessFamily.aidl19
-rw-r--r--telephony/java/android/telephony/RadioAccessFamily.java135
-rw-r--r--telephony/java/android/telephony/SubInfoRecord.java28
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java49
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java148
-rw-r--r--telephony/java/com/android/internal/telephony/DcParamObject.java58
-rw-r--r--telephony/java/com/android/internal/telephony/DctConstants.java1
-rw-r--r--telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl6
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl35
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneConstants.java6
-rw-r--r--telephony/java/com/android/internal/telephony/RILConstants.java4
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyIntents.java19
14 files changed, 484 insertions, 81 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 30799f8..27e9baf 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -976,6 +976,8 @@ public class PhoneNumberUtils
return 0xc;
} else if (c == WILD) {
return 0xd;
+ } else if (c == WAIT) {
+ return 0xe;
} else {
throw new RuntimeException ("invalid char for BCD " + c);
}
@@ -1813,23 +1815,31 @@ public class PhoneNumberUtils
// to the list.
number = extractNetworkPortionAlt(number);
- String numbers = "";
+ Rlog.d(LOG_TAG, "subId:" + subId + ", number: " + number + ", defaultCountryIso:" +
+ ((defaultCountryIso == null) ? "NULL" : defaultCountryIso));
+
+ String emergencyNumbers = "";
int slotId = SubscriptionManager.getSlotId(subId);
- // retrieve the list of emergency numbers
- // check read-write ecclist property first
- String ecclist = (slotId <= 0) ? "ril.ecclist" : ("ril.ecclist" + slotId);
- numbers = SystemProperties.get(ecclist);
+ if (slotId >= 0) {
+ // retrieve the list of emergency numbers
+ // check read-write ecclist property first
+ String ecclist = (slotId == 0) ? "ril.ecclist" : ("ril.ecclist" + slotId);
+
+ emergencyNumbers = SystemProperties.get(ecclist, "");
+ }
- if (TextUtils.isEmpty(numbers)) {
+ Rlog.d(LOG_TAG, "slotId:" + slotId + ", emergencyNumbers: " + emergencyNumbers);
+
+ if (TextUtils.isEmpty(emergencyNumbers)) {
// then read-only ecclist property since old RIL only uses this
- numbers = SystemProperties.get("ro.ril.ecclist");
+ emergencyNumbers = SystemProperties.get("ro.ril.ecclist");
}
- if (!TextUtils.isEmpty(numbers)) {
+ if (!TextUtils.isEmpty(emergencyNumbers)) {
// searches through the comma-separated list for a match,
// return true if one is found.
- for (String emergencyNum : numbers.split(",")) {
+ for (String emergencyNum : emergencyNumbers.split(",")) {
// It is not possible to append additional digits to an emergency number to dial
// the number in Brazil - it won't connect.
if (useExactMatch || "BR".equalsIgnoreCase(defaultCountryIso)) {
@@ -1849,6 +1859,23 @@ public class PhoneNumberUtils
Rlog.d(LOG_TAG, "System property doesn't provide any emergency numbers."
+ " Use embedded logic for determining ones.");
+ // If slot id is invalid, means that there is no sim card.
+ // According spec 3GPP TS22.101, the following numbers should be
+ // ECC numbers when SIM/USIM is not present.
+ emergencyNumbers = ((slotId < 0) ? "112,911,000,08,110,118,119,999" : "112,911");
+
+ for (String emergencyNum : emergencyNumbers.split(",")) {
+ if (useExactMatch) {
+ if (number.equals(emergencyNum)) {
+ return true;
+ }
+ } else {
+ if (number.startsWith(emergencyNum)) {
+ return true;
+ }
+ }
+ }
+
// No ecclist system property, so use our own list.
if (defaultCountryIso != null) {
ShortNumberUtil util = new ShortNumberUtil();
@@ -1857,13 +1884,9 @@ public class PhoneNumberUtils
} else {
return util.connectsToEmergencyNumber(number, defaultCountryIso);
}
- } else {
- if (useExactMatch) {
- return (number.equals("112") || number.equals("911"));
- } else {
- return (number.startsWith("112") || number.startsWith("911"));
- }
}
+
+ return false;
}
/**
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index 0dcd7c6..ec34ce8 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -20,6 +20,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.telephony.SubscriptionManager;
import android.telephony.CellLocation;
import android.telephony.CellInfo;
import android.telephony.VoLteServiceState;
@@ -31,6 +32,7 @@ import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
import com.android.internal.telephony.IPhoneStateListener;
+import com.android.internal.telephony.PhoneConstants;
import java.util.List;
@@ -225,7 +227,7 @@ public class PhoneStateListener {
* @hide
*/
/** @hide */
- protected long mSubId = 0;
+ protected long mSubId = SubscriptionManager.INVALID_SUB_ID;
private final Handler mHandler;
diff --git a/telephony/java/android/telephony/RadioAccessFamily.aidl b/telephony/java/android/telephony/RadioAccessFamily.aidl
new file mode 100644
index 0000000..f42e134
--- /dev/null
+++ b/telephony/java/android/telephony/RadioAccessFamily.aidl
@@ -0,0 +1,19 @@
+/*
+* Copyright (C) 2014 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package android.telephony;
+
+parcelable RadioAccessFamily; \ No newline at end of file
diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java
new file mode 100644
index 0000000..dd4c45d
--- /dev/null
+++ b/telephony/java/android/telephony/RadioAccessFamily.java
@@ -0,0 +1,135 @@
+/*
+* Copyright (C) 2014 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Object to indicate the phone radio type and access technology.
+ *
+ * @hide
+ */
+public class RadioAccessFamily implements Parcelable {
+
+ // Radio Access Family
+ public static final int RAF_UNKNOWN = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN);
+ public static final int RAF_GPRS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GPRS);
+ public static final int RAF_EDGE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EDGE);
+ public static final int RAF_UMTS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
+ public static final int RAF_IS95A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95A);
+ public static final int RAF_IS95B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95B);
+ public static final int RAF_1xRTT = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
+ public static final int RAF_EVDO_0 = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0);
+ public static final int RAF_EVDO_A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A);
+ public static final int RAF_HSDPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA);
+ public static final int RAF_HSUPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA);
+ public static final int RAF_HSPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA);
+ public static final int RAF_EVDO_B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B);
+ public static final int RAF_EHRPD = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD);
+ public static final int RAF_LTE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ public static final int RAF_HSPAP = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP);
+ public static final int RAF_GSM = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM);
+ public static final int RAF_TD_SCDMA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA);
+
+ /* Phone ID of phone */
+ private int mPhoneId;
+
+ /* Radio Access Family */
+ private int mRadioAccessFamily;
+
+ /**
+ * Constructor.
+ *
+ * @param phoneId the phone ID
+ * @param radioAccessFamily the phone radio access family defined
+ * in RadioAccessFamily. It's a bit mask value to represent
+ * the support type.
+ */
+ public RadioAccessFamily(int phoneId, int radioAccessFamily) {
+ mPhoneId = phoneId;
+ mRadioAccessFamily = radioAccessFamily;
+ }
+
+ /**
+ * Get phone ID.
+ *
+ * @return phone ID
+ */
+ public int getPhoneId() {
+ return mPhoneId;
+ }
+
+ /**
+ * get radio access family.
+ *
+ * @return radio access family
+ */
+ public int getRadioAccessFamily() {
+ return mRadioAccessFamily;
+ }
+
+ @Override
+ public String toString() {
+ String ret = "{ mPhoneId = " + mPhoneId
+ + ", mRadioAccessFamily = " + mRadioAccessFamily
+ + "}";
+ return ret;
+ }
+
+ /**
+ * Implement the Parcelable interface.
+ *
+ * @return describe content
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Implement the Parcelable interface.
+ *
+ * @param outParcel The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written.
+ */
+ public void writeToParcel(Parcel outParcel, int flags) {
+ outParcel.writeInt(mPhoneId);
+ outParcel.writeInt(mRadioAccessFamily);
+ }
+
+ /**
+ * Implement the Parcelable interface.
+ */
+ public static final Creator<RadioAccessFamily> CREATOR =
+ new Creator<RadioAccessFamily>() {
+
+ @Override
+ public RadioAccessFamily createFromParcel(Parcel in) {
+ int phoneId = in.readInt();
+ int radioAccessFamily = in.readInt();
+
+ return new RadioAccessFamily(phoneId, radioAccessFamily);
+ }
+
+ @Override
+ public RadioAccessFamily[] newArray(int size) {
+ return new RadioAccessFamily[size];
+ }
+ };
+}
+
diff --git a/telephony/java/android/telephony/SubInfoRecord.java b/telephony/java/android/telephony/SubInfoRecord.java
index 805f787..10058e2 100644
--- a/telephony/java/android/telephony/SubInfoRecord.java
+++ b/telephony/java/android/telephony/SubInfoRecord.java
@@ -16,12 +16,13 @@
package android.telephony;
+import android.graphics.drawable.BitmapDrawable;
import android.os.Parcel;
import android.os.Parcelable;
/**
* A Parcelable class for Subscription Information.
- * @hide - to be unhidden
+ * @hide
*/
public class SubInfoRecord implements Parcelable {
@@ -108,6 +109,31 @@ public class SubInfoRecord implements Parcelable {
this.mnc = mnc;
}
+ /**
+ * Returns the string displayed to the user that identifies this subscription
+ */
+ public String getLabel() {
+ return this.displayName;
+ }
+
+ /**
+ * Return the icon used to identify this SIM.
+ * TODO: return the correct drawable.
+ */
+ public BitmapDrawable getIconDrawable() {
+ return new BitmapDrawable();
+ }
+
+ /**
+ * Return the color to be used for when displaying to the user. This is the value of the color.
+ * ex: 0x00ff00
+ */
+ public int getColor() {
+ // Note: This color is currently an index into a list of drawables, but this is soon to
+ // change.
+ return this.color;
+ }
+
public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() {
@Override
public SubInfoRecord createFromParcel(Parcel source) {
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index fe68263..b37a752 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -18,6 +18,7 @@ package android.telephony;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
+import android.annotation.SystemApi;
import android.content.Intent;
import android.net.Uri;
import android.provider.BaseColumns;
@@ -38,7 +39,7 @@ import java.util.List;
* The android.Manifest.permission.READ_PHONE_STATE to retrieve the information, except
* getActiveSubIdList and getActiveSubIdCount for which no permission is needed.
*
- * @hide - to be unhidden
+ * @hide
*/
public class SubscriptionManager implements BaseColumns {
private static final String LOG_TAG = "SUB";
@@ -46,32 +47,42 @@ public class SubscriptionManager implements BaseColumns {
private static final boolean VDBG = false;
/** An invalid phone identifier */
- /** @hide - to be unhidden */
+ @SystemApi
public static final int INVALID_PHONE_ID = -1000;
/** Indicates the caller wants the default phone id. */
- /** @hide - to be unhidden */
+ @SystemApi
public static final int DEFAULT_PHONE_ID = Integer.MAX_VALUE;
/** An invalid slot identifier */
- /** @hide - to be unhidden */
+ @SystemApi
public static final int INVALID_SLOT_ID = -1000;
/** Indicates the caller wants the default slot id. */
- /** @hide */
+ @SystemApi
public static final int DEFAULT_SLOT_ID = Integer.MAX_VALUE;
- /** Indicates the user should be asked which sub to use. */
- /** @hide */
+ /** Indicates the user should be asked which subscription to use. */
+ @SystemApi
public static final long ASK_USER_SUB_ID = -1001;
/** An invalid subscription identifier */
+ @SystemApi
public static final long INVALID_SUB_ID = -1000;
/** Indicates the caller wants the default sub id. */
- /** @hide - to be unhidden */
+ @SystemApi
public static final long DEFAULT_SUB_ID = Long.MAX_VALUE;
+ /** Minimum possible subid that represents a subscription */
+ /** @hide */
+ public static final long MIN_SUB_ID_VALUE = 0;
+
+ /** Maximum possible subid that represents a subscription */
+ /** @hide */
+ public static final long MAX_SUB_ID_VALUE = DEFAULT_SUB_ID - 1;
+
+
/** @hide */
public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo");
@@ -114,7 +125,7 @@ public class SubscriptionManager implements BaseColumns {
public static final String SIM_ID = "sim_id";
/** SIM is not inserted */
- /** @hide - to be unhidden */
+ @SystemApi
public static final int SIM_NOT_INSERTED = -1;
/**
@@ -263,7 +274,6 @@ public class SubscriptionManager implements BaseColumns {
* Get the SubInfoRecord associated with the subId
* @param subId The unique SubInfoRecord index in database
* @return SubInfoRecord, maybe null
- * @hide - to be unhidden
*/
public static SubInfoRecord getSubInfoForSubscriber(long subId) {
if (!isValidSubId(subId)) {
@@ -321,8 +331,8 @@ public class SubscriptionManager implements BaseColumns {
* Get the SubInfoRecord according to slotId
* @param slotId the slot which the SIM is inserted
* @return SubInfoRecord list, maybe empty but not null
- * @hide - to be unhidden
*/
+ @SystemApi
public static List<SubInfoRecord> getSubInfoUsingSlotId(int slotId) {
// FIXME: Consider never returning null
if (!isValidSlotId(slotId)) {
@@ -377,8 +387,8 @@ public class SubscriptionManager implements BaseColumns {
/**
* Get the SubInfoRecord(s) of the currently inserted SIM(s)
* @return Array list of currently inserted SubInfoRecord(s) maybe empty but not null
- * @hide - to be unhidden
*/
+ @SystemApi
public static List<SubInfoRecord> getActiveSubInfoList() {
List<SubInfoRecord> result = null;
@@ -634,8 +644,8 @@ public class SubscriptionManager implements BaseColumns {
* Get slotId associated with the subscription.
* @return slotId as a positive integer or a negative value if an error either
* SIM_NOT_INSERTED or INVALID_SLOT_ID.
- * @hide - to be unhidden
*/
+ @SystemApi
public static int getSlotId(long subId) {
if (!isValidSubId(subId)) {
logd("[getSlotId]- fail");
@@ -793,8 +803,8 @@ public class SubscriptionManager implements BaseColumns {
/**
* @return subId of the DefaultSms subscription or the value INVALID_SUB_ID if an error.
- * @hide - to be unhidden
*/
+ @SystemApi
public static long getDefaultSmsSubId() {
long subId = INVALID_SUB_ID;
@@ -922,12 +932,21 @@ public class SubscriptionManager implements BaseColumns {
/**
* @return true if a valid subId else false
- * @hide - to be unhidden
*/
+ @SystemApi
public static boolean isValidSubId(long subId) {
return subId > INVALID_SUB_ID ;
}
+ /**
+ * @return true if subId is an usable subId value else false. A
+ * usable subId means its neither a INVALID_SUB_ID nor a DEFAUL_SUB_ID.
+ * @hide
+ */
+ public static boolean isUsableSubIdValue(long subId) {
+ return subId >= MIN_SUB_ID_VALUE && subId <= MAX_SUB_ID_VALUE;
+ }
+
/** @hide */
public static boolean isValidSlotId(int slotId) {
// We are testing INVALID_SLOT_ID and slotId >= 0 independently because we should
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 6ba151f..b72a920 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -572,8 +572,28 @@ public class TelephonyManager {
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
*/
public String getDeviceSoftwareVersion() {
+ return getDeviceSoftwareVersion(getDefaultSim());
+ }
+
+ /**
+ * Returns the software version number for the device, for example,
+ * the IMEI/SV for GSM phones. Return null if the software version is
+ * not available.
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+ *
+ * @param slotId of which deviceID is returned
+ */
+ /** {@hide} */
+ public String getDeviceSoftwareVersion(int slotId) {
+ // FIXME methods taking slot id should not use subscription, instead us Uicc directly
+ long[] subId = SubscriptionManager.getSubId(slotId);
+ if (subId == null || subId.length == 0) {
+ return null;
+ }
try {
- return getSubscriberInfo().getDeviceSvn();
+ return getSubscriberInfo().getDeviceSvnUsingSubId(subId[0]);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -603,7 +623,11 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getDeviceId(int slotId) {
+ // FIXME methods taking slot id should not use subscription, instead us Uicc directly
long[] subId = SubscriptionManager.getSubId(slotId);
+ if (subId == null || subId.length == 0) {
+ return null;
+ }
try {
return getSubscriberInfo().getDeviceIdForSubscriber(subId[0]);
} catch (RemoteException ex) {
@@ -786,23 +810,23 @@ public class TelephonyManager {
/** {@hide} */
@SystemApi
public int getCurrentPhoneType(long subId) {
-
+ int phoneId = SubscriptionManager.getPhoneId(subId);
try{
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.getActivePhoneTypeForSubscriber(subId);
} else {
// This can happen when the ITelephony interface is not up yet.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
}
} catch (RemoteException ex) {
// This shouldn't happen in the normal case, as a backup we
// read from the system property.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
} catch (NullPointerException ex) {
// This shouldn't happen in the normal case, as a backup we
// read from the system property.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
}
}
@@ -823,31 +847,29 @@ public class TelephonyManager {
}
private int getPhoneTypeFromProperty() {
- return getPhoneTypeFromProperty(getDefaultSubscription());
+ return getPhoneTypeFromProperty(getDefaultPhone());
}
/** {@hide} */
- private int getPhoneTypeFromProperty(long subId) {
- String type =
- getTelephonyProperty
- (TelephonyProperties.CURRENT_ACTIVE_PHONE, subId, null);
- if (type != null) {
- return (Integer.parseInt(type));
- } else {
- return getPhoneTypeFromNetworkType(subId);
+ private int getPhoneTypeFromProperty(int phoneId) {
+ String type = getTelephonyProperty(phoneId,
+ TelephonyProperties.CURRENT_ACTIVE_PHONE, null);
+ if (type == null || type.equals("")) {
+ return getPhoneTypeFromNetworkType(phoneId);
}
+ return Integer.parseInt(type);
}
private int getPhoneTypeFromNetworkType() {
- return getPhoneTypeFromNetworkType(getDefaultSubscription());
+ return getPhoneTypeFromNetworkType(getDefaultPhone());
}
/** {@hide} */
- private int getPhoneTypeFromNetworkType(long subId) {
+ private int getPhoneTypeFromNetworkType(int phoneId) {
// When the system property CURRENT_ACTIVE_PHONE, has not been set,
// use the system property for default network type.
// This is a fail safe, and can only happen at first boot.
- String mode = getTelephonyProperty("ro.telephony.default_network", subId, null);
+ String mode = getTelephonyProperty(phoneId, "ro.telephony.default_network", null);
if (mode != null) {
return TelephonyManager.getPhoneType(Integer.parseInt(mode));
}
@@ -1000,9 +1022,8 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getNetworkOperatorName(long subId) {
-
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ALPHA, "");
}
/**
@@ -1028,9 +1049,8 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getNetworkOperator(long subId) {
-
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
}
/**
@@ -1053,8 +1073,9 @@ public class TelephonyManager {
*/
/** {@hide} */
public boolean isNetworkRoaming(long subId) {
- return "true".equals(getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
- subId, null));
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return Boolean.parseBoolean(getTelephonyProperty(phoneId,
+ TelephonyProperties.PROPERTY_OPERATOR_ISROAMING, null));
}
/**
@@ -1081,8 +1102,8 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getNetworkCountryIso(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
}
/** Network type is unknown */
@@ -1441,13 +1462,13 @@ public class TelephonyManager {
// FIXME the argument to pass is subId ??
public int getSimState(int slotId) {
long[] subId = SubscriptionManager.getSubId(slotId);
- if (subId == null) {
+ if (subId == null || subId.length == 0) {
return SIM_STATE_ABSENT;
}
// FIXME Do not use a property to determine SIM_STATE, call
// appropriate method on some object.
- String prop =
- getTelephonyProperty(TelephonyProperties.PROPERTY_SIM_STATE, subId[0], "");
+ int phoneId = SubscriptionManager.getPhoneId(subId[0]);
+ String prop = getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_SIM_STATE, "");
if ("ABSENT".equals(prop)) {
return SIM_STATE_ABSENT;
}
@@ -1480,7 +1501,16 @@ public class TelephonyManager {
* @see #getSimState
*/
public String getSimOperator() {
- long subId = getDefaultSubscription();
+ long subId = SubscriptionManager.getDefaultDataSubId();
+ if (!SubscriptionManager.isUsableSubIdValue(subId)) {
+ subId = SubscriptionManager.getDefaultSmsSubId();
+ if (!SubscriptionManager.isUsableSubIdValue(subId)) {
+ subId = SubscriptionManager.getDefaultVoiceSubId();
+ if (!SubscriptionManager.isUsableSubIdValue(subId)) {
+ subId = SubscriptionManager.getDefaultSubId();
+ }
+ }
+ }
Rlog.d(TAG, "getSimOperator(): default subId=" + subId);
return getSimOperator(subId);
}
@@ -1497,8 +1527,9 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getSimOperator(long subId) {
- String operator = getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ String operator = getTelephonyProperty(phoneId,
+ TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "");
Rlog.d(TAG, "getSimOperator: subId=" + subId + " operator=" + operator);
return operator;
}
@@ -1525,8 +1556,8 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getSimOperatorName(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA, "");
}
/**
@@ -1543,8 +1574,9 @@ public class TelephonyManager {
*/
/** {@hide} */
public String getSimCountryIso(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
+ "");
}
/**
@@ -2026,6 +2058,9 @@ public class TelephonyManager {
}
}
+ /**
+ * @hide
+ */
private IPhoneSubInfo getSubscriberInfo() {
// get it each time because that process crashes a lot
return IPhoneSubInfo.Stub.asInterface(ServiceManager.getService("iphonesubinfo"));
@@ -2143,10 +2178,16 @@ public class TelephonyManager {
}
}
+ /**
+ * @hide
+ */
private ITelephony getITelephony() {
return ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
}
+ /**
+ * @hide
+ */
private ITelecomService getTelecomService() {
return ITelecomService.Stub.asInterface(ServiceManager.getService(Context.TELECOM_SERVICE));
}
@@ -2628,10 +2669,16 @@ public class TelephonyManager {
return SubscriptionManager.getDefaultSubId();
}
+ /**
+ * Returns Default phone.
+ */
+ private static int getDefaultPhone() {
+ return SubscriptionManager.getPhoneId(SubscriptionManager.getDefaultSubId());
+ }
+
/** {@hide} */
public int getDefaultSim() {
- //TODO Need to get it from Telephony Devcontroller
- return 0;
+ return SubscriptionManager.getSlotId(SubscriptionManager.getDefaultSubId());
}
/**
@@ -2639,11 +2686,12 @@ public class TelephonyManager {
*
* @hide
*/
- public static void setTelephonyProperty(String property, long subId, String value) {
+ public static void setTelephonyProperty(int phoneId, String property, String value) {
+ Rlog.d(TAG, "setTelephonyProperty property: " + property + " phoneId: " + phoneId +
+ " value: " + value);
String propVal = "";
String p[] = null;
String prop = SystemProperties.get(property);
- int phoneId = SubscriptionManager.getPhoneId(subId);
if (value == null) {
value = "";
@@ -2653,7 +2701,10 @@ public class TelephonyManager {
p = prop.split(",");
}
- if (phoneId < 0) return;
+ if (!SubscriptionManager.isValidPhoneId(phoneId)) {
+ Rlog.d(TAG, "setTelephonyProperty invalid phone id");
+ return;
+ }
for (int i = 0; i < phoneId; i++) {
String str = "";
@@ -2738,6 +2789,12 @@ public class TelephonyManager {
String valArray[] = null;
String v = android.provider.Settings.Global.getString(cr, name);
+ if (index == Integer.MAX_VALUE) {
+ throw new RuntimeException("putIntAtIndex index == MAX_VALUE index=" + index);
+ }
+ if (index < 0) {
+ throw new RuntimeException("putIntAtIndex index < 0 index=" + index);
+ }
if (v != null) {
valArray = v.split(",");
}
@@ -2767,9 +2824,8 @@ public class TelephonyManager {
*
* @hide
*/
- public static String getTelephonyProperty(String property, long subId, String defaultVal) {
+ public static String getTelephonyProperty(int phoneId, String property, String defaultVal) {
String propVal = null;
- int phoneId = SubscriptionManager.getPhoneId(subId);
String prop = SystemProperties.get(property);
if ((prop != null) && (prop.length() > 0)) {
String values[] = prop.split(",");
@@ -2783,10 +2839,10 @@ public class TelephonyManager {
/** @hide */
public int getSimCount() {
if(isMultiSimEnabled()) {
- //TODO Need to get it from Telephony Devcontroller
+ //FIXME Need to get it from Telephony Devcontroller
return 2;
} else {
- return 1;
+ return 1;
}
}
diff --git a/telephony/java/com/android/internal/telephony/DcParamObject.java b/telephony/java/com/android/internal/telephony/DcParamObject.java
new file mode 100644
index 0000000..c92988f
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/DcParamObject.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+import android.os.Parcelable;
+import android.os.Parcel;
+
+public class DcParamObject implements Parcelable {
+
+ private long mSubId;
+
+ public DcParamObject(long subId) {
+ mSubId = subId;
+ }
+
+ public DcParamObject(Parcel in) {
+ readFromParcel(in);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeLong(mSubId);
+ }
+
+ private void readFromParcel(Parcel in) {
+ mSubId = in.readLong();
+ }
+
+ public static final Parcelable.Creator<DcParamObject> CREATOR = new Parcelable.Creator<DcParamObject>() {
+ public DcParamObject createFromParcel(Parcel in) {
+ return new DcParamObject(in);
+ }
+ public DcParamObject[] newArray(int size) {
+ return new DcParamObject[size];
+ }
+ };
+
+ public long getSubId() {
+ return mSubId;
+ }
+}
diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java
index 7185c46..a4e9486 100644
--- a/telephony/java/com/android/internal/telephony/DctConstants.java
+++ b/telephony/java/com/android/internal/telephony/DctConstants.java
@@ -116,6 +116,7 @@ public class DctConstants {
public static final int APN_EMERGENCY_ID = 9;
public static final int APN_NUM_TYPES = 10;
+ public static final int INVALID = -1;
public static final int DISABLED = 0;
public static final int ENABLED = 1;
diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
index c203442..d706203 100644
--- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
+++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
@@ -45,6 +45,12 @@ interface IPhoneSubInfo {
String getDeviceSvn();
/**
+ * Retrieves the software version number of a subId for the device, e.g., IMEI/SV
+ * for GSM phones.
+ */
+ String getDeviceSvnUsingSubId(long subId);
+
+ /**
* Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones.
*/
String getSubscriberId();
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 0868f41..58807b2 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -21,6 +21,7 @@ import android.os.Bundle;
import android.telephony.CellInfo;
import android.telephony.IccOpenLogicalChannelResponse;
import android.telephony.NeighboringCellInfo;
+import android.telephony.RadioAccessFamily;
import java.util.List;
@@ -79,6 +80,23 @@ interface ITelephony {
void answerRingingCall();
/**
+ * Answer the currently-ringing call on particular subId .
+ *
+ * If there's already a current active call, that call will be
+ * automatically put on hold. If both lines are currently in use, the
+ * current active call will be ended.
+ *
+ * TODO: provide a flag to let the caller specify what policy to use
+ * if both lines are in use. (The current behavior is hardwired to
+ * "answer incoming, end ongoing", which is how the CALL button
+ * is specced to behave.)
+ *
+ * TODO: this should be a oneway call (especially since it's called
+ * directly from the key queue thread).
+ */
+ void answerRingingCallForSubscriber(long subId);
+
+ /**
* Silence the ringer if an incoming call is currently ringing.
* (If vibrating, stop the vibrator also.)
*
@@ -796,4 +814,21 @@ interface ITelephony {
* Shutdown Mobile Radios
*/
void shutdownMobileRadios();
+
+ /**
+ * Set phone radio type and access technology.
+ *
+ * @param rafs an RadioAccessFamily array to indicate all phone's
+ * new radio access family. The length of RadioAccessFamily
+ * must equ]]al to phone count.
+ */
+ void setRadioCapability(in RadioAccessFamily[] rafs);
+
+ /**
+ * Get phone radio type and access technology.
+ *
+ * @param phoneId which phone you want to get
+ * @return phone radio type and access technology
+ */
+ int getRadioAccessFamily(in int phoneId);
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index 62b5596..b8e8064 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -160,9 +160,6 @@ public class PhoneConstants {
public static final int SUB2 = 1;
public static final int SUB3 = 2;
- public static final int EVENT_SUBSCRIPTION_ACTIVATED = 500;
- public static final int EVENT_SUBSCRIPTION_DEACTIVATED = 501;
-
// TODO: Remove these constants and use an int instead.
public static final int SIM_ID_1 = 0;
public static final int SIM_ID_2 = 1;
@@ -186,4 +183,7 @@ public class PhoneConstants {
// Initial MTU value.
public static final int UNSET_MTU = 0;
+
+ //FIXME maybe this shouldn't be here - sprout only
+ public static final int CAPABILITY_3G = 1;
}
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index e730bde..d093a29 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -291,6 +291,8 @@ cat include/telephony/ril.h | \
int RIL_REQUEST_SET_DC_RT_INFO_RATE = 127;
int RIL_REQUEST_SET_DATA_PROFILE = 128;
int RIL_REQUEST_SHUTDOWN = 129;
+ int RIL_REQUEST_GET_RADIO_CAPABILITY = 130;
+ int RIL_REQUEST_SET_RADIO_CAPABILITY = 131;
int RIL_UNSOL_RESPONSE_BASE = 1000;
int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;
@@ -334,4 +336,6 @@ cat include/telephony/ril.h | \
int RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED = 1038;
int RIL_UNSOL_SRVCC_STATE_NOTIFY = 1039;
int RIL_UNSOL_HARDWARE_CONFIG_CHANGED = 1040;
+ int RIL_UNSOL_DC_RT_INFO_CHANGED = 1041;
+ int RIL_UNSOL_RADIO_CAPABILITY = 1042;
}
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index e7aca90..d05e7d1 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -401,4 +401,23 @@ public class TelephonyIntents {
*/
public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED
= "android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED";
+
+ /*
+ * Broadcast Action: An attempt to set phone radio type and access technology has changed.
+ * This has the following extra values:
+ * <ul>
+ * <li><em>phones radio access family </em> - A RadioAccessFamily
+ * array, contain phone ID and new radio access family for each phone.</li>
+ * </ul>
+ */
+ public static final String ACTION_SET_RADIO_CAPABILITY_DONE =
+ "android.intent.action.ACTION_SET_RADIO_CAPABILITY_DONE";
+
+ public static final String EXTRA_RADIO_ACCESS_FAMILY = "rafs";
+
+ /*
+ * Broadcast Action: An attempt to set phone radio access family has failed.
+ */
+ public static final String ACTION_SET_RADIO_CAPABILITY_FAILED =
+ "android.intent.action.ACTION_SET_RADIO_CAPABILITY_FAILED";
}