ksd to lmp-sprout-dev
Change-Id: I94eb65c62231b5831570bb0cbbbd9c916bee0a37
diff --git a/core/java/android/content/res/ResourcesKey.java b/core/java/android/content/res/ResourcesKey.java
index e0f1b3a..4ae3825 100644
--- a/core/java/android/content/res/ResourcesKey.java
+++ b/core/java/android/content/res/ResourcesKey.java
@@ -62,10 +62,15 @@
return false;
}
ResourcesKey peer = (ResourcesKey) obj;
- if (mResDir != peer.mResDir) {
- if (mResDir == null || peer.mResDir == null) {
- return false;
- } else if (!mResDir.equals(peer.mResDir)) {
+
+ if ((mResDir == null) && (peer.mResDir != null)) {
+ return false;
+ }
+ if ((mResDir != null) && (peer.mResDir == null)) {
+ return false;
+ }
+ if ((mResDir != null) && (peer.mResDir != null)) {
+ if (!mResDir.equals(peer.mResDir)) {
return false;
}
}
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 0202f91..08209fa 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -24,17 +24,13 @@
import android.content.Intent;
import android.content.pm.UserInfo;
import android.database.Cursor;
-import android.location.Country;
-import android.location.CountryDetector;
import android.net.Uri;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.ContactsContract.CommonDataKinds.Callable;
import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.DataUsageFeedback;
import android.telecomm.PhoneAccountHandle;
-import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import com.android.internal.telephony.CallerInfo;
@@ -389,10 +385,12 @@
public static Uri addCall(CallerInfo ci, Context context, String number,
int presentation, int callType, int features, PhoneAccountHandle accountHandle,
long start, int duration, Long dataUsage) {
+ // FIXME using -1 as subId instead of SubscriptionManager.INVALID_SUB_ID
return addCall(ci, context, number, presentation, callType, features, accountHandle,
start, duration, dataUsage, false);
}
+
/**
* Adds a call to the call log.
*
@@ -408,6 +406,7 @@
* @param accountHandle The accountHandle object identifying the provider of the call
* @param start time stamp for the call in milliseconds
* @param duration call duration in seconds
+ * @param subId the subscription id.
* @param dataUsage data usage for the call in bytes, null if data usage was not tracked for
* the call.
* @param addForAllUsers If true, the call is added to the call log of all currently
@@ -465,6 +464,7 @@
values.put(PHONE_ACCOUNT_COMPONENT_NAME, accountComponentString);
values.put(PHONE_ACCOUNT_ID, accountId);
values.put(NEW, Integer.valueOf(1));
+
if (callType == MISSED_TYPE) {
values.put(IS_READ, Integer.valueOf(0));
}
@@ -505,13 +505,12 @@
if (cursor != null) {
try {
if (cursor.getCount() > 0 && cursor.moveToFirst()) {
- final String dataId = cursor.getString(0);
- updateDataUsageStatForData(resolver, dataId);
- if (duration >= MIN_DURATION_FOR_NORMALIZED_NUMBER_UPDATE_MS
- && callType == Calls.OUTGOING_TYPE
- && TextUtils.isEmpty(ci.normalizedNumber)) {
- updateNormalizedNumber(context, resolver, dataId, number);
- }
+ final Uri feedbackUri = DataUsageFeedback.FEEDBACK_URI.buildUpon()
+ .appendPath(cursor.getString(0))
+ .appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
+ DataUsageFeedback.USAGE_TYPE_CALL)
+ .build();
+ resolver.update(feedbackUri, new ContentValues(), null, null);
}
} finally {
cursor.close();
@@ -584,53 +583,5 @@
+ " LIMIT -1 OFFSET 500)", null);
return result;
}
-
- private static void updateDataUsageStatForData(ContentResolver resolver, String dataId) {
- final Uri feedbackUri = DataUsageFeedback.FEEDBACK_URI.buildUpon()
- .appendPath(dataId)
- .appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
- DataUsageFeedback.USAGE_TYPE_CALL)
- .build();
- resolver.update(feedbackUri, new ContentValues(), null, null);
- }
-
- /**
- * Update the normalized phone number for the given dataId in the ContactsProvider, based
- * on the user's current country.
- */
- private static void updateNormalizedNumber(Context context, ContentResolver resolver,
- String dataId, String number) {
- if (TextUtils.isEmpty(number) || TextUtils.isEmpty(dataId)) {
- return;
- }
-
- final String countryIso = getCurrentCountryIso(context);
- if (TextUtils.isEmpty(countryIso)) {
- return;
- }
-
- final String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number,
- getCurrentCountryIso(context));
- if (TextUtils.isEmpty(normalizedNumber)) {
- return;
- }
-
- final ContentValues values = new ContentValues();
- values.put(Phone.NORMALIZED_NUMBER, normalizedNumber);
- resolver.update(Data.CONTENT_URI, values, Data._ID + "=?", new String[] {dataId});
- }
-
- private static String getCurrentCountryIso(Context context) {
- String countryIso = null;
- final CountryDetector detector = (CountryDetector) context.getSystemService(
- Context.COUNTRY_DETECTOR);
- if (detector != null) {
- final Country country = detector.detectCountry();
- if (country != null) {
- countryIso = country.getCountryIso();
- }
- }
- return countryIso;
- }
}
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 7c5233c..3429fdb 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -271,6 +271,8 @@
<protected-broadcast android:name="android.intent.action.PHONE_STATE" />
+ <protected-broadcast android:name="android.intent.action.SUB_DEFAULT_CHANGED" />
+
<protected-broadcast android:name="android.location.GPS_ENABLED_CHANGE" />
<protected-broadcast android:name="android.location.PROVIDERS_CHANGED" />
<protected-broadcast android:name="android.location.MODE_CHANGED" />
@@ -291,6 +293,12 @@
<protected-broadcast android:name="android.nfc.handover.intent.action.TRANSFER_PROGRESS" />
<protected-broadcast android:name="android.nfc.handover.intent.action.TRANSFER_DONE" />
+ <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_SUBSCRIPTION_CHANGED" />
+ <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED" />
+ <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED" />
+ <protected-broadcast android:name="android.intent.action.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED" />
+ <protected-broadcast android:name="android.intent.action.ACTION_SUBINFO_CONTENT_CHANGE" />
+ <protected-broadcast android:name="android.intent.action.ACTION_SUBINFO_RECORD_UPDATED" />
<!-- ====================================== -->
<!-- Permissions for things that cost money -->
diff --git a/core/res/res/layout/subscription_item_layout.xml b/core/res/res/layout/subscription_item_layout.xml
index 9f8f2b3..aa835f4 100755
--- a/core/res/res/layout/subscription_item_layout.xml
+++ b/core/res/res/layout/subscription_item_layout.xml
@@ -36,7 +36,7 @@
android:id="@+id/sub_short_number"
android:layout_marginBottom="2dip"
android:layout_marginEnd="4dip"
- android:layout_alignParentEnd="true"
+ android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:textSize="12sp"
android:singleLine="true"
@@ -54,8 +54,6 @@
android:id="@+id/sub_name"
android:singleLine="true"
android:ellipsize="none"
- android:requiresFadingEdge="horizontal"
- android:scrollHorizontally="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:layout_width="wrap_content"
@@ -65,8 +63,7 @@
android:layout_alignStart="@+id/sub_name"
android:singleLine="true"
android:ellipsize="none"
- android:requiresFadingEdge="horizontal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</RelativeLayout>
-</LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index af213ba..6c2d27d 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -944,6 +944,9 @@
device is data-only. -->
<bool name="config_voice_capable">true</bool>
+ <!-- Flag indicating if the user is notified when the mobile network access is restricted -->
+ <bool name="config_user_notification_of_restrictied_mobile_access">true</bool>
+
<!-- Flag indicating whether the current device allows sms service.
If true, this means that the device supports both sending and
receiving sms via the telephony network.
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index f1ec5d2..fe55238 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1718,6 +1718,11 @@
various peripherals for the purpose of hardware testing.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_fm">access FM radio</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_fm">Allows the app to access FM radio to listen to programs.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_callPhone">directly call phone numbers</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_callPhone">Allows the app to call phone numbers
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 622a01a..b81eab7e 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -267,6 +267,7 @@
<java-symbol type="bool" name="config_ui_enableFadingMarquee" />
<java-symbol type="bool" name="config_use_strict_phone_number_comparation" />
<java-symbol type="bool" name="config_voice_capable" />
+ <java-symbol type="bool" name="config_user_notification_of_restrictied_mobile_access" />
<java-symbol type="bool" name="config_wifiDisplaySupportsProtectedBuffers" />
<java-symbol type="bool" name="preferences_prefer_dual_pane" />
<java-symbol type="bool" name="skip_restoring_network_selection" />
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index acb97a0..8509dcc 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -984,6 +984,8 @@
return 0xc;
} else if (c == WILD) {
return 0xd;
+ } else if (c == WAIT) {
+ return 0xe;
} else {
throw new RuntimeException ("invalid char for BCD " + c);
}
@@ -1821,23 +1823,31 @@
// to the list.
number = extractNetworkPortionAlt(number);
- String numbers = "";
+ Rlog.d(LOG_TAG, "subId:" + subId + ", number: " + number + ", defaultCountryIso:" +
+ ((defaultCountryIso == null) ? "NULL" : defaultCountryIso));
+
+ String emergencyNumbers = "";
int slotId = SubscriptionManager.getSlotId(subId);
- // retrieve the list of emergency numbers
- // check read-write ecclist property first
- String ecclist = (slotId <= 0) ? "ril.ecclist" : ("ril.ecclist" + slotId);
- numbers = SystemProperties.get(ecclist);
+ if (slotId >= 0) {
+ // retrieve the list of emergency numbers
+ // check read-write ecclist property first
+ String ecclist = (slotId == 0) ? "ril.ecclist" : ("ril.ecclist" + slotId);
- if (TextUtils.isEmpty(numbers)) {
- // then read-only ecclist property since old RIL only uses this
- numbers = SystemProperties.get("ro.ril.ecclist");
+ emergencyNumbers = SystemProperties.get(ecclist, "");
}
- if (!TextUtils.isEmpty(numbers)) {
+ Rlog.d(LOG_TAG, "slotId:" + slotId + ", emergencyNumbers: " + emergencyNumbers);
+
+ if (TextUtils.isEmpty(emergencyNumbers)) {
+ // then read-only ecclist property since old RIL only uses this
+ emergencyNumbers = SystemProperties.get("ro.ril.ecclist");
+ }
+
+ if (!TextUtils.isEmpty(emergencyNumbers)) {
// searches through the comma-separated list for a match,
// return true if one is found.
- for (String emergencyNum : numbers.split(",")) {
+ for (String emergencyNum : emergencyNumbers.split(",")) {
// It is not possible to append additional digits to an emergency number to dial
// the number in Brazil - it won't connect.
if (useExactMatch || "BR".equalsIgnoreCase(defaultCountryIso)) {
@@ -1857,6 +1867,23 @@
Rlog.d(LOG_TAG, "System property doesn't provide any emergency numbers."
+ " Use embedded logic for determining ones.");
+ // If slot id is invalid, means that there is no sim card.
+ // According spec 3GPP TS22.101, the following numbers should be
+ // ECC numbers when SIM/USIM is not present.
+ emergencyNumbers = ((slotId < 0) ? "112,911,000,08,110,118,119,999" : "112,911");
+
+ for (String emergencyNum : emergencyNumbers.split(",")) {
+ if (useExactMatch) {
+ if (number.equals(emergencyNum)) {
+ return true;
+ }
+ } else {
+ if (number.startsWith(emergencyNum)) {
+ return true;
+ }
+ }
+ }
+
// No ecclist system property, so use our own list.
if (defaultCountryIso != null) {
ShortNumberUtil util = new ShortNumberUtil();
@@ -1865,13 +1892,9 @@
} else {
return util.connectsToEmergencyNumber(number, defaultCountryIso);
}
- } else {
- if (useExactMatch) {
- return (number.equals("112") || number.equals("911"));
- } else {
- return (number.startsWith("112") || number.startsWith("911"));
- }
}
+
+ return false;
}
/**
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index 350c27e..1705051 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -20,6 +20,7 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.telephony.SubscriptionManager;
import android.telephony.CellLocation;
import android.telephony.CellInfo;
import android.telephony.VoLteServiceState;
@@ -31,6 +32,7 @@
import android.telephony.PreciseDataConnectionState;
import com.android.internal.telephony.IPhoneStateListener;
+import com.android.internal.telephony.PhoneConstants;
import java.util.List;
@@ -217,12 +219,12 @@
* @hide
*/
/** @hide */
- protected long mSubId = 0;
+ protected long mSubId = SubscriptionManager.INVALID_SUB_ID;
private final Handler mHandler;
public PhoneStateListener() {
- this(SubscriptionManager.DEFAULT_SUB_ID, Looper.myLooper());
+ this(SubscriptionManager.getDefaultSubId(), Looper.myLooper());
}
/**
diff --git a/telephony/java/android/telephony/SubInfoRecord.java b/telephony/java/android/telephony/SubInfoRecord.java
index ced8e2f..55781fa 100644
--- a/telephony/java/android/telephony/SubInfoRecord.java
+++ b/telephony/java/android/telephony/SubInfoRecord.java
@@ -33,34 +33,33 @@
public int mNameSource;
public int mColor;
public String mNumber;
- public int mDispalyNumberFormat;
+ public int mDisplayNumberFormat;
public int mDataRoaming;
public int[] mSimIconRes;
public SubInfoRecord() {
- this.mSubId = -1;
+ this.mSubId = SubscriptionManager.INVALID_SUB_ID;
this.mIccId = "";
- this.mSlotId = -1;
+ this.mSlotId = SubscriptionManager.INVALID_SLOT_ID;
this.mDisplayName = "";
this.mNameSource = 0;
this.mColor = 0;
this.mNumber = "";
- this.mDispalyNumberFormat = 0;
+ this.mDisplayNumberFormat = 0;
this.mDataRoaming = 0;
this.mSimIconRes = new int[2];
}
-
- public SubInfoRecord(long subId, String iccId, int slotId, String displayname, int nameSource,
- int mColor, String mNumber, int displayFormat, int roaming, int[] iconRes) {
+ public SubInfoRecord(long subId, String iccId, int slotId, String displayName,
+ int nameSource, int mColor, String mNumber, int displayFormat, int roaming, int[] iconRes) {
this.mSubId = subId;
this.mIccId = iccId;
this.mSlotId = slotId;
- this.mDisplayName = displayname;
+ this.mDisplayName = displayName;
this.mNameSource = nameSource;
this.mColor = mColor;
this.mNumber = mNumber;
- this.mDispalyNumberFormat = displayFormat;
+ this.mDisplayNumberFormat = displayFormat;
this.mDataRoaming = roaming;
this.mSimIconRes = iconRes;
}
@@ -74,13 +73,13 @@
int mNameSource = source.readInt();
int mColor = source.readInt();
String mNumber = source.readString();
- int mDispalyNumberFormat = source.readInt();
+ int mDisplayNumberFormat = source.readInt();
int mDataRoaming = source.readInt();
int[] iconRes = new int[2];
source.readIntArray(iconRes);
return new SubInfoRecord(mSubId, mIccId, mSlotId, mDisplayName, mNameSource, mColor, mNumber,
- mDispalyNumberFormat, mDataRoaming, iconRes);
+ mDisplayNumberFormat, mDataRoaming, iconRes);
}
public SubInfoRecord[] newArray(int size) {
@@ -96,7 +95,7 @@
dest.writeInt(mNameSource);
dest.writeInt(mColor);
dest.writeString(mNumber);
- dest.writeInt(mDispalyNumberFormat);
+ dest.writeInt(mDisplayNumberFormat);
dest.writeInt(mDataRoaming);
dest.writeIntArray(mSimIconRes);
}
@@ -109,7 +108,7 @@
return "{mSubId=" + mSubId + ", mIccId=" + mIccId + " mSlotId=" + mSlotId
+ " mDisplayName=" + mDisplayName + " mNameSource=" + mNameSource
+ " mColor=" + mColor + " mNumber=" + mNumber
- + " mDispalyNumberFormat=" + mDispalyNumberFormat + " mDataRoaming=" + mDataRoaming
+ + " mDisplayNumberFormat=" + mDisplayNumberFormat + " mDataRoaming=" + mDataRoaming
+ " mSimIconRes=" + mSimIconRes + "}";
}
}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 79e9fd5..f32d3af 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -18,6 +18,8 @@
import static android.Manifest.permission.READ_PHONE_STATE;
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
import android.app.ActivityManagerNative;
import android.content.ContentResolver;
import android.content.ContentUris;
@@ -50,11 +52,26 @@
private static final boolean DBG = true;
private static final boolean VDBG = false;
- // An invalid subscription identifier
- public static final long INVALID_SUB_ID = Long.MAX_VALUE;
+ // An invalid phone identifier
+ public static final int INVALID_PHONE_ID = -1000;
- // The default subscription identifier
- public static final long DEFAULT_SUB_ID = Long.MAX_VALUE - 1;
+ // Indicates the caller wants the default phone id.
+ public static final int DEFAULT_PHONE_ID = Integer.MAX_VALUE;
+
+ // An invalid slot identifier
+ public static final int INVALID_SLOT_ID = -1000;
+
+ // Indicates the caller wants the default slot id.
+ public static final int DEFAULT_SLOT_ID = Integer.MAX_VALUE;
+
+ // An invalid subscription identifier
+ public static final long INVALID_SUB_ID = -1000;
+
+ // Indicates the user should be asked which sub to use.
+ public static final long ASK_USER_SUB_ID = -1001;
+
+ // Indicates the caller wants the default sub id.
+ public static final long DEFAULT_SUB_ID = Long.MAX_VALUE;
public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo");
@@ -133,7 +150,7 @@
*/
public static final String DISPLAY_NUMBER_FORMAT = "display_number_format";
- public static final int DISPALY_NUMBER_NONE = 0;
+ public static final int DISPLAY_NUMBER_NONE = 0;
public static final int DISPLAY_NUMBER_FIRST = 1;
@@ -163,8 +180,17 @@
private static HashMap<Integer, Long> mSimInfo = new HashMap<Integer, Long>();
+ /**
+ * Broadcast Action: The user has changed one of the default subs related to
+ * data, phone calls, or sms</p>
+ *
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String SUB_DEFAULT_CHANGED_ACTION =
+ "android.intent.action.SUB_DEFAULT_CHANGED";
+
public SubscriptionManager() {
- if (DBG) logd("SubscriptionManager created");
+ logd("SubscriptionManager created");
}
/**
@@ -174,9 +200,8 @@
* @return SubInfoRecord, maybe null
*/
public static SubInfoRecord getSubInfoUsingSubId(Context context, long subId) {
- if (VDBG) logd("[getSubInfoUsingSubIdx]+ subId:" + subId);
- if (subId <= 0) {
- if (VDBG) logd("[getSubInfoUsingSubIdx]- subId <= 0");
+ if (!isValidSubId(subId)) {
+ logd("[getSubInfoUsingSubIdx]- invalid subId");
return null;
}
@@ -229,9 +254,8 @@
* @return SubInfoRecord, maybe null
*/
public static List<SubInfoRecord> getSubInfoUsingSlotId(Context context, int slotId) {
- if (VDBG) logd("[getSubInfoUsingSlotId]- slotId=" + slotId);
- if (slotId < 0) {
- logd("[getSubInfoUsingSlotId]- return null, slotId < 0");
+ if (!isValidSlotId(slotId)) {
+ logd("[getSubInfoUsingSlotId]- invalid slotId");
return null;
}
@@ -277,8 +301,16 @@
* @return Array list of currently inserted SubInfoRecord(s)
*/
public static List<SubInfoRecord> getActivatedSubInfoList(Context context) {
- if (VDBG) logd("[getActivatedSubInfoList]+");
+ //. FLAG -- we should get rid of this function. The context param isn't used.
+ logd("[getActivatedSubInfoList]+ (old one with context param)");
+ return getActivatedSubInfoList();
+ }
+ /**
+ * Get the SubInfoRecord(s) of the currently inserted SIM(s)
+ * @return Array list of currently inserted SubInfoRecord(s)
+ */
+ public static List<SubInfoRecord> getActivatedSubInfoList() {
List<SubInfoRecord> result = null;
try {
@@ -316,6 +348,26 @@
}
/**
+ * Get the count of activated SUB(s)
+ * @param context Context provided by caller
+ * @return activated SIM count
+ */
+ public static int getActivatedSubInfoCount(Context context) {
+ int result = 0;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ result = iSub.getActivatedSubInfoCount();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ return result;
+ }
+
+ /**
* Add a new SubInfoRecord to subinfo database if needed
* @param context Context provided by caller
* @param iccId the IccId of the SIM card
@@ -327,6 +379,9 @@
if (iccId == null) {
logd("[addSubInfoRecord]- null iccId");
}
+ if (!isValidSlotId(slotId)) {
+ logd("[addSubInfoRecord]- invalid slotId");
+ }
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -353,7 +408,7 @@
public static int setColor(Context context, int color, long subId) {
if (VDBG) logd("[setColor]+ color:" + color + " subId:" + subId);
int size = sSimBackgroundDarkRes.length;
- if (subId <= 0 || color < 0 || color >= size) {
+ if (!isValidSubId(subId) || color < 0 || color >= size) {
logd("[setColor]- fail");
return -1;
}
@@ -394,7 +449,7 @@
*/
public static int setDisplayName(Context context, String displayName, long subId, long nameSource) {
if (VDBG) logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource);
- if (subId <= 0) {
+ if (!isValidSubId(subId)) {
logd("[setDisplayName]- fail");
return -1;
}
@@ -421,10 +476,9 @@
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
*/
- public static int setDispalyNumber(Context context, String number, long subId) {
- if (VDBG) logd("[setDispalyNumber]+ number:" + number + " subId:" + subId);
- if (number == null || subId <= 0) {
- logd("[setDispalyNumber]- fail");
+ public static int setDisplayNumber(Context context, String number, long subId) {
+ if (number == null || !isValidSubId(subId)) {
+ logd("[setDisplayNumber]- fail");
return -1;
}
@@ -433,7 +487,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.setDispalyNumber(number, subId);
+ result = iSub.setDisplayNumber(number, subId);
}
} catch (RemoteException ex) {
// ignore it
@@ -452,7 +506,7 @@
*/
public static int setDisplayNumberFormat(Context context, int format, long subId) {
if (VDBG) logd("[setDisplayNumberFormat]+ format:" + format + " subId:" + subId);
- if (format < 0 || subId <= 0) {
+ if (format < 0 || !isValidSubId(subId)) {
logd("[setDisplayNumberFormat]- fail, return -1");
return -1;
}
@@ -481,7 +535,7 @@
*/
public static int setDataRoaming(Context context, int roaming, long subId) {
if (VDBG) logd("[setDataRoaming]+ roaming:" + roaming + " subId:" + subId);
- if (roaming < 0 || subId <= 0) {
+ if (roaming < 0 || !isValidSubId(subId)) {
logd("[setDataRoaming]- fail");
return -1;
}
@@ -501,9 +555,11 @@
}
public static int getSlotId(long subId) {
- if (VDBG) logd("[getSlotId]+ subId:" + subId);
+ if (!isValidSubId(subId)) {
+ logd("[getSlotId]- fail");
+ }
- int result = 0;
+ int result = INVALID_SLOT_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -519,7 +575,10 @@
}
public static long[] getSubId(int slotId) {
- if (VDBG) logd("[getSubId]+ slotId:" + slotId);
+ if (!isValidSlotId(slotId)) {
+ logd("[getSubId]- fail");
+ return null;
+ }
long[] subId = null;
@@ -536,9 +595,12 @@
}
public static int getPhoneId(long subId) {
- if (VDBG) logd("[getPhoneId]+ subId=" + subId);
+ if (!isValidSubId(subId)) {
+ logd("[getPhoneId]- fail");
+ return INVALID_PHONE_ID;
+ }
- int result = 0;
+ int result = INVALID_PHONE_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -549,7 +611,7 @@
// ignore it
}
- if (VDBG) logd("[getPhoneId]- phonId=" + result);
+ if (VDBG) logd("[getPhoneId]- phoneId=" + result);
return result;
}
@@ -583,23 +645,13 @@
Rlog.d(LOG_TAG, "[SubManager] " + msg);
}
- public static long normalizeSubId(long subId) {
- long retVal = (subId == DEFAULT_SUB_ID) ? getDefaultSubId() : subId;
- Rlog.d(LOG_TAG, "[SubManager] normalizeSubId subId=" + retVal);
- return retVal;
- }
-
- public static boolean validSubId(long subId) {
- return (subId != DEFAULT_SUB_ID) && (subId != -1);
- }
-
/**
* @return the "system" defaultSubId on a voice capable device this
* will be getDefaultVoiceSubId() and on a data only device it will be
* getDefaultDataSubId().
*/
public static long getDefaultSubId() {
- long subId = 1;
+ long subId = INVALID_SUB_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -615,7 +667,7 @@
}
public static long getDefaultVoiceSubId() {
- long subId = 1;
+ long subId = INVALID_SUB_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
@@ -626,7 +678,7 @@
// ignore it
}
- if (VDBG) logd("getDefaultSubId, sub id = " + subId);
+ if (VDBG) logd("getDefaultVoiceSubId, sub id = " + subId);
return subId;
}
@@ -638,32 +690,68 @@
iSub.setDefaultVoiceSubId(subId);
}
} catch (RemoteException ex) {
- // ignore it
+ // ignore it
}
}
- public static long getPreferredSmsSubId() {
- // FIXME add framework support to get the preferred sub
- return getDefaultSubId();
+ public static SubInfoRecord getDefaultVoiceSubInfo(Context context) {
+ return getSubInfoUsingSubId(context, getDefaultVoiceSubId());
}
- public static long getPreferredDataSubId() {
- // FIXME add framework support to get the preferred sub
- return getDefaultSubId();
+ public static int getDefaultVoicePhoneId() {
+ return getPhoneId(getDefaultVoiceSubId());
}
- public static long getDefaultDataSubId() {
+ public static long getDefaultSmsSubId() {
+ long subId = INVALID_SUB_ID;
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- return iSub.getDefaultDataSubId();
- } else {
- return -1;
+ subId = iSub.getDefaultSmsSubId();
}
} catch (RemoteException ex) {
- return -1;
+ // ignore it
}
+
+ if (VDBG) logd("getDefaultSmsSubId, sub id = " + subId);
+ return subId;
+ }
+
+ public static void setDefaultSmsSubId(long subId) {
+ if (VDBG) logd("setDefaultSmsSubId sub id = " + subId);
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ iSub.setDefaultSmsSubId(subId);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ }
+
+ public static SubInfoRecord getDefaultSmsSubInfo(Context context) {
+ return getSubInfoUsingSubId(context, getDefaultSmsSubId());
+ }
+
+ public static int getDefaultSmsPhoneId() {
+ return getPhoneId(getDefaultSmsSubId());
+ }
+
+ public static long getDefaultDataSubId() {
+ long subId = INVALID_SUB_ID;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ subId = iSub.getDefaultDataSubId();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ if (VDBG) logd("getDefaultDataSubId, sub id = " + subId);
+ return subId;
}
public static void setDefaultDataSubId(long subId) {
@@ -674,14 +762,19 @@
iSub.setDefaultDataSubId(subId);
}
} catch (RemoteException ex) {
- // ignore it
+ // ignore it
}
}
- public static void clearSubInfo()
- {
- if (VDBG) logd("[clearSubInfo]+");
+ public static SubInfoRecord getDefaultDataSubInfo(Context context) {
+ return getSubInfoUsingSubId(context, getDefaultDataSubId());
+ }
+ public static int getDefaultDataPhoneId() {
+ return getPhoneId(getDefaultDataSubId());
+ }
+
+ public static void clearSubInfo() {
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
@@ -694,10 +787,55 @@
return;
}
+ //FIXME this is vulnerable to race conditions
+ public static boolean allDefaultsSelected() {
+ if (getDefaultDataSubId() == INVALID_SUB_ID) {
+ return false;
+ }
+ if (getDefaultSmsSubId() == INVALID_SUB_ID) {
+ return false;
+ }
+ if (getDefaultVoiceSubId() == INVALID_SUB_ID) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * If a default is set to subscription which is not active, this will reset that default back to
+ * INVALID_SUB_ID.
+ */
+ public static void clearDefaultsForInactiveSubIds() {
+ if (VDBG) logd("clearDefaultsForInactiveSubIds");
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ iSub.clearDefaultsForInactiveSubIds();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ }
+
+ public static boolean isValidSubId(long subId) {
+ return subId > INVALID_SUB_ID ;
+ }
+
+ public static boolean isValidSlotId(int slotId) {
+ return slotId > INVALID_SLOT_ID && slotId < TelephonyManager.getDefault().getSimCount();
+ }
+
+ public static boolean isValidPhoneId(int phoneId) {
+ //FIXME also check it is < num phones
+ return phoneId > INVALID_PHONE_ID
+ && phoneId < TelephonyManager.getDefault().getPhoneCount();
+ }
+
public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId) {
- long [] subId = SubscriptionManager.getSubId(phoneId);
- if ((subId != null) && (subId.length >= 1)) {
- putPhoneIdAndSubIdExtra(intent, phoneId, subId[0]);
+ //FIXME this is using phoneId and slotId interchangeably
+ long[] subIds = SubscriptionManager.getSubId(phoneId);
+ if (subIds != null && subIds.length > 0) {
+ putPhoneIdAndSubIdExtra(intent, phoneId, subIds[0]);
} else {
logd("putPhoneIdAndSubIdExtra: no valid subs");
}
@@ -705,8 +843,35 @@
public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, long subId) {
if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
- intent.putExtra(PhoneConstants.SLOT_KEY, phoneId); //FIXME: RENAME TO PHONE_ID_KEY ??
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
+ intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
+ //FIXME this is using phoneId and slotId interchangeably
+ //Eventually, this should be removed as it is not the slot id
+ intent.putExtra(PhoneConstants.SLOT_KEY, phoneId);
+ }
+
+ /**
+ * @return the list of subId's that are activated,
+ * is never null but the length maybe 0.
+ */
+ public static long[] getActivatedSubIdList() {
+ long[] subId = null;
+
+ try {
+ ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
+ if (iSub != null) {
+ subId = iSub.getActivatedSubIdList();
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+
+ if (subId == null) {
+ subId = new long[0];
+ }
+
+ return subId;
+
}
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index cdee3de..9c44666 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -575,8 +575,28 @@
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
*/
public String getDeviceSoftwareVersion() {
+ return getDeviceSoftwareVersion(getDefaultSim());
+ }
+
+ /**
+ * Returns the software version number for the device, for example,
+ * the IMEI/SV for GSM phones. Return null if the software version is
+ * not available.
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+ *
+ * @param slotId of which deviceID is returned
+ */
+ /** {@hide} */
+ public String getDeviceSoftwareVersion(int slotId) {
+ // FIXME methods taking slot id should not use subscription, instead us Uicc directly
+ long[] subId = SubscriptionManager.getSubId(slotId);
+ if (subId == null || subId.length == 0) {
+ return null;
+ }
try {
- return getSubscriberInfo().getDeviceSvn();
+ return getSubscriberInfo().getDeviceSvnUsingSubId(subId[0]);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -606,7 +626,11 @@
*/
/** {@hide} */
public String getDeviceId(int slotId) {
+ // FIXME methods taking slot id should not use subscription, instead us Uicc directly
long[] subId = SubscriptionManager.getSubId(slotId);
+ if (subId == null || subId.length == 0) {
+ return null;
+ }
try {
return getSubscriberInfo().getDeviceIdUsingSubId(subId[0]);
} catch (RemoteException ex) {
@@ -787,23 +811,23 @@
*/
/** {@hide} */
public int getCurrentPhoneType(long subId) {
-
+ int phoneId = SubscriptionManager.getPhoneId(subId);
try{
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.getActivePhoneTypeUsingSubId(subId);
} else {
// This can happen when the ITelephony interface is not up yet.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
}
} catch (RemoteException ex) {
// This shouldn't happen in the normal case, as a backup we
// read from the system property.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
} catch (NullPointerException ex) {
// This shouldn't happen in the normal case, as a backup we
// read from the system property.
- return getPhoneTypeFromProperty(subId);
+ return getPhoneTypeFromProperty(phoneId);
}
}
@@ -824,31 +848,29 @@
}
private int getPhoneTypeFromProperty() {
- return getPhoneTypeFromProperty(getDefaultSubscription());
+ return getPhoneTypeFromProperty(getDefaultPhone());
}
/** {@hide} */
- private int getPhoneTypeFromProperty(long subId) {
- String type =
- getTelephonyProperty
- (TelephonyProperties.CURRENT_ACTIVE_PHONE, subId, null);
- if (type != null) {
- return (Integer.parseInt(type));
- } else {
- return getPhoneTypeFromNetworkType(subId);
+ private int getPhoneTypeFromProperty(int phoneId) {
+ String type = getTelephonyProperty(phoneId,
+ TelephonyProperties.CURRENT_ACTIVE_PHONE, null);
+ if (type == null || type.equals("")) {
+ return getPhoneTypeFromNetworkType(phoneId);
}
+ return Integer.parseInt(type);
}
private int getPhoneTypeFromNetworkType() {
- return getPhoneTypeFromNetworkType(getDefaultSubscription());
+ return getPhoneTypeFromNetworkType(getDefaultPhone());
}
/** {@hide} */
- private int getPhoneTypeFromNetworkType(long subId) {
+ private int getPhoneTypeFromNetworkType(int phoneId) {
// When the system property CURRENT_ACTIVE_PHONE, has not been set,
// use the system property for default network type.
// This is a fail safe, and can only happen at first boot.
- String mode = getTelephonyProperty("ro.telephony.default_network", subId, null);
+ String mode = getTelephonyProperty(phoneId, "ro.telephony.default_network", null);
if (mode != null) {
return TelephonyManager.getPhoneType(Integer.parseInt(mode));
}
@@ -1001,9 +1023,8 @@
*/
/** {@hide} */
public String getNetworkOperatorName(long subId) {
-
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ALPHA, "");
}
/**
@@ -1029,9 +1050,8 @@
*/
/** {@hide} */
public String getNetworkOperator(long subId) {
-
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
}
/**
@@ -1054,8 +1074,9 @@
*/
/** {@hide} */
public boolean isNetworkRoaming(long subId) {
- return "true".equals(getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
- subId, null));
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return Boolean.parseBoolean(getTelephonyProperty(phoneId,
+ TelephonyProperties.PROPERTY_OPERATOR_ISROAMING, null));
}
/**
@@ -1082,8 +1103,8 @@
*/
/** {@hide} */
public String getNetworkCountryIso(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
}
/** Network type is unknown */
@@ -1442,13 +1463,13 @@
// FIXME the argument to pass is subId ??
public int getSimState(int slotId) {
long[] subId = SubscriptionManager.getSubId(slotId);
- if (subId == null) {
+ if (subId == null || subId.length == 0) {
return SIM_STATE_ABSENT;
}
// FIXME Do not use a property to determine SIM_STATE, call
// appropriate method on some object.
- String prop =
- getTelephonyProperty(TelephonyProperties.PROPERTY_SIM_STATE, subId[0], "");
+ int phoneId = SubscriptionManager.getPhoneId(subId[0]);
+ String prop = getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_SIM_STATE, "");
if ("ABSENT".equals(prop)) {
return SIM_STATE_ABSENT;
}
@@ -1498,8 +1519,9 @@
*/
/** {@hide} */
public String getSimOperator(long subId) {
- String operator = getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ String operator = getTelephonyProperty(phoneId,
+ TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "");
Rlog.d(TAG, "getSimOperator: subId=" + subId + " operator=" + operator);
return operator;
}
@@ -1526,8 +1548,8 @@
*/
/** {@hide} */
public String getSimOperatorName(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA, "");
}
/**
@@ -1544,8 +1566,9 @@
*/
/** {@hide} */
public String getSimCountryIso(long subId) {
- return getTelephonyProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
- subId, "");
+ int phoneId = SubscriptionManager.getPhoneId(subId);
+ return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
+ "");
}
/**
@@ -2025,6 +2048,9 @@
}
}
+ /**
+ * @hide
+ */
private IPhoneSubInfo getSubscriberInfo() {
// get it each time because that process crashes a lot
return IPhoneSubInfo.Stub.asInterface(ServiceManager.getService("iphonesubinfo"));
@@ -2138,10 +2164,16 @@
}
}
+ /**
+ * @hide
+ */
private ITelephony getITelephony() {
return ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
}
+ /**
+ * @hide
+ */
private ITelecommService getTelecommService() {
return ITelecommService.Stub.asInterface(ServiceManager.getService(TELECOMM_SERVICE_NAME));
}
@@ -2629,10 +2661,16 @@
return SubscriptionManager.getDefaultSubId();
}
+ /**
+ * Returns Default phone.
+ */
+ private static int getDefaultPhone() {
+ return SubscriptionManager.getPhoneId(SubscriptionManager.getDefaultSubId());
+ }
+
/** {@hide} */
public int getDefaultSim() {
- //TODO Need to get it from Telephony Devcontroller
- return 0;
+ return SubscriptionManager.getSlotId(SubscriptionManager.getDefaultSubId());
}
/**
@@ -2640,11 +2678,12 @@
*
* @hide
*/
- public static void setTelephonyProperty(String property, long subId, String value) {
+ public static void setTelephonyProperty(int phoneId, String property, String value) {
+ Rlog.d(TAG, "setTelephonyProperty property: " + property + " phoneId: " + phoneId +
+ " value: " + value);
String propVal = "";
String p[] = null;
String prop = SystemProperties.get(property);
- int phoneId = SubscriptionManager.getPhoneId(subId);
if (value == null) {
value = "";
@@ -2654,7 +2693,10 @@
p = prop.split(",");
}
- if (phoneId < 0) return;
+ if (!SubscriptionManager.isValidPhoneId(phoneId)) {
+ Rlog.d(TAG, "setTelephonyProperty invalid phone id");
+ return;
+ }
for (int i = 0; i < phoneId; i++) {
String str = "";
@@ -2739,6 +2781,12 @@
String valArray[] = null;
String v = android.provider.Settings.Global.getString(cr, name);
+ if (index == Integer.MAX_VALUE) {
+ throw new RuntimeException("putIntAtIndex index == MAX_VALUE index=" + index);
+ }
+ if (index < 0) {
+ throw new RuntimeException("putIntAtIndex index < 0 index=" + index);
+ }
if (v != null) {
valArray = v.split(",");
}
@@ -2768,9 +2816,8 @@
*
* @hide
*/
- public static String getTelephonyProperty(String property, long subId, String defaultVal) {
+ public static String getTelephonyProperty(int phoneId, String property, String defaultVal) {
String propVal = null;
- int phoneId = SubscriptionManager.getPhoneId(subId);
String prop = SystemProperties.get(property);
if ((prop != null) && (prop.length() > 0)) {
String values[] = prop.split(",");
@@ -2784,10 +2831,10 @@
/** @hide */
public int getSimCount() {
if(isMultiSimEnabled()) {
- //TODO Need to get it from Telephony Devcontroller
+ //FIXME Need to get it from Telephony Devcontroller
return 2;
} else {
- return 1;
+ return 1;
}
}
diff --git a/telephony/java/com/android/internal/telephony/DcParamObject.java b/telephony/java/com/android/internal/telephony/DcParamObject.java
new file mode 100644
index 0000000..2736e6f
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/DcParamObject.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 MediaTek Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+import android.os.Parcelable;
+import android.os.Parcel;
+
+public class DcParamObject implements Parcelable {
+
+ private long mSubId;
+
+ public DcParamObject(long subId) {
+ mSubId = subId;
+ }
+
+ public DcParamObject(Parcel in) {
+ readFromParcel(in);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeLong(mSubId);
+ }
+
+ private void readFromParcel(Parcel in) {
+ mSubId = in.readLong();
+ }
+
+ public static final Parcelable.Creator<DcParamObject> CREATOR = new Parcelable.Creator<DcParamObject>() {
+ public DcParamObject createFromParcel(Parcel in) {
+ return new DcParamObject(in);
+ }
+ public DcParamObject[] newArray(int size) {
+ return new DcParamObject[size];
+ }
+ };
+
+ public long getSubId() {
+ return mSubId;
+ }
+}
diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java
index 7eef89a..defb43b 100644
--- a/telephony/java/com/android/internal/telephony/DctConstants.java
+++ b/telephony/java/com/android/internal/telephony/DctConstants.java
@@ -115,6 +115,7 @@
public static final int APN_EMERGENCY_ID = 9;
public static final int APN_NUM_TYPES = 10;
+ public static final int INVALID = -1;
public static final int DISABLED = 0;
public static final int ENABLED = 1;
diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
index 552abaf..d3a0849 100644
--- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
+++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl
@@ -45,6 +45,12 @@
String getDeviceSvn();
/**
+ * Retrieves the software version number of a subId for the device, e.g., IMEI/SV
+ * for GSM phones.
+ */
+ String getDeviceSvnUsingSubId(long subId);
+
+ /**
* Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones.
*/
String getSubscriberId();
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index 6021ccf..c0946e7 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -66,6 +66,13 @@
int getAllSubInfoCount();
/**
+ * Get the count of activated SUB(s)
+ * @param context Context provided by caller
+ * @return activated SIM count
+ */
+ int getActivatedSubInfoCount();
+
+ /**
* Add a new SubInfoRecord to subinfo database if needed
* @param context Context provided by caller
* @param iccId the IccId of the SIM card
@@ -109,7 +116,7 @@
* @param subId the unique SubInfoRecord index in database
* @return the number of records updated
*/
- int setDispalyNumber(String number, long subId);
+ int setDisplayNumber(String number, long subId);
/**
* Set number display format. 0: none, 1: the first four digits, 2: the last four digits
@@ -150,4 +157,12 @@
long getDefaultVoiceSubId();
void setDefaultVoiceSubId(long subId);
+
+ long getDefaultSmsSubId();
+
+ void setDefaultSmsSubId(long subId);
+
+ void clearDefaultsForInactiveSubIds();
+
+ long[] getActivatedSubIdList();
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 5c3dcdb..7f30277 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -79,6 +79,23 @@
void answerRingingCall();
/**
+ * Answer the currently-ringing call on particular subId .
+ *
+ * If there's already a current active call, that call will be
+ * automatically put on hold. If both lines are currently in use, the
+ * current active call will be ended.
+ *
+ * TODO: provide a flag to let the caller specify what policy to use
+ * if both lines are in use. (The current behavior is hardwired to
+ * "answer incoming, end ongoing", which is how the CALL button
+ * is specced to behave.)
+ *
+ * TODO: this should be a oneway call (especially since it's called
+ * directly from the key queue thread).
+ */
+ void answerRingingCallUsingSubId(long subId);
+
+ /**
* Silence the ringer if an incoming call is currently ringing.
* (If vibrating, stop the vibrator also.)
*
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index b4b1ea5..b8e8064 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -136,14 +136,6 @@
/** APN type for IA Emergency PDN */
public static final String APN_TYPE_EMERGENCY = "emergency";
- // FIXME: This looks to be used as default phoneId, rename
- // or use SubscriptionManager.DEFAULT_SUB_ID
- public static final int DEFAULT_SUBSCRIPTION = 0;
-
- // FIXME: This looks to be used as invalid phoneId, rename
- // or use SubscriptionManager.INVALID_SUB_ID
- public static final int INVALID_SUBSCRIPTION = -1;
-
public static final int RIL_CARD_MAX_APPS = 8;
public static final int DEFAULT_CARD_INDEX = 0;
@@ -154,19 +146,20 @@
public static final int MAX_PHONE_COUNT_TRI_SIM = 3;
- public static final String SUBSCRIPTION_KEY = "subscription";
+ public static final String PHONE_KEY = "phone";
public static final String SLOT_KEY = "slot";
+ // FIXME: This is used to pass a subId via intents, we need to look at its usage, which is
+ // FIXME: extensive, and see if this should be an array of all active subId's or ...?
+ public static final String SUBSCRIPTION_KEY = "subscription";
+
public static final String SUB_SETTING = "subSettings";
public static final int SUB1 = 0;
public static final int SUB2 = 1;
public static final int SUB3 = 2;
- public static final int EVENT_SUBSCRIPTION_ACTIVATED = 500;
- public static final int EVENT_SUBSCRIPTION_DEACTIVATED = 501;
-
// TODO: Remove these constants and use an int instead.
public static final int SIM_ID_1 = 0;
public static final int SIM_ID_2 = 1;
@@ -190,4 +183,7 @@
// Initial MTU value.
public static final int UNSET_MTU = 0;
+
+ //FIXME maybe this shouldn't be here - sprout only
+ public static final int CAPABILITY_3G = 1;
}
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index e730bde..4aaf99b 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -291,6 +291,8 @@
int RIL_REQUEST_SET_DC_RT_INFO_RATE = 127;
int RIL_REQUEST_SET_DATA_PROFILE = 128;
int RIL_REQUEST_SHUTDOWN = 129;
+ int RIL_REQUEST_GET_3G_CAPABILITY = 130;
+ int RIL_REQUEST_SET_3G_CAPABILITY = 131;
int RIL_UNSOL_RESPONSE_BASE = 1000;
int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index 85ceefd..dfa31c3 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -391,4 +391,29 @@
*/
public static final String ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED
= "android.intent.action.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED";
+
+ /**
+ * Broadcast Action: The default sms subscription has changed. This has the following
+ * extra values:</p>
+ * <ul>
+ * <li><em>subscription</em> - A int, the current sms default subscription.</li>
+ * </ul>
+ */
+ public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED
+ = "android.intent.action.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED";
+
+ /**
+ * To notify the capability switch procedure start
+ */
+ // FIXME maybe these should be removed - sprout only
+ public static final String ACTION_CAPABILITY_SWITCH_START
+ = "com.android.phone.ACTION_CAPABILITY_SWITCH_START";
+
+ /**
+ * To notify the capability switch procedure end
+ */
+ // FIXME maybe these should be removed - sprout only
+ public static final String ACTION_CAPABILITY_SWITCH_DONE
+ = "com.android.phone.ACTION_CAPABILITY_SWITCH_DONE";
+
}