TelephonyManager System APIs process
- lock down some TelephonyManager APIs with system permission
- deprecate some TelephonyManager APIs due to its equivalents
- introduce an aidl interface that handles the current
getPhoneType() functions
The doc: https://docs.google.com/spreadsheets/d/1OJ6EXJ-Zys21mZ1BHgJeWkcfLq0pPxBR765r46ck80U/edit#gid=0
Bug: 62346128
Test: Compile
Change-Id: I5367372f3304e5ad368d0d4775f6e96168243aa3
Merged-In: I5367372f3304e5ad368d0d4775f6e96168243aa3
(cherry picked from commit 3b991aee47)
This commit is contained in:
@@ -5205,10 +5205,10 @@ package android.telephony {
|
||||
method public boolean handlePinMmi(java.lang.String);
|
||||
method public boolean handlePinMmiForSubscriber(int, java.lang.String);
|
||||
method public boolean isDataConnectivityPossible();
|
||||
method public boolean isIdle();
|
||||
method public boolean isOffhook();
|
||||
method public boolean isRadioOn();
|
||||
method public boolean isRinging();
|
||||
method public deprecated boolean isIdle();
|
||||
method public deprecated boolean isOffhook();
|
||||
method public deprecated boolean isRadioOn();
|
||||
method public deprecated boolean isRinging();
|
||||
method public boolean isVideoCallingEnabled();
|
||||
method public deprecated boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle);
|
||||
method public boolean needsOtaServiceProvisioning();
|
||||
|
||||
@@ -1455,6 +1455,7 @@ public class TelephonyManager {
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public int getCurrentPhoneType() {
|
||||
return getCurrentPhoneType(getSubId());
|
||||
}
|
||||
@@ -1470,7 +1471,17 @@ public class TelephonyManager {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public int getCurrentPhoneType(int subId) {
|
||||
return getCurrentPhoneType(subId, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* getCurrentPhoneType() with optional check if device is voice capable.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getCurrentPhoneType(int subId, boolean checkIsVoiceCapable) {
|
||||
int phoneId;
|
||||
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
||||
// if we don't have any sims, we don't have subscriptions, but we
|
||||
@@ -1479,8 +1490,7 @@ public class TelephonyManager {
|
||||
} else {
|
||||
phoneId = SubscriptionManager.getPhoneId(subId);
|
||||
}
|
||||
|
||||
return getCurrentPhoneTypeForSlot(phoneId);
|
||||
return getCurrentPhoneTypeForSlot(phoneId, checkIsVoiceCapable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1488,11 +1498,15 @@ public class TelephonyManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getCurrentPhoneTypeForSlot(int slotIndex) {
|
||||
public int getCurrentPhoneTypeForSlot(int slotIndex, boolean checkIsVoiceCapable) {
|
||||
try{
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
return telephony.getActivePhoneTypeForSlot(slotIndex);
|
||||
if (checkIsVoiceCapable) {
|
||||
return telephony.getVoiceCapableActivePhoneTypeForSlot(slotIndex);
|
||||
} else {
|
||||
return telephony.getActivePhoneTypeForSlot(slotIndex);
|
||||
}
|
||||
} else {
|
||||
// This can happen when the ITelephony interface is not up yet.
|
||||
return getPhoneTypeFromProperty(slotIndex);
|
||||
@@ -1518,10 +1532,7 @@ public class TelephonyManager {
|
||||
* @see #PHONE_TYPE_SIP
|
||||
*/
|
||||
public int getPhoneType() {
|
||||
if (!isVoiceCapable()) {
|
||||
return PHONE_TYPE_NONE;
|
||||
}
|
||||
return getCurrentPhoneType();
|
||||
return getCurrentPhoneType(getSubId(), true);
|
||||
}
|
||||
|
||||
private int getPhoneTypeFromProperty() {
|
||||
@@ -5838,12 +5849,14 @@ public class TelephonyManager {
|
||||
|
||||
/** @hide */
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public List<String> getCarrierPackageNamesForIntent(Intent intent) {
|
||||
return getCarrierPackageNamesForIntentAndPhone(intent, getPhoneId());
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public List<String> getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId) {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
@@ -5953,7 +5966,11 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* @deprecated Use {@link android.telecom.TelecomManager#isInCall} instead
|
||||
* @hide
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
|
||||
@@ -5970,7 +5987,11 @@ public class TelephonyManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* @deprecated Use {@link android.telecom.TelecomManager#isRinging} instead
|
||||
* @hide
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
|
||||
@@ -5987,7 +6008,11 @@ public class TelephonyManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* @deprecated Use {@link android.telecom.TelecomManager#isInCall} instead
|
||||
* @hide
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
|
||||
@@ -6004,7 +6029,11 @@ public class TelephonyManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* @deprecated Use {@link android.telephony.TelephonyManager#getServiceState} instead
|
||||
* @hide
|
||||
*/
|
||||
@Deprecated
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
|
||||
@@ -6295,6 +6324,7 @@ public class TelephonyManager {
|
||||
|
||||
/** @hide */
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public boolean isDataConnectivityPossible() {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
@@ -6309,6 +6339,7 @@ public class TelephonyManager {
|
||||
|
||||
/** @hide */
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public boolean needsOtaServiceProvisioning() {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
@@ -6411,10 +6442,7 @@ public class TelephonyManager {
|
||||
|
||||
/** @hide */
|
||||
@SystemApi
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
|
||||
android.Manifest.permission.READ_PHONE_STATE
|
||||
})
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public boolean isVideoCallingEnabled() {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
|
||||
@@ -375,6 +375,8 @@ interface ITelephony {
|
||||
|
||||
/**
|
||||
* Report whether data connectivity is possible.
|
||||
*
|
||||
* <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
|
||||
*/
|
||||
boolean isDataConnectivityPossible(int subId);
|
||||
|
||||
@@ -413,10 +415,24 @@ interface ITelephony {
|
||||
* Returns the current active phone type as integer for particular slot.
|
||||
* Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
|
||||
* and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
|
||||
*
|
||||
* <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
|
||||
*
|
||||
* @param slotIndex - slot to query.
|
||||
*/
|
||||
int getActivePhoneTypeForSlot(int slotIndex);
|
||||
|
||||
/**
|
||||
* Returns the current active phone type as integer for particular slot.
|
||||
* Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
|
||||
* and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
|
||||
*
|
||||
* If the device is not voice-capable, return PHONE_TYPE_NONE
|
||||
*
|
||||
* @param slotIndex - slot to query.
|
||||
*/
|
||||
int getVoiceCapableActivePhoneTypeForSlot(int slotIndex);
|
||||
|
||||
/**
|
||||
* Returns the CDMA ERI icon index to display
|
||||
* @param callingPackage package making the call.
|
||||
@@ -464,6 +480,8 @@ interface ITelephony {
|
||||
* Returns true if OTA service provisioning needs to run.
|
||||
* Only relevant on some technologies, others will always
|
||||
* return false.
|
||||
*
|
||||
* <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
|
||||
*/
|
||||
boolean needsOtaServiceProvisioning();
|
||||
|
||||
@@ -982,6 +1000,8 @@ interface ITelephony {
|
||||
* Returns list of the package names of the carrier apps that should handle the input intent
|
||||
* and have carrier privileges for the given phoneId.
|
||||
*
|
||||
* <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
|
||||
*
|
||||
* @param intent Intent that will be sent.
|
||||
* @param phoneId The phoneId on which the carrier app has carrier privileges.
|
||||
* @return list of carrier app package names that can handle the intent on phoneId.
|
||||
@@ -1106,6 +1126,8 @@ interface ITelephony {
|
||||
/**
|
||||
* Whether video calling has been enabled by the user.
|
||||
*
|
||||
* <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
|
||||
*
|
||||
* @param callingPackage The package making the call.
|
||||
* @return {@code true} if the user has enabled video calling, {@code false} otherwise.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user