Merge "Fix permissions on TelephonyManager" into mnc-dev

This commit is contained in:
Robert Greenwalt
2015-07-09 03:19:20 +00:00
committed by Android (Google) Code Review
2 changed files with 59 additions and 40 deletions

View File

@@ -1371,7 +1371,7 @@ public class TelephonyManager {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.getNetworkTypeForSubscriber(subId);
return telephony.getNetworkTypeForSubscriber(subId, getOpPackageName());
} else {
// This can happen when the ITelephony interface is not up yet.
return NETWORK_TYPE_UNKNOWN;
@@ -1425,7 +1425,7 @@ public class TelephonyManager {
try{
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.getDataNetworkTypeForSubscriber(subId);
return telephony.getDataNetworkTypeForSubscriber(subId, getOpPackageName());
} else {
// This can happen when the ITelephony interface is not up yet.
return NETWORK_TYPE_UNKNOWN;
@@ -1919,7 +1919,7 @@ public class TelephonyManager {
ITelephony telephony = getITelephony();
if (telephony == null)
return PhoneConstants.LTE_ON_CDMA_UNKNOWN;
return telephony.getLteOnCdmaModeForSubscriber(subId);
return telephony.getLteOnCdmaModeForSubscriber(subId, getOpPackageName());
} catch (RemoteException ex) {
// Assume no ICC card if remote exception which shouldn't happen
return PhoneConstants.LTE_ON_CDMA_UNKNOWN;
@@ -2657,7 +2657,7 @@ public class TelephonyManager {
ITelephony telephony = getITelephony();
if (telephony == null)
return -1;
return telephony.getCdmaEriIconIndexForSubscriber(subId);
return telephony.getCdmaEriIconIndexForSubscriber(subId, getOpPackageName());
} catch (RemoteException ex) {
// the phone process is restarting.
return -1;
@@ -2688,7 +2688,7 @@ public class TelephonyManager {
ITelephony telephony = getITelephony();
if (telephony == null)
return -1;
return telephony.getCdmaEriIconModeForSubscriber(subId);
return telephony.getCdmaEriIconModeForSubscriber(subId, getOpPackageName());
} catch (RemoteException ex) {
// the phone process is restarting.
return -1;
@@ -2716,7 +2716,7 @@ public class TelephonyManager {
ITelephony telephony = getITelephony();
if (telephony == null)
return null;
return telephony.getCdmaEriTextForSubscriber(subId);
return telephony.getCdmaEriTextForSubscriber(subId, getOpPackageName());
} catch (RemoteException ex) {
// the phone process is restarting.
return null;
@@ -3833,7 +3833,7 @@ public class TelephonyManager {
try {
ITelephony telephony = getITelephony();
if (telephony != null)
return telephony.isOffhook();
return telephony.isOffhook(getOpPackageName());
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isOffhook", e);
}
@@ -3846,7 +3846,7 @@ public class TelephonyManager {
try {
ITelephony telephony = getITelephony();
if (telephony != null)
return telephony.isRinging();
return telephony.isRinging(getOpPackageName());
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isRinging", e);
}
@@ -3859,7 +3859,7 @@ public class TelephonyManager {
try {
ITelephony telephony = getITelephony();
if (telephony != null)
return telephony.isIdle();
return telephony.isIdle(getOpPackageName());
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isIdle", e);
}
@@ -3872,7 +3872,7 @@ public class TelephonyManager {
try {
ITelephony telephony = getITelephony();
if (telephony != null)
return telephony.isRadioOn();
return telephony.isRadioOn(getOpPackageName());
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isRadioOn", e);
}

View File

@@ -116,59 +116,67 @@ interface ITelephony {
/**
* Check if we are in either an active or holding call
* @param callingPackage the name of the package making the call.
* @return true if the phone state is OFFHOOK.
*/
boolean isOffhook();
boolean isOffhook(String callingPackage);
/**
* Check if a particular subId has an active or holding call
*
* @param subId user preferred subId.
* @param callingPackage the name of the package making the call.
* @return true if the phone state is OFFHOOK.
*/
boolean isOffhookForSubscriber(int subId);
boolean isOffhookForSubscriber(int subId, String callingPackage);
/**
* Check if an incoming phone call is ringing or call waiting
* on a particular subId.
*
* @param subId user preferred subId.
* @param callingPackage the name of the package making the call.
* @return true if the phone state is RINGING.
*/
boolean isRingingForSubscriber(int subId);
boolean isRingingForSubscriber(int subId, String callingPackage);
/**
* Check if an incoming phone call is ringing or call waiting.
* @param callingPackage the name of the package making the call.
* @return true if the phone state is RINGING.
*/
boolean isRinging();
boolean isRinging(String callingPackage);
/**
* Check if the phone is idle.
* @param callingPackage the name of the package making the call.
* @return true if the phone state is IDLE.
*/
boolean isIdle();
boolean isIdle(String callingPackage);
/**
* Check if the phone is idle on a particular subId.
*
* @param subId user preferred subId.
* @param callingPackage the name of the package making the call.
* @return true if the phone state is IDLE.
*/
boolean isIdleForSubscriber(int subId);
boolean isIdleForSubscriber(int subId, String callingPackage);
/**
* Check to see if the radio is on or not.
* @param callingPackage the name of the package making the call.
* @return returns true if the radio is on.
*/
boolean isRadioOn();
boolean isRadioOn(String callingPackage);
/**
* Check to see if the radio is on or not on particular subId.
* @param subId user preferred subId.
* @param callingPackage the name of the package making the call.
* @return returns true if the radio is on.
*/
boolean isRadioOnForSubscriber(int subId);
boolean isRadioOnForSubscriber(int subId, String callingPackage);
/**
* Check if the SIM pin lock is enabled.
@@ -380,40 +388,46 @@ interface ITelephony {
/**
* Returns the CDMA ERI icon index to display
* @param callingPackage package making the call.
*/
int getCdmaEriIconIndex();
int getCdmaEriIconIndex(String callingPackage);
/**
* Returns the CDMA ERI icon index to display on particular subId.
* @param subId user preferred subId.
* @param callingPackage package making the call.
*/
int getCdmaEriIconIndexForSubscriber(int subId);
int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage);
/**
* Returns the CDMA ERI icon mode,
* 0 - ON
* 1 - FLASHING
* @param callingPackage package making the call.
*/
int getCdmaEriIconMode();
int getCdmaEriIconMode(String callingPackage);
/**
* Returns the CDMA ERI icon mode on particular subId,
* 0 - ON
* 1 - FLASHING
* @param subId user preferred subId.
* @param callingPackage package making the call.
*/
int getCdmaEriIconModeForSubscriber(int subId);
int getCdmaEriIconModeForSubscriber(int subId, String callingPackage);
/**
* Returns the CDMA ERI text,
* @param callingPackage package making the call.
*/
String getCdmaEriText();
String getCdmaEriText(String callingPackage);
/**
* Returns the CDMA ERI text for particular subId,
* @param subId user preferred subId.
* @param callingPackage package making the call.
*/
String getCdmaEriTextForSubscriber(int subId);
String getCdmaEriTextForSubscriber(int subId, String callingPackage);
/**
* Returns true if OTA service provisioning needs to run.
@@ -440,28 +454,30 @@ interface ITelephony {
int getVoiceMessageCountForSubscriber(int subId);
/**
* Returns the network type for data transmission
*/
int getNetworkType();
* Returns the network type for data transmission
* @param callingPackage package making the call.
*/
int getNetworkType(String callingPackage);
/**
* Returns the network type of a subId.
* @param subId user preferred subId.
* Returns the network type
* @param callingPackage package making the call.
*/
int getNetworkTypeForSubscriber(int subId);
int getNetworkTypeForSubscriber(int subId, String callingPackage);
/**
* Returns the network type for data transmission
*/
int getDataNetworkType();
* Returns the network type for data transmission
* @param callingPackage package making the call.
*/
int getDataNetworkType(String callingPackage);
/**
* Returns the data network type of a subId
* @param subId user preferred subId.
* Returns the network type
*/
int getDataNetworkTypeForSubscriber(int subId);
* Returns the data network type of a subId
* @param subId user preferred subId.
* @param callingPackage package making the call.
*/
int getDataNetworkTypeForSubscriber(int subId, String callingPackage);
/**
* Returns the network type for voice
@@ -492,20 +508,22 @@ interface ITelephony {
* is a tri-state return value as for a period of time
* the mode may be unknown.
*
* @param callingPackage the name of the calling package
* @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
* or {@link PHone#LTE_ON_CDMA_TRUE}
*/
int getLteOnCdmaMode();
int getLteOnCdmaMode(String callingPackage);
/**
* Return if the current radio is LTE on CDMA. This
* is a tri-state return value as for a period of time
* the mode may be unknown.
*
* @param callingPackage the name of the calling package
* @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
* or {@link PHone#LTE_ON_CDMA_TRUE}
*/
int getLteOnCdmaModeForSubscriber(int subId);
int getLteOnCdmaModeForSubscriber(int subId, String callingPackage);
/**
* Returns the all observed cell information of the device.
@@ -890,9 +908,10 @@ interface ITelephony {
* Get phone radio type and access technology.
*
* @param phoneId which phone you want to get
* @param callingPackage the name of the package making the call
* @return phone radio type and access technology
*/
int getRadioAccessFamily(in int phoneId);
int getRadioAccessFamily(in int phoneId, String callingPackage);
/**
* Enables or disables video calling.