diff options
Diffstat (limited to 'telephony')
30 files changed, 1235 insertions, 805 deletions
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java index 6fe10dc..674777e 100644 --- a/telephony/java/android/telephony/DisconnectCause.java +++ b/telephony/java/android/telephony/DisconnectCause.java @@ -160,11 +160,43 @@ public class DisconnectCause { */ public static final int OUTGOING_CANCELED = 44; + /** + * The call, which was an IMS call, disconnected because it merged with another call. + */ + public static final int IMS_MERGED_SUCCESSFULLY = 45; + + /** + * Stk Call Control modified DIAL request to USSD request. + * {@hide} + */ + public static final int DIAL_MODIFIED_TO_USSD = 46; + /** + * Stk Call Control modified DIAL request to SS request. + * {@hide} + */ + public static final int DIAL_MODIFIED_TO_SS = 47; + /** + * Stk Call Control modified DIAL request to DIAL with modified data. + * {@hide} + */ + public static final int DIAL_MODIFIED_TO_DIAL = 48; + + //********************************************************************************************* + // When adding a disconnect type: + // 1) Please assign the new type the next id value below. + // 2) Increment the next id value below to a new value. + // 3) Update MAXIMUM_VALID_VALUE to the new disconnect type. + // 4) Update toString() with the newly added disconnect type. + // 5) Update android.telecom.DisconnectCauseUtil with any mappings to a telecom.DisconnectCause. + // + // NextId: 49 + //********************************************************************************************* + /** Smallest valid value for call disconnect codes. */ public static final int MINIMUM_VALID_VALUE = NOT_DISCONNECTED; /** Largest valid value for call disconnect codes. */ - public static final int MAXIMUM_VALID_VALUE = OUTGOING_CANCELED; + public static final int MAXIMUM_VALID_VALUE = DIAL_MODIFIED_TO_DIAL; /** Private constructor to avoid class instantiation. */ private DisconnectCause() { @@ -256,12 +288,20 @@ public class DisconnectCause { return "CDMA_CALL_LOST"; case EXITED_ECM: return "EXITED_ECM"; + case DIAL_MODIFIED_TO_USSD: + return "DIAL_MODIFIED_TO_USSD"; + case DIAL_MODIFIED_TO_SS: + return "DIAL_MODIFIED_TO_SS"; + case DIAL_MODIFIED_TO_DIAL: + return "DIAL_MODIFIED_TO_DIAL"; case ERROR_UNSPECIFIED: return "ERROR_UNSPECIFIED"; case OUTGOING_FAILURE: return "OUTGOING_FAILURE"; case OUTGOING_CANCELED: return "OUTGOING_CANCELED"; + case IMS_MERGED_SUCCESSFULLY: + return "IMS_MERGED_SUCCESSFULLY"; default: return "INVALID: " + cause; } diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 27e9baf..897702d 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1570,7 +1570,7 @@ public class PhoneNumberUtils * listed in the RIL / SIM, otherwise return false. * @hide */ - public static boolean isEmergencyNumber(long subId, String number) { + public static boolean isEmergencyNumber(int subId, String number) { // Return true only if the specified number *exactly* matches // one of the emergency numbers listed by the RIL / SIM. return isEmergencyNumberInternal(subId, number, true /* useExactMatch */); @@ -1620,7 +1620,7 @@ public class PhoneNumberUtils * same digits as any of those emergency numbers. * @hide */ - public static boolean isPotentialEmergencyNumber(long subId, String number) { + public static boolean isPotentialEmergencyNumber(int subId, String number) { // Check against the emergency numbers listed by the RIL / SIM, // and *don't* require an exact match. return isEmergencyNumberInternal(subId, number, false /* useExactMatch */); @@ -1669,7 +1669,7 @@ public class PhoneNumberUtils * @return true if the number is in the list of emergency numbers * listed in the RIL / sim, otherwise return false. */ - private static boolean isEmergencyNumberInternal(long subId, String number, + private static boolean isEmergencyNumberInternal(int subId, String number, boolean useExactMatch) { return isEmergencyNumberInternal(subId, number, null, useExactMatch); } @@ -1698,7 +1698,7 @@ public class PhoneNumberUtils * otherwise false * @hide */ - public static boolean isEmergencyNumber(long subId, String number, String defaultCountryIso) { + public static boolean isEmergencyNumber(int subId, String number, String defaultCountryIso) { return isEmergencyNumberInternal(subId, number, defaultCountryIso, true /* useExactMatch */); @@ -1750,7 +1750,7 @@ public class PhoneNumberUtils * any of those emergency numbers. * @hide */ - public static boolean isPotentialEmergencyNumber(long subId, String number, + public static boolean isPotentialEmergencyNumber(int subId, String number, String defaultCountryIso) { return isEmergencyNumberInternal(subId, number, defaultCountryIso, @@ -1794,7 +1794,7 @@ public class PhoneNumberUtils * @return true if the number is an emergency number for the specified country. * @hide */ - private static boolean isEmergencyNumberInternal(long subId, String number, + private static boolean isEmergencyNumberInternal(int subId, String number, String defaultCountryIso, boolean useExactMatch) { // If the number passed in is null, just return false: @@ -1911,7 +1911,7 @@ public class PhoneNumberUtils * is currently in. * @hide */ - public static boolean isLocalEmergencyNumber(Context context, long subId, String number) { + public static boolean isLocalEmergencyNumber(Context context, int subId, String number) { return isLocalEmergencyNumberInternal(subId, number, context, true /* useExactMatch */); @@ -1965,7 +1965,7 @@ public class PhoneNumberUtils * * @hide */ - public static boolean isPotentialLocalEmergencyNumber(Context context, long subId, + public static boolean isPotentialLocalEmergencyNumber(Context context, int subId, String number) { return isLocalEmergencyNumberInternal(subId, number, context, @@ -2014,7 +2014,7 @@ public class PhoneNumberUtils * local country, based on the CountryDetector. * @hide */ - private static boolean isLocalEmergencyNumberInternal(long subId, String number, + private static boolean isLocalEmergencyNumberInternal(int subId, String number, Context context, boolean useExactMatch) { String countryIso; @@ -2057,7 +2057,7 @@ public class PhoneNumberUtils * to read the VM number. * @hide */ - public static boolean isVoiceMailNumber(long subId, String number) { + public static boolean isVoiceMailNumber(int subId, String number) { String vmNumber; try { @@ -2796,7 +2796,7 @@ public class PhoneNumberUtils /** * Returns Default voice subscription Id. */ - private static long getDefaultVoiceSubId() { + private static int getDefaultVoiceSubId() { return SubscriptionManager.getDefaultVoiceSubId(); } //==== End of utility methods used only in compareStrictly() ===== diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index ec34ce8..2f1a8da 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -227,7 +227,7 @@ public class PhoneStateListener { * @hide */ /** @hide */ - protected long mSubId = SubscriptionManager.INVALID_SUB_ID; + protected int mSubId = SubscriptionManager.INVALID_SUB_ID; private final Handler mHandler; @@ -252,10 +252,10 @@ public class PhoneStateListener { /** * Create a PhoneStateListener for the Phone using the specified subscription. * This class requires Looper.myLooper() not return null. To supply your - * own non-null Looper use PhoneStateListener(long subId, Looper looper) below. + * own non-null Looper use PhoneStateListener(int subId, Looper looper) below. * @hide */ - public PhoneStateListener(long subId) { + public PhoneStateListener(int subId) { this(subId, Looper.myLooper()); } @@ -264,7 +264,7 @@ public class PhoneStateListener { * and non-null Looper. * @hide */ - public PhoneStateListener(long subId, Looper looper) { + public PhoneStateListener(int subId, Looper looper) { if (DBG) log("ctor: subId=" + subId + " looper=" + looper); mSubId = subId; mHandler = new Handler(looper) { diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 52d0516..8c2a4eb 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -864,4 +864,23 @@ public class ServiceState implements Parcelable { || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_B || radioTechnology == RIL_RADIO_TECHNOLOGY_EHRPD; } + + /** + * Returns a merged ServiceState consisting of the base SS with voice settings from the + * voice SS. The voice SS is only used if it is IN_SERVICE (otherwise the base SS is returned). + * @hide + * */ + public static ServiceState mergeServiceStates(ServiceState baseSs, ServiceState voiceSs) { + if (voiceSs.mVoiceRegState != STATE_IN_SERVICE) { + return baseSs; + } + + ServiceState newSs = new ServiceState(baseSs); + + // voice overrides + newSs.mVoiceRegState = voiceSs.mVoiceRegState; + newSs.mIsEmergencyOnly = false; // only get here if voice is IN_SERVICE + + return newSs; + } } diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java index 3363ca6..17db3fb 100644 --- a/telephony/java/android/telephony/SignalStrength.java +++ b/telephony/java/android/telephony/SignalStrength.java @@ -20,6 +20,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.telephony.Rlog; +import android.content.res.Resources; /** * Contains phone signal strength related information. @@ -50,6 +51,11 @@ public class SignalStrength implements Parcelable { //Use int max, as -1 is a valid value in signal strength public static final int INVALID = 0x7FFFFFFF; + private static final int RSRP_THRESH_TYPE_STRICT = 0; + private static final int[] RSRP_THRESH_STRICT = new int[] {-140, -115, -105, -95, -85, -44}; + private static final int[] RSRP_THRESH_LENIENT = new int[] {-140, -128, -118, -108, -98, -44}; + + private int mGsmSignalStrength; // Valid values are (0-31, 99) as defined in TS 27.007 8.5 private int mGsmBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 private int mCdmaDbm; // This value is the RSSI value @@ -745,12 +751,21 @@ public class SignalStrength implements Parcelable { */ int rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, rsrpIconLevel = -1, snrIconLevel = -1; - if (mLteRsrp > -44) rsrpIconLevel = -1; - else if (mLteRsrp >= -85) rsrpIconLevel = SIGNAL_STRENGTH_GREAT; - else if (mLteRsrp >= -95) rsrpIconLevel = SIGNAL_STRENGTH_GOOD; - else if (mLteRsrp >= -105) rsrpIconLevel = SIGNAL_STRENGTH_MODERATE; - else if (mLteRsrp >= -115) rsrpIconLevel = SIGNAL_STRENGTH_POOR; - else if (mLteRsrp >= -140) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; + int rsrpThreshType = Resources.getSystem().getInteger(com.android.internal.R.integer. + config_LTE_RSRP_threshold_type); + int[] threshRsrp; + if (rsrpThreshType == RSRP_THRESH_TYPE_STRICT) { + threshRsrp = RSRP_THRESH_STRICT; + } else { + threshRsrp = RSRP_THRESH_LENIENT; + } + + if (mLteRsrp > threshRsrp[5]) rsrpIconLevel = -1; + else if (mLteRsrp >= threshRsrp[4]) rsrpIconLevel = SIGNAL_STRENGTH_GREAT; + else if (mLteRsrp >= threshRsrp[3]) rsrpIconLevel = SIGNAL_STRENGTH_GOOD; + else if (mLteRsrp >= threshRsrp[2]) rsrpIconLevel = SIGNAL_STRENGTH_MODERATE; + else if (mLteRsrp >= threshRsrp[1]) rsrpIconLevel = SIGNAL_STRENGTH_POOR; + else if (mLteRsrp >= threshRsrp[0]) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; /* * Values are -200 dB to +300 (SNR*10dB) RS_SNR >= 13.0 dB =>4 bars 4.5 @@ -789,6 +804,7 @@ public class SignalStrength implements Parcelable { else if (mLteSignalStrength >= 8) rssiIconLevel = SIGNAL_STRENGTH_GOOD; else if (mLteSignalStrength >= 5) rssiIconLevel = SIGNAL_STRENGTH_MODERATE; else if (mLteSignalStrength >= 0) rssiIconLevel = SIGNAL_STRENGTH_POOR; + if (DBG) log("getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:" + rssiIconLevel); return rssiIconLevel; diff --git a/telephony/java/android/telephony/SubInfoRecord.java b/telephony/java/android/telephony/SubInfoRecord.java deleted file mode 100644 index 10058e2..0000000 --- a/telephony/java/android/telephony/SubInfoRecord.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * 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.graphics.drawable.BitmapDrawable; -import android.os.Parcel; -import android.os.Parcelable; - -/** - * A Parcelable class for Subscription Information. - * @hide - */ -public class SubInfoRecord implements Parcelable { - - /** - * Subscription Identifier, this is a device unique number - * and not an index into an array - */ - public long subId; - /** The GID for a SIM that maybe associated with this subscription, empty if unknown */ - public String iccId; - /** - * The slot identifier for that currently contains the subscription - * and not necessarily unique and maybe INVALID_SLOT_ID if unknown - */ - public int slotId; - /** - * The string displayed to the user that identifies this subscription - */ - public String displayName; - /** - * The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE, - * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT. - */ - public int nameSource; - /** - * The color to be used for when displaying to the user - */ - public int color; - /** - * A number presented to the user identify this subscription - */ - public String number; - /** - * How to display the phone number, DISPLAY_NUMBER_NONE, DISPLAY_NUMBER_FIRST, - * DISPLAY_NUMBER_LAST - */ - public int displayNumberFormat; - /** - * Data roaming state, DATA_RAOMING_ENABLE, DATA_RAOMING_DISABLE - */ - public int dataRoaming; - /** - * SIM Icon resource identifiers. FIXME: Check with MTK what it really is - */ - public int[] simIconRes; - /** - * Mobile Country Code - */ - public int mcc; - /** - * Mobile Network Code - */ - public int mnc; - - public SubInfoRecord() { - this.subId = SubscriptionManager.INVALID_SUB_ID; - this.iccId = ""; - this.slotId = SubscriptionManager.INVALID_SLOT_ID; - this.displayName = ""; - this.nameSource = 0; - this.color = 0; - this.number = ""; - this.displayNumberFormat = 0; - this.dataRoaming = 0; - this.simIconRes = new int[2]; - this.mcc = 0; - this.mnc = 0; - } - - public SubInfoRecord(long subId, String iccId, int slotId, String displayName, int nameSource, - int color, String number, int displayFormat, int roaming, int[] iconRes, - int mcc, int mnc) { - this.subId = subId; - this.iccId = iccId; - this.slotId = slotId; - this.displayName = displayName; - this.nameSource = nameSource; - this.color = color; - this.number = number; - this.displayNumberFormat = displayFormat; - this.dataRoaming = roaming; - this.simIconRes = iconRes; - this.mcc = mcc; - 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) { - long subId = source.readLong(); - String iccId = source.readString(); - int slotId = source.readInt(); - String displayName = source.readString(); - int nameSource = source.readInt(); - int color = source.readInt(); - String number = source.readString(); - int displayNumberFormat = source.readInt(); - int dataRoaming = source.readInt(); - int[] iconRes = new int[2]; - source.readIntArray(iconRes); - int mcc = source.readInt(); - int mnc = source.readInt(); - - return new SubInfoRecord(subId, iccId, slotId, displayName, nameSource, color, number, - displayNumberFormat, dataRoaming, iconRes, mcc, mnc); - } - - @Override - public SubInfoRecord[] newArray(int size) { - return new SubInfoRecord[size]; - } - }; - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(subId); - dest.writeString(iccId); - dest.writeInt(slotId); - dest.writeString(displayName); - dest.writeInt(nameSource); - dest.writeInt(color); - dest.writeString(number); - dest.writeInt(displayNumberFormat); - dest.writeInt(dataRoaming); - dest.writeIntArray(simIconRes); - dest.writeInt(mcc); - dest.writeInt(mnc); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public String toString() { - return "{mSubId=" + subId + ", mIccId=" + iccId + " mSlotId=" + slotId - + " mDisplayName=" + displayName + " mNameSource=" + nameSource - + " mColor=" + color + " mNumber=" + number - + " mDisplayNumberFormat=" + displayNumberFormat + " mDataRoaming=" + dataRoaming - + " mSimIconRes=" + simIconRes + " mMcc " + mcc + " mMnc " + mnc + "}"; - } -} diff --git a/telephony/java/android/telephony/SubInfoRecord.aidl b/telephony/java/android/telephony/SubscriptionInfo.aidl index a2de676..1e13732 100755 --- a/telephony/java/android/telephony/SubInfoRecord.aidl +++ b/telephony/java/android/telephony/SubscriptionInfo.aidl @@ -16,4 +16,4 @@ package android.telephony; -parcelable SubInfoRecord; +parcelable SubscriptionInfo; diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java new file mode 100644 index 0000000..a3ace36 --- /dev/null +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -0,0 +1,323 @@ +/* + * 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.content.Context; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.Rect; +import android.graphics.Typeface; +import android.os.Parcel; +import android.os.Parcelable; + +/** + * A Parcelable class for Subscription Information. + */ +public class SubscriptionInfo implements Parcelable { + + /** + * Size of text to render on the icon. + */ + private static final int TEXT_SIZE = 22; + + /** + * Subscription Identifier, this is a device unique number + * and not an index into an array + */ + private int mId; + + /** + * The GID for a SIM that maybe associated with this subscription, empty if unknown + */ + private String mIccId; + + /** + * The index of the slot that currently contains the subscription + * and not necessarily unique and maybe INVALID_SLOT_ID if unknown + */ + private int mSimSlotIndex; + + /** + * The name displayed to the user that identifies this subscription + */ + private CharSequence mDisplayName; + + /** + * The string displayed to the user that identifies Subscription Provider Name + */ + private CharSequence mCarrierName; + + /** + * The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE, + * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT. + */ + private int mNameSource; + + /** + * The color to be used for tinting the icon when displaying to the user + */ + private int mIconTint; + + /** + * A number presented to the user identify this subscription + */ + private String mNumber; + + /** + * Data roaming state, DATA_RAOMING_ENABLE, DATA_RAOMING_DISABLE + */ + private int mDataRoaming; + + /** + * SIM Icon bitmap + */ + private Bitmap mIconBitmap; + + /** + * Mobile Country Code + */ + private int mMcc; + + /** + * Mobile Network Code + */ + private int mMnc; + + /** + * @hide + */ + public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName, + CharSequence carrierName, int nameSource, int iconTint, String number, int roaming, + Bitmap icon, int mcc, int mnc) { + this.mId = id; + this.mIccId = iccId; + this.mSimSlotIndex = simSlotIndex; + this.mDisplayName = displayName; + this.mCarrierName = carrierName; + this.mNameSource = nameSource; + this.mIconTint = iconTint; + this.mNumber = number; + this.mDataRoaming = roaming; + this.mIconBitmap = icon; + this.mMcc = mcc; + this.mMnc = mnc; + } + + /** + * Returns the subscription ID. + */ + public int getSubscriptionId() { + return this.mId; + } + + /** + * Returns the ICC ID. + */ + public String getIccId() { + return this.mIccId; + } + + /** + * Returns the slot index of this Subscription's SIM card. + */ + public int getSimSlotIndex() { + return this.mSimSlotIndex; + } + + /** + * Returns the name displayed to the user that identifies this subscription + */ + public CharSequence getDisplayName() { + return this.mDisplayName; + } + + /** + * Sets the name displayed to the user that identifies this subscription + * @hide + */ + public void setDisplayName(CharSequence name) { + this.mDisplayName = name; + } + + /** + * Returns the name displayed to the user that identifies Subscription provider name + * @hide + */ + public CharSequence getCarrierName() { + return this.mCarrierName; + } + + /** + * Sets the name displayed to the user that identifies Subscription provider name + * @hide + */ + public void setCarrierName(CharSequence name) { + this.mCarrierName = name; + } + + /** + * Return the source of the name, eg NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE, + * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT. + */ + public int getNameSource() { + return this.mNameSource; + } + + /** + * Creates and returns an icon {@code Bitmap} to represent this {@code SubscriptionInfo} in a user + * interface. + * + * @param context A {@code Context} to get the {@code DisplayMetrics}s from. + * + * @return A bitmap icon for this {@code SubscriptionInfo}. + */ + public Bitmap createIconBitmap(Context context) { + int width = mIconBitmap.getWidth(); + int height = mIconBitmap.getHeight(); + + // Create a new bitmap of the same size because it will be modified. + Bitmap workingBitmap = Bitmap.createBitmap(context.getResources().getDisplayMetrics(), + width, height, mIconBitmap.getConfig()); + + Canvas canvas = new Canvas(workingBitmap); + Paint paint = new Paint(); + + // Tint the icon with the color. + paint.setColorFilter(new PorterDuffColorFilter(mIconTint, PorterDuff.Mode.SRC_ATOP)); + canvas.drawBitmap(mIconBitmap, 0, 0, paint); + paint.setColorFilter(null); + + // Write the sim slot index. + paint.setAntiAlias(true); + paint.setTypeface(Typeface.create("sans-serif", Typeface.NORMAL)); + paint.setColor(Color.WHITE); + paint.setTextSize(TEXT_SIZE); + final String index = Integer.toString(mSimSlotIndex + 1); + final Rect textBound = new Rect(); + paint.getTextBounds(index, 0, 1, textBound); + final float xOffset = (width / 2.f) - textBound.centerX(); + final float yOffset = (height / 2.f) - textBound.centerY(); + canvas.drawText(index, xOffset, yOffset, paint); + + return workingBitmap; + } + + /** + * A highlight color to use in displaying information about this {@code PhoneAccount}. + * + * @return A hexadecimal color value. + */ + public int getIconTint() { + return mIconTint; + } + + /** + * Sets the color displayed to the user that identifies this subscription + * @hide + */ + public void setIconTint(int iconTint) { + this.mIconTint = iconTint; + } + + /** + * Returns the number of this subscription. + */ + public String getNumber() { + return mNumber; + } + + /** + * Return the data roaming value. + */ + public int getDataRoaming() { + return this.mDataRoaming; + } + + /** + * Returns the MCC. + */ + public int getMcc() { + return this.mMcc; + } + + /** + * Returns the MNC. + */ + public int getMnc() { + return this.mMnc; + } + + public static final Parcelable.Creator<SubscriptionInfo> CREATOR = new Parcelable.Creator<SubscriptionInfo>() { + @Override + public SubscriptionInfo createFromParcel(Parcel source) { + int id = source.readInt(); + String iccId = source.readString(); + int simSlotIndex = source.readInt(); + CharSequence displayName = source.readCharSequence(); + CharSequence carrierName = source.readCharSequence(); + int nameSource = source.readInt(); + int iconTint = source.readInt(); + String number = source.readString(); + int dataRoaming = source.readInt(); + int mcc = source.readInt(); + int mnc = source.readInt(); + Bitmap iconBitmap = Bitmap.CREATOR.createFromParcel(source); + + return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName, nameSource, + iconTint, number, dataRoaming, iconBitmap, mcc, mnc); + } + + @Override + public SubscriptionInfo[] newArray(int size) { + return new SubscriptionInfo[size]; + } + }; + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mId); + dest.writeString(mIccId); + dest.writeInt(mSimSlotIndex); + dest.writeCharSequence(mDisplayName); + dest.writeCharSequence(mCarrierName); + dest.writeInt(mNameSource); + dest.writeInt(mIconTint); + dest.writeString(mNumber); + dest.writeInt(mDataRoaming); + dest.writeInt(mMcc); + dest.writeInt(mMnc); + mIconBitmap.writeToParcel(dest, flags); + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public String toString() { + return "{id=" + mId + ", iccId=" + mIccId + " simSlotIndex=" + mSimSlotIndex + + " displayName=" + mDisplayName + " carrierName=" + mCarrierName + + " nameSource=" + mNameSource + " iconTint=" + mIconTint + " number=" + mNumber + + " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc " + mMcc + + " mnc " + mMnc + "}"; + } +} diff --git a/telephony/java/android/telephony/SubscriptionListener.java b/telephony/java/android/telephony/SubscriptionListener.java new file mode 100644 index 0000000..5c65333 --- /dev/null +++ b/telephony/java/android/telephony/SubscriptionListener.java @@ -0,0 +1,125 @@ +/* + * 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 com.android.internal.telephony.ISub; +import com.android.internal.telephony.ISubscriptionListener; + +import android.os.Bundle; +import android.os.Handler; +import android.os.IBinder; +import android.os.Looper; +import android.os.Message; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.telephony.Rlog; + +import java.util.List; + +/** + * A listener class for monitoring changes to Subscription state + * changes on the device. + * <p> + * Override the onXxxx methods in this class and passing to the listen method + * bitwise-or of the corresponding LISTEN_Xxxx bit flags below. + * <p> + * Note that access to some of the information is permission-protected. Your + * application won't receive updates for protected information unless it has + * the appropriate permissions declared in its manifest file. Where permissions + * apply, they are noted in the appropriate LISTEN_ flags. + */ +public class SubscriptionListener { + private static final String LOG_TAG = "SubscriptionListener"; + private static final boolean DBG = false; // STOPSHIP if true + + /** + * Permission for LISTEN_SUBSCRIPTION_INFO_LIST_CHANGED + * + * @hide + */ + public static final String PERMISSION_LISTEN_SUBSCRIPTION_INFO_LIST_CHANGED = + android.Manifest.permission.READ_PHONE_STATE; + + /** + * Listen for changes to the SubscriptionInoList when listening for this event + * it is guaranteed that on #onSubscriptionInfoChanged will be invoked. This initial + * invocation should be used to call SubscriptionManager.getActiveSubscriptionInfoList() + * to get the initial list. + * + * Permissions: android.Manifest.permission.READ_PHONE_STATE + * @see #onSubscriptionInfoChanged + */ + public static final int LISTEN_SUBSCRIPTION_INFO_LIST_CHANGED = 0x00000001; + + private final Handler mHandler; + + /** + * Create a SubscriptionLitener for the device. + * + * This class requires Looper.myLooper() not return null. To supply your + * own non-null looper use PhoneStateListener(Looper looper) below. + */ + public SubscriptionListener() { + this(Looper.myLooper()); + } + + /** + * Create a PhoneStateListener for the Phone using the specified subscription + * and non-null Looper. + */ + public SubscriptionListener(Looper looper) { + if (DBG) log("ctor: looper=" + looper); + + ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); + mHandler = new Handler(looper) { + @Override + public void handleMessage(Message msg) { + if (DBG) { + log("what=0x" + Integer.toHexString(msg.what) + " msg=" + msg); + } + switch (msg.what) { + case LISTEN_SUBSCRIPTION_INFO_LIST_CHANGED: + SubscriptionListener.this.onSubscriptionInfoChanged(); + break; + } + } + }; + } + + /** + * Callback invoked when there is any change to any SubscriptionInfo. + */ + public void onSubscriptionInfoChanged() { + // default implementation empty + } + + /** + * The callback methods need to be called on the handler thread where + * this object was created. If the binder did that for us it'd be nice. + */ + ISubscriptionListener callback = new ISubscriptionListener.Stub() { + @Override + public void onSubscriptionInfoChanged() { + Message msg = Message.obtain(mHandler, LISTEN_SUBSCRIPTION_INFO_LIST_CHANGED); + msg.sendToTarget(); + } + }; + + private void log(String s) { + Rlog.d(LOG_TAG, s); + } +} diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index b37a752..78ab6870 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -18,7 +18,7 @@ package android.telephony; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; -import android.annotation.SystemApi; +import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.BaseColumns; @@ -27,6 +27,7 @@ import android.os.ServiceManager; import android.os.RemoteException; import com.android.internal.telephony.ISub; +import com.android.internal.telephony.ITelephonyRegistry; import com.android.internal.telephony.PhoneConstants; import java.util.ArrayList; @@ -38,78 +39,46 @@ 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 */ public class SubscriptionManager implements BaseColumns { private static final String LOG_TAG = "SUB"; private static final boolean DBG = true; private static final boolean VDBG = false; - /** An invalid phone identifier */ - @SystemApi - public static final int INVALID_PHONE_ID = -1000; - - /** Indicates the caller wants the default phone id. */ - @SystemApi - public static final int DEFAULT_PHONE_ID = Integer.MAX_VALUE; - - /** An invalid slot identifier */ - @SystemApi - public static final int INVALID_SLOT_ID = -1000; - - /** Indicates the caller wants the default slot id. */ - @SystemApi - public static final int DEFAULT_SLOT_ID = Integer.MAX_VALUE; - - /** 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. */ - @SystemApi - public static final long DEFAULT_SUB_ID = Long.MAX_VALUE; + public static final int INVALID_SUB_ID = -1000; - /** Minimum possible subid that represents a subscription */ + /** An invalid phone identifier */ /** @hide */ - public static final long MIN_SUB_ID_VALUE = 0; + public static final int INVALID_PHONE_ID = -1; - /** Maximum possible subid that represents a subscription */ + /** An invalid slot identifier */ /** @hide */ - public static final long MAX_SUB_ID_VALUE = DEFAULT_SUB_ID - 1; - + public static final int INVALID_SLOT_ID = -1; + /** Indicates the caller wants the default sub id. */ /** @hide */ - public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo"); + public static final int DEFAULT_SUB_ID = Integer.MAX_VALUE; + /** Indicates the caller wants the default phone id. */ /** @hide */ - public static final int DEFAULT_INT_VALUE = -100; + public static final int DEFAULT_PHONE_ID = Integer.MAX_VALUE; + /** Indicates the caller wants the default slot id. */ /** @hide */ - public static final String DEFAULT_STRING_VALUE = "N/A"; + public static final int DEFAULT_SLOT_ID = Integer.MAX_VALUE; + /** Minimum possible subid that represents a subscription */ /** @hide */ - public static final int EXTRA_VALUE_NEW_SIM = 1; + public static final int MIN_SUB_ID_VALUE = 0; + /** Maximum possible subid that represents a subscription */ /** @hide */ - public static final int EXTRA_VALUE_REMOVE_SIM = 2; - /** @hide */ - public static final int EXTRA_VALUE_REPOSITION_SIM = 3; - /** @hide */ - public static final int EXTRA_VALUE_NOCHANGE = 4; + public static final int MAX_SUB_ID_VALUE = DEFAULT_SUB_ID - 1; + /** @hide */ - public static final String INTENT_KEY_DETECT_STATUS = "simDetectStatus"; - /** @hide */ - public static final String INTENT_KEY_SIM_COUNT = "simCount"; - /** @hide */ - public static final String INTENT_KEY_NEW_SIM_SLOT = "newSIMSlot"; - /** @hide */ - public static final String INTENT_KEY_NEW_SIM_STATUS = "newSIMStatus"; + public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo"); /** * The ICC ID of a SIM. @@ -125,7 +94,7 @@ public class SubscriptionManager implements BaseColumns { public static final String SIM_ID = "sim_id"; /** SIM is not inserted */ - @SystemApi + /** @hide */ public static final int SIM_NOT_INSERTED = -1; /** @@ -136,6 +105,13 @@ public class SubscriptionManager implements BaseColumns { public static final String DISPLAY_NAME = "display_name"; /** + * TelephonyProvider column name for the service provider name for the SIM. + * <P>Type: TEXT (String)</P> + */ + /** @hide */ + public static final String CARRIER_NAME = "carrier_name"; + + /** * Default name resource * @hide */ @@ -219,7 +195,7 @@ public class SubscriptionManager implements BaseColumns { public static final int DISPLAY_NUMBER_LAST = 2; /** @hide */ - public static final int DISLPAY_NUMBER_DEFAULT = DISPLAY_NUMBER_FIRST; + public static final int DISPLAY_NUMBER_DEFAULT = DISPLAY_NUMBER_FIRST; /** * TelephonyProvider column name for permission for data roaming of a SIM. @@ -240,22 +216,17 @@ public class SubscriptionManager implements BaseColumns { /** * TelephonyProvider column name for the MCC associated with a SIM. * <P>Type: INTEGER (int)</P> + * @hide */ public static final String MCC = "mcc"; /** * TelephonyProvider column name for the MNC associated with a SIM. * <P>Type: INTEGER (int)</P> + * @hide */ public static final String MNC = "mnc"; - - private static final int RES_TYPE_BACKGROUND_DARK = 0; - - private static final int RES_TYPE_BACKGROUND_LIGHT = 1; - - private static final int[] sSimBackgroundDarkRes = setSimResource(RES_TYPE_BACKGROUND_DARK); - /** * Broadcast Action: The user has changed one of the default subs related to * data, phone calls, or sms</p> @@ -271,17 +242,70 @@ public class SubscriptionManager implements BaseColumns { } /** - * Get the SubInfoRecord associated with the subId - * @param subId The unique SubInfoRecord index in database - * @return SubInfoRecord, maybe null + * Register for changes to events defined by SubscriptionListener.LISTEN_Xxx. Some of + * the events will fire as registration completes, this could be before or after + * this method returns. + * + * @param listener an instance of SubscriptionListner with overridden methods the + * overridden method should match the bits defined in events. + * @param events is one or more of the SubscriptionListener.LISTEN_Xxx bits */ - public static SubInfoRecord getSubInfoForSubscriber(long subId) { + public static void register(Context context, SubscriptionListener listener, int events) { + String pkgForDebug = context != null ? context.getPackageName() : "<unknown>"; + if (DBG) { + logd("SubscriptionManager listen pkgForDebug=" + pkgForDebug + + " events=0x" + Integer.toHexString(events) + " listener=" + listener); + } + try { + // We use the TelephonyRegistry as its runs in the system and thus is always + // available where as SubscriptionController could crash and not be available + ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( + "telephony.registry")); + if (tr != null) { + tr.registerSubscriptionListener(pkgForDebug, listener.callback, events); + } + } catch (RemoteException ex) { + // Should not happen + } + } + + /** + * Unregister the listener. + * + * @param context + * @param listener + */ + public static void unregister(Context context, SubscriptionListener listener) { + String pkgForDebug = context != null ? context.getPackageName() : "<unknown>"; + if (DBG) { + logd("SubscriptionManager unregister pkgForDebug=" + pkgForDebug + + " listener=" + listener); + } + try { + // We use the TelephonyRegistry as its runs in the system and thus is always + // available where as SubscriptionController could crash and not be available + ITelephonyRegistry tr = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService( + "telephony.registry")); + if (tr != null) { + tr.unregisterSubscriptionListener(pkgForDebug, listener.callback); + } + } catch (RemoteException ex) { + // Should not happen + } + } + + /** + * Get the SubscriptionInfo associated with the subId + * @param subId The unique SubscriptionInfo index in database + * @return SubscriptionInfo, maybe null + */ + public static SubscriptionInfo getSubscriptionInfoForSubscriber(int subId) { if (!isValidSubId(subId)) { - logd("[getSubInfoForSubscriberx]- invalid subId"); + logd("[getSubscriptionInfoForSubscriber]- invalid subId"); return null; } - SubInfoRecord subInfo = null; + SubscriptionInfo subInfo = null; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -297,19 +321,19 @@ public class SubscriptionManager implements BaseColumns { } /** - * Get the SubInfoRecord according to an IccId + * Get the SubscriptionInfo according to an IccId * @param iccId the IccId of SIM card - * @return SubInfoRecord List, maybe empty but not null + * @return SubscriptionInfo List, maybe empty but not null * @hide */ - public static List<SubInfoRecord> getSubInfoUsingIccId(String iccId) { - if (VDBG) logd("[getSubInfoUsingIccId]+ iccId=" + iccId); + public static List<SubscriptionInfo> getSubscriptionInfoUsingIccId(String iccId) { + if (VDBG) logd("[getSubscriptionInfoUsingIccId]+ iccId=" + iccId); if (iccId == null) { - logd("[getSubInfoUsingIccId]- null iccid"); + logd("[getSubscriptionInfoUsingIccId]- null iccid"); return null; } - List<SubInfoRecord> result = null; + List<SubscriptionInfo> result = null; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -322,25 +346,24 @@ public class SubscriptionManager implements BaseColumns { if (result == null) { - result = new ArrayList<SubInfoRecord>(); + result = new ArrayList<SubscriptionInfo>(); } return result; } /** - * Get the SubInfoRecord according to slotId + * Get the SubscriptionInfo according to slotId * @param slotId the slot which the SIM is inserted - * @return SubInfoRecord list, maybe empty but not null + * @return SubscriptionInfo list, maybe empty but not null */ - @SystemApi - public static List<SubInfoRecord> getSubInfoUsingSlotId(int slotId) { + public static List<SubscriptionInfo> getSubscriptionInfoUsingSlotId(int slotId) { // FIXME: Consider never returning null if (!isValidSlotId(slotId)) { - logd("[getSubInfoUsingSlotId]- invalid slotId"); + logd("[getSubscriptionInfoUsingSlotId]- invalid slotId"); return null; } - List<SubInfoRecord> result = null; + List<SubscriptionInfo> result = null; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -353,21 +376,21 @@ public class SubscriptionManager implements BaseColumns { if (result == null) { - result = new ArrayList<SubInfoRecord>(); + result = new ArrayList<SubscriptionInfo>(); } return result; } /** - * Get all the SubInfoRecord(s) in subInfo database - * @return List of all SubInfoRecords in database, include those that were inserted before + * Get all the SubscriptionInfo(s) in subInfo database + * @return List of all SubscriptionInfos in database, include those that were inserted before * maybe empty but not null. * @hide */ - public static List<SubInfoRecord> getAllSubInfoList() { - if (VDBG) logd("[getAllSubInfoList]+"); + public static List<SubscriptionInfo> getAllSubscriptionInfoList() { + if (VDBG) logd("[getAllSubscriptionInfoList]+"); - List<SubInfoRecord> result = null; + List<SubscriptionInfo> result = null; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -379,18 +402,17 @@ public class SubscriptionManager implements BaseColumns { } if (result == null) { - result = new ArrayList<SubInfoRecord>(); + result = new ArrayList<SubscriptionInfo>(); } return result; } /** - * Get the SubInfoRecord(s) of the currently inserted SIM(s) - * @return Array list of currently inserted SubInfoRecord(s) maybe empty but not null + * Get the SubscriptionInfo(s) of the currently inserted SIM(s) + * @return Array list of currently inserted SubscriptionInfo(s) maybe empty but not null */ - @SystemApi - public static List<SubInfoRecord> getActiveSubInfoList() { - List<SubInfoRecord> result = null; + public static List<SubscriptionInfo> getActiveSubscriptionInfoList() { + List<SubscriptionInfo> result = null; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -402,7 +424,7 @@ public class SubscriptionManager implements BaseColumns { } if (result == null) { - result = new ArrayList<SubInfoRecord>(); + result = new ArrayList<SubscriptionInfo>(); } return result; } @@ -412,8 +434,8 @@ public class SubscriptionManager implements BaseColumns { * @return all SIM count in database, include what was inserted before * @hide */ - public static int getAllSubInfoCount() { - if (VDBG) logd("[getAllSubInfoCount]+"); + public static int getAllSubscriptionInfoCount() { + if (VDBG) logd("[getAllSubscriptionInfoCount]+"); int result = 0; @@ -434,7 +456,7 @@ public class SubscriptionManager implements BaseColumns { * @return active SIM count * @hide */ - public static int getActiveSubInfoCount() { + public static int getActiveSubscriptionInfoCount() { int result = 0; try { @@ -450,19 +472,19 @@ public class SubscriptionManager implements BaseColumns { } /** - * Add a new SubInfoRecord to subinfo database if needed + * Add a new SubscriptionInfo to subinfo database if needed * @param iccId the IccId of the SIM card * @param slotId the slot which the SIM is inserted * @return the URL of the newly created row or the updated row * @hide */ - public static Uri addSubInfoRecord(String iccId, int slotId) { - if (VDBG) logd("[addSubInfoRecord]+ iccId:" + iccId + " slotId:" + slotId); + public static Uri addSubscriptionInfoRecord(String iccId, int slotId) { + if (VDBG) logd("[addSubscriptionInfoRecord]+ iccId:" + iccId + " slotId:" + slotId); if (iccId == null) { - logd("[addSubInfoRecord]- null iccId"); + logd("[addSubscriptionInfoRecord]- null iccId"); } if (!isValidSlotId(slotId)) { - logd("[addSubInfoRecord]- invalid slotId"); + logd("[addSubscriptionInfoRecord]- invalid slotId"); } try { @@ -481,17 +503,16 @@ public class SubscriptionManager implements BaseColumns { } /** - * Set SIM color by simInfo index - * @param color the color of the SIM + * Set SIM icon tint color by simInfo index + * @param tint the rgb value of icon tint color of the SIM * @param subId the unique SubInfoRecord index in database * @return the number of records updated * @hide */ - public static int setColor(int color, long subId) { - if (VDBG) logd("[setColor]+ color:" + color + " subId:" + subId); - int size = sSimBackgroundDarkRes.length; - if (!isValidSubId(subId) || color < 0 || color >= size) { - logd("[setColor]- fail"); + public static int setIconTint(int tint, int subId) { + if (VDBG) logd("[setIconTint]+ tint:" + tint + " subId:" + subId); + if (!isValidSubId(subId)) { + logd("[setIconTint]- fail"); return -1; } @@ -500,7 +521,7 @@ public class SubscriptionManager implements BaseColumns { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.setColor(color, subId); + result = iSub.setIconTint(tint, subId); } } catch (RemoteException ex) { // ignore it @@ -513,24 +534,24 @@ public class SubscriptionManager implements BaseColumns { /** * Set display name by simInfo index * @param displayName the display name of SIM card - * @param subId the unique SubInfoRecord index in database + * @param subId the unique SubscriptionInfo index in database * @return the number of records updated * @hide */ - public static int setDisplayName(String displayName, long subId) { + public static int setDisplayName(String displayName, int subId) { return setDisplayName(displayName, subId, NAME_SOURCE_UNDEFINDED); } /** * Set display name by simInfo index with name source * @param displayName the display name of SIM card - * @param subId the unique SubInfoRecord index in database + * @param subId the unique SubscriptionInfo index in database * @param nameSource 0: NAME_SOURCE_DEFAULT_SOURCE, 1: NAME_SOURCE_SIM_SOURCE, * 2: NAME_SOURCE_USER_INPUT, -1 NAME_SOURCE_UNDEFINED * @return the number of records updated or -1 if invalid subId * @hide */ - public static int setDisplayName(String displayName, long subId, long nameSource) { + public static int setDisplayName(String displayName, int subId, long nameSource) { if (VDBG) { logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource); @@ -558,11 +579,11 @@ public class SubscriptionManager implements BaseColumns { /** * Set phone number by subId * @param number the phone number of the SIM - * @param subId the unique SubInfoRecord index in database + * @param subId the unique SubscriptionInfo index in database * @return the number of records updated * @hide */ - public static int setDisplayNumber(String number, long subId) { + public static int setDisplayNumber(String number, int subId) { if (number == null || !isValidSubId(subId)) { logd("[setDisplayNumber]- fail"); return -1; @@ -584,42 +605,13 @@ public class SubscriptionManager implements BaseColumns { } /** - * Set number display format. 0: none, 1: the first four digits, 2: the last four digits - * @param format the display format of phone number - * @param subId the unique SubInfoRecord index in database - * @return the number of records updated - * @hide - */ - public static int setDisplayNumberFormat(int format, long subId) { - if (VDBG) logd("[setDisplayNumberFormat]+ format:" + format + " subId:" + subId); - if (format < 0 || !isValidSubId(subId)) { - logd("[setDisplayNumberFormat]- fail, return -1"); - return -1; - } - - int result = 0; - - try { - ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); - if (iSub != null) { - result = iSub.setDisplayNumberFormat(format, subId); - } - } catch (RemoteException ex) { - // ignore it - } - - return result; - - } - - /** * Set data roaming by simInfo index * @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming - * @param subId the unique SubInfoRecord index in database + * @param subId the unique SubscriptionInfo index in database * @return the number of records updated * @hide */ - public static int setDataRoaming(int roaming, long subId) { + public static int setDataRoaming(int roaming, int subId) { if (VDBG) logd("[setDataRoaming]+ roaming:" + roaming + " subId:" + subId); if (roaming < 0 || !isValidSubId(subId)) { logd("[setDataRoaming]- fail"); @@ -644,9 +636,9 @@ 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 */ - @SystemApi - public static int getSlotId(long subId) { + public static int getSlotId(int subId) { if (!isValidSubId(subId)) { logd("[getSlotId]- fail"); } @@ -667,13 +659,13 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static long[] getSubId(int slotId) { + public static int[] getSubId(int slotId) { if (!isValidSlotId(slotId)) { logd("[getSubId]- fail"); return null; } - long[] subId = null; + int[] subId = null; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -688,7 +680,7 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static int getPhoneId(long subId) { + public static int getPhoneId(int subId) { if (!isValidSubId(subId)) { logd("[getPhoneId]- fail"); return INVALID_PHONE_ID; @@ -710,31 +702,6 @@ public class SubscriptionManager implements BaseColumns { } - private static int[] setSimResource(int type) { - int[] simResource = null; - - switch (type) { - case RES_TYPE_BACKGROUND_DARK: - simResource = new int[] { - com.android.internal.R.drawable.sim_dark_blue, - com.android.internal.R.drawable.sim_dark_orange, - com.android.internal.R.drawable.sim_dark_green, - com.android.internal.R.drawable.sim_dark_purple - }; - break; - case RES_TYPE_BACKGROUND_LIGHT: - simResource = new int[] { - com.android.internal.R.drawable.sim_light_blue, - com.android.internal.R.drawable.sim_light_orange, - com.android.internal.R.drawable.sim_light_green, - com.android.internal.R.drawable.sim_light_purple - }; - break; - } - - return simResource; - } - private static void logd(String msg) { Rlog.d(LOG_TAG, "[SubManager] " + msg); } @@ -745,8 +712,8 @@ public class SubscriptionManager implements BaseColumns { * getDefaultDataSubId(). * @hide */ - public static long getDefaultSubId() { - long subId = INVALID_SUB_ID; + public static int getDefaultSubId() { + int subId = INVALID_SUB_ID; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -762,8 +729,8 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static long getDefaultVoiceSubId() { - long subId = INVALID_SUB_ID; + public static int getDefaultVoiceSubId() { + int subId = INVALID_SUB_ID; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -779,7 +746,7 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static void setDefaultVoiceSubId(long subId) { + public static void setDefaultVoiceSubId(int subId) { if (VDBG) logd("setDefaultVoiceSubId sub id = " + subId); try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -792,8 +759,8 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static SubInfoRecord getDefaultVoiceSubInfo() { - return getSubInfoForSubscriber(getDefaultVoiceSubId()); + public static SubscriptionInfo getDefaultVoiceSubscriptionInfo() { + return getSubscriptionInfoForSubscriber(getDefaultVoiceSubId()); } /** @hide */ @@ -803,10 +770,10 @@ public class SubscriptionManager implements BaseColumns { /** * @return subId of the DefaultSms subscription or the value INVALID_SUB_ID if an error. + * @hide */ - @SystemApi - public static long getDefaultSmsSubId() { - long subId = INVALID_SUB_ID; + public static int getDefaultSmsSubId() { + int subId = INVALID_SUB_ID; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -822,7 +789,7 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static void setDefaultSmsSubId(long subId) { + public static void setDefaultSmsSubId(int subId) { if (VDBG) logd("setDefaultSmsSubId sub id = " + subId); try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -835,8 +802,8 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static SubInfoRecord getDefaultSmsSubInfo() { - return getSubInfoForSubscriber(getDefaultSmsSubId()); + public static SubscriptionInfo getDefaultSmsSubscriptionInfo() { + return getSubscriptionInfoForSubscriber(getDefaultSmsSubId()); } /** @hide */ @@ -845,8 +812,8 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static long getDefaultDataSubId() { - long subId = INVALID_SUB_ID; + public static int getDefaultDataSubId() { + int subId = INVALID_SUB_ID; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -862,7 +829,7 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static void setDefaultDataSubId(long subId) { + public static void setDefaultDataSubId(int subId) { if (VDBG) logd("setDataSubscription sub id = " + subId); try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -875,8 +842,8 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static SubInfoRecord getDefaultDataSubInfo() { - return getSubInfoForSubscriber(getDefaultDataSubId()); + public static SubscriptionInfo getDefaultDataSubscriptionInfo() { + return getSubscriptionInfoForSubscriber(getDefaultDataSubId()); } /** @hide */ @@ -885,7 +852,7 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static void clearSubInfo() { + public static void clearSubscriptionInfo() { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { @@ -932,9 +899,9 @@ public class SubscriptionManager implements BaseColumns { /** * @return true if a valid subId else false + * @hide */ - @SystemApi - public static boolean isValidSubId(long subId) { + public static boolean isValidSubId(int subId) { return subId > INVALID_SUB_ID ; } @@ -943,7 +910,7 @@ public class SubscriptionManager implements BaseColumns { * usable subId means its neither a INVALID_SUB_ID nor a DEFAUL_SUB_ID. * @hide */ - public static boolean isUsableSubIdValue(long subId) { + public static boolean isUsableSubIdValue(int subId) { return subId >= MIN_SUB_ID_VALUE && subId <= MAX_SUB_ID_VALUE; } @@ -967,7 +934,7 @@ public class SubscriptionManager implements BaseColumns { /** @hide */ public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId) { - long[] subIds = SubscriptionManager.getSubId(phoneId); + int[] subIds = SubscriptionManager.getSubId(phoneId); if (subIds != null && subIds.length > 0) { putPhoneIdAndSubIdExtra(intent, phoneId, subIds[0]); } else { @@ -976,7 +943,7 @@ public class SubscriptionManager implements BaseColumns { } /** @hide */ - public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, long subId) { + public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, int subId) { if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId); intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); intent.putExtra(PhoneConstants.PHONE_KEY, phoneId); @@ -990,8 +957,8 @@ public class SubscriptionManager implements BaseColumns { * is never null but the length maybe 0. * @hide */ - public static long[] getActiveSubIdList() { - long[] subId = null; + public static int[] getActiveSubIdList() { + int[] subId = null; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); @@ -1003,7 +970,7 @@ public class SubscriptionManager implements BaseColumns { } if (subId == null) { - subId = new long[0]; + subId = new int[0]; } return subId; diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b72a920..7c03d42 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -588,7 +588,7 @@ public class TelephonyManager { /** {@hide} */ public String getDeviceSoftwareVersion(int slotId) { // FIXME methods taking slot id should not use subscription, instead us Uicc directly - long[] subId = SubscriptionManager.getSubId(slotId); + int[] subId = SubscriptionManager.getSubId(slotId); if (subId == null || subId.length == 0) { return null; } @@ -624,7 +624,7 @@ 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); + int[] subId = SubscriptionManager.getSubId(slotId); if (subId == null || subId.length == 0) { return null; } @@ -658,7 +658,7 @@ public class TelephonyManager { */ /** {@hide} */ public String getImei(int slotId) { - long[] subId = SubscriptionManager.getSubId(slotId); + int[] subId = SubscriptionManager.getSubId(slotId); try { return getSubscriberInfo().getImeiForSubscriber(subId[0]); } catch (RemoteException ex) { @@ -669,6 +669,32 @@ public class TelephonyManager { } /** + * Returns the NAI. Return null if NAI is not available. + * + */ + /** {@hide}*/ + public String getNai() { + return getNai(getDefaultSim()); + } + + /** + * Returns the NAI. Return null if NAI is not available. + * + * @param slotId of which Nai is returned + */ + /** {@hide}*/ + public String getNai(int slotId) { + int[] subId = SubscriptionManager.getSubId(slotId); + try { + return getSubscriberInfo().getNaiForSubscriber(subId[0]); + } catch (RemoteException ex) { + return null; + } catch (NullPointerException ex) { + return null; + } + } + + /** * Returns the current location of the device. *<p> * If there is only one radio in the device and that radio has an LTE connection, @@ -722,7 +748,7 @@ public class TelephonyManager { * @param subId for which the location updates are enabled */ /** @hide */ - public void enableLocationUpdates(long subId) { + public void enableLocationUpdates(int subId) { try { getITelephony().enableLocationUpdatesForSubscriber(subId); } catch (RemoteException ex) { @@ -744,7 +770,7 @@ public class TelephonyManager { } /** @hide */ - public void disableLocationUpdates(long subId) { + public void disableLocationUpdates(int subId) { try { getITelephony().disableLocationUpdatesForSubscriber(subId); } catch (RemoteException ex) { @@ -809,7 +835,7 @@ public class TelephonyManager { */ /** {@hide} */ @SystemApi - public int getCurrentPhoneType(long subId) { + public int getCurrentPhoneType(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); try{ ITelephony telephony = getITelephony(); @@ -1021,7 +1047,7 @@ public class TelephonyManager { * @param subId */ /** {@hide} */ - public String getNetworkOperatorName(long subId) { + public String getNetworkOperatorName(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ALPHA, ""); } @@ -1048,7 +1074,7 @@ public class TelephonyManager { * @param subId */ /** {@hide} */ - public String getNetworkOperator(long subId) { + public String getNetworkOperator(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); } @@ -1072,7 +1098,7 @@ public class TelephonyManager { * @param subId */ /** {@hide} */ - public boolean isNetworkRoaming(long subId) { + public boolean isNetworkRoaming(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); return Boolean.parseBoolean(getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ISROAMING, null)); @@ -1101,7 +1127,7 @@ public class TelephonyManager { * @param subId for which Network CountryIso is returned */ /** {@hide} */ - public String getNetworkCountryIso(long subId) { + public String getNetworkCountryIso(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, ""); } @@ -1173,7 +1199,7 @@ public class TelephonyManager { * @see #NETWORK_TYPE_HSPAP */ /** {@hide} */ - public int getNetworkType(long subId) { + public int getNetworkType(int subId) { try { ITelephony telephony = getITelephony(); if (telephony != null) { @@ -1227,7 +1253,7 @@ public class TelephonyManager { * @param subId for which network type is returned */ /** {@hide} */ - public int getDataNetworkType(long subId) { + public int getDataNetworkType(int subId) { try{ ITelephony telephony = getITelephony(); if (telephony != null) { @@ -1259,7 +1285,7 @@ public class TelephonyManager { * */ /** {@hide} */ - public int getVoiceNetworkType(long subId) { + public int getVoiceNetworkType(int subId) { try{ ITelephony telephony = getITelephony(); if (telephony != null) { @@ -1416,7 +1442,7 @@ public class TelephonyManager { */ /** {@hide} */ // FIXME Input argument slotId should be of type int - public boolean hasIccCard(long slotId) { + public boolean hasIccCard(int slotId) { try { return getITelephony().hasIccCardUsingSlotId(slotId); @@ -1461,7 +1487,7 @@ public class TelephonyManager { /** {@hide} */ // FIXME the argument to pass is subId ?? public int getSimState(int slotId) { - long[] subId = SubscriptionManager.getSubId(slotId); + int[] subId = SubscriptionManager.getSubId(slotId); if (subId == null || subId.length == 0) { return SIM_STATE_ABSENT; } @@ -1501,7 +1527,7 @@ public class TelephonyManager { * @see #getSimState */ public String getSimOperator() { - long subId = SubscriptionManager.getDefaultDataSubId(); + int subId = SubscriptionManager.getDefaultDataSubId(); if (!SubscriptionManager.isUsableSubIdValue(subId)) { subId = SubscriptionManager.getDefaultSmsSubId(); if (!SubscriptionManager.isUsableSubIdValue(subId)) { @@ -1526,7 +1552,7 @@ public class TelephonyManager { * @param subId for which SimOperator is returned */ /** {@hide} */ - public String getSimOperator(long subId) { + public String getSimOperator(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); String operator = getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, ""); @@ -1555,7 +1581,7 @@ public class TelephonyManager { * @param subId for which SimOperatorName is returned */ /** {@hide} */ - public String getSimOperatorName(long subId) { + public String getSimOperatorName(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA, ""); } @@ -1573,7 +1599,7 @@ public class TelephonyManager { * @param subId for which SimCountryIso is returned */ /** {@hide} */ - public String getSimCountryIso(long subId) { + public String getSimCountryIso(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY, ""); @@ -1599,7 +1625,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ /** {@hide} */ - public String getSimSerialNumber(long subId) { + public String getSimSerialNumber(int subId) { try { return getSubscriberInfo().getIccSerialNumberForSubscriber(subId); } catch (RemoteException ex) { @@ -1635,7 +1661,7 @@ public class TelephonyManager { * */ /** {@hide} */ - public int getLteOnCdmaMode(long subId) { + public int getLteOnCdmaMode(int subId) { try { return getITelephony().getLteOnCdmaModeForSubscriber(subId); } catch (RemoteException ex) { @@ -1675,7 +1701,7 @@ public class TelephonyManager { * @param subId whose subscriber id is returned */ /** {@hide} */ - public String getSubscriberId(long subId) { + public String getSubscriberId(int subId) { try { return getSubscriberInfo().getSubscriberIdForSubscriber(subId); } catch (RemoteException ex) { @@ -1714,7 +1740,7 @@ public class TelephonyManager { * @param subscription whose subscriber id is returned */ /** {@hide} */ - public String getGroupIdLevel1(long subId) { + public String getGroupIdLevel1(int subId) { try { return getSubscriberInfo().getGroupIdLevel1ForSubscriber(subId); } catch (RemoteException ex) { @@ -1746,7 +1772,7 @@ public class TelephonyManager { * @param subId whose phone number for line 1 is returned */ /** {@hide} */ - public String getLine1NumberForSubscriber(long subId) { + public String getLine1NumberForSubscriber(int subId) { String number = null; try { number = getITelephony().getLine1NumberForDisplay(subId); @@ -1771,14 +1797,12 @@ public class TelephonyManager { * for display purpose only, for example, displayed in Phone Status. It won't * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null * value. - * <p> - * Requires Permission: - * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} - * Or the calling app has carrier privileges. @see #hasCarrierPrivileges + * + * <p>Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges * * @param alphaTag alpha-tagging of the dailing nubmer * @param number The dialing number - * @hide */ public void setLine1NumberForDisplay(String alphaTag, String number) { setLine1NumberForDisplayForSubscriber(getDefaultSubscription(), alphaTag, number); @@ -1789,17 +1813,16 @@ public class TelephonyManager { * for display purpose only, for example, displayed in Phone Status. It won't * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null * value. - * <p> - * Requires Permission: - * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} - * Or the calling app has carrier privileges. @see #hasCarrierPrivileges + * + * <p>Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges * * @param subId the subscriber that the alphatag and dialing number belongs to. * @param alphaTag alpha-tagging of the dailing nubmer * @param number The dialing number * @hide */ - public void setLine1NumberForDisplayForSubscriber(long subId, String alphaTag, String number) { + public void setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number) { try { getITelephony().setLine1NumberForDisplayForSubscriber(subId, alphaTag, number); } catch (RemoteException ex) { @@ -1831,7 +1854,7 @@ public class TelephonyManager { * nobody seems to call this. */ /** {@hide} */ - public String getLine1AlphaTagForSubscriber(long subId) { + public String getLine1AlphaTagForSubscriber(int subId) { String alphaTag = null; try { alphaTag = getITelephony().getLine1AlphaTagForDisplay(subId); @@ -1874,7 +1897,7 @@ public class TelephonyManager { * @param subId for which msisdn is returned */ /** {@hide} */ - public String getMsisdn(long subId) { + public String getMsisdn(int subId) { try { return getSubscriberInfo().getMsisdnForSubscriber(subId); } catch (RemoteException ex) { @@ -1904,7 +1927,7 @@ public class TelephonyManager { * @param subId whose voice mail number is returned */ /** {@hide} */ - public String getVoiceMailNumber(long subId) { + public String getVoiceMailNumber(int subId) { try { return getSubscriberInfo().getVoiceMailNumberForSubscriber(subId); } catch (RemoteException ex) { @@ -1936,7 +1959,7 @@ public class TelephonyManager { * @param subId */ /** {@hide} */ - public String getCompleteVoiceMailNumber(long subId) { + public String getCompleteVoiceMailNumber(int subId) { try { return getSubscriberInfo().getCompleteVoiceMailNumberForSubscriber(subId); } catch (RemoteException ex) { @@ -1948,6 +1971,39 @@ public class TelephonyManager { } /** + * Sets the voice mail number. + * + * <p>Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges + * + * @param alphaTag The alpha tag to display. + * @param number The voicemail number. + */ + public boolean setVoiceMailNumber(String alphaTag, String number) { + return setVoiceMailNumber(getDefaultSubscription(), alphaTag, number); + } + + /** + * Sets the voicemail number for the given subscriber. + * + * <p>Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges + * + * @param subId The subscriber id. + * @param alphaTag The alpha tag to display. + * @param number The voicemail number. + */ + /** {@hide} */ + public boolean setVoiceMailNumber(int subId, String alphaTag, String number) { + try { + return getITelephony().setVoiceMailNumber(subId, alphaTag, number); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return false; + } + + /** * Returns the voice mail count. Return 0 if unavailable. * <p> * Requires Permission: @@ -1966,7 +2022,7 @@ public class TelephonyManager { * @param subId whose voice message count is returned */ /** {@hide} */ - public int getVoiceMessageCount(long subId) { + public int getVoiceMessageCount(int subId) { try { return getITelephony().getVoiceMessageCountForSubscriber(subId); } catch (RemoteException ex) { @@ -1998,7 +2054,7 @@ public class TelephonyManager { * voice mail number is returned */ /** {@hide} */ - public String getVoiceMailAlphaTag(long subId) { + public String getVoiceMailAlphaTag(int subId) { try { return getSubscriberInfo().getVoiceMailAlphaTagForSubscriber(subId); } catch (RemoteException ex) { @@ -2095,7 +2151,7 @@ public class TelephonyManager { * @param subId whose call state is returned */ /** {@hide} */ - public int getCallState(long subId) { + public int getCallState(int subId) { try { return getITelephony().getCallStateForSubscriber(subId); } catch (RemoteException ex) { @@ -2246,7 +2302,7 @@ public class TelephonyManager { * Returns the CDMA ERI icon index to display for a subscription */ /** {@hide} */ - public int getCdmaEriIconIndex(long subId) { + public int getCdmaEriIconIndex(int subId) { try { return getITelephony().getCdmaEriIconIndexForSubscriber(subId); } catch (RemoteException ex) { @@ -2274,7 +2330,7 @@ public class TelephonyManager { * 1 - FLASHING */ /** {@hide} */ - public int getCdmaEriIconMode(long subId) { + public int getCdmaEriIconMode(int subId) { try { return getITelephony().getCdmaEriIconModeForSubscriber(subId); } catch (RemoteException ex) { @@ -2299,7 +2355,7 @@ public class TelephonyManager { * */ /** {@hide} */ - public String getCdmaEriText(long subId) { + public String getCdmaEriText(int subId) { try { return getITelephony().getCdmaEriTextForSubscriber(subId); } catch (RemoteException ex) { @@ -2423,6 +2479,7 @@ public class TelephonyManager { * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges * * @param AID Application id. See ETSI 102.221 and 101.220. * @return an IccOpenLogicalChannelResponse object. @@ -2443,6 +2500,7 @@ public class TelephonyManager { * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges * * @param channel is the channel id to be closed as retruned by a successful * iccOpenLogicalChannel. @@ -2464,6 +2522,7 @@ public class TelephonyManager { * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges * * @param channel is the channel id to be closed as returned by a successful * iccOpenLogicalChannel. @@ -2495,6 +2554,7 @@ public class TelephonyManager { * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges * * @param cla Class of the APDU command. * @param instruction Instruction of the APDU command. @@ -2522,6 +2582,7 @@ public class TelephonyManager { * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges * * @param fileID * @param command @@ -2547,6 +2608,7 @@ public class TelephonyManager { * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * Or the calling app has carrier privileges. @see #hasCarrierPrivileges * * @param content String containing SAT/USAT response in hexadecimal * format starting with command tag. See TS 102 223 for @@ -2665,7 +2727,7 @@ public class TelephonyManager { /** * Returns Default subscription. */ - private static long getDefaultSubscription() { + private static int getDefaultSubscription() { return SubscriptionManager.getDefaultSubId(); } @@ -2907,7 +2969,7 @@ public class TelephonyManager { * @return the response of SIM Authentication, or null if not available * @hide */ - public String getIccSimChallengeResponse(long subId, int appType, String data) { + public String getIccSimChallengeResponse(int subId, int appType, String data) { try { return getSubscriberInfo().getIccSimChallengeResponse(subId, appType, data); } catch (RemoteException ex) { @@ -3006,12 +3068,10 @@ public class TelephonyManager { * Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA. * * <p> - * Requires Permission: - * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} - * Or the calling app has carrier privileges. @see #hasCarrierPrivileges + * Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges * * @return true on success; false on any failure. - * @hide */ public boolean setGlobalPreferredNetworkType() { return setPreferredNetworkType(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA); @@ -3019,23 +3079,14 @@ public class TelephonyManager { /** * Values used to return status for hasCarrierPrivileges call. - * @hide */ + /** @hide */ public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; - /** - * Values used to return status for hasCarrierPrivileges call. - * @hide - */ + /** @hide */ public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; - /** - * Values used to return status for hasCarrierPrivileges call. - * @hide - */ + /** @hide */ public static final int CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED = -1; - /** - * Values used to return status for hasCarrierPrivileges call. - * @hide - */ + /** @hide */ public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; /** @@ -3047,22 +3098,18 @@ public class TelephonyManager { * * TODO: Add a link to documentation. * - * @return CARRIER_PRIVILEGE_STATUS_HAS_ACCESS if the app has carrier privileges. - * CARRIER_PRIVILEGE_STATUS_NO_ACCESS if the app does not have carrier privileges. - * CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED if the carrier rules are not loaded. - * CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES if there was an error loading carrier - * rules (or if there are no rules). - * @hide + * @return true if the app has carrier privileges. */ - public int hasCarrierPrivileges() { + public boolean hasCarrierPrivileges() { try { - return getITelephony().hasCarrierPrivileges(); + return getITelephony().getCarrierPrivilegeStatus() == + CARRIER_PRIVILEGE_STATUS_HAS_ACCESS; } catch (RemoteException ex) { Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "hasCarrierPrivileges NPE", ex); } - return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; + return false; } /** @@ -3073,13 +3120,11 @@ public class TelephonyManager { * brand value input. To unset the value, the same function should be * called with a null brand value. * - * <p>Requires Permission: - * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} - * or has to be carrier app - see #hasCarrierPrivileges. + * <p>Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges * * @param brand The brand name to display/set. * @return true if the operation was executed correctly. - * @hide */ public boolean setOperatorBrandOverride(String brand) { try { @@ -3104,7 +3149,7 @@ public class TelephonyManager { /** @hide */ @SystemApi - public String getCdmaMdn(long subId) { + public String getCdmaMdn(int subId) { try { return getITelephony().getCdmaMdn(subId); } catch (RemoteException ex) { @@ -3122,7 +3167,7 @@ public class TelephonyManager { /** @hide */ @SystemApi - public String getCdmaMin(long subId) { + public String getCdmaMin(int subId) { try { return getITelephony().getCdmaMin(subId); } catch (RemoteException ex) { @@ -3138,9 +3183,9 @@ public class TelephonyManager { try { return getITelephony().checkCarrierPrivilegesForPackage(pkgname); } catch (RemoteException ex) { - Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex); + Rlog.e(TAG, "checkCarrierPrivilegesForPackage RemoteException", ex); } catch (NullPointerException ex) { - Rlog.e(TAG, "hasCarrierPrivileges NPE", ex); + Rlog.e(TAG, "checkCarrierPrivilegesForPackage NPE", ex); } return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; } @@ -3321,6 +3366,17 @@ public class TelephonyManager { /** @hide */ @SystemApi + public boolean handlePinMmiForSubscriber(int subId, String dialString) { + try { + return getITelephony().handlePinMmiForSubscriber(subId, dialString); + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#handlePinMmi", e); + } + return false; + } + + /** @hide */ + @SystemApi public void toggleRadioOnOff() { try { getITelephony().toggleRadioOnOff(); @@ -3427,75 +3483,6 @@ public class TelephonyManager { } /** - * Set whether Android should display a simplified Mobile Network Settings UI - * for the current ICCID. - * <p> - * Requires Permission: - * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} - * Or the calling app has carrier privileges. @see #hasCarrierPrivileges - * - * @param enable true means enabling the simplified UI. - * @hide - */ - public void enableSimplifiedNetworkSettings(boolean enable) { - enableSimplifiedNetworkSettingsForSubscriber(getDefaultSubscription(), enable); - } - - /** - * Set whether Android should display a simplified Mobile Network Settings UI - * for the current ICCID. - * <p> - * Requires Permission: - * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} - * Or the calling app has carrier privileges. @see #hasCarrierPrivileges - * - * @param subId for which the simplified UI should be enabled or disabled. - * @param enable true means enabling the simplified UI. - * @hide - */ - public void enableSimplifiedNetworkSettingsForSubscriber(long subId, boolean enable) { - try { - getITelephony().enableSimplifiedNetworkSettingsForSubscriber(subId, enable); - } catch (RemoteException ex) { - } catch (NullPointerException ex) { - } - } - - /** - * Get whether a simplified Mobile Network Settings UI is enabled for the - * current ICCID. - * <p> - * Requires Permission: - * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} - * - * @return true if the simplified UI is enabled. - * @hide - */ - public boolean getSimplifiedNetworkSettingsEnabled() { - return getSimplifiedNetworkSettingsEnabledForSubscriber(getDefaultSubscription()); - } - - /** - * Get whether a simplified Mobile Network Settings UI is enabled for the - * current ICCID. - * <p> - * Requires Permission: - * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} - * - * @param subId for which the simplified UI should be enabled or disabled. - * @return true if the simplified UI is enabled. - * @hide - */ - public boolean getSimplifiedNetworkSettingsEnabledForSubscriber(long subId) { - try { - return getITelephony().getSimplifiedNetworkSettingsEnabledForSubscriber(subId); - } catch (RemoteException ex) { - } catch (NullPointerException ex) { - } - return false; - } - - /** * Returns the result and response from RIL for oem request * * @param oemReq the data is sent to ril. @@ -3513,4 +3500,25 @@ public class TelephonyManager { } return -1; } + + /** @hide */ + @SystemApi + public void enableVideoCalling(boolean enable) { + try { + getITelephony().enableVideoCalling(enable); + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#enableVideoCalling", e); + } + } + + /** @hide */ + @SystemApi + public boolean isVideoCallingEnabled() { + try { + return getITelephony().isVideoCallingEnabled(); + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#isVideoCallingEnabled", e); + } + return false; + } } diff --git a/telephony/java/com/android/ims/ImsCallProfile.java b/telephony/java/com/android/ims/ImsCallProfile.java index 8b7901c..9de938a 100644 --- a/telephony/java/com/android/ims/ImsCallProfile.java +++ b/telephony/java/com/android/ims/ImsCallProfile.java @@ -114,6 +114,10 @@ public class ImsCallProfile implements Parcelable { public static final String EXTRA_CALL_MODE_CHANGEABLE = "call_mode_changeable"; public static final String EXTRA_CONFERENCE_AVAIL = "conference_avail"; + // Extra string for internal use only. OEMs should not use + // this for packing extras. + public static final String EXTRA_OEM_EXTRAS = "OemCallExtras"; + /** * Integer extra properties * oir : Rule for originating identity (number) presentation, MO/MT. @@ -151,6 +155,18 @@ public class ImsCallProfile implements Parcelable { public static final int DIALSTRING_USSD = 2; /** + * Values for causes that restrict call types + */ + // Default cause not restricted at peer and HD is supported + public static final int CALL_RESTRICT_CAUSE_NONE = 0; + // Service not supported by RAT at peer + public static final int CALL_RESTRICT_CAUSE_RAT = 1; + // Service Disabled at peer + public static final int CALL_RESTRICT_CAUSE_DISABLED = 2; + // HD is not supported + public static final int CALL_RESTRICT_CAUSE_HD = 3; + + /** * String extra properties * oi : Originating identity (number), MT only * cna : Calling name @@ -164,11 +180,10 @@ public class ImsCallProfile implements Parcelable { public int mServiceType; public int mCallType; + public int mRestrictCause = CALL_RESTRICT_CAUSE_NONE; public Bundle mCallExtras; public ImsStreamMediaProfile mMediaProfile; - - public ImsCallProfile(Parcel in) { readFromParcel(in); } diff --git a/telephony/java/com/android/ims/ImsConferenceState.java b/telephony/java/com/android/ims/ImsConferenceState.java index f708d5b..c57ef98 100644 --- a/telephony/java/com/android/ims/ImsConferenceState.java +++ b/telephony/java/com/android/ims/ImsConferenceState.java @@ -24,6 +24,8 @@ import java.util.Set; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; +import android.telecom.Call; +import android.telecom.Connection; /** * Provides the conference information (defined in RFC 4575) for IMS conference call. @@ -139,4 +141,30 @@ public class ImsConferenceState implements Parcelable { return new ImsConferenceState[size]; } }; + + /** + * Translates an {@code ImsConferenceState} status type to a telecom connection state. + * + * @param status The status type. + * @return The corresponding {@link android.telecom.Connection} state. + */ + public static int getConnectionStateForStatus(String status) { + if (status.equals(STATUS_PENDING)) { + return Connection.STATE_INITIALIZING; + } else if (status.equals(STATUS_DIALING_IN)) { + return Connection.STATE_RINGING; + } else if (status.equals(STATUS_ALERTING) || + status.equals(STATUS_DIALING_OUT)) { + return Connection.STATE_DIALING; + } else if (status.equals(STATUS_ON_HOLD)) { + return Connection.STATE_HOLDING; + } else if (status.equals(STATUS_CONNECTED) || + status.equals(STATUS_MUTED_VIA_FOCUS) || + status.equals(STATUS_DISCONNECTING)) { + return Connection.STATE_ACTIVE; + } else if (status.equals(STATUS_DISCONNECTED)) { + return Connection.STATE_DISCONNECTED; + } + return Call.STATE_ACTIVE; + } } diff --git a/telephony/java/com/android/ims/ImsStreamMediaProfile.java b/telephony/java/com/android/ims/ImsStreamMediaProfile.java index 003499c..359b270 100644 --- a/telephony/java/com/android/ims/ImsStreamMediaProfile.java +++ b/telephony/java/com/android/ims/ImsStreamMediaProfile.java @@ -41,10 +41,18 @@ public class ImsStreamMediaProfile implements Parcelable { * Audio information */ public static final int AUDIO_QUALITY_NONE = 0; - public static final int AUDIO_QUALITY_AMR = (1 << 0); - public static final int AUDIO_QUALITY_AMR_WB = (1 << 1); - - /** + public static final int AUDIO_QUALITY_AMR = 1; + public static final int AUDIO_QUALITY_AMR_WB = 2; + public static final int AUDIO_QUALITY_QCELP13K = 3; + public static final int AUDIO_QUALITY_EVRC = 4; + public static final int AUDIO_QUALITY_EVRC_B = 5; + public static final int AUDIO_QUALITY_EVRC_WB = 6; + public static final int AUDIO_QUALITY_EVRC_NW = 7; + public static final int AUDIO_QUALITY_GSM_EFR = 8; + public static final int AUDIO_QUALITY_GSM_FR = 9; + public static final int AUDIO_QUALITY_GSM_HR = 10; + + /** * Video information */ public static final int VIDEO_QUALITY_NONE = 0; diff --git a/telephony/java/com/android/ims/internal/IImsCallSession.aidl b/telephony/java/com/android/ims/internal/IImsCallSession.aidl index 98b2d8a..d1946e3 100644 --- a/telephony/java/com/android/ims/internal/IImsCallSession.aidl +++ b/telephony/java/com/android/ims/internal/IImsCallSession.aidl @@ -55,6 +55,13 @@ interface IImsCallSession { ImsCallProfile getLocalCallProfile(); /** + * Gets the remote call profile that this session is associated with + * + * @return the remote call profile that this session is associated with + */ + ImsCallProfile getRemoteCallProfile(); + + /** * Gets the value associated with the specified property of this session. * * @return the string value associated with the specified property @@ -160,10 +167,13 @@ interface IImsCallSession { void resume(in ImsStreamMediaProfile profile); /** - * Merges the active & hold call. When it succeeds, {@link Listener#callSessionMerged} - * is called. + * Merges the active & hold call. When the merge starts, + * {@link Listener#callSessionMergeStarted} is called. + * {@link Listener#callSessionMergeComplete} is called if the merge is successful, and + * {@link Listener#callSessionMergeFailed} is called if the merge fails. * - * @see Listener#callSessionMerged, Listener#callSessionMergeFailed + * @see Listener#callSessionMergeStarted, Listener#callSessionMergeComplete, + * Listener#callSessionMergeFailed */ void merge(); @@ -225,4 +235,10 @@ interface IImsCallSession { * intermediates between the propriety implementation and Telecomm/InCall. */ IImsVideoCallProvider getVideoCallProvider(); + + /** + * Determines if the current session is multiparty. + * @return {@code True} if the session is multiparty. + */ + boolean isMultiparty(); } diff --git a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl index acd1eb9..84d1c545 100644 --- a/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl +++ b/telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl @@ -48,10 +48,11 @@ interface IImsCallSessionListener { void callSessionResumeReceived(in IImsCallSession session, in ImsCallProfile profile); /** - * Notifiies the result of call merge operation. + * Notifies the result of call merge operation. */ - void callSessionMerged(in IImsCallSession session, + void callSessionMergeStarted(in IImsCallSession session, in IImsCallSession newSession, in ImsCallProfile profile); + void callSessionMergeComplete(in IImsCallSession session); void callSessionMergeFailed(in IImsCallSession session, in ImsReasonInfo reasonInfo); @@ -104,4 +105,14 @@ interface IImsCallSessionListener { in int srcAccessTech, in int targetAccessTech, in ImsReasonInfo reasonInfo); void callSessionHandoverFailed(in IImsCallSession session, in int srcAccessTech, in int targetAccessTech, in ImsReasonInfo reasonInfo); + + /** + * Notifies the TTY mode change by remote party. + * @param mode one of the following: + * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} + */ + void callSessionTtyModeReceived(in IImsCallSession session, in int mode); } diff --git a/telephony/java/com/android/ims/internal/IImsConfig.aidl b/telephony/java/com/android/ims/internal/IImsConfig.aidl index e8d921e..c5ccf5f 100644 --- a/telephony/java/com/android/ims/internal/IImsConfig.aidl +++ b/telephony/java/com/android/ims/internal/IImsConfig.aidl @@ -73,9 +73,9 @@ interface IImsConfig { * * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants. * @param value in Integer format. - * @return void. + * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants. */ - void setProvisionedValue(int item, int value); + int setProvisionedValue(int item, int value); /** * Sets the value for IMS service/capabilities parameters by the operator device @@ -84,9 +84,9 @@ interface IImsConfig { * * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants. * @param value in String format. - * @return void. + * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants. */ - void setProvisionedStringValue(int item, String value); + int setProvisionedStringValue(int item, String value); /** * Gets the value of the specified IMS feature item for specified network type. diff --git a/telephony/java/com/android/ims/internal/IImsService.aidl b/telephony/java/com/android/ims/internal/IImsService.aidl index 5138305..b9cee42 100644 --- a/telephony/java/com/android/ims/internal/IImsService.aidl +++ b/telephony/java/com/android/ims/internal/IImsService.aidl @@ -26,6 +26,8 @@ import com.android.ims.internal.IImsEcbm; import com.android.ims.internal.IImsUt; import com.android.ims.internal.IImsConfig; +import android.os.Message; + /** * {@hide} */ @@ -64,10 +66,13 @@ interface IImsService { */ void turnOffIms(); - /** * ECBM interface for Emergency Callback mode mechanism. */ IImsEcbm getEcbmInterface(int serviceId); + /** + * Used to set current TTY Mode. + */ + void setUiTTYMode(int serviceId, int uiTtyMode, in Message onComplete); } diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java index 88e5bd6..5cd5d4e 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfo.java +++ b/telephony/java/com/android/internal/telephony/CallerInfo.java @@ -301,7 +301,7 @@ public class CallerInfo { public static CallerInfo getCallerInfo(Context context, String number) { if (VDBG) Rlog.v(TAG, "getCallerInfo() based on number..."); - long subId = SubscriptionManager.getDefaultSubId(); + int subId = SubscriptionManager.getDefaultSubId(); return getCallerInfo(context, number, subId); } @@ -316,7 +316,7 @@ public class CallerInfo { * a matching number is not found, then a generic caller info is returned, * with all relevant fields empty or null. */ - public static CallerInfo getCallerInfo(Context context, String number, long subId) { + public static CallerInfo getCallerInfo(Context context, String number, int subId) { if (TextUtils.isEmpty(number)) { return null; @@ -418,12 +418,12 @@ public class CallerInfo { // string in the phone number field. /* package */ CallerInfo markAsVoiceMail() { - long subId = SubscriptionManager.getDefaultSubId(); + int subId = SubscriptionManager.getDefaultSubId(); return markAsVoiceMail(subId); } - /* package */ CallerInfo markAsVoiceMail(long subId) { + /* package */ CallerInfo markAsVoiceMail(int subId) { mIsVoiceMail = true; try { diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java index 0d18389..aae7617 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java +++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java @@ -81,7 +81,7 @@ public class CallerInfoAsyncQuery { public int event; public String number; - public long subId; + public int subId; } @@ -388,7 +388,7 @@ public class CallerInfoAsyncQuery { public static CallerInfoAsyncQuery startQuery(int token, Context context, String number, OnQueryCompleteListener listener, Object cookie) { - long subId = SubscriptionManager.getDefaultSubId(); + int subId = SubscriptionManager.getDefaultSubId(); return startQuery(token, context, number, listener, cookie, subId); } @@ -404,7 +404,7 @@ public class CallerInfoAsyncQuery { * the phone type of the incoming connection. */ public static CallerInfoAsyncQuery startQuery(int token, Context context, String number, - OnQueryCompleteListener listener, Object cookie, long subId) { + OnQueryCompleteListener listener, Object cookie, int subId) { if (DBG) { Rlog.d(LOG_TAG, "##### CallerInfoAsyncQuery startQuery()... #####"); diff --git a/telephony/java/com/android/internal/telephony/DcParamObject.java b/telephony/java/com/android/internal/telephony/DcParamObject.java index c92988f..139939c 100644 --- a/telephony/java/com/android/internal/telephony/DcParamObject.java +++ b/telephony/java/com/android/internal/telephony/DcParamObject.java @@ -21,9 +21,9 @@ import android.os.Parcel; public class DcParamObject implements Parcelable { - private long mSubId; + private int mSubId; - public DcParamObject(long subId) { + public DcParamObject(int subId) { mSubId = subId; } @@ -40,7 +40,7 @@ public class DcParamObject implements Parcelable { } private void readFromParcel(Parcel in) { - mSubId = in.readLong(); + mSubId = in.readInt(); } public static final Parcelable.Creator<DcParamObject> CREATOR = new Parcelable.Creator<DcParamObject>() { @@ -52,7 +52,7 @@ public class DcParamObject implements Parcelable { } }; - public long getSubId() { + public int getSubId() { return mSubId; } } diff --git a/telephony/java/com/android/internal/telephony/IMms.aidl b/telephony/java/com/android/internal/telephony/IMms.aidl index ebfefd1..0322499 100644 --- a/telephony/java/com/android/internal/telephony/IMms.aidl +++ b/telephony/java/com/android/internal/telephony/IMms.aidl @@ -39,7 +39,7 @@ interface IMms { * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed */ - void sendMessage(long subId, String callingPkg, in Uri contentUri, + void sendMessage(int subId, String callingPkg, in Uri contentUri, String locationUrl, in Bundle configOverrides, in PendingIntent sentIntent); /** @@ -56,7 +56,7 @@ interface IMms { * @param downloadedIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is downloaded, or the download is failed */ - void downloadMessage(long subId, String callingPkg, String locationUrl, + void downloadMessage(int subId, String callingPkg, String locationUrl, in Uri contentUri, in Bundle configOverrides, in PendingIntent downloadedIntent); @@ -99,7 +99,7 @@ interface IMms { * * @param subId the SIM id */ - Bundle getCarrierConfigValues(long subId); + Bundle getCarrierConfigValues(int subId); /** * Import a text message into system's SMS store @@ -204,7 +204,7 @@ interface IMms { * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed */ - void sendStoredMessage(long subId, String callingPkg, in Uri messageUri, + void sendStoredMessage(int subId, String callingPkg, in Uri messageUri, in Bundle configOverrides, in PendingIntent sentIntent); /** diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index d706203..eec5333 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -27,16 +27,21 @@ interface IPhoneSubInfo { */ String getDeviceId(); + /** + * Retrieves the unique Network Access ID + */ + String getNaiForSubscriber(int subId); + /** * Retrieves the unique device ID of a subId for the device, e.g., IMEI * for GSM phones. */ - String getDeviceIdForSubscriber(long subId); + String getDeviceIdForSubscriber(int subId); /** * Retrieves the IMEI. */ - String getImeiForSubscriber(long subId); + String getImeiForSubscriber(int subId); /** * Retrieves the software version number for the device, e.g., IMEI/SV @@ -48,7 +53,7 @@ interface IPhoneSubInfo { * Retrieves the software version number of a subId for the device, e.g., IMEI/SV * for GSM phones. */ - String getDeviceSvnUsingSubId(long subId); + String getDeviceSvnUsingSubId(int subId); /** * Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones. @@ -58,7 +63,7 @@ interface IPhoneSubInfo { /** * Retrieves the unique subscriber ID of a given subId, e.g., IMSI for GSM phones. */ - String getSubscriberIdForSubscriber(long subId); + String getSubscriberIdForSubscriber(int subId); /** * Retrieves the Group Identifier Level1 for GSM phones. @@ -68,7 +73,7 @@ interface IPhoneSubInfo { /** * Retrieves the Group Identifier Level1 for GSM phones of a subId. */ - String getGroupIdLevel1ForSubscriber(long subId); + String getGroupIdLevel1ForSubscriber(int subId); /** * Retrieves the serial number of the ICC, if applicable. @@ -78,7 +83,7 @@ interface IPhoneSubInfo { /** * Retrieves the serial number of a given subId. */ - String getIccSerialNumberForSubscriber(long subId); + String getIccSerialNumberForSubscriber(int subId); /** * Retrieves the phone number string for line 1. @@ -88,7 +93,7 @@ interface IPhoneSubInfo { /** * Retrieves the phone number string for line 1 of a subcription. */ - String getLine1NumberForSubscriber(long subId); + String getLine1NumberForSubscriber(int subId); /** @@ -99,7 +104,7 @@ interface IPhoneSubInfo { /** * Retrieves the alpha identifier for line 1 of a subId. */ - String getLine1AlphaTagForSubscriber(long subId); + String getLine1AlphaTagForSubscriber(int subId); /** @@ -110,7 +115,7 @@ interface IPhoneSubInfo { /** * Retrieves the Msisdn of a subId. */ - String getMsisdnForSubscriber(long subId); + String getMsisdnForSubscriber(int subId); /** * Retrieves the voice mail number. @@ -120,7 +125,7 @@ interface IPhoneSubInfo { /** * Retrieves the voice mail number of a given subId. */ - String getVoiceMailNumberForSubscriber(long subId); + String getVoiceMailNumberForSubscriber(int subId); /** * Retrieves the complete voice mail number. @@ -130,7 +135,7 @@ interface IPhoneSubInfo { /** * Retrieves the complete voice mail number for particular subId */ - String getCompleteVoiceMailNumberForSubscriber(long subId); + String getCompleteVoiceMailNumberForSubscriber(int subId); /** * Retrieves the alpha identifier associated with the voice mail number. @@ -141,7 +146,7 @@ interface IPhoneSubInfo { * Retrieves the alpha identifier associated with the voice mail number * of a subId. */ - String getVoiceMailAlphaTagForSubscriber(long subId); + String getVoiceMailAlphaTagForSubscriber(int subId); /** * Returns the IMS private user identity (IMPI) that was loaded from the ISIM. @@ -194,5 +199,5 @@ interface IPhoneSubInfo { * @param data authentication challenge data * @return challenge response */ - String getIccSimChallengeResponse(long subId, int appType, String data); + String getIccSimChallengeResponse(int subId, int appType, String data); } diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl index 32bb8b4..15fa340 100644 --- a/telephony/java/com/android/internal/telephony/ISms.aidl +++ b/telephony/java/com/android/internal/telephony/ISms.aidl @@ -47,7 +47,7 @@ interface ISms { * @param subId the subId id. * @return list of SmsRawData of all sms on ICC */ - List<SmsRawData> getAllMessagesFromIccEfForSubscriber(in long subId, String callingPkg); + List<SmsRawData> getAllMessagesFromIccEfForSubscriber(in int subId, String callingPkg); /** * Update the specified message on the ICC. @@ -75,7 +75,7 @@ interface ISms { * @return success or not * */ - boolean updateMessageOnIccEfForSubscriber(in long subId, String callingPkg, + boolean updateMessageOnIccEfForSubscriber(in int subId, String callingPkg, int messageIndex, int newStatus, in byte[] pdu); /** @@ -99,7 +99,7 @@ interface ISms { * @return success or not * */ - boolean copyMessageToIccEfForSubscriber(in long subId, String callingPkg, int status, + boolean copyMessageToIccEfForSubscriber(in int subId, String callingPkg, int status, in byte[] pdu, in byte[] smsc); /** @@ -152,7 +152,7 @@ interface ISms { * raw pdu of the status report is in the extended data ("pdu"). * @param subId the subId id. */ - void sendDataForSubscriber(long subId, String callingPkg, in String destAddr, + void sendDataForSubscriber(int subId, String callingPkg, in String destAddr, in String scAddr, in int destPort, in byte[] data, in PendingIntent sentIntent, in PendingIntent deliveryIntent); @@ -206,7 +206,7 @@ interface ISms { * raw pdu of the status report is in the extended data ("pdu"). * @param subId the subId on which the SMS has to be sent. */ - void sendTextForSubscriber(in long subId, String callingPkg, in String destAddr, + void sendTextForSubscriber(in int subId, String callingPkg, in String destAddr, in String scAddr, in String text, in PendingIntent sentIntent, in PendingIntent deliveryIntent); @@ -283,88 +283,109 @@ interface ISms { * extended data ("pdu"). * @param subId the subId on which the SMS has to be sent. */ - void sendMultipartTextForSubscriber(in long subId, String callingPkg, + void sendMultipartTextForSubscriber(in int subId, String callingPkg, in String destinationAddress, in String scAddress, in List<String> parts, in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents); /** * Enable reception of cell broadcast (SMS-CB) messages with the given - * message identifier. Note that if two different clients enable the same - * message identifier, they must both disable it for the device to stop - * receiving those messages. + * message identifier and RAN type. The RAN type specify this message ID + * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients + * enable the same message identifier, they must both disable it for the + * device to stop receiving those messages. * * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) + * @param ranType as defined in class SmsManager, the value can be one of these: + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #disableCellBroadcast(int) + * @see #disableCellBroadcast(int, int) */ - boolean enableCellBroadcast(int messageIdentifier); + boolean enableCellBroadcast(int messageIdentifier, int ranType); /** * Enable reception of cell broadcast (SMS-CB) messages with the given - * message identifier. Note that if two different clients enable the same - * message identifier, they must both disable it for the device to stop - * receiving those messages. + * message identifier and RAN type. The RAN type specify this message ID + * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients + * enable the same message identifier, they must both disable it for the + * device to stop receiving those messages. * * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) * @param subId for which the broadcast has to be enabled + * @param ranType as defined in class SmsManager, the value can be one of these: + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #disableCellBroadcast(int) + * @see #disableCellBroadcast(int, int) */ - boolean enableCellBroadcastForSubscriber(in long subId, int messageIdentifier); + boolean enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType); /** * Disable reception of cell broadcast (SMS-CB) messages with the given - * message identifier. Note that if two different clients enable the same - * message identifier, they must both disable it for the device to stop - * receiving those messages. + * message identifier and RAN type. The RAN type specify this message ID + * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients + * enable the same message identifier, they must both disable it for the + * device to stop receiving those messages. * * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) + * @param ranType as defined in class SmsManager, the value can be one of these: + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #enableCellBroadcast(int) + * @see #enableCellBroadcast(int, int) */ - boolean disableCellBroadcast(int messageIdentifier); + boolean disableCellBroadcast(int messageIdentifier, int ranType); /** * Disable reception of cell broadcast (SMS-CB) messages with the given - * message identifier. Note that if two different clients enable the same - * message identifier, they must both disable it for the device to stop - * receiving those messages. + * message identifier and RAN type. The RAN type specify this message ID + * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients + * enable the same message identifier, they must both disable it for the + * device to stop receiving those messages. * * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) * @param subId for which the broadcast has to be disabled + * @param ranType as defined in class SmsManager, the value can be one of these: + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #enableCellBroadcast(int) + * @see #enableCellBroadcast(int, int) */ - boolean disableCellBroadcastForSubscriber(in long subId, int messageIdentifier); + boolean disableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType); /* * Enable reception of cell broadcast (SMS-CB) messages with the given - * message identifier range. Note that if two different clients enable - * a message identifier range, they must both disable it for the device - * to stop receiving those messages. + * message identifier range and RAN type. The RAN type specify this message + * ID range belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different + * clients enable a message identifier range, they must both disable it for + * the device to stop receiving those messages. * * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) + * @param ranType as defined in class SmsManager, the value can be one of these: + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #disableCellBroadcastRange(int, int) + * @see #disableCellBroadcastRange(int, int, int) */ - boolean enableCellBroadcastRange(int startMessageId, int endMessageId); + boolean enableCellBroadcastRange(int startMessageId, int endMessageId, int ranType); /* * Enable reception of cell broadcast (SMS-CB) messages with the given - * message identifier range. Note that if two different clients enable + * message identifier range and RAN type. The RAN type specify this message ID range + * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable * a message identifier range, they must both disable it for the device * to stop receiving those messages. * @@ -373,15 +394,20 @@ interface ISms { * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) * @param subId for which the broadcast has to be enabled + * @param ranType as defined in class SmsManager, the value can be one of these: + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #disableCellBroadcastRange(int, int) + * @see #disableCellBroadcastRange(int, int, int) */ - boolean enableCellBroadcastRangeForSubscriber(long subId, int startMessageId, int endMessageId); + boolean enableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, + int ranType); /** * Disable reception of cell broadcast (SMS-CB) messages with the given - * message identifier range. Note that if two different clients enable + * message identifier range and RAN type. The RAN type specify this message ID range + * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable * a message identifier range, they must both disable it for the device * to stop receiving those messages. * @@ -389,15 +415,19 @@ interface ISms { * C.R1001-G (3GPP2) * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) + * @param ranType as defined in class SmsManager, the value can be one of these: + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #enableCellBroadcastRange(int, int) + * @see #enableCellBroadcastRange(int, int, int) */ - boolean disableCellBroadcastRange(int startMessageId, int endMessageId); + boolean disableCellBroadcastRange(int startMessageId, int endMessageId, int ranType); /** * Disable reception of cell broadcast (SMS-CB) messages with the given - * message identifier range. Note that if two different clients enable + * message identifier range and RAN type. The RAN type specify this message ID range + * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable * a message identifier range, they must both disable it for the device * to stop receiving those messages. * @@ -406,12 +436,15 @@ interface ISms { * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or * C.R1001-G (3GPP2) * @param subId for which the broadcast has to be disabled + * @param ranType as defined in class SmsManager, the value can be one of these: + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_GSM + * android.telephony.SmsMessage.CELL_BROADCAST_RAN_TYPE_CDMA * @return true if successful, false otherwise * - * @see #enableCellBroadcastRange(int, int, int) + * @see #enableCellBroadcastRange(int, int, int, int) */ - boolean disableCellBroadcastRangeForSubscriber(long subId, int startMessageId, - int endMessageId); + boolean disableCellBroadcastRangeForSubscriber(int subId, int startMessageId, + int endMessageId, int ranType); /** * Returns the premium SMS send permission for the specified package. @@ -423,7 +456,7 @@ interface ISms { * Returns the premium SMS send permission for the specified package. * Requires system permission. */ - int getPremiumSmsPermissionForSubscriber(long subId, String packageName); + int getPremiumSmsPermissionForSubscriber(int subId, String packageName); /** * Set the SMS send permission for the specified package. @@ -439,7 +472,7 @@ interface ISms { * Set the SMS send permission for the specified package. * Requires system permission. */ - void setPremiumSmsPermissionForSubscriber(long subId, String packageName, int permission); + void setPremiumSmsPermissionForSubscriber(int subId, String packageName, int permission); /** * SMS over IMS is supported if IMS is registered and SMS is supported @@ -459,13 +492,13 @@ interface ISms { * * @see #getImsSmsFormat() */ - boolean isImsSmsSupportedForSubscriber(long subId); + boolean isImsSmsSupportedForSubscriber(int subId); /* * get user prefered SMS subId * @return subId id */ - long getPreferredSmsSubscription(); + int getPreferredSmsSubscription(); /** * Gets SMS format supported on IMS. SMS over IMS format is @@ -489,7 +522,7 @@ interface ISms { * * @see #isImsSmsSupported() */ - String getImsSmsFormatForSubscriber(long subId); + String getImsSmsFormatForSubscriber(int subId); /* * Get SMS prompt property, enabled or not @@ -524,7 +557,7 @@ interface ISms { * broadcast when the message is delivered to the recipient. The * raw pdu of the status report is in the extended data ("pdu"). */ - void sendStoredText(long subId, String callingPkg, in Uri messageUri, String scAddress, + void sendStoredText(int subId, String callingPkg, in Uri messageUri, String scAddress, in PendingIntent sentIntent, in PendingIntent deliveryIntent); /** @@ -560,7 +593,7 @@ interface ISms { * to the recipient. The raw pdu of the status report is in the * extended data ("pdu"). */ - void sendStoredMultipartText(long subId, String callingPkg, in Uri messageUri, + void sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri, String scAddress, in List<PendingIntent> sentIntents, in List<PendingIntent> deliveryIntents); } diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index b87365e..d82c492 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -17,41 +17,42 @@ package com.android.internal.telephony; import android.app.PendingIntent; -import android.telephony.SubInfoRecord; +import android.telephony.SubscriptionInfo; +import com.android.internal.telephony.ISubscriptionListener; interface ISub { /** - * Get the SubInfoRecord according to an index - * @param subId The unique SubInfoRecord index in database - * @return SubInfoRecord, maybe null + * Get the SubscriptionInfo according to an index + * @param subId The unique SubscriptionInfo index in database + * @return SubscriptionInfo, maybe null */ - SubInfoRecord getSubInfoForSubscriber(long subId); + SubscriptionInfo getSubInfoForSubscriber(int subId); /** - * Get the SubInfoRecord according to an IccId + * Get the SubscriptionInfo according to an IccId * @param iccId the IccId of SIM card - * @return SubInfoRecord, maybe null + * @return SubscriptionInfo, maybe null */ - List<SubInfoRecord> getSubInfoUsingIccId(String iccId); + List<SubscriptionInfo> getSubInfoUsingIccId(String iccId); /** - * Get the SubInfoRecord according to slotId + * Get the SubscriptionInfo according to slotId * @param slotId the slot which the SIM is inserted - * @return SubInfoRecord, maybe null + * @return SubscriptionInfo, maybe null */ - List<SubInfoRecord> getSubInfoUsingSlotId(int slotId); + List<SubscriptionInfo> getSubInfoUsingSlotId(int slotId); /** - * Get all the SubInfoRecord(s) in subinfo database + * Get all the SubscriptionInfo(s) in subinfo database * @return Array list of all SubInfoRecords in database, include thsoe that were inserted before */ - List<SubInfoRecord> getAllSubInfoList(); + List<SubscriptionInfo> getAllSubInfoList(); /** - * Get the SubInfoRecord(s) of the currently inserted SIM(s) - * @return Array list of currently inserted SubInfoRecord(s) + * Get the SubscriptionInfo(s) of the currently inserted SIM(s) + * @return Array list of currently inserted SubscriptionInfo(s) */ - List<SubInfoRecord> getActiveSubInfoList(); + List<SubscriptionInfo> getActiveSubInfoList(); /** * Get the SUB count of all SUB(s) in subinfo database @@ -66,7 +67,7 @@ interface ISub { int getActiveSubInfoCount(); /** - * Add a new SubInfoRecord to subinfo database if needed + * Add a new SubscriptionInfo to subinfo database if needed * @param iccId the IccId of the SIM card * @param slotId the slot which the SIM is inserted * @return the URL of the newly created row or the updated row @@ -74,81 +75,73 @@ interface ISub { int addSubInfoRecord(String iccId, int slotId); /** - * Set SIM color by simInfo index - * @param color the color of the SIM - * @param subId the unique SubInfoRecord index in database + * Set SIM icon tint color by simInfo index + * @param tint the icon tint color of the SIM + * @param subId the unique SubscriptionInfo index in database * @return the number of records updated */ - int setColor(int color, long subId); + int setIconTint(int tint, int subId); /** * Set display name by simInfo index * @param displayName the display name of SIM card - * @param subId the unique SubInfoRecord index in database + * @param subId the unique SubscriptionInfo index in database * @return the number of records updated */ - int setDisplayName(String displayName, long subId); + int setDisplayName(String displayName, int subId); /** * Set display name by simInfo index with name source * @param displayName the display name of SIM card - * @param subId the unique SubInfoRecord index in database + * @param subId the unique SubscriptionInfo index in database * @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT * @return the number of records updated */ - int setDisplayNameUsingSrc(String displayName, long subId, long nameSource); + int setDisplayNameUsingSrc(String displayName, int subId, long nameSource); /** * Set phone number by subId * @param number the phone number of the SIM - * @param subId the unique SubInfoRecord index in database + * @param subId the unique SubscriptionInfo index in database * @return the number of records updated */ - int setDisplayNumber(String number, long subId); - - /** - * Set number display format. 0: none, 1: the first four digits, 2: the last four digits - * @param format the display format of phone number - * @param subId the unique SubInfoRecord index in database - * @return the number of records updated - */ - int setDisplayNumberFormat(int format, long subId); + int setDisplayNumber(String number, int subId); /** * Set data roaming by simInfo index * @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming - * @param subId the unique SubInfoRecord index in database + * @param subId the unique SubscriptionInfo index in database * @return the number of records updated */ - int setDataRoaming(int roaming, long subId); + int setDataRoaming(int roaming, int subId); - int getSlotId(long subId); + int getSlotId(int subId); - long[] getSubId(int slotId); + int[] getSubId(int slotId); - long getDefaultSubId(); + int getDefaultSubId(); int clearSubInfo(); - int getPhoneId(long subId); + int getPhoneId(int subId); /** * Get the default data subscription * @return Id of the data subscription */ - long getDefaultDataSubId(); + int getDefaultDataSubId(); - void setDefaultDataSubId(long subId); + void setDefaultDataSubId(int subId); - long getDefaultVoiceSubId(); + int getDefaultVoiceSubId(); - void setDefaultVoiceSubId(long subId); + void setDefaultVoiceSubId(int subId); - long getDefaultSmsSubId(); + int getDefaultSmsSubId(); - void setDefaultSmsSubId(long subId); + void setDefaultSmsSubId(int subId); void clearDefaultsForInactiveSubIds(); - long[] getActiveSubIdList(); + int[] getActiveSubIdList(); } diff --git a/telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl b/telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl new file mode 100644 index 0000000..4ccdea5 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl @@ -0,0 +1,24 @@ +/* + * 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.telephony.SubscriptionInfo; + +oneway interface ISubscriptionListener { + void onSubscriptionInfoChanged(); +} + diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 58807b2..adb3bc4 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -28,7 +28,7 @@ import java.util.List; /** * Interface used to interact with the phone. Mostly this is used by the * TelephonyManager class. A few places are still using this directly. - * Please clean them up if possible and use TelephonyManager insteadl. + * Please clean them up if possible and use TelephonyManager instead. * * {@hide} */ @@ -60,7 +60,7 @@ interface ITelephony { * @param subId user preferred subId. * @return whether it hung up */ - boolean endCallForSubscriber(long subId); + boolean endCallForSubscriber(int subId); /** * Answer the currently-ringing call. @@ -94,7 +94,7 @@ interface ITelephony { * TODO: this should be a oneway call (especially since it's called * directly from the key queue thread). */ - void answerRingingCallForSubscriber(long subId); + void answerRingingCallForSubscriber(int subId); /** * Silence the ringer if an incoming call is currently ringing. @@ -121,7 +121,7 @@ interface ITelephony { * @param subId user preferred subId. * @return true if the phone state is OFFHOOK. */ - boolean isOffhookForSubscriber(long subId); + boolean isOffhookForSubscriber(int subId); /** * Check if an incoming phone call is ringing or call waiting @@ -130,7 +130,7 @@ interface ITelephony { * @param subId user preferred subId. * @return true if the phone state is RINGING. */ - boolean isRingingForSubscriber(long subId); + boolean isRingingForSubscriber(int subId); /** * Check if an incoming phone call is ringing or call waiting. @@ -150,7 +150,7 @@ interface ITelephony { * @param subId user preferred subId. * @return true if the phone state is IDLE. */ - boolean isIdleForSubscriber(long subId); + boolean isIdleForSubscriber(int subId); /** * Check to see if the radio is on or not. @@ -163,7 +163,7 @@ interface ITelephony { * @param subId user preferred subId. * @return returns true if the radio is on. */ - boolean isRadioOnForSubscriber(long subId); + boolean isRadioOnForSubscriber(int subId); /** * Check if the SIM pin lock is enabled. @@ -185,7 +185,7 @@ interface ITelephony { * @param subId user preferred subId. * @return whether the operation was a success. */ - boolean supplyPinForSubscriber(long subId, String pin); + boolean supplyPinForSubscriber(int subId, String pin); /** * Supply puk to unlock the SIM and set SIM pin to new pin. @@ -204,7 +204,7 @@ interface ITelephony { * @param subId user preferred subId. * @return whether the operation was a success. */ - boolean supplyPukForSubscriber(long subId, String puk, String pin); + boolean supplyPukForSubscriber(int subId, String puk, String pin); /** * Supply a pin to unlock the SIM. Blocks until a result is determined. @@ -222,7 +222,7 @@ interface ITelephony { * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code * retValue[1] = number of attempts remaining if known otherwise -1 */ - int[] supplyPinReportResultForSubscriber(long subId, String pin); + int[] supplyPinReportResultForSubscriber(int subId, String pin); /** * Supply puk to unlock the SIM and set SIM pin to new pin. @@ -244,7 +244,7 @@ interface ITelephony { * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code * retValue[1] = number of attempts remaining if known otherwise -1 */ - int[] supplyPukReportResultForSubscriber(long subId, String puk, String pin); + int[] supplyPukReportResultForSubscriber(int subId, String puk, String pin); /** * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated @@ -263,7 +263,7 @@ interface ITelephony { * @param subId user preferred subId. * @return true if MMI command is executed. */ - boolean handlePinMmiForSubscriber(long subId, String dialString); + boolean handlePinMmiForSubscriber(int subId, String dialString); /** * Toggles the radio on or off. @@ -274,7 +274,7 @@ interface ITelephony { * Toggles the radio on or off on particular subId. * @param subId user preferred subId. */ - void toggleRadioOnOffForSubscriber(long subId); + void toggleRadioOnOffForSubscriber(int subId); /** * Set the radio to on or off @@ -285,7 +285,7 @@ interface ITelephony { * Set the radio to on or off on particular subId. * @param subId user preferred subId. */ - boolean setRadioForSubscriber(long subId, boolean turnOn); + boolean setRadioForSubscriber(int subId, boolean turnOn); /** * Set the radio to on or off unconditionally @@ -301,7 +301,7 @@ interface ITelephony { * Request to update location information for a subscrition in service state * @param subId user preferred subId. */ - void updateServiceLocationForSubscriber(long subId); + void updateServiceLocationForSubscriber(int subId); /** * Enable location update notifications. @@ -312,7 +312,7 @@ interface ITelephony { * Enable location update notifications. * @param subId user preferred subId. */ - void enableLocationUpdatesForSubscriber(long subId); + void enableLocationUpdatesForSubscriber(int subId); /** * Disable location update notifications. @@ -323,7 +323,7 @@ interface ITelephony { * Disable location update notifications. * @param subId user preferred subId. */ - void disableLocationUpdatesForSubscriber(long subId); + void disableLocationUpdatesForSubscriber(int subId); /** * Allow mobile data connections. @@ -352,7 +352,7 @@ interface ITelephony { /** * Returns the call state for a subId. */ - int getCallStateForSubscriber(long subId); + int getCallStateForSubscriber(int subId); int getDataActivity(); int getDataState(); @@ -370,7 +370,7 @@ interface ITelephony { * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE * @param subId user preferred subId. */ - int getActivePhoneTypeForSubscriber(long subId); + int getActivePhoneTypeForSubscriber(int subId); /** * Returns the CDMA ERI icon index to display @@ -381,7 +381,7 @@ interface ITelephony { * Returns the CDMA ERI icon index to display on particular subId. * @param subId user preferred subId. */ - int getCdmaEriIconIndexForSubscriber(long subId); + int getCdmaEriIconIndexForSubscriber(int subId); /** * Returns the CDMA ERI icon mode, @@ -396,7 +396,7 @@ interface ITelephony { * 1 - FLASHING * @param subId user preferred subId. */ - int getCdmaEriIconModeForSubscriber(long subId); + int getCdmaEriIconModeForSubscriber(int subId); /** * Returns the CDMA ERI text, @@ -407,7 +407,7 @@ interface ITelephony { * Returns the CDMA ERI text for particular subId, * @param subId user preferred subId. */ - String getCdmaEriTextForSubscriber(long subId); + String getCdmaEriTextForSubscriber(int subId); /** * Returns true if OTA service provisioning needs to run. @@ -417,6 +417,11 @@ interface ITelephony { boolean needsOtaServiceProvisioning(); /** + * Sets the voicemail number for a particular subscriber. + */ + boolean setVoiceMailNumber(int subId, String alphaTag, String number); + + /** * Returns the unread count of voicemails */ int getVoiceMessageCount(); @@ -426,7 +431,7 @@ interface ITelephony { * @param subId user preferred subId. * Returns the unread count of voicemails */ - int getVoiceMessageCountForSubscriber(long subId); + int getVoiceMessageCountForSubscriber(int subId); /** * Returns the network type for data transmission @@ -438,7 +443,7 @@ interface ITelephony { * @param subId user preferred subId. * Returns the network type */ - int getNetworkTypeForSubscriber(long subId); + int getNetworkTypeForSubscriber(int subId); /** * Returns the network type for data transmission @@ -450,7 +455,7 @@ interface ITelephony { * @param subId user preferred subId. * Returns the network type */ - int getDataNetworkTypeForSubscriber(long subId); + int getDataNetworkTypeForSubscriber(int subId); /** * Returns the network type for voice @@ -462,7 +467,7 @@ interface ITelephony { * @param subId user preferred subId. * Returns the network type */ - int getVoiceNetworkTypeForSubscriber(long subId); + int getVoiceNetworkTypeForSubscriber(int subId); /** * Return true if an ICC card is present @@ -474,7 +479,7 @@ interface ITelephony { * @param slotId user preferred slotId. * Return true if an ICC card is present */ - boolean hasIccCardUsingSlotId(long slotId); + boolean hasIccCardUsingSlotId(int slotId); /** * Return if the current radio is LTE on CDMA. This @@ -494,7 +499,7 @@ interface ITelephony { * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} * or {@link PHone#LTE_ON_CDMA_TRUE} */ - int getLteOnCdmaModeForSubscriber(long subId); + int getLteOnCdmaModeForSubscriber(int subId); /** * Returns the all observed cell information of the device. @@ -689,13 +694,13 @@ interface ITelephony { * Return MDN string for CDMA phone. * @param subId user preferred subId. */ - String getCdmaMdn(long subId); + String getCdmaMdn(int subId); /** * Return MIN string for CDMA phone. * @param subId user preferred subId. */ - String getCdmaMin(long subId); + String getCdmaMin(int subId); /** * Has the calling application been granted special privileges by the carrier. @@ -708,7 +713,7 @@ interface ITelephony { * * @return carrier privilege status defined in TelephonyManager. */ - int hasCarrierPrivileges(); + int getCarrierPrivilegeStatus(); /** * Similar to above, but check for pkg whose name is pkgname. @@ -727,24 +732,6 @@ interface ITelephony { List<String> getCarrierPackageNamesForIntent(in Intent intent); /** - * Set whether Android should display a simplified Mobile Network Settings UI - * for the current ICCID. - * - * @param subId for which the simplified UI should be enabled or disabled. - * @param enable true means enabling the simplified UI. - */ - void enableSimplifiedNetworkSettingsForSubscriber(long subId, boolean enable); - - /** - * Get whether a simplified Mobile Network Settings UI is enabled for the - * current ICCID. - * - * @param subId for which the simplified UI should be enabled or disabled. - * @return true if the simplified UI is enabled. - */ - boolean getSimplifiedNetworkSettingsEnabledForSubscriber(long subId); - - /** * Set the line 1 phone number string and its alphatag for the current ICCID * for display purpose only, for example, displayed in Phone Status. It won't * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null @@ -754,7 +741,7 @@ interface ITelephony { * @param alphaTag alpha-tagging of the dailing nubmer * @param number The dialing number */ - void setLine1NumberForDisplayForSubscriber(long subId, String alphaTag, String number); + void setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number); /** * Returns the displayed dialing number string if it was set previously via @@ -763,7 +750,7 @@ interface ITelephony { * @param subId whose dialing number for line 1 is returned. * @return the displayed dialing number if set, or null if not set. */ - String getLine1NumberForDisplay(long subId); + String getLine1NumberForDisplay(int subId); /** * Returns the displayed alphatag of the dialing number if it was set @@ -773,7 +760,7 @@ interface ITelephony { * @return the displayed alphatag of the dialing number if set, or null if * not set. */ - String getLine1AlphaTagForDisplay(long subId); + String getLine1AlphaTagForDisplay(int subId); /** * Override the operator branding for the current ICCID. @@ -831,4 +818,18 @@ interface ITelephony { * @return phone radio type and access technology */ int getRadioAccessFamily(in int phoneId); + + /** + * Enables or disables video calling. + * + * @param enable Whether to enable video calling. + */ + void enableVideoCalling(boolean enable); + + /** + * Whether video calling has been enabled by the user. + * + * @return {@code True} if the user has enabled video calling, {@code false} otherwise. + */ + boolean isVideoCallingEnabled(); } diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index 39defcf..1a1f8fe 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -27,31 +27,34 @@ import android.telephony.SignalStrength; import android.telephony.CellInfo; import android.telephony.VoLteServiceState; import com.android.internal.telephony.IPhoneStateListener; +import com.android.internal.telephony.ISubscriptionListener; interface ITelephonyRegistry { + void registerSubscriptionListener(String pkg, ISubscriptionListener callback, int events); + void unregisterSubscriptionListener(String pkg, ISubscriptionListener callback); void listen(String pkg, IPhoneStateListener callback, int events, boolean notifyNow); - void listenForSubscriber(in long subId, String pkg, IPhoneStateListener callback, int events, + void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events, boolean notifyNow); void notifyCallState(int state, String incomingNumber); - void notifyCallStateForSubscriber(in long subId, int state, String incomingNumber); - void notifyServiceStateForPhoneId(in int phoneId, in long subId, in ServiceState state); + void notifyCallStateForSubscriber(in int subId, int state, String incomingNumber); + void notifyServiceStateForPhoneId(in int phoneId, in int subId, in ServiceState state); void notifySignalStrength(in SignalStrength signalStrength); - void notifySignalStrengthForSubscriber(in long subId, in SignalStrength signalStrength); - void notifyMessageWaitingChangedForPhoneId(in int phoneId, in long subId, in boolean mwi); + void notifySignalStrengthForSubscriber(in int subId, in SignalStrength signalStrength); + void notifyMessageWaitingChangedForPhoneId(in int phoneId, in int subId, in boolean mwi); void notifyCallForwardingChanged(boolean cfi); - void notifyCallForwardingChangedForSubscriber(in long subId, boolean cfi); + void notifyCallForwardingChangedForSubscriber(in int subId, boolean cfi); void notifyDataActivity(int state); - void notifyDataActivityForSubscriber(in long subId, int state); + void notifyDataActivityForSubscriber(in int subId, int state); void notifyDataConnection(int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, in LinkProperties linkProperties, in NetworkCapabilities networkCapabilities, int networkType, boolean roaming); - void notifyDataConnectionForSubscriber(long subId, int state, boolean isDataConnectivityPossible, + void notifyDataConnectionForSubscriber(int subId, int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, in LinkProperties linkProperties, in NetworkCapabilities networkCapabilities, int networkType, boolean roaming); void notifyDataConnectionFailed(String reason, String apnType); - void notifyDataConnectionFailedForSubscriber(long subId, String reason, String apnType); + void notifyDataConnectionFailedForSubscriber(int subId, String reason, String apnType); void notifyCellLocation(in Bundle cellLocation); - void notifyCellLocationForSubscriber(in long subId, in Bundle cellLocation); + void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation); void notifyOtaspChanged(in int otaspMode); void notifyCellInfo(in List<CellInfo> cellInfo); void notifyPreciseCallState(int ringingCallState, int foregroundCallState, @@ -59,8 +62,9 @@ interface ITelephonyRegistry { void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause); void notifyPreciseDataConnectionFailed(String reason, String apnType, String apn, String failCause); - void notifyCellInfoForSubscriber(in long subId, in List<CellInfo> cellInfo); + void notifyCellInfoForSubscriber(in int subId, in List<CellInfo> cellInfo); void notifyDataConnectionRealTimeInfo(in DataConnectionRealTimeInfo dcRtInfo); void notifyVoLteServiceStateChanged(in VoLteServiceState lteState); - void notifyOemHookRawEventForSubscriber(in long subId, in byte[] rawData); + void notifyOemHookRawEventForSubscriber(in int subId, in byte[] rawData); + void notifySubscriptionInfoChanged(); } diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index d093a29..082e8bb 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -24,6 +24,8 @@ package com.android.internal.telephony; * Also they should all probably be static final. */ +import android.os.SystemProperties; + /** * {@hide} */ @@ -57,7 +59,17 @@ public interface RILConstants { retries needed */ int MISSING_RESOURCE = 16; /* no logical channel available */ int NO_SUCH_ELEMENT = 17; /* application not found on SIM */ + int DIAL_MODIFIED_TO_USSD = 18; /* DIAL request modified to USSD */ + int DIAL_MODIFIED_TO_SS = 19; /* DIAL request modified to SS */ + int DIAL_MODIFIED_TO_DIAL = 20; /* DIAL request modified to DIAL with different data*/ + int USSD_MODIFIED_TO_DIAL = 21; /* USSD request modified to DIAL */ + int USSD_MODIFIED_TO_SS = 22; /* USSD request modified to SS */ + int USSD_MODIFIED_TO_USSD = 23; /* USSD request modified to different USSD request */ + int SS_MODIFIED_TO_DIAL = 24; /* SS request modified to DIAL */ + int SS_MODIFIED_TO_USSD = 25; /* SS request modified to USSD */ int SUBSCRIPTION_NOT_SUPPORTED = 26; /* Subscription not supported */ + int SS_MODIFIED_TO_SS = 27; /* SS request modified to different SS request */ + /* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */ int NETWORK_MODE_WCDMA_PREF = 0; /* GSM/WCDMA (WCDMA preferred) */ @@ -76,7 +88,8 @@ public interface RILConstants { int NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = 10; /* LTE, CDMA, EvDo, GSM/WCDMA */ int NETWORK_MODE_LTE_ONLY = 11; /* LTE Only mode. */ int NETWORK_MODE_LTE_WCDMA = 12; /* LTE/WCDMA */ - int PREFERRED_NETWORK_MODE = NETWORK_MODE_WCDMA_PREF; + int PREFERRED_NETWORK_MODE = SystemProperties.getInt("ro.telephony.default_network", + NETWORK_MODE_WCDMA_PREF); int CDMA_CELL_BROADCAST_SMS_DISABLED = 1; int CDMA_CELL_BROADCAST_SMS_ENABLED = 0; @@ -161,6 +174,7 @@ cat include/telephony/ril.h | \ public static final int DATA_PROFILE_FOTA = 3; public static final int DATA_PROFILE_CBS = 4; public static final int DATA_PROFILE_OEM_BASE = 1000; + public static final int DATA_PROFILE_INVALID = 0xFFFFFFFF; int RIL_REQUEST_GET_SIM_STATUS = 1; int RIL_REQUEST_ENTER_SIM_PIN = 2; @@ -338,4 +352,6 @@ cat include/telephony/ril.h | \ int RIL_UNSOL_HARDWARE_CONFIG_CHANGED = 1040; int RIL_UNSOL_DC_RT_INFO_CHANGED = 1041; int RIL_UNSOL_RADIO_CAPABILITY = 1042; + int RIL_UNSOL_ON_SS = 1043; + int RIL_UNSOL_STK_CC_ALPHA_NOTIFY = 1044; } diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java index d05e7d1..c67e5d7 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java +++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java @@ -312,27 +312,7 @@ public class TelephonyIntents { public static final String EXTRA_SPN = "spn"; /** - * <p>Broadcast Action: It indicates one column of a siminfo record has been changed - * The intent will have the following extra values:</p> - * <ul> - * <li><em>columnName</em> - The siminfo column that is updated.</li> - * <li><em>stringContent</em> - The string value of the updated column.</li> - * <li><em>intContent</em> - The int value of the updated column.</li> - * </ul> - * <p class="note">This is a protected intent that can only be sent - * by the system. - */ - public static final String ACTION_SIMINFO_CONTENT_CHANGE - = "android.intent.action.ACTION_SIMINFO_CONTENT_CHANGE"; - - /** * <p>Broadcast Action: It indicates one column of a subinfo record has been changed - * The intent will have the following extra values:</p> - * <ul> - * <li><em>columnName</em> - The siminfo column that is updated.</li> - * <li><em>stringContent</em> - The string value of the updated column.</li> - * <li><em>intContent</em> - The int value of the updated column.</li> - * </ul> * <p class="note">This is a protected intent that can only be sent * by the system. */ @@ -340,28 +320,14 @@ public class TelephonyIntents { = "android.intent.action.ACTION_SUBINFO_CONTENT_CHANGE"; /** - * <p>Broadcast Action: It indicates siminfo update is completed when SIM inserted state change - * The intent will have the following extra values:</p> - * <p class="note">This is a protected intent that can only be sent - * by the system. - */ - public static final String ACTION_SIMINFO_UPDATED - = "android.intent.action.ACTION_SIMINFO_UPDATED"; - - /** * <p>Broadcast Action: It indicates subinfo record update is completed * when SIM inserted state change - * The intent will have the following extra values:</p> * <p class="note">This is a protected intent that can only be sent * by the system. */ public static final String ACTION_SUBINFO_RECORD_UPDATED = "android.intent.action.ACTION_SUBINFO_RECORD_UPDATED"; - public static final String EXTRA_COLUMN_NAME = "columnName"; - public static final String EXTRA_INT_CONTENT = "intContent"; - public static final String EXTRA_STRING_CONTENT = "stringContent"; - /** * Broadcast Action: The default subscription has changed. This has the following * extra values:</p> |