@Implements(value=android.telephony.SubscriptionManager.class, minSdk=22) public class ShadowSubscriptionManager extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
ShadowSubscriptionManager.SubscriptionInfoBuilder |
Builder class to create instance of
SubscriptionInfo . |
Modifier and Type | Field | Description |
---|---|---|
static int |
INVALID_PHONE_INDEX |
Constructor | Description |
---|---|
ShadowSubscriptionManager() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
addOnSubscriptionsChangedListener(SubscriptionManager.OnSubscriptionsChangedListener listener) |
Adds a listener to a local list of listeners.
|
void |
clearNetworkRoamingStatus() |
Clears the local cache of roaming subscription Ids used by
isNetworkRoaming(int) . |
static void |
clearPhoneIds() |
Removes all mappings between subscription IDs and phone IDs from the map used by
getPhoneId(int) . |
protected int[] |
getActiveSubscriptionIdList() |
Returns subscription Ids that were set via
setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>) . |
protected SubscriptionInfo |
getActiveSubscriptionInfo(int subId) |
Returns subscription that were set via
setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>) if it can find
one with the specified id or null if none found. |
protected int |
getActiveSubscriptionInfoCount() |
Returns the size of the list of
SubscriptionInfo that were set via setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>) . |
protected int |
getActiveSubscriptionInfoCountMax() |
|
protected SubscriptionInfo |
getActiveSubscriptionInfoForSimSlotIndex(int slotIndex) |
Returns subscription that were set via
setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>) if it can find
one with the specified slot index or null if none found. |
protected List<SubscriptionInfo> |
getActiveSubscriptionInfoList() |
Returns the active list of
SubscriptionInfo that were set via setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>) . |
protected List<SubscriptionInfo> |
getAvailableSubscriptionInfoList() |
Returns the available list of
SubscriptionInfo that were set via setAvailableSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>) . |
protected static int |
getDefaultDataSubId() |
|
protected static int |
getDefaultDataSubscriptionId() |
Returns value set with
setDefaultDataSubscriptionId(int) . |
protected static int |
getDefaultSmsSubId() |
|
protected static int |
getDefaultSmsSubscriptionId() |
Returns value set with
setDefaultSmsSubscriptionId(int) . |
protected static int |
getDefaultSubId() |
|
protected static int |
getDefaultSubscriptionId() |
Returns value set with
setDefaultSubscriptionId(int) . |
protected static int |
getDefaultVoiceSubId() |
|
protected static int |
getDefaultVoiceSubscriptionId() |
Returns value set with
setDefaultVoiceSubscriptionId(int) . |
protected static int |
getPhoneId(int subId) |
Uses the map of subscription IDs to phone IDs managed by
putPhoneId(int,int) and removePhoneId(int) to return the phone ID for a given subscription ID. |
protected boolean |
isNetworkRoaming(int simSubscriptionId) |
Uses the local cache of roaming sim subscription Ids managed by
setNetworkRoamingStatus(int, boolean) to return subscription Ids marked as roaming. |
static void |
putPhoneId(int subId,
int phoneId) |
Adds a subscription ID-phone ID mapping to the map used by
getPhoneId(int) . |
protected void |
removeOnSubscriptionsChangedListener(SubscriptionManager.OnSubscriptionsChangedListener listener) |
Removes a listener from a local list of listeners.
|
static Integer |
removePhoneId(int subId) |
Removes a subscription ID-phone ID mapping from the map used by
getPhoneId(int) . |
static void |
reset() |
|
void |
setActiveSubscriptionInfoList(List<SubscriptionInfo> list) |
Sets the active list of
SubscriptionInfo . |
void |
setActiveSubscriptionInfos(SubscriptionInfo... infos) |
Sets the active list of
SubscriptionInfo . |
void |
setAvailableSubscriptionInfoList(List<SubscriptionInfo> list) |
Sets the active list of
SubscriptionInfo . |
void |
setAvailableSubscriptionInfos(SubscriptionInfo... infos) |
Sets the active list of
SubscriptionInfo . |
static void |
setDefaultDataSubscriptionId(int defaultDataSubscriptionId) |
|
static void |
setDefaultSmsSubscriptionId(int defaultSmsSubscriptionId) |
|
static void |
setDefaultSubscriptionId(int defaultSubscriptionId) |
Sets the value that will be returned by
getDefaultSubscriptionId() . |
static void |
setDefaultVoiceSubscriptionId(int defaultVoiceSubscriptionId) |
|
void |
setNetworkRoamingStatus(int simSubscriptionId,
boolean isNetworkRoaming) |
If isNetworkRoaming is set, it will mark the provided sim subscriptionId as roaming in a local
cache.
|
@Implementation(minSdk=24) protected static int getDefaultSubscriptionId()
setDefaultSubscriptionId(int)
.@Implementation(minSdk=24) protected static int getDefaultDataSubscriptionId()
setDefaultDataSubscriptionId(int)
.@Implementation(minSdk=24) protected static int getDefaultSmsSubscriptionId()
setDefaultSmsSubscriptionId(int)
.@Implementation(minSdk=24) protected static int getDefaultVoiceSubscriptionId()
setDefaultVoiceSubscriptionId(int)
.@Implementation(maxSdk=23) @HiddenApi protected static int getDefaultSubId()
@Implementation(maxSdk=23) @HiddenApi protected static int getDefaultVoiceSubId()
@Implementation(maxSdk=23) @HiddenApi protected static int getDefaultSmsSubId()
@Implementation(maxSdk=23) @HiddenApi protected static int getDefaultDataSubId()
public static void setDefaultSubscriptionId(int defaultSubscriptionId)
getDefaultSubscriptionId()
.public static void setDefaultDataSubscriptionId(int defaultDataSubscriptionId)
public static void setDefaultSmsSubscriptionId(int defaultSmsSubscriptionId)
public static void setDefaultVoiceSubscriptionId(int defaultVoiceSubscriptionId)
@Implementation(minSdk=22) protected List<SubscriptionInfo> getActiveSubscriptionInfoList()
SubscriptionInfo
that were set via setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>)
.@Implementation(minSdk=27) protected List<SubscriptionInfo> getAvailableSubscriptionInfoList()
SubscriptionInfo
that were set via setAvailableSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>)
.@Implementation(minSdk=22) protected int getActiveSubscriptionInfoCount()
SubscriptionInfo
that were set via setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>)
. If no list was set, returns 0.@Implementation(minSdk=22) protected SubscriptionInfo getActiveSubscriptionInfo(int subId)
setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>)
if it can find
one with the specified id or null if none found.@Implementation(minSdk=22) protected int getActiveSubscriptionInfoCountMax()
getActiveSubscriptionInfoList()
and the value returned by getActiveSubscriptionInfoCount()
.@Implementation(minSdk=24) protected SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex)
setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>)
if it can find
one with the specified slot index or null if none found.public void setActiveSubscriptionInfoList(List<SubscriptionInfo> list)
SubscriptionInfo
. This call internally triggers SubscriptionManager.OnSubscriptionsChangedListener.onSubscriptionsChanged()
to all the listeners.list
- - The subscription info list, can be null.public void setAvailableSubscriptionInfoList(List<SubscriptionInfo> list)
SubscriptionInfo
. This call internally triggers SubscriptionManager.OnSubscriptionsChangedListener.onSubscriptionsChanged()
to all the listeners.list
- - The subscription info list, can be null.public void setActiveSubscriptionInfos(SubscriptionInfo... infos)
SubscriptionInfo
. This call internally triggers SubscriptionManager.OnSubscriptionsChangedListener.onSubscriptionsChanged()
to all the listeners.public void setAvailableSubscriptionInfos(SubscriptionInfo... infos)
SubscriptionInfo
. This call internally triggers SubscriptionManager.OnSubscriptionsChangedListener.onSubscriptionsChanged()
to all the listeners.@Implementation(minSdk=22) protected void addOnSubscriptionsChangedListener(SubscriptionManager.OnSubscriptionsChangedListener listener)
setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>)
when the local list of SubscriptionInfo
is updated.@Implementation(minSdk=22) protected void removeOnSubscriptionsChangedListener(SubscriptionManager.OnSubscriptionsChangedListener listener)
setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>)
when the local list of SubscriptionInfo
is updated.@Implementation(minSdk=22) @HiddenApi protected int[] getActiveSubscriptionIdList()
setActiveSubscriptionInfoList(java.util.List<android.telephony.SubscriptionInfo>)
.public void clearNetworkRoamingStatus()
isNetworkRoaming(int)
.public void setNetworkRoamingStatus(int simSubscriptionId, boolean isNetworkRoaming)
isNetworkRoaming(int)
.@Implementation(minSdk=22) protected boolean isNetworkRoaming(int simSubscriptionId)
setNetworkRoamingStatus(int, boolean)
to return subscription Ids marked as roaming. Otherwise subscription
Ids will be considered as non-roaming if they are not in the cache.public static void putPhoneId(int subId, int phoneId)
getPhoneId(int)
.public static Integer removePhoneId(int subId)
getPhoneId(int)
.public static void clearPhoneIds()
getPhoneId(int)
.@Implementation(minSdk=22, maxSdk=28) @HiddenApi protected static int getPhoneId(int subId)
putPhoneId(int,int)
and removePhoneId(int)
to return the phone ID for a given subscription ID.@Resetter public static void reset()