Merge "Improve AllowedNetworkTypesForReason and refactor PreferredNetworkType"
This commit is contained in:
@@ -39099,6 +39099,9 @@ package android.telephony {
|
|||||||
method public static boolean isConfigForIdentifiedCarrier(android.os.PersistableBundle);
|
method public static boolean isConfigForIdentifiedCarrier(android.os.PersistableBundle);
|
||||||
method public void notifyConfigChangedForSubId(int);
|
method public void notifyConfigChangedForSubId(int);
|
||||||
field public static final String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
|
field public static final String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
|
||||||
|
field public static final int CARRIER_NR_AVAILABILITY_NONE = 0; // 0x0
|
||||||
|
field public static final int CARRIER_NR_AVAILABILITY_NSA = 1; // 0x1
|
||||||
|
field public static final int CARRIER_NR_AVAILABILITY_SA = 2; // 0x2
|
||||||
field public static final int DATA_CYCLE_THRESHOLD_DISABLED = -2; // 0xfffffffe
|
field public static final int DATA_CYCLE_THRESHOLD_DISABLED = -2; // 0xfffffffe
|
||||||
field public static final int DATA_CYCLE_USE_PLATFORM_DEFAULT = -1; // 0xffffffff
|
field public static final int DATA_CYCLE_USE_PLATFORM_DEFAULT = -1; // 0xffffffff
|
||||||
field public static final String ENABLE_EAP_METHOD_PREFIX_BOOL = "enable_eap_method_prefix_bool";
|
field public static final String ENABLE_EAP_METHOD_PREFIX_BOOL = "enable_eap_method_prefix_bool";
|
||||||
@@ -39157,6 +39160,7 @@ package android.telephony {
|
|||||||
field public static final String KEY_CARRIER_INSTANT_LETTERING_LENGTH_LIMIT_INT = "carrier_instant_lettering_length_limit_int";
|
field public static final String KEY_CARRIER_INSTANT_LETTERING_LENGTH_LIMIT_INT = "carrier_instant_lettering_length_limit_int";
|
||||||
field public static final String KEY_CARRIER_NAME_OVERRIDE_BOOL = "carrier_name_override_bool";
|
field public static final String KEY_CARRIER_NAME_OVERRIDE_BOOL = "carrier_name_override_bool";
|
||||||
field public static final String KEY_CARRIER_NAME_STRING = "carrier_name_string";
|
field public static final String KEY_CARRIER_NAME_STRING = "carrier_name_string";
|
||||||
|
field public static final String KEY_CARRIER_NR_AVAILABILITY_INT = "carrier_nr_availability_int";
|
||||||
field public static final String KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL = "carrier_rcs_provisioning_required_bool";
|
field public static final String KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL = "carrier_rcs_provisioning_required_bool";
|
||||||
field public static final String KEY_CARRIER_SETTINGS_ACTIVITY_COMPONENT_NAME_STRING = "carrier_settings_activity_component_name_string";
|
field public static final String KEY_CARRIER_SETTINGS_ACTIVITY_COMPONENT_NAME_STRING = "carrier_settings_activity_component_name_string";
|
||||||
field public static final String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool";
|
field public static final String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool";
|
||||||
|
|||||||
@@ -9638,6 +9638,7 @@ package android.telephony {
|
|||||||
method public void onSrvccStateChanged(int);
|
method public void onSrvccStateChanged(int);
|
||||||
method public void onVoiceActivationStateChanged(int);
|
method public void onVoiceActivationStateChanged(int);
|
||||||
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED = 23; // 0x17
|
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED = 23; // 0x17
|
||||||
|
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int EVENT_ALLOWED_NETWORK_TYPE_LIST_CHANGED = 35; // 0x23
|
||||||
field @RequiresPermission("android.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH") public static final int EVENT_ALWAYS_REPORTED_SIGNAL_STRENGTH_CHANGED = 10; // 0xa
|
field @RequiresPermission("android.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH") public static final int EVENT_ALWAYS_REPORTED_SIGNAL_STRENGTH_CHANGED = 10; // 0xa
|
||||||
field @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static final int EVENT_BARRING_INFO_CHANGED = 32; // 0x20
|
field @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static final int EVENT_BARRING_INFO_CHANGED = 32; // 0x20
|
||||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_CALL_ATTRIBUTES_CHANGED = 27; // 0x1b
|
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_CALL_ATTRIBUTES_CHANGED = 27; // 0x1b
|
||||||
@@ -9680,6 +9681,10 @@ package android.telephony {
|
|||||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int LISTEN_VOICE_ACTIVATION_STATE = 131072; // 0x20000
|
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int LISTEN_VOICE_ACTIVATION_STATE = 131072; // 0x20000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static interface PhoneStateListener.AllowedNetworkTypesChangedListener {
|
||||||
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void onAllowedNetworkTypesChanged(@NonNull java.util.Map<java.lang.Integer,java.lang.Long>);
|
||||||
|
}
|
||||||
|
|
||||||
public static interface PhoneStateListener.CallAttributesChangedListener {
|
public static interface PhoneStateListener.CallAttributesChangedListener {
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onCallAttributesChanged(@NonNull android.telephony.CallAttributes);
|
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onCallAttributesChanged(@NonNull android.telephony.CallAttributes);
|
||||||
}
|
}
|
||||||
@@ -10082,7 +10087,9 @@ package android.telephony {
|
|||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enableVideoCalling(boolean);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enableVideoCalling(boolean);
|
||||||
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int);
|
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int);
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypes();
|
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypes();
|
||||||
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypesBitmask();
|
||||||
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypesForReason(int);
|
||||||
method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.ComponentName getAndUpdateDefaultRespondViaMessageApplication();
|
method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.ComponentName getAndUpdateDefaultRespondViaMessageApplication();
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallForwarding(int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CallForwardingInfoCallback);
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallForwarding(int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CallForwardingInfoCallback);
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallWaitingStatus(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallWaitingStatus(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
|
||||||
@@ -10116,7 +10123,7 @@ package android.telephony {
|
|||||||
method public int getMaxNumberOfSimultaneouslyActiveSims();
|
method public int getMaxNumberOfSimultaneouslyActiveSims();
|
||||||
method public static long getMaxNumberVerificationTimeoutMillis();
|
method public static long getMaxNumberVerificationTimeoutMillis();
|
||||||
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String[] getMergedImsisFromGroup();
|
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String[] getMergedImsisFromGroup();
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
|
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
|
||||||
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
|
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
|
||||||
method public int getSimApplicationState();
|
method public int getSimApplicationState();
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSimApplicationState(int);
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSimApplicationState(int);
|
||||||
@@ -10171,7 +10178,8 @@ package android.telephony {
|
|||||||
method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void resetSettings();
|
method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void resetSettings();
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int sendThermalMitigationRequest(@NonNull android.telephony.ThermalMitigationRequest);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int sendThermalMitigationRequest(@NonNull android.telephony.ThermalMitigationRequest);
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long);
|
||||||
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setAllowedNetworkTypesForReason(int, long);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallForwarding(@NonNull android.telephony.CallForwardingInfo, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallForwarding(@NonNull android.telephony.CallForwardingInfo, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean);
|
||||||
@@ -10186,7 +10194,7 @@ package android.telephony {
|
|||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean);
|
||||||
method public int setNrDualConnectivityState(int);
|
method public int setNrDualConnectivityState(int);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunisticNetworkState(boolean);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunisticNetworkState(boolean);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRadioEnabled(boolean);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRadioEnabled(boolean);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);
|
||||||
@@ -10220,6 +10228,9 @@ package android.telephony {
|
|||||||
field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED";
|
field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED";
|
||||||
field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED";
|
field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED";
|
||||||
field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED";
|
field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED";
|
||||||
|
field public static final int ALLOWED_NETWORK_TYPES_REASON_CARRIER = 2; // 0x2
|
||||||
|
field public static final int ALLOWED_NETWORK_TYPES_REASON_POWER = 1; // 0x1
|
||||||
|
field public static final int ALLOWED_NETWORK_TYPES_REASON_USER = 0; // 0x0
|
||||||
field public static final int CALL_WAITING_STATUS_DISABLED = 2; // 0x2
|
field public static final int CALL_WAITING_STATUS_DISABLED = 2; // 0x2
|
||||||
field public static final int CALL_WAITING_STATUS_ENABLED = 1; // 0x1
|
field public static final int CALL_WAITING_STATUS_ENABLED = 1; // 0x1
|
||||||
field public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; // 0x4
|
field public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; // 0x4
|
||||||
|
|||||||
@@ -5279,6 +5279,19 @@ public final class Telephony {
|
|||||||
*/
|
*/
|
||||||
public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types";
|
public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TelephonyProvider column name for allowed network types with all of reasons. Indicate
|
||||||
|
* which network types are allowed for
|
||||||
|
* {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER},
|
||||||
|
* {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_POWER},
|
||||||
|
* {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER}.
|
||||||
|
* <P>Type: TEXT </P>
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS =
|
||||||
|
"allowed_network_types_for_reasons";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TelephonyProvider column name for RCS configuration.
|
* TelephonyProvider column name for RCS configuration.
|
||||||
* <p>TYPE: BLOB
|
* <p>TYPE: BLOB
|
||||||
|
|||||||
@@ -1020,6 +1020,19 @@ public class PhoneStateListener {
|
|||||||
@RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE)
|
||||||
public static final int EVENT_DATA_ENABLED_CHANGED = 34;
|
public static final int EVENT_DATA_ENABLED_CHANGED = 34;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event for changes to allowed network list based on all active subscriptions.
|
||||||
|
*
|
||||||
|
* <p>Requires permission {@link android.Manifest.permission#READ_PHONE_STATE} or the calling
|
||||||
|
* app has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}).
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
* @see AllowedNetworkTypesChangedListener#onAllowedNetworkTypesChanged
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
|
public static final int EVENT_ALLOWED_NETWORK_TYPE_LIST_CHANGED = 35;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@IntDef(prefix = { "EVENT_" }, value = {
|
@IntDef(prefix = { "EVENT_" }, value = {
|
||||||
EVENT_SERVICE_STATE_CHANGED,
|
EVENT_SERVICE_STATE_CHANGED,
|
||||||
@@ -1055,7 +1068,8 @@ public class PhoneStateListener {
|
|||||||
EVENT_REGISTRATION_FAILURE,
|
EVENT_REGISTRATION_FAILURE,
|
||||||
EVENT_BARRING_INFO_CHANGED,
|
EVENT_BARRING_INFO_CHANGED,
|
||||||
EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED,
|
EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED,
|
||||||
EVENT_DATA_ENABLED_CHANGED
|
EVENT_DATA_ENABLED_CHANGED,
|
||||||
|
EVENT_ALLOWED_NETWORK_TYPE_LIST_CHANGED
|
||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface TelephonyEvent {}
|
public @interface TelephonyEvent {}
|
||||||
@@ -1802,6 +1816,41 @@ public class PhoneStateListener {
|
|||||||
int causeCode, int additionalCauseCode);
|
int causeCode, int additionalCauseCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for the current allowed network type list listener. This list involves values of
|
||||||
|
* allowed network type for each of reasons.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public interface AllowedNetworkTypesChangedListener {
|
||||||
|
/**
|
||||||
|
* Callback invoked when the current allowed network type list has changed on the
|
||||||
|
* registered subscription.
|
||||||
|
* Note, the registered subscription is associated with {@link TelephonyManager} object
|
||||||
|
* on which
|
||||||
|
* {@link TelephonyManager#registerPhoneStateListener(Executor, PhoneStateListener)}
|
||||||
|
* was called.
|
||||||
|
* If this TelephonyManager object was created with
|
||||||
|
* {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the
|
||||||
|
* given subscription ID. Otherwise, this callback applies to
|
||||||
|
* {@link SubscriptionManager#getDefaultSubscriptionId()}.
|
||||||
|
*
|
||||||
|
* @param allowedNetworkTypesList Map associating all allowed network type reasons
|
||||||
|
* ({@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER},
|
||||||
|
* {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_POWER}, and
|
||||||
|
* {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER}) with reason's allowed
|
||||||
|
* network type values.
|
||||||
|
* For example:
|
||||||
|
* map{{TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER, long type value},
|
||||||
|
* {TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_POWER, long type value},
|
||||||
|
* {TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER, long type value}}
|
||||||
|
*/
|
||||||
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
|
void onAllowedNetworkTypesChanged(
|
||||||
|
@NonNull Map<Integer, Long> allowedNetworkTypesList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for call attributes listener.
|
* Interface for call attributes listener.
|
||||||
*
|
*
|
||||||
@@ -2811,6 +2860,16 @@ public class PhoneStateListener {
|
|||||||
() -> mExecutor.execute(() -> listener.onDataEnabledChanged(
|
() -> mExecutor.execute(() -> listener.onDataEnabledChanged(
|
||||||
enabled, reason)));
|
enabled, reason)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onAllowedNetworkTypesChanged(Map allowedNetworkTypesList) {
|
||||||
|
AllowedNetworkTypesChangedListener listener =
|
||||||
|
(AllowedNetworkTypesChangedListener) mPhoneStateListenerWeakRef.get();
|
||||||
|
if (listener == null) return;
|
||||||
|
|
||||||
|
Binder.withCleanCallingIdentity(
|
||||||
|
() -> mExecutor.execute(
|
||||||
|
() -> listener.onAllowedNetworkTypesChanged(allowedNetworkTypesList)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void log(String s) {
|
private void log(String s) {
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ import android.compat.annotation.EnabledAfter;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.HandlerExecutor;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.telephony.Annotation.CallState;
|
import android.telephony.Annotation.CallState;
|
||||||
@@ -802,6 +799,22 @@ public class TelephonyRegistryManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify emergency number list changed on certain subscription.
|
||||||
|
*
|
||||||
|
* @param subId for which emergency number list changed.
|
||||||
|
* @param slotIndex for which emergency number list changed. Can be derived from subId except
|
||||||
|
* when subId is invalid.
|
||||||
|
*/
|
||||||
|
public void notifyAllowedNetworkTypesChanged(int subId, int slotIndex,
|
||||||
|
Map<Integer, Long> allowedNetworkTypeList) {
|
||||||
|
try {
|
||||||
|
sRegistry.notifyAllowedNetworkTypesChanged(slotIndex, subId, allowedNetworkTypeList);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
// system process is dead
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public @NonNull Set<Integer> getEventsFromListener(@NonNull PhoneStateListener listener) {
|
public @NonNull Set<Integer> getEventsFromListener(@NonNull PhoneStateListener listener) {
|
||||||
|
|
||||||
Set<Integer> eventList = new ArraySet<>();
|
Set<Integer> eventList = new ArraySet<>();
|
||||||
@@ -930,6 +943,10 @@ public class TelephonyRegistryManager {
|
|||||||
eventList.add(PhoneStateListener.EVENT_DATA_ENABLED_CHANGED);
|
eventList.add(PhoneStateListener.EVENT_DATA_ENABLED_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (listener instanceof PhoneStateListener.AllowedNetworkTypesChangedListener) {
|
||||||
|
eventList.add(PhoneStateListener.EVENT_ALLOWED_NETWORK_TYPE_LIST_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
return eventList;
|
return eventList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,4 +71,5 @@ oneway interface IPhoneStateListener {
|
|||||||
void onBarringInfoChanged(in BarringInfo barringInfo);
|
void onBarringInfoChanged(in BarringInfo barringInfo);
|
||||||
void onPhysicalChannelConfigChanged(in List<PhysicalChannelConfig> configs);
|
void onPhysicalChannelConfigChanged(in List<PhysicalChannelConfig> configs);
|
||||||
void onDataEnabledChanged(boolean enabled, int reason);
|
void onDataEnabledChanged(boolean enabled, int reason);
|
||||||
|
void onAllowedNetworkTypesChanged(in Map allowedNetworkTypeList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,4 +94,5 @@ interface ITelephonyRegistry {
|
|||||||
void notifyPhysicalChannelConfigForSubscriber(in int subId,
|
void notifyPhysicalChannelConfigForSubscriber(in int subId,
|
||||||
in List<PhysicalChannelConfig> configs);
|
in List<PhysicalChannelConfig> configs);
|
||||||
void notifyDataEnabled(in int phoneId, int subId, boolean enabled, int reason);
|
void notifyDataEnabled(in int phoneId, int subId, boolean enabled, int reason);
|
||||||
|
void notifyAllowedNetworkTypesChanged(in int phoneId, in int subId, in Map allowedNetworkTypeList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -317,6 +317,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
|
|
||||||
private int[] mDataEnabledReason;
|
private int[] mDataEnabledReason;
|
||||||
|
|
||||||
|
private Map<Integer, Long> mAllowedNetworkTypesList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Per-phone map of precise data connection state. The key of the map is the pair of transport
|
* Per-phone map of precise data connection state. The key of the map is the pair of transport
|
||||||
* type and APN setting. This is the cache to prevent redundant callbacks to the listeners.
|
* type and APN setting. This is the cache to prevent redundant callbacks to the listeners.
|
||||||
@@ -629,6 +631,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
mPhysicalChannelConfigs = new ArrayList<>();
|
mPhysicalChannelConfigs = new ArrayList<>();
|
||||||
mIsDataEnabled = new boolean[numPhones];
|
mIsDataEnabled = new boolean[numPhones];
|
||||||
mDataEnabledReason = new int[numPhones];
|
mDataEnabledReason = new int[numPhones];
|
||||||
|
mAllowedNetworkTypesList = new HashMap<>();
|
||||||
for (int i = 0; i < numPhones; i++) {
|
for (int i = 0; i < numPhones; i++) {
|
||||||
mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
|
mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
|
||||||
mDataActivity[i] = TelephonyManager.DATA_ACTIVITY_NONE;
|
mDataActivity[i] = TelephonyManager.DATA_ACTIVITY_NONE;
|
||||||
@@ -1161,6 +1164,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
remove(r.binder);
|
remove(r.binder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (events.contains(
|
||||||
|
PhoneStateListener.EVENT_ALLOWED_NETWORK_TYPE_LIST_CHANGED)) {
|
||||||
|
try {
|
||||||
|
r.callback.onAllowedNetworkTypesChanged(mAllowedNetworkTypesList);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
remove(r.binder);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2405,6 +2416,44 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify that the allowed network type has changed.
|
||||||
|
*
|
||||||
|
* @param phoneId the phone id.
|
||||||
|
* @param subId the subId.
|
||||||
|
* @param allowedNetworkTypesList Map associating all allowed network type reasons with reason's
|
||||||
|
* allowed network type values.
|
||||||
|
*/
|
||||||
|
public void notifyAllowedNetworkTypesChanged(int phoneId, int subId,
|
||||||
|
Map allowedNetworkTypesList) {
|
||||||
|
if (!checkNotifyPermission("notifyAllowedNetworkTypesChanged()")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized (mRecords) {
|
||||||
|
if (validatePhoneId(phoneId)) {
|
||||||
|
mAllowedNetworkTypesList = allowedNetworkTypesList;
|
||||||
|
|
||||||
|
for (Record r : mRecords) {
|
||||||
|
if (r.matchPhoneStateListenerEvent(
|
||||||
|
PhoneStateListener.EVENT_ALLOWED_NETWORK_TYPE_LIST_CHANGED)
|
||||||
|
&& idMatch(r.subId, subId, phoneId)) {
|
||||||
|
try {
|
||||||
|
if (VDBG) {
|
||||||
|
log("notifyAllowedNetworkTypesChanged: AllowedNetworkTypesList= "
|
||||||
|
+ mAllowedNetworkTypesList.toString());
|
||||||
|
}
|
||||||
|
r.callback.onAllowedNetworkTypesChanged(mAllowedNetworkTypesList);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
mRemoveList.add(r.binder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleRemoveListLocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
|
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
|
import android.annotation.IntDef;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
@@ -37,6 +38,8 @@ import android.telephony.ims.ImsSsData;
|
|||||||
import com.android.internal.telephony.ICarrierConfigLoader;
|
import com.android.internal.telephony.ICarrierConfigLoader;
|
||||||
import com.android.telephony.Rlog;
|
import com.android.telephony.Rlog;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,6 +106,32 @@ public class CarrierConfigManager {
|
|||||||
*/
|
*/
|
||||||
public static final int USSD_OVER_IMS_ONLY = 3;
|
public static final int USSD_OVER_IMS_ONLY = 3;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@IntDef(prefix = { "CARRIER_NR_AVAILABILITY_" }, value = {
|
||||||
|
CARRIER_NR_AVAILABILITY_NONE,
|
||||||
|
CARRIER_NR_AVAILABILITY_NSA,
|
||||||
|
CARRIER_NR_AVAILABILITY_SA,
|
||||||
|
})
|
||||||
|
public @interface DeviceNrCapability {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates CARRIER_NR_AVAILABILITY_NONE determine that the carrier does not enable 5G NR.
|
||||||
|
*/
|
||||||
|
public static final int CARRIER_NR_AVAILABILITY_NONE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates CARRIER_NR_AVAILABILITY_NSA determine that the carrier enable the non-standalone
|
||||||
|
* (NSA) mode of 5G NR.
|
||||||
|
*/
|
||||||
|
public static final int CARRIER_NR_AVAILABILITY_NSA = 1 << 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates CARRIER_NR_AVAILABILITY_SA determine that the carrier enable the standalone (SA)
|
||||||
|
* mode of 5G NR.
|
||||||
|
*/
|
||||||
|
public static final int CARRIER_NR_AVAILABILITY_SA = 1 << 1;
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1774,10 +1803,23 @@ public class CarrierConfigManager {
|
|||||||
"show_precise_failed_cause_bool";
|
"show_precise_failed_cause_bool";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean to decide whether NR is enabled.
|
* Bit-field integer to determine whether the carrier enable the non-standalone (NSA) mode of
|
||||||
* @hide
|
* 5G NR, standalone (SA) mode of 5G NR
|
||||||
|
*
|
||||||
|
* <UL>
|
||||||
|
* <LI>CARRIER_NR_AVAILABILITY_NONE: non-NR = 0 </LI>
|
||||||
|
* <LI>CARRIER_NR_AVAILABILITY_NSA: NSA = 1 << 0</LI>
|
||||||
|
* <LI>CARRIER_NR_AVAILABILITY_SA: SA = 1 << 1</LI>
|
||||||
|
* </UL>
|
||||||
|
* <p> The value of this key must be bitwise OR of
|
||||||
|
* {@link #CARRIER_NR_AVAILABILITY_NONE}, {@link #CARRIER_NR_AVAILABILITY_NSA},
|
||||||
|
* {@link #CARRIER_NR_AVAILABILITY_SA}.
|
||||||
|
*
|
||||||
|
* <p> For example, if both NSA and SA are used, the value of key is 3 (1 << 0 | 1 << 1).
|
||||||
|
* If the carrier doesn't support 5G NR, the value of key is 0 (non-NR).
|
||||||
|
* If the key is invalid or not configured, a default value 3 (NSA|SA = 3) will apply.
|
||||||
*/
|
*/
|
||||||
public static final String KEY_NR_ENABLED_BOOL = "nr_enabled_bool";
|
public static final String KEY_CARRIER_NR_AVAILABILITY_INT = "carrier_nr_availability_int";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean to decide whether LTE is enabled.
|
* Boolean to decide whether LTE is enabled.
|
||||||
@@ -4546,7 +4588,8 @@ public class CarrierConfigManager {
|
|||||||
sDefaults.putString(KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING, "");
|
sDefaults.putString(KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING, "");
|
||||||
sDefaults.putBoolean(KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL, true);
|
sDefaults.putBoolean(KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL, true);
|
||||||
sDefaults.putInt(KEY_LTE_PLUS_THRESHOLD_BANDWIDTH_KHZ_INT, 20000);
|
sDefaults.putInt(KEY_LTE_PLUS_THRESHOLD_BANDWIDTH_KHZ_INT, 20000);
|
||||||
sDefaults.putBoolean(KEY_NR_ENABLED_BOOL, true);
|
sDefaults.putInt(KEY_CARRIER_NR_AVAILABILITY_INT,
|
||||||
|
CARRIER_NR_AVAILABILITY_NSA | CARRIER_NR_AVAILABILITY_SA);
|
||||||
sDefaults.putBoolean(KEY_LTE_ENABLED_BOOL, true);
|
sDefaults.putBoolean(KEY_LTE_ENABLED_BOOL, true);
|
||||||
sDefaults.putBoolean(KEY_SUPPORT_TDSCDMA_BOOL, false);
|
sDefaults.putBoolean(KEY_SUPPORT_TDSCDMA_BOOL, false);
|
||||||
sDefaults.putStringArray(KEY_SUPPORT_TDSCDMA_ROAMING_NETWORKS_STRING_ARRAY, null);
|
sDefaults.putStringArray(KEY_SUPPORT_TDSCDMA_ROAMING_NETWORKS_STRING_ARRAY, null);
|
||||||
|
|||||||
@@ -907,7 +907,8 @@ public class SubscriptionManager {
|
|||||||
* Indicate which network type is allowed. By default it's enabled.
|
* Indicate which network type is allowed. By default it's enabled.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final String ALLOWED_NETWORK_TYPES = SimInfo.COLUMN_ALLOWED_NETWORK_TYPES;
|
public static final String ALLOWED_NETWORK_TYPES =
|
||||||
|
SimInfo.COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast Action: The user has changed one of the default subs related to
|
* Broadcast Action: The user has changed one of the default subs related to
|
||||||
|
|||||||
@@ -7735,21 +7735,13 @@ public class TelephonyManager {
|
|||||||
*
|
*
|
||||||
* @return the preferred network type.
|
* @return the preferred network type.
|
||||||
* @hide
|
* @hide
|
||||||
* @deprecated Use {@link #getPreferredNetworkTypeBitmask} instead.
|
* @deprecated Use {@link #getAllowedNetworkTypesBitmask} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@RequiresPermission((android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE))
|
@RequiresPermission((android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE))
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public @PrefNetworkMode int getPreferredNetworkType(int subId) {
|
public @PrefNetworkMode int getPreferredNetworkType(int subId) {
|
||||||
try {
|
return RadioAccessFamily.getNetworkTypeFromRaf((int) getAllowedNetworkTypesBitmask());
|
||||||
ITelephony telephony = getITelephony();
|
|
||||||
if (telephony != null) {
|
|
||||||
return telephony.getPreferredNetworkType(subId);
|
|
||||||
}
|
|
||||||
} catch (RemoteException ex) {
|
|
||||||
Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7765,24 +7757,47 @@ public class TelephonyManager {
|
|||||||
* @return The bitmask of preferred network types.
|
* @return The bitmask of preferred network types.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
|
* @deprecated Use {@link #getAllowedNetworkTypesBitmask} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
@SystemApi
|
@SystemApi
|
||||||
public @NetworkTypeBitMask long getPreferredNetworkTypeBitmask() {
|
public @NetworkTypeBitMask long getPreferredNetworkTypeBitmask() {
|
||||||
|
return getAllowedNetworkTypesBitmask();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the allowed network type bitmask.
|
||||||
|
* Note that the device can only register on the network of {@link NetworkTypeBitmask}
|
||||||
|
* (except for emergency call cases).
|
||||||
|
*
|
||||||
|
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
|
||||||
|
* given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
|
||||||
|
*
|
||||||
|
* <p>Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
|
||||||
|
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
|
||||||
|
*
|
||||||
|
* @return The bitmask of allowed network types.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
|
@SystemApi
|
||||||
|
public @NetworkTypeBitMask long getAllowedNetworkTypesBitmask() {
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return (long) RadioAccessFamily.getRafFromNetworkType(
|
return (long) telephony.getAllowedNetworkTypesBitmask(getSubId());
|
||||||
telephony.getPreferredNetworkType(getSubId()));
|
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Rlog.e(TAG, "getPreferredNetworkTypeBitmask RemoteException", ex);
|
Rlog.e(TAG, "getAllowedNetworkTypesBitmask RemoteException", ex);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the allowed network types.
|
* Get the allowed network types by carriers.
|
||||||
*
|
*
|
||||||
* <p>Requires Permission:
|
* <p>Requires Permission:
|
||||||
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
|
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
|
||||||
@@ -7790,14 +7805,17 @@ public class TelephonyManager {
|
|||||||
*
|
*
|
||||||
* @return the allowed network type bitmask
|
* @return the allowed network type bitmask
|
||||||
* @hide
|
* @hide
|
||||||
|
* @deprecated Use {@link #getAllowedNetworkTypesForReason} instead.
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
@SystemApi
|
@SystemApi
|
||||||
|
@Deprecated
|
||||||
public @NetworkTypeBitMask long getAllowedNetworkTypes() {
|
public @NetworkTypeBitMask long getAllowedNetworkTypes() {
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return telephony.getAllowedNetworkTypes(getSubId());
|
return telephony.getAllowedNetworkTypesForReason(getSubId(),
|
||||||
|
TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER);
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Rlog.e(TAG, "getAllowedNetworkTypes RemoteException", ex);
|
Rlog.e(TAG, "getAllowedNetworkTypes RemoteException", ex);
|
||||||
@@ -8019,7 +8037,7 @@ public class TelephonyManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the network selection mode.
|
* Get the network selection mode.
|
||||||
*
|
*
|
||||||
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
|
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
|
||||||
@@ -8116,7 +8134,7 @@ public class TelephonyManager {
|
|||||||
* @param networkType the preferred network type
|
* @param networkType the preferred network type
|
||||||
* @return true on success; false on any failure.
|
* @return true on success; false on any failure.
|
||||||
* @hide
|
* @hide
|
||||||
* @deprecated Use {@link #setPreferredNetworkTypeBitmask} instead.
|
* @deprecated Use {@link #setAllowedNetworkTypesForReason} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||||
@@ -8124,7 +8142,9 @@ public class TelephonyManager {
|
|||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return telephony.setPreferredNetworkType(subId, networkType);
|
return telephony.setAllowedNetworkTypesForReason(subId,
|
||||||
|
TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER,
|
||||||
|
RadioAccessFamily.getRafFromNetworkType(networkType));
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex);
|
Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex);
|
||||||
@@ -8151,16 +8171,17 @@ public class TelephonyManager {
|
|||||||
* @param networkTypeBitmask The bitmask of preferred network types.
|
* @param networkTypeBitmask The bitmask of preferred network types.
|
||||||
* @return true on success; false on any failure.
|
* @return true on success; false on any failure.
|
||||||
* @hide
|
* @hide
|
||||||
|
* @deprecated Use {@link #setAllowedNetworkTypesForReason} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
@SystemApi
|
@SystemApi
|
||||||
public boolean setPreferredNetworkTypeBitmask(@NetworkTypeBitMask long networkTypeBitmask) {
|
public boolean setPreferredNetworkTypeBitmask(@NetworkTypeBitMask long networkTypeBitmask) {
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return telephony.setPreferredNetworkType(
|
return telephony.setAllowedNetworkTypesForReason(getSubId(),
|
||||||
getSubId(), RadioAccessFamily.getNetworkTypeFromRaf(
|
TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER, networkTypeBitmask);
|
||||||
(int) networkTypeBitmask));
|
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Rlog.e(TAG, "setPreferredNetworkTypeBitmask RemoteException", ex);
|
Rlog.e(TAG, "setPreferredNetworkTypeBitmask RemoteException", ex);
|
||||||
@@ -8181,7 +8202,9 @@ public class TelephonyManager {
|
|||||||
* @param allowedNetworkTypes The bitmask of allowed network types.
|
* @param allowedNetworkTypes The bitmask of allowed network types.
|
||||||
* @return true on success; false on any failure.
|
* @return true on success; false on any failure.
|
||||||
* @hide
|
* @hide
|
||||||
|
* @deprecated Use {@link #setAllowedNetworkTypesForReason} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
@RequiresFeature(
|
@RequiresFeature(
|
||||||
enforcement = "android.telephony.TelephonyManager#isRadioInterfaceCapabilitySupported",
|
enforcement = "android.telephony.TelephonyManager#isRadioInterfaceCapabilitySupported",
|
||||||
@@ -8191,7 +8214,8 @@ public class TelephonyManager {
|
|||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return telephony.setAllowedNetworkTypes(getSubId(), allowedNetworkTypes);
|
return telephony.setAllowedNetworkTypesForReason(getSubId(),
|
||||||
|
TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER, allowedNetworkTypes);
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Rlog.e(TAG, "setAllowedNetworkTypes RemoteException", ex);
|
Rlog.e(TAG, "setAllowedNetworkTypes RemoteException", ex);
|
||||||
@@ -8201,27 +8225,53 @@ public class TelephonyManager {
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@IntDef({
|
@IntDef({
|
||||||
ALLOWED_NETWORK_TYPES_REASON_POWER
|
ALLOWED_NETWORK_TYPES_REASON_USER,
|
||||||
|
ALLOWED_NETWORK_TYPES_REASON_POWER,
|
||||||
|
ALLOWED_NETWORK_TYPES_REASON_CARRIER
|
||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface AllowedNetworkTypesReason{}
|
public @interface AllowedNetworkTypesReason {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To indicate allowed network type change is requested by user.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public static final int ALLOWED_NETWORK_TYPES_REASON_USER = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To indicate allowed network type change is requested by power manager.
|
* To indicate allowed network type change is requested by power manager.
|
||||||
* Power Manger configuration won't affect the settings configured through
|
* Power Manger configuration won't affect the settings configured through
|
||||||
* {@link setAllowedNetworkTypes} and will result in allowing network types that are in both
|
* other reasons and will result in allowing network types that are in both
|
||||||
* configurations (i.e intersection of both sets).
|
* configurations (i.e intersection of both sets).
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final int ALLOWED_NETWORK_TYPES_REASON_POWER = 0;
|
@SystemApi
|
||||||
|
public static final int ALLOWED_NETWORK_TYPES_REASON_POWER = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To indicate allowed network type change is requested by carrier.
|
||||||
|
* Carrier configuration won't affect the settings configured through
|
||||||
|
* other reasons and will result in allowing network types that are in both
|
||||||
|
* configurations (i.e intersection of both sets).
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public static final int ALLOWED_NETWORK_TYPES_REASON_CARRIER = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the allowed network types of the device and
|
* Set the allowed network types of the device and
|
||||||
* provide the reason triggering the allowed network change.
|
* provide the reason triggering the allowed network change.
|
||||||
* This can be called for following reasons
|
* This can be called for following reasons
|
||||||
* <ol>
|
* <ol>
|
||||||
|
* <li>Allowed network types control by USER {@link #ALLOWED_NETWORK_TYPES_REASON_USER}
|
||||||
* <li>Allowed network types control by power manager
|
* <li>Allowed network types control by power manager
|
||||||
* {@link #ALLOWED_NETWORK_TYPES_REASON_POWER}
|
* {@link #ALLOWED_NETWORK_TYPES_REASON_POWER}
|
||||||
|
* <li>Allowed network types control by carrier {@link #ALLOWED_NETWORK_TYPES_REASON_CARRIER}
|
||||||
* </ol>
|
* </ol>
|
||||||
* This API will result in allowing an intersection of allowed network types for all reasons,
|
* This API will result in allowing an intersection of allowed network types for all reasons,
|
||||||
* including the configuration done through other reasons.
|
* including the configuration done through other reasons.
|
||||||
@@ -8237,15 +8287,17 @@ public class TelephonyManager {
|
|||||||
* @throws IllegalArgumentException if invalid AllowedNetworkTypesReason is passed.
|
* @throws IllegalArgumentException if invalid AllowedNetworkTypesReason is passed.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
@RequiresFeature(
|
@RequiresFeature(
|
||||||
enforcement = "android.telephony.TelephonyManager#isRadioInterfaceCapabilitySupported",
|
enforcement = "android.telephony.TelephonyManager#isRadioInterfaceCapabilitySupported",
|
||||||
value = TelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED)
|
value = TelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED)
|
||||||
public void setAllowedNetworkTypesForReason(@AllowedNetworkTypesReason int reason,
|
public void setAllowedNetworkTypesForReason(@AllowedNetworkTypesReason int reason,
|
||||||
@NetworkTypeBitMask long allowedNetworkTypes) {
|
@NetworkTypeBitMask long allowedNetworkTypes) {
|
||||||
if (reason != ALLOWED_NETWORK_TYPES_REASON_POWER) {
|
if (!isValidAllowedNetworkTypesReason(reason)) {
|
||||||
throw new IllegalArgumentException("invalid AllowedNetworkTypesReason.");
|
throw new IllegalArgumentException("invalid AllowedNetworkTypesReason.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
@@ -8264,28 +8316,29 @@ public class TelephonyManager {
|
|||||||
* Get the allowed network types for certain reason.
|
* Get the allowed network types for certain reason.
|
||||||
*
|
*
|
||||||
* {@link #getAllowedNetworkTypesForReason} returns allowed network type for a
|
* {@link #getAllowedNetworkTypesForReason} returns allowed network type for a
|
||||||
* specific reason. For effective allowed network types configured on device,
|
* specific reason.
|
||||||
* query {@link getEffectiveAllowedNetworkTypes}
|
|
||||||
*
|
*
|
||||||
* <p>Requires Permission:
|
* <p>Requires Permission:
|
||||||
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
|
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
|
||||||
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
|
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
|
||||||
*s
|
*
|
||||||
* @param reason the reason the allowed network type change is taking place
|
* @param reason the reason the allowed network type change is taking place
|
||||||
* @return the allowed network type bitmask
|
* @return the allowed network type bitmask
|
||||||
* @throws IllegalStateException if the Telephony process is not currently available.
|
* @throws IllegalStateException if the Telephony process is not currently available.
|
||||||
* @throws IllegalArgumentException if invalid AllowedNetworkTypesReason is passed.
|
* @throws IllegalArgumentException if invalid AllowedNetworkTypesReason is passed.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
@RequiresFeature(
|
@RequiresFeature(
|
||||||
enforcement = "android.telephony.TelephonyManager#isRadioInterfaceCapabilitySupported",
|
enforcement = "android.telephony.TelephonyManager#isRadioInterfaceCapabilitySupported",
|
||||||
value = TelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED)
|
value = TelephonyManager.CAPABILITY_ALLOWED_NETWORK_TYPES_USED)
|
||||||
public @NetworkTypeBitMask long getAllowedNetworkTypesForReason(
|
public @NetworkTypeBitMask long getAllowedNetworkTypesForReason(
|
||||||
@AllowedNetworkTypesReason int reason) {
|
@AllowedNetworkTypesReason int reason) {
|
||||||
if (reason != ALLOWED_NETWORK_TYPES_REASON_POWER) {
|
if (!isValidAllowedNetworkTypesReason(reason)) {
|
||||||
throw new IllegalArgumentException("invalid AllowedNetworkTypesReason.");
|
throw new IllegalArgumentException("invalid AllowedNetworkTypesReason.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
@@ -8299,7 +8352,19 @@ public class TelephonyManager {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Verifies that the reason provided is valid.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static boolean isValidAllowedNetworkTypesReason(@AllowedNetworkTypesReason int reason) {
|
||||||
|
switch (reason) {
|
||||||
|
case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER:
|
||||||
|
case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_POWER:
|
||||||
|
case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Get bit mask of all network types.
|
* Get bit mask of all network types.
|
||||||
*
|
*
|
||||||
@@ -8310,35 +8375,6 @@ public class TelephonyManager {
|
|||||||
return NETWORK_STANDARDS_FAMILY_BITMASK_3GPP | NETWORK_STANDARDS_FAMILY_BITMASK_3GPP2;
|
return NETWORK_STANDARDS_FAMILY_BITMASK_3GPP | NETWORK_STANDARDS_FAMILY_BITMASK_3GPP2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the allowed network types configured on the device.
|
|
||||||
* This API will return an intersection of allowed network types for all reasons,
|
|
||||||
* including the configuration done through setAllowedNetworkTypes
|
|
||||||
*
|
|
||||||
* <p>Requires Permission:
|
|
||||||
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
|
|
||||||
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
|
|
||||||
*
|
|
||||||
* @return the allowed network type bitmask
|
|
||||||
* @throws IllegalStateException if the Telephony process is not currently available.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
|
||||||
public @NetworkTypeBitMask long getEffectiveAllowedNetworkTypes() {
|
|
||||||
try {
|
|
||||||
ITelephony telephony = getITelephony();
|
|
||||||
if (telephony != null) {
|
|
||||||
return telephony.getEffectiveAllowedNetworkTypes(getSubId());
|
|
||||||
} else {
|
|
||||||
throw new IllegalStateException("telephony service is null.");
|
|
||||||
}
|
|
||||||
} catch (RemoteException ex) {
|
|
||||||
Rlog.e(TAG, "getEffectiveAllowedNetworkTypes RemoteException", ex);
|
|
||||||
ex.rethrowFromSystemServer();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA.
|
* Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -797,24 +797,15 @@ interface ITelephony {
|
|||||||
* @return {@code true} on success; {@code false} on any failure.
|
* @return {@code true} on success; {@code false} on any failure.
|
||||||
*/
|
*/
|
||||||
boolean rebootModem(int slotIndex);
|
boolean rebootModem(int slotIndex);
|
||||||
/*
|
|
||||||
* Get the calculated preferred network type.
|
|
||||||
* Used for device configuration by some CDMA operators.
|
|
||||||
* @param callingPackage The package making the call.
|
|
||||||
* @param callingFeatureId The feature in the package.
|
|
||||||
*
|
|
||||||
* @return the calculated preferred network type, defined in RILConstants.java.
|
|
||||||
*/
|
|
||||||
int getCalculatedPreferredNetworkType(String callingPackage, String callingFeatureId);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the preferred network type.
|
* Get the allowed network type.
|
||||||
* Used for device configuration by some CDMA operators.
|
* Used for device configuration by some CDMA operators.
|
||||||
*
|
*
|
||||||
* @param subId the id of the subscription to query.
|
* @param subId the id of the subscription to query.
|
||||||
* @return the preferred network type, defined in RILConstants.java.
|
* @return the allowed network type bitmask, defined in RILConstants.java.
|
||||||
*/
|
*/
|
||||||
int getPreferredNetworkType(int subId);
|
int getAllowedNetworkTypesBitmask(int subId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether DUN APN is required for tethering with subId.
|
* Check whether DUN APN is required for tethering with subId.
|
||||||
@@ -939,23 +930,6 @@ interface ITelephony {
|
|||||||
boolean setNetworkSelectionModeManual(
|
boolean setNetworkSelectionModeManual(
|
||||||
int subId, in OperatorInfo operatorInfo, boolean persisSelection);
|
int subId, in OperatorInfo operatorInfo, boolean persisSelection);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the allowed network types that store in the telephony provider.
|
|
||||||
*
|
|
||||||
* @param subId the id of the subscription.
|
|
||||||
* @return allowedNetworkTypes the allowed network types.
|
|
||||||
*/
|
|
||||||
long getAllowedNetworkTypes(int subId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the allowed network types.
|
|
||||||
*
|
|
||||||
* @param subId the id of the subscription.
|
|
||||||
* @param allowedNetworkTypes the allowed network types.
|
|
||||||
* @return true on success; false on any failure.
|
|
||||||
*/
|
|
||||||
boolean setAllowedNetworkTypes(int subId, long allowedNetworkTypes);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the allowed network types for certain reason.
|
* Get the allowed network types for certain reason.
|
||||||
*
|
*
|
||||||
@@ -965,16 +939,6 @@ interface ITelephony {
|
|||||||
*/
|
*/
|
||||||
long getAllowedNetworkTypesForReason(int subId, int reason);
|
long getAllowedNetworkTypesForReason(int subId, int reason);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the effective allowed network types on the device. This API will
|
|
||||||
* return an intersection of allowed network types for all reasons,
|
|
||||||
* including the configuration done through setAllowedNetworkTypes
|
|
||||||
*
|
|
||||||
* @param subId the id of the subscription.
|
|
||||||
* @return allowedNetworkTypes the allowed network types.
|
|
||||||
*/
|
|
||||||
long getEffectiveAllowedNetworkTypes(int subId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the allowed network types and provide the reason triggering the allowed network change.
|
* Set the allowed network types and provide the reason triggering the allowed network change.
|
||||||
*
|
*
|
||||||
@@ -985,16 +949,6 @@ interface ITelephony {
|
|||||||
*/
|
*/
|
||||||
boolean setAllowedNetworkTypesForReason(int subId, int reason, long allowedNetworkTypes);
|
boolean setAllowedNetworkTypesForReason(int subId, int reason, long allowedNetworkTypes);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the preferred network type.
|
|
||||||
* Used for device configuration by some CDMA operators.
|
|
||||||
*
|
|
||||||
* @param subId the id of the subscription to update.
|
|
||||||
* @param networkType the preferred network type, defined in RILConstants.java.
|
|
||||||
* @return true on success; false on any failure.
|
|
||||||
*/
|
|
||||||
boolean setPreferredNetworkType(int subId, int networkType);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the user enabled state of Mobile Data.
|
* Get the user enabled state of Mobile Data.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user