summaryrefslogtreecommitdiff
path: root/telephony/java
diff options
context:
space:
mode:
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/CallQuality.java4
-rwxr-xr-xtelephony/java/android/telephony/CarrierConfigManager.java12
-rw-r--r--telephony/java/android/telephony/CellIdentity.java4
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java199
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl47
5 files changed, 189 insertions, 77 deletions
diff --git a/telephony/java/android/telephony/CallQuality.java b/telephony/java/android/telephony/CallQuality.java
index 1c82e96a0183..1effeb774484 100644
--- a/telephony/java/android/telephony/CallQuality.java
+++ b/telephony/java/android/telephony/CallQuality.java
@@ -345,8 +345,8 @@ public final class CallQuality implements Parcelable {
+ " averageRoundTripTime=" + mAverageRoundTripTime
+ " codecType=" + mCodecType
+ " rtpInactivityDetected=" + mRtpInactivityDetected
- + " txSilenceDetected=" + mRxSilenceDetected
- + " rxSilenceDetected=" + mTxSilenceDetected
+ + " txSilenceDetected=" + mTxSilenceDetected
+ + " rxSilenceDetected=" + mRxSilenceDetected
+ "}";
}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 6d0677daeae2..66fa5d5de7e1 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1085,6 +1085,15 @@ public class CarrierConfigManager {
"show_signal_strength_in_sim_status_bool";
/**
+ * Flag specifying if we should interpret all signal strength as one bar higher
+ * This is a replacement for the former resource config_inflateSignalStrength
+ * The default value is false.
+ * @hide
+ */
+ public static final String KEY_INFLATE_SIGNAL_STRENGTH_BOOL =
+ "inflate_signal_strength_bool";
+
+ /**
* Flag specifying whether an additional (client initiated) intent needs to be sent on System
* update
*/
@@ -1573,7 +1582,7 @@ public class CarrierConfigManager {
*/
public static final class Apn {
/** Prefix of all Apn.KEY_* constants. */
- public static final String KEY_PREFIX = "apn.";
+ private static final String KEY_PREFIX = "apn.";
/** IPv4 internet protocol */
public static final String PROTOCOL_IPV4 = "IP";
@@ -3962,6 +3971,7 @@ public class CarrierConfigManager {
sDefaults.putStringArray(KEY_CARRIER_VVM_PACKAGE_NAME_STRING_ARRAY, null);
sDefaults.putBoolean(KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL, false);
sDefaults.putBoolean(KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL, true);
+ sDefaults.putBoolean(KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false);
sDefaults.putBoolean(KEY_CI_ACTION_ON_SYS_UPDATE_BOOL, false);
sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, "");
sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, "");
diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java
index 1e5ce05ff28a..e8a51a99c6ba 100644
--- a/telephony/java/android/telephony/CellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentity.java
@@ -70,8 +70,7 @@ public abstract class CellIdentity implements Parcelable {
/** @hide */
protected String mAlphaShort;
- // For GSM, WCDMA, TDSCDMA, LTE and NR, Cell Global ID is defined in 3GPP TS 23.003.
- // For CDMA, its defined as System Id + Network Id + Basestation Id.
+ // Cell Global, 3GPP TS 23.003
/** @hide */
protected String mGlobalCellId;
@@ -206,7 +205,6 @@ public abstract class CellIdentity implements Parcelable {
public boolean isSameCell(@Nullable CellIdentity ci) {
if (ci == null) return false;
if (this.getClass() != ci.getClass()) return false;
- if (this.getGlobalCellId() == null || ci.getGlobalCellId() == null) return false;
return TextUtils.equals(this.getGlobalCellId(), ci.getGlobalCellId());
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index ee146089b852..705fdf778d6c 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -5517,23 +5517,6 @@ public class TelephonyManager {
}
}
- /**
- * Convert data state to string
- *
- * @return The data state in string format.
- * @hide
- */
- public static String dataStateToString(@DataState int state) {
- switch (state) {
- case DATA_DISCONNECTED: return "DISCONNECTED";
- case DATA_CONNECTING: return "CONNECTING";
- case DATA_CONNECTED: return "CONNECTED";
- case DATA_SUSPENDED: return "SUSPENDED";
- case DATA_DISCONNECTING: return "DISCONNECTING";
- }
- return "UNKNOWN(" + state + ")";
- }
-
/**
* @hide
*/
@@ -8066,13 +8049,13 @@ public class TelephonyManager {
/**
* Get the PLMN chosen for Manual Network Selection if active.
- * Return empty string if in automatic selection.
+ * Return null string if in automatic selection.
*
* <p>Requires Permission: {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE
* READ_PRECISE_PHONE_STATE} or that the calling app has carrier privileges
* (see {@link #hasCarrierPrivileges})
*
- * @return manually selected network info on success or empty string on failure
+ * @return manually selected network info on success or null string on failure
*/
@SuppressAutoDoc // No support carrier privileges (b/72967236).
@RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE)
@@ -8085,7 +8068,7 @@ public class TelephonyManager {
} catch (RemoteException ex) {
Rlog.e(TAG, "getManualNetworkSelectionPlmn RemoteException", ex);
}
- return "";
+ return null;
}
/**
@@ -9269,8 +9252,10 @@ public class TelephonyManager {
* app has carrier privileges (see {@link #hasCarrierPrivileges}).
*
* @param enable Whether to enable mobile data.
+ * @deprecated use setDataEnabledWithReason with reason DATA_ENABLED_REASON_USER instead.
*
*/
+ @Deprecated
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setDataEnabled(boolean enable) {
@@ -9279,19 +9264,16 @@ public class TelephonyManager {
/**
* @hide
- * @deprecated use {@link #setDataEnabled(boolean)} instead.
+ * @deprecated use {@link #setDataEnabledWithReason(int, boolean)} instead.
*/
@SystemApi
@Deprecated
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setDataEnabled(int subId, boolean enable) {
try {
- Log.d(TAG, "setDataEnabled: enabled=" + enable);
- ITelephony telephony = getITelephony();
- if (telephony != null)
- telephony.setUserDataEnabled(subId, enable);
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#setUserDataEnabled", e);
+ setDataEnabledWithReason(subId, DATA_ENABLED_REASON_USER, enable);
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Error calling setDataEnabledWithReason e:" + e);
}
}
@@ -9499,15 +9481,12 @@ public class TelephonyManager {
@Deprecated
@SystemApi
public boolean getDataEnabled(int subId) {
- boolean retVal = false;
try {
- ITelephony telephony = getITelephony();
- if (telephony != null)
- retVal = telephony.isUserDataEnabled(subId);
- } catch (RemoteException | NullPointerException e) {
- Log.e(TAG, "Error calling ITelephony#isUserDataEnabled", e);
+ return isDataEnabledWithReason(DATA_ENABLED_REASON_USER);
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Error calling isDataEnabledWithReason e:" + e);
}
- return retVal;
+ return false;
}
/**
@@ -11058,19 +11037,18 @@ public class TelephonyManager {
*
* @param enabled control enable or disable carrier data.
* @see #resetAllCarrierActions()
+ * @deprecated use {@link #setDataEnabledWithReason(int, boolean) with
+ * reason {@link #DATA_ENABLED_REASON_CARRIER}} instead.
* @hide
*/
+ @Deprecated
@SystemApi
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setCarrierDataEnabled(boolean enabled) {
try {
- ITelephony service = getITelephony();
- if (service != null) {
- service.carrierActionSetMeteredApnsEnabled(
- getSubId(SubscriptionManager.getDefaultDataSubscriptionId()), enabled);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#setCarrierDataEnabled", e);
+ setDataEnabledWithReason(DATA_ENABLED_REASON_CARRIER, enabled);
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Error calling setDataEnabledWithReason e:" + e);
}
}
@@ -11156,21 +11134,154 @@ public class TelephonyManager {
/**
* Policy control of data connection. Usually used when data limit is passed.
* @param enabled True if enabling the data, otherwise disabling.
+ * @deprecated use {@link #setDataEnabledWithReason(int, boolean) with
+ * reason {@link #DATA_ENABLED_REASON_POLICY}} instead.
* @hide
*/
+ @Deprecated
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setPolicyDataEnabled(boolean enabled) {
try {
+ setDataEnabledWithReason(DATA_ENABLED_REASON_POLICY, enabled);
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Error calling setDataEnabledWithReason e:" + e);
+ }
+ }
+
+ /** @hide */
+ @IntDef({
+ DATA_ENABLED_REASON_USER,
+ DATA_ENABLED_REASON_POLICY,
+ DATA_ENABLED_REASON_CARRIER,
+ DATA_ENABLED_REASON_THERMAL
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DataEnabledReason{}
+
+ /**
+ * To indicate that user enabled or disabled data.
+ * @hide
+ */
+ @SystemApi
+ public static final int DATA_ENABLED_REASON_USER = 0;
+
+ /**
+ * To indicate that data control due to policy. Usually used when data limit is passed.
+ * Policy data on/off won't affect user settings but will bypass the
+ * settings and turns off data internally if set to {@code false}.
+ * @hide
+ */
+ @SystemApi
+ public static final int DATA_ENABLED_REASON_POLICY = 1;
+
+ /**
+ * To indicate enable or disable carrier data by the system based on carrier signalling or
+ * carrier privileged apps. Carrier data on/off won't affect user settings but will bypass the
+ * settings and turns off data internally if set to {@code false}.
+ * @hide
+ */
+ @SystemApi
+ public static final int DATA_ENABLED_REASON_CARRIER = 2;
+
+ /**
+ * To indicate enable or disable data by thermal service.
+ * Thermal data on/off won't affect user settings but will bypass the
+ * settings and turns off data internally if set to {@code false}.
+ * @hide
+ */
+ @SystemApi
+ public static final int DATA_ENABLED_REASON_THERMAL = 3;
+
+ /**
+ * Control of data connection and provide the reason triggering the data connection control.
+ * This can be called for following reasons
+ * <ol>
+ * <li>data limit is passed {@link #DATA_ENABLED_REASON_POLICY}
+ * <li>data disabled by carrier {@link #DATA_ENABLED_REASON_CARRIER}
+ * <li>data disabled by user {@link #DATA_ENABLED_REASON_USER}
+ * <li>data disabled due to thermal {@link #DATA_ENABLED_REASON_THERMAL}
+ * </ol>
+ * If any of the reason is off, then it will result in
+ * bypassing user preference and result in data to be turned off.
+ *
+ * <p>If this object has been created with {@link #createForSubscriptionId}, applies
+ * to the given subId. Otherwise, applies to
+ * {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ *
+ *
+ * @param reason the reason the data enable change is taking place
+ * @param enabled True if enabling the data, otherwise disabling.
+ *
+ * <p>Requires Permission:
+ * The calling app has carrier privileges (see {@link #hasCarrierPrivileges}) if the reason is
+ * {@link #DATA_ENABLED_REASON_USER} or {@link #DATA_ENABLED_REASON_CARRIER} or the call app
+ * has {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} irrespective of
+ * the reason.
+ * @throws IllegalStateException if the Telephony process is not currently available.
+ * @hide
+ */
+ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
+ @SystemApi
+ public void setDataEnabledWithReason(@DataEnabledReason int reason, boolean enabled) {
+ setDataEnabledWithReason(getSubId(), reason, enabled);
+ }
+
+ private void setDataEnabledWithReason(int subId, @DataEnabledReason int reason,
+ boolean enabled) {
+ try {
ITelephony service = getITelephony();
if (service != null) {
- service.setPolicyDataEnabled(enabled, getSubId());
+ service.setDataEnabledWithReason(subId, reason, enabled);
+ } else {
+ throw new IllegalStateException("telephony service is null.");
}
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#setPolicyDataEnabled", e);
+ } catch (RemoteException ex) {
+ Log.e(TAG, "Telephony#setDataEnabledWithReason RemoteException", ex);
+ ex.rethrowFromSystemServer();
}
}
/**
+ * Return whether data is enabled for certain reason .
+ *
+ * If {@link #isDataEnabledWithReason} returns false, it means in data enablement for a
+ * specific reason is turned off. If any of the reason is off, then it will result in
+ * bypassing user preference and result in data to be turned off.
+ *
+ * <p>If this object has been created with {@link #createForSubscriptionId}, applies
+ * to the given subId. Otherwise, applies to
+ * {@link SubscriptionManager#getDefaultDataSubscriptionId()}
+ *
+ * @param reason the reason the data enable change is taking place
+ * @return whether data is enabled for a reason.
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+ * @throws IllegalStateException if the Telephony process is not currently available.
+ * @hide
+ */
+ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE,
+ android.Manifest.permission.READ_PHONE_STATE})
+ @SystemApi
+ public boolean isDataEnabledWithReason(@DataEnabledReason int reason) {
+ return isDataEnabledWithReason(getSubId(), reason);
+ }
+
+ private boolean isDataEnabledWithReason(int subId, @DataEnabledReason int reason) {
+ try {
+ ITelephony service = getITelephony();
+ if (service != null) {
+ return service.isDataEnabledWithReason(subId, reason);
+ } else {
+ throw new IllegalStateException("telephony service is null.");
+ }
+ } catch (RemoteException ex) {
+ Log.e(TAG, "Telephony#isDataEnabledWithReason RemoteException", ex);
+ ex.rethrowFromSystemServer();
+ }
+ return false;
+ }
+
+ /**
* Get Client request stats which will contain statistical information
* on each request made by client.
* Callers require either READ_PRIVILEGED_PHONE_STATE or
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index b70937cee8a1..4276e713561b 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -995,13 +995,6 @@ interface ITelephony {
boolean setPreferredNetworkType(int subId, int networkType);
/**
- * User enable/disable Mobile Data.
- *
- * @param enable true to turn on, else false
- */
- void setUserDataEnabled(int subId, boolean enable);
-
- /**
* Get the user enabled state of Mobile Data.
*
* TODO: remove and use isUserDataEnabled.
@@ -1022,12 +1015,29 @@ interface ITelephony {
boolean isUserDataEnabled(int subId);
/**
- * Get the overall enabled state of Mobile Data.
- *
+ * Check if data is enabled on the device. It can be disabled by
+ * user, carrier, policy or thermal.
* @return true on enabled
*/
boolean isDataEnabled(int subId);
+ /**
+ * Control of data connection and provide the reason triggering the data connection control.
+ *
+ * @param subId user preferred subId.
+ * @param reason the reason the data enable change is taking place
+ * @param enable true to turn on, else false
+ */
+ void setDataEnabledWithReason(int subId, int reason, boolean enable);
+
+ /**
+ * Return whether data is enabled for certain reason
+ * @param subId user preferred subId. .
+ * @param reason the reason the data enable change is taking place
+ * @return true on enabled
+ */
+ boolean isDataEnabledWithReason(int subId, int reason);
+
/**
* Checks if manual network selection is allowed.
*
@@ -1625,15 +1635,6 @@ interface ITelephony {
int getCarrierIdFromMccMnc(int slotIndex, String mccmnc, boolean isSubscriptionMccMnc);
/**
- * Action set from carrier signalling broadcast receivers to enable/disable metered apns
- * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
- * @param subId the subscription ID that this action applies to.
- * @param enabled control enable or disable metered apns.
- * @hide
- */
- void carrierActionSetMeteredApnsEnabled(int subId, boolean visible);
-
- /**
* Action set from carrier signalling broadcast receivers to enable/disable radio
* Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
* @param subId the subscription ID that this action applies to.
@@ -1734,14 +1735,6 @@ interface ITelephony {
boolean setCallWaitingStatus(int subId, boolean isEnable);
/**
- * Policy control of data connection. Usually used when data limit is passed.
- * @param enabled True if enabling the data, otherwise disabling.
- * @param subId Subscription index
- * @hide
- */
- void setPolicyDataEnabled(boolean enabled, int subId);
-
- /**
* Get Client request stats which will contain statistical information
* on each request made by client.
* @param callingPackage package making the call.
@@ -2299,7 +2292,7 @@ interface ITelephony {
/**
* Get the user manual network selection.
- * Return empty string if in automatic selection.
+ * Return null if inactive or phone process is down.
*
* @param subId the id of the subscription
* @return operatorinfo on success