Merge "Fix permissions." into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1ebcb6f8b2
@@ -1339,7 +1339,21 @@ public class TelephonyManager {
|
|||||||
* @return the NETWORK_TYPE_xxxx for current data connection.
|
* @return the NETWORK_TYPE_xxxx for current data connection.
|
||||||
*/
|
*/
|
||||||
public int getNetworkType() {
|
public int getNetworkType() {
|
||||||
return getDataNetworkType();
|
try {
|
||||||
|
ITelephony telephony = getITelephony();
|
||||||
|
if (telephony != null) {
|
||||||
|
return telephony.getNetworkType();
|
||||||
|
} else {
|
||||||
|
// This can happen when the ITelephony interface is not up yet.
|
||||||
|
return NETWORK_TYPE_UNKNOWN;
|
||||||
|
}
|
||||||
|
} catch(RemoteException ex) {
|
||||||
|
// This shouldn't happen in the normal case
|
||||||
|
return NETWORK_TYPE_UNKNOWN;
|
||||||
|
} catch (NullPointerException ex) {
|
||||||
|
// This could happen before phone restarts due to crashing
|
||||||
|
return NETWORK_TYPE_UNKNOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1365,6 +1379,10 @@ public class TelephonyManager {
|
|||||||
* @see #NETWORK_TYPE_LTE
|
* @see #NETWORK_TYPE_LTE
|
||||||
* @see #NETWORK_TYPE_EHRPD
|
* @see #NETWORK_TYPE_EHRPD
|
||||||
* @see #NETWORK_TYPE_HSPAP
|
* @see #NETWORK_TYPE_HSPAP
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
*/
|
*/
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public int getNetworkType(int subId) {
|
public int getNetworkType(int subId) {
|
||||||
@@ -1407,6 +1425,9 @@ public class TelephonyManager {
|
|||||||
* @see #NETWORK_TYPE_EHRPD
|
* @see #NETWORK_TYPE_EHRPD
|
||||||
* @see #NETWORK_TYPE_HSPAP
|
* @see #NETWORK_TYPE_HSPAP
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public int getDataNetworkType() {
|
public int getDataNetworkType() {
|
||||||
@@ -1419,6 +1440,10 @@ public class TelephonyManager {
|
|||||||
* @return the network type
|
* @return the network type
|
||||||
*
|
*
|
||||||
* @param subId for which network type is returned
|
* @param subId for which network type is returned
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
*/
|
*/
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public int getDataNetworkType(int subId) {
|
public int getDataNetworkType(int subId) {
|
||||||
@@ -1442,6 +1467,9 @@ public class TelephonyManager {
|
|||||||
/**
|
/**
|
||||||
* Returns the NETWORK_TYPE_xxxx for voice
|
* Returns the NETWORK_TYPE_xxxx for voice
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public int getVoiceNetworkType() {
|
public int getVoiceNetworkType() {
|
||||||
@@ -1451,13 +1479,16 @@ public class TelephonyManager {
|
|||||||
/**
|
/**
|
||||||
* Returns the NETWORK_TYPE_xxxx for voice for a subId
|
* Returns the NETWORK_TYPE_xxxx for voice for a subId
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
*/
|
*/
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public int getVoiceNetworkType(int subId) {
|
public int getVoiceNetworkType(int subId) {
|
||||||
try{
|
try{
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return telephony.getVoiceNetworkTypeForSubscriber(subId);
|
return telephony.getVoiceNetworkTypeForSubscriber(subId, getOpPackageName());
|
||||||
} else {
|
} else {
|
||||||
// This can happen when the ITelephony interface is not up yet.
|
// This can happen when the ITelephony interface is not up yet.
|
||||||
return NETWORK_TYPE_UNKNOWN;
|
return NETWORK_TYPE_UNKNOWN;
|
||||||
@@ -1897,6 +1928,10 @@ public class TelephonyManager {
|
|||||||
* @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
|
* @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
|
||||||
* or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
|
* or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public int getLteOnCdmaMode() {
|
public int getLteOnCdmaMode() {
|
||||||
@@ -1912,6 +1947,9 @@ public class TelephonyManager {
|
|||||||
* @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
|
* @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
|
||||||
* or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
|
* or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
*/
|
*/
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public int getLteOnCdmaMode(int subId) {
|
public int getLteOnCdmaMode(int subId) {
|
||||||
@@ -2642,6 +2680,9 @@ public class TelephonyManager {
|
|||||||
/**
|
/**
|
||||||
* Returns the CDMA ERI icon index to display
|
* Returns the CDMA ERI icon index to display
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public int getCdmaEriIconIndex() {
|
public int getCdmaEriIconIndex() {
|
||||||
@@ -2650,6 +2691,9 @@ public class TelephonyManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the CDMA ERI icon index to display for a subscription
|
* Returns the CDMA ERI icon index to display for a subscription
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
*/
|
*/
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public int getCdmaEriIconIndex(int subId) {
|
public int getCdmaEriIconIndex(int subId) {
|
||||||
@@ -2671,6 +2715,9 @@ public class TelephonyManager {
|
|||||||
* 0 - ON
|
* 0 - ON
|
||||||
* 1 - FLASHING
|
* 1 - FLASHING
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public int getCdmaEriIconMode() {
|
public int getCdmaEriIconMode() {
|
||||||
@@ -2681,6 +2728,10 @@ public class TelephonyManager {
|
|||||||
* Returns the CDMA ERI icon mode for a subscription.
|
* Returns the CDMA ERI icon mode for a subscription.
|
||||||
* 0 - ON
|
* 0 - ON
|
||||||
* 1 - FLASHING
|
* 1 - FLASHING
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
*/
|
*/
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public int getCdmaEriIconMode(int subId) {
|
public int getCdmaEriIconMode(int subId) {
|
||||||
@@ -2700,6 +2751,9 @@ public class TelephonyManager {
|
|||||||
/**
|
/**
|
||||||
* Returns the CDMA ERI text,
|
* Returns the CDMA ERI text,
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public String getCdmaEriText() {
|
public String getCdmaEriText() {
|
||||||
@@ -2709,6 +2763,9 @@ public class TelephonyManager {
|
|||||||
/**
|
/**
|
||||||
* Returns the CDMA ERI text, of a subscription
|
* Returns the CDMA ERI text, of a subscription
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
*/
|
*/
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public String getCdmaEriText(int subId) {
|
public String getCdmaEriText(int subId) {
|
||||||
|
|||||||
@@ -455,9 +455,9 @@ interface ITelephony {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the network type for data transmission
|
* Returns the network type for data transmission
|
||||||
* @param callingPackage package making the call.
|
* Legacy call, permission-free
|
||||||
*/
|
*/
|
||||||
int getNetworkType(String callingPackage);
|
int getNetworkType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the network type of a subId.
|
* Returns the network type of a subId.
|
||||||
@@ -479,17 +479,13 @@ interface ITelephony {
|
|||||||
*/
|
*/
|
||||||
int getDataNetworkTypeForSubscriber(int subId, String callingPackage);
|
int getDataNetworkTypeForSubscriber(int subId, String callingPackage);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the network type for voice
|
|
||||||
*/
|
|
||||||
int getVoiceNetworkType();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the voice network type of a subId
|
* Returns the voice network type of a subId
|
||||||
* @param subId user preferred subId.
|
* @param subId user preferred subId.
|
||||||
|
* @param callingPackage package making the call.
|
||||||
* Returns the network type
|
* Returns the network type
|
||||||
*/
|
*/
|
||||||
int getVoiceNetworkTypeForSubscriber(int subId);
|
int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if an ICC card is present
|
* Return true if an ICC card is present
|
||||||
|
|||||||
Reference in New Issue
Block a user