summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
Diffstat (limited to 'telephony/java')
-rwxr-xr-xtelephony/java/android/telephony/SubscriptionInfo.aidl (renamed from telephony/java/android/telephony/SubInfoRecord.aidl)2
-rw-r--r--telephony/java/android/telephony/SubscriptionInfo.java (renamed from telephony/java/android/telephony/SubInfoRecord.java)18
-rw-r--r--telephony/java/android/telephony/SubscriptionListener.java125
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java211
-rwxr-xr-xtelephony/java/com/android/internal/telephony/ISub.aidl45
-rw-r--r--telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl24
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl4
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyIntents.java34
8 files changed, 310 insertions, 153 deletions
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/SubInfoRecord.java b/telephony/java/android/telephony/SubscriptionInfo.java
index 89a6bd4..26f17c8 100644
--- a/telephony/java/android/telephony/SubInfoRecord.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -31,7 +31,7 @@ import android.os.Parcelable;
/**
* A Parcelable class for Subscription Information.
*/
-public class SubInfoRecord implements Parcelable {
+public class SubscriptionInfo implements Parcelable {
/**
* Subscription Identifier, this is a device unique number
@@ -99,7 +99,7 @@ public class SubInfoRecord implements Parcelable {
/**
* @hide
*/
- public SubInfoRecord(int id, String iccId, int simSlotIndex, CharSequence displayName,
+ 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;
@@ -177,12 +177,12 @@ public class SubInfoRecord implements Parcelable {
}
/**
- * Creates and returns an icon {@code Bitmap} to represent this {@code SubInfoRecord} in a user
+ * 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 SubInfoRecord}.
+ * @return A bitmap icon for this {@code SubscriptionInfo}.
*/
public Bitmap createIconBitmap(Context context) {
int width = mIconBitmap.getWidth();
@@ -259,9 +259,9 @@ public class SubInfoRecord implements Parcelable {
return this.mMnc;
}
- public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() {
+ public static final Parcelable.Creator<SubscriptionInfo> CREATOR = new Parcelable.Creator<SubscriptionInfo>() {
@Override
- public SubInfoRecord createFromParcel(Parcel source) {
+ public SubscriptionInfo createFromParcel(Parcel source) {
int id = source.readInt();
String iccId = source.readString();
int simSlotIndex = source.readInt();
@@ -275,13 +275,13 @@ public class SubInfoRecord implements Parcelable {
int mnc = source.readInt();
Bitmap iconBitmap = Bitmap.CREATOR.createFromParcel(source);
- return new SubInfoRecord(id, iccId, simSlotIndex, displayName, carrierName, nameSource,
+ return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName, nameSource,
iconTint, number, dataRoaming, iconBitmap, mcc, mnc);
}
@Override
- public SubInfoRecord[] newArray(int size) {
- return new SubInfoRecord[size];
+ public SubscriptionInfo[] newArray(int size) {
+ return new SubscriptionInfo[size];
}
};
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 21d225d..78ab6870 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -18,6 +18,7 @@ package android.telephony;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.BaseColumns;
@@ -26,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;
@@ -43,28 +45,29 @@ public class SubscriptionManager implements BaseColumns {
private static final boolean DBG = true;
private static final boolean VDBG = false;
+ /** An invalid subscription identifier */
+ public static final int INVALID_SUB_ID = -1000;
+
/** An invalid phone identifier */
- public static final int INVALID_PHONE_ID = -1000;
+ /** @hide */
+ public static final int INVALID_PHONE_ID = -1;
+
+ /** An invalid slot identifier */
+ /** @hide */
+ public static final int INVALID_SLOT_ID = -1;
+
+ /** Indicates the caller wants the default sub id. */
+ /** @hide */
+ public static final int DEFAULT_SUB_ID = Integer.MAX_VALUE;
/** Indicates the caller wants the default phone id. */
+ /** @hide */
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. */
/** @hide */
public static final int DEFAULT_SLOT_ID = Integer.MAX_VALUE;
- /** Indicates the user should be asked which subscription to use. */
- public static final int ASK_USER_SUB_ID = -1001;
-
- /** An invalid subscription identifier */
- public static final int INVALID_SUB_ID = -1000;
-
- /** Indicates the caller wants the default sub id. */
- public static final int DEFAULT_SUB_ID = Integer.MAX_VALUE;
-
/** Minimum possible subid that represents a subscription */
/** @hide */
public static final int MIN_SUB_ID_VALUE = 0;
@@ -77,31 +80,6 @@ public class SubscriptionManager implements BaseColumns {
/** @hide */
public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo");
- /** @hide */
- public static final int DEFAULT_INT_VALUE = -100;
-
- /** @hide */
- public static final String DEFAULT_STRING_VALUE = "N/A";
-
- /** @hide */
- public static final int EXTRA_VALUE_NEW_SIM = 1;
-
- /** @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;
-
- /** @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";
-
/**
* The ICC ID of a SIM.
* <P>Type: TEXT (String)</P>
@@ -116,6 +94,7 @@ public class SubscriptionManager implements BaseColumns {
public static final String SIM_ID = "sim_id";
/** SIM is not inserted */
+ /** @hide */
public static final int SIM_NOT_INSERTED = -1;
/**
@@ -237,12 +216,14 @@ 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";
@@ -261,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 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 SubInfoRecord getSubInfoForSubscriber(int subId) {
+ 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"));
@@ -287,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"));
@@ -312,24 +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
*/
- 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"));
@@ -342,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"));
@@ -368,17 +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
*/
- 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"));
@@ -390,7 +424,7 @@ public class SubscriptionManager implements BaseColumns {
}
if (result == null) {
- result = new ArrayList<SubInfoRecord>();
+ result = new ArrayList<SubscriptionInfo>();
}
return result;
}
@@ -400,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;
@@ -422,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 {
@@ -438,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 {
@@ -500,7 +534,7 @@ 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
*/
@@ -511,7 +545,7 @@ public class SubscriptionManager implements BaseColumns {
/**
* 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
@@ -545,7 +579,7 @@ 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
*/
@@ -573,7 +607,7 @@ public class SubscriptionManager implements BaseColumns {
/**
* 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
*/
@@ -602,6 +636,7 @@ 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
*/
public static int getSlotId(int subId) {
if (!isValidSubId(subId)) {
@@ -724,8 +759,8 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static SubInfoRecord getDefaultVoiceSubInfo() {
- return getSubInfoForSubscriber(getDefaultVoiceSubId());
+ public static SubscriptionInfo getDefaultVoiceSubscriptionInfo() {
+ return getSubscriptionInfoForSubscriber(getDefaultVoiceSubId());
}
/** @hide */
@@ -735,6 +770,7 @@ public class SubscriptionManager implements BaseColumns {
/**
* @return subId of the DefaultSms subscription or the value INVALID_SUB_ID if an error.
+ * @hide
*/
public static int getDefaultSmsSubId() {
int subId = INVALID_SUB_ID;
@@ -766,8 +802,8 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static SubInfoRecord getDefaultSmsSubInfo() {
- return getSubInfoForSubscriber(getDefaultSmsSubId());
+ public static SubscriptionInfo getDefaultSmsSubscriptionInfo() {
+ return getSubscriptionInfoForSubscriber(getDefaultSmsSubId());
}
/** @hide */
@@ -806,8 +842,8 @@ public class SubscriptionManager implements BaseColumns {
}
/** @hide */
- public static SubInfoRecord getDefaultDataSubInfo() {
- return getSubInfoForSubscriber(getDefaultDataSubId());
+ public static SubscriptionInfo getDefaultDataSubscriptionInfo() {
+ return getSubscriptionInfoForSubscriber(getDefaultDataSubId());
}
/** @hide */
@@ -816,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) {
@@ -863,6 +899,7 @@ public class SubscriptionManager implements BaseColumns {
/**
* @return true if a valid subId else false
+ * @hide
*/
public static boolean isValidSubId(int subId) {
return subId > INVALID_SUB_ID ;
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index 829620a..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(int 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
@@ -76,7 +77,7 @@ interface ISub {
/**
* Set SIM icon tint color by simInfo index
* @param tint the icon tint color 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 setIconTint(int tint, int subId);
@@ -84,7 +85,7 @@ interface ISub {
/**
* 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, int subId);
@@ -92,7 +93,7 @@ interface ISub {
/**
* 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
*/
@@ -101,7 +102,7 @@ interface ISub {
/**
* 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, int subId);
@@ -109,7 +110,7 @@ interface ISub {
/**
* 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, int subId);
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/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index ee3f8b0..1a1f8fe 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -27,8 +27,11 @@ 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 int subId, String pkg, IPhoneStateListener callback, int events,
boolean notifyNow);
@@ -63,4 +66,5 @@ interface ITelephonyRegistry {
void notifyDataConnectionRealTimeInfo(in DataConnectionRealTimeInfo dcRtInfo);
void notifyVoLteServiceStateChanged(in VoLteServiceState lteState);
void notifyOemHookRawEventForSubscriber(in int subId, in byte[] rawData);
+ void notifySubscriptionInfoChanged();
}
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>