summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
authorNick Vaccaro <nvaccaro@google.com>2015-02-19 16:15:29 -0800
committerNick Vaccaro <nvaccaro@google.com>2015-02-27 15:31:09 -0800
commitf257469c08f06e40f47f0b884cb0737d1316cc2c (patch)
tree535ae236afdd2894b891fcd0c9c1865ffae22908 /telephony/java
parent25395a7e07caca454bb411492698ea8ce1aaaaa9 (diff)
downloadframeworks_base-f257469c08f06e40f47f0b884cb0737d1316cc2c.zip
frameworks_base-f257469c08f06e40f47f0b884cb0737d1316cc2c.tar.gz
frameworks_base-f257469c08f06e40f47f0b884cb0737d1316cc2c.tar.bz2
Avoid unhandled page fault cases on Android Wear
Telephony routines were dereferencing the null result of getITelephony() and getSubscriberInfo(), causing unhandled page faults at the hardware level. Bug: 18264818 Change-Id: I7d058aa881c7dac20051d6faea2a6d52be4bd74e
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java414
1 files changed, 318 insertions, 96 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index db0da61..6938354 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -604,7 +604,10 @@ public class TelephonyManager {
return null;
}
try {
- return getSubscriberInfo().getDeviceSvnUsingSubId(subId[0]);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getDeviceSvnUsingSubId(subId[0]);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -621,7 +624,10 @@ public class TelephonyManager {
*/
public String getDeviceId() {
try {
- return getITelephony().getDeviceId();
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return null;
+ return telephony.getDeviceId();
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -642,7 +648,10 @@ public class TelephonyManager {
public String getDeviceId(int slotId) {
// FIXME this assumes phoneId == slotId
try {
- return getSubscriberInfo().getDeviceIdForPhone(slotId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getDeviceIdForPhone(slotId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -673,7 +682,10 @@ public class TelephonyManager {
public String getImei(int slotId) {
int[] subId = SubscriptionManager.getSubId(slotId);
try {
- return getSubscriberInfo().getImeiForSubscriber(subId[0]);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getImeiForSubscriber(subId[0]);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -699,7 +711,10 @@ public class TelephonyManager {
public String getNai(int slotId) {
int[] subId = SubscriptionManager.getSubId(slotId);
try {
- String nai = getSubscriberInfo().getNaiForSubscriber(subId[0]);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ String nai = info.getNaiForSubscriber(subId[0]);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Rlog.v(TAG, "Nai = " + nai);
}
@@ -728,7 +743,10 @@ public class TelephonyManager {
*/
public CellLocation getCellLocation() {
try {
- Bundle bundle = getITelephony().getCellLocation();
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return null;
+ Bundle bundle = telephony.getCellLocation();
if (bundle.isEmpty()) return null;
CellLocation cl = CellLocation.newFromBundle(bundle);
if (cl.isEmpty())
@@ -767,7 +785,9 @@ public class TelephonyManager {
/** @hide */
public void enableLocationUpdates(int subId) {
try {
- getITelephony().enableLocationUpdatesForSubscriber(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.enableLocationUpdatesForSubscriber(subId);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -789,7 +809,9 @@ public class TelephonyManager {
/** @hide */
public void disableLocationUpdates(int subId) {
try {
- getITelephony().disableLocationUpdatesForSubscriber(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.disableLocationUpdatesForSubscriber(subId);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -808,7 +830,10 @@ public class TelephonyManager {
*/
public List<NeighboringCellInfo> getNeighboringCellInfo() {
try {
- return getITelephony().getNeighboringCellInfo(mContext.getOpPackageName());
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return null;
+ return telephony.getNeighboringCellInfo(mContext.getOpPackageName());
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -1504,7 +1529,10 @@ public class TelephonyManager {
public boolean hasIccCard(int slotId) {
try {
- return getITelephony().hasIccCardUsingSlotId(slotId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return false;
+ return telephony.hasIccCardUsingSlotId(slotId);
} catch (RemoteException ex) {
// Assume no ICC card if remote exception which shouldn't happen
return false;
@@ -1736,7 +1764,10 @@ public class TelephonyManager {
/** {@hide} */
public String getSimSerialNumber(int subId) {
try {
- return getSubscriberInfo().getIccSerialNumberForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getIccSerialNumberForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -1772,7 +1803,10 @@ public class TelephonyManager {
/** {@hide} */
public int getLteOnCdmaMode(int subId) {
try {
- return getITelephony().getLteOnCdmaModeForSubscriber(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return PhoneConstants.LTE_ON_CDMA_UNKNOWN;
+ return telephony.getLteOnCdmaModeForSubscriber(subId);
} catch (RemoteException ex) {
// Assume no ICC card if remote exception which shouldn't happen
return PhoneConstants.LTE_ON_CDMA_UNKNOWN;
@@ -1812,7 +1846,10 @@ public class TelephonyManager {
/** {@hide} */
public String getSubscriberId(int subId) {
try {
- return getSubscriberInfo().getSubscriberIdForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getSubscriberIdForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -1830,7 +1867,10 @@ public class TelephonyManager {
*/
public String getGroupIdLevel1() {
try {
- return getSubscriberInfo().getGroupIdLevel1();
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getGroupIdLevel1();
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -1851,7 +1891,10 @@ public class TelephonyManager {
/** {@hide} */
public String getGroupIdLevel1(int subId) {
try {
- return getSubscriberInfo().getGroupIdLevel1ForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getGroupIdLevel1ForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -1884,7 +1927,9 @@ public class TelephonyManager {
public String getLine1NumberForSubscriber(int subId) {
String number = null;
try {
- number = getITelephony().getLine1NumberForDisplay(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ number = telephony.getLine1NumberForDisplay(subId);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -1892,7 +1937,10 @@ public class TelephonyManager {
return number;
}
try {
- return getSubscriberInfo().getLine1NumberForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getLine1NumberForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -1935,7 +1983,9 @@ public class TelephonyManager {
*/
public boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number) {
try {
- return getITelephony().setLine1NumberForDisplayForSubscriber(subId, alphaTag, number);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.setLine1NumberForDisplayForSubscriber(subId, alphaTag, number);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -1969,7 +2019,9 @@ public class TelephonyManager {
public String getLine1AlphaTagForSubscriber(int subId) {
String alphaTag = null;
try {
- alphaTag = getITelephony().getLine1AlphaTagForDisplay(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ alphaTag = telephony.getLine1AlphaTagForDisplay(subId);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -1977,7 +2029,10 @@ public class TelephonyManager {
return alphaTag;
}
try {
- return getSubscriberInfo().getLine1AlphaTagForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getLine1AlphaTagForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -1996,7 +2051,9 @@ public class TelephonyManager {
*/
public @Nullable String[] getMergedSubscriberIds() {
try {
- return getITelephony().getMergedSubscriberIds();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.getMergedSubscriberIds();
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -2028,7 +2085,10 @@ public class TelephonyManager {
/** {@hide} */
public String getMsisdn(int subId) {
try {
- return getSubscriberInfo().getMsisdnForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getMsisdnForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2058,7 +2118,10 @@ public class TelephonyManager {
/** {@hide} */
public String getVoiceMailNumber(int subId) {
try {
- return getSubscriberInfo().getVoiceMailNumberForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getVoiceMailNumberForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2090,7 +2153,10 @@ public class TelephonyManager {
/** {@hide} */
public String getCompleteVoiceMailNumber(int subId) {
try {
- return getSubscriberInfo().getCompleteVoiceMailNumberForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getCompleteVoiceMailNumberForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2125,7 +2191,9 @@ public class TelephonyManager {
/** {@hide} */
public boolean setVoiceMailNumber(int subId, String alphaTag, String number) {
try {
- return getITelephony().setVoiceMailNumber(subId, alphaTag, number);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.setVoiceMailNumber(subId, alphaTag, number);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -2153,7 +2221,10 @@ public class TelephonyManager {
/** {@hide} */
public int getVoiceMessageCount(int subId) {
try {
- return getITelephony().getVoiceMessageCountForSubscriber(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return 0;
+ return telephony.getVoiceMessageCountForSubscriber(subId);
} catch (RemoteException ex) {
return 0;
} catch (NullPointerException ex) {
@@ -2185,7 +2256,10 @@ public class TelephonyManager {
/** {@hide} */
public String getVoiceMailAlphaTag(int subId) {
try {
- return getSubscriberInfo().getVoiceMailAlphaTagForSubscriber(subId);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getVoiceMailAlphaTagForSubscriber(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2201,7 +2275,10 @@ public class TelephonyManager {
*/
public String getIsimImpi() {
try {
- return getSubscriberInfo().getIsimImpi();
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getIsimImpi();
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2217,7 +2294,10 @@ public class TelephonyManager {
*/
public String getIsimDomain() {
try {
- return getSubscriberInfo().getIsimDomain();
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getIsimDomain();
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2234,7 +2314,10 @@ public class TelephonyManager {
*/
public String[] getIsimImpu() {
try {
- return getSubscriberInfo().getIsimImpu();
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getIsimImpu();
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2282,7 +2365,10 @@ public class TelephonyManager {
/** {@hide} */
public int getCallState(int subId) {
try {
- return getITelephony().getCallStateForSubscriber(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return CALL_STATE_IDLE;
+ return telephony.getCallStateForSubscriber(subId);
} catch (RemoteException ex) {
// the phone process is restarting.
return CALL_STATE_IDLE;
@@ -2318,7 +2404,10 @@ public class TelephonyManager {
*/
public int getDataActivity() {
try {
- return getITelephony().getDataActivity();
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return DATA_ACTIVITY_NONE;
+ return telephony.getDataActivity();
} catch (RemoteException ex) {
// the phone process is restarting.
return DATA_ACTIVITY_NONE;
@@ -2354,7 +2443,10 @@ public class TelephonyManager {
*/
public int getDataState() {
try {
- return getITelephony().getDataState();
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return DATA_DISCONNECTED;
+ return telephony.getDataState();
} catch (RemoteException ex) {
// the phone process is restarting.
return DATA_DISCONNECTED;
@@ -2433,7 +2525,10 @@ public class TelephonyManager {
/** {@hide} */
public int getCdmaEriIconIndex(int subId) {
try {
- return getITelephony().getCdmaEriIconIndexForSubscriber(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return -1;
+ return telephony.getCdmaEriIconIndexForSubscriber(subId);
} catch (RemoteException ex) {
// the phone process is restarting.
return -1;
@@ -2461,7 +2556,10 @@ public class TelephonyManager {
/** {@hide} */
public int getCdmaEriIconMode(int subId) {
try {
- return getITelephony().getCdmaEriIconModeForSubscriber(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return -1;
+ return telephony.getCdmaEriIconModeForSubscriber(subId);
} catch (RemoteException ex) {
// the phone process is restarting.
return -1;
@@ -2486,7 +2584,10 @@ public class TelephonyManager {
/** {@hide} */
public String getCdmaEriText(int subId) {
try {
- return getITelephony().getCdmaEriTextForSubscriber(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return null;
+ return telephony.getCdmaEriTextForSubscriber(subId);
} catch (RemoteException ex) {
// the phone process is restarting.
return null;
@@ -2553,7 +2654,10 @@ public class TelephonyManager {
*/
public List<CellInfo> getAllCellInfo() {
try {
- return getITelephony().getAllCellInfo();
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return null;
+ return telephony.getAllCellInfo();
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2575,7 +2679,9 @@ public class TelephonyManager {
*/
public void setCellInfoListRate(int rateInMillis) {
try {
- getITelephony().setCellInfoListRate(rateInMillis);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.setCellInfoListRate(rateInMillis);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -2613,7 +2719,9 @@ public class TelephonyManager {
*/
public IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID) {
try {
- return getITelephony().iccOpenLogicalChannel(AID);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.iccOpenLogicalChannel(AID);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -2635,7 +2743,9 @@ public class TelephonyManager {
*/
public boolean iccCloseLogicalChannel(int channel) {
try {
- return getITelephony().iccCloseLogicalChannel(channel);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.iccCloseLogicalChannel(channel);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -2666,7 +2776,9 @@ public class TelephonyManager {
public String iccTransmitApduLogicalChannel(int channel, int cla,
int instruction, int p1, int p2, int p3, String data) {
try {
- return getITelephony().iccTransmitApduLogicalChannel(channel, cla,
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.iccTransmitApduLogicalChannel(channel, cla,
instruction, p1, p2, p3, data);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
@@ -2696,7 +2808,9 @@ public class TelephonyManager {
public String iccTransmitApduBasicChannel(int cla,
int instruction, int p1, int p2, int p3, String data) {
try {
- return getITelephony().iccTransmitApduBasicChannel(cla,
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.iccTransmitApduBasicChannel(cla,
instruction, p1, p2, p3, data);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
@@ -2722,8 +2836,9 @@ public class TelephonyManager {
public byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3,
String filePath) {
try {
- return getITelephony().iccExchangeSimIO(fileID, command, p1, p2,
- p3, filePath);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.iccExchangeSimIO(fileID, command, p1, p2, p3, filePath);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -2746,7 +2861,9 @@ public class TelephonyManager {
*/
public String sendEnvelopeWithStatus(String content) {
try {
- return getITelephony().sendEnvelopeWithStatus(content);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.sendEnvelopeWithStatus(content);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -2768,7 +2885,9 @@ public class TelephonyManager {
*/
public String nvReadItem(int itemID) {
try {
- return getITelephony().nvReadItem(itemID);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.nvReadItem(itemID);
} catch (RemoteException ex) {
Rlog.e(TAG, "nvReadItem RemoteException", ex);
} catch (NullPointerException ex) {
@@ -2793,7 +2912,9 @@ public class TelephonyManager {
*/
public boolean nvWriteItem(int itemID, String itemValue) {
try {
- return getITelephony().nvWriteItem(itemID, itemValue);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.nvWriteItem(itemID, itemValue);
} catch (RemoteException ex) {
Rlog.e(TAG, "nvWriteItem RemoteException", ex);
} catch (NullPointerException ex) {
@@ -2817,7 +2938,9 @@ public class TelephonyManager {
*/
public boolean nvWriteCdmaPrl(byte[] preferredRoamingList) {
try {
- return getITelephony().nvWriteCdmaPrl(preferredRoamingList);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.nvWriteCdmaPrl(preferredRoamingList);
} catch (RemoteException ex) {
Rlog.e(TAG, "nvWriteCdmaPrl RemoteException", ex);
} catch (NullPointerException ex) {
@@ -2842,7 +2965,9 @@ public class TelephonyManager {
*/
public boolean nvResetConfig(int resetType) {
try {
- return getITelephony().nvResetConfig(resetType);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.nvResetConfig(resetType);
} catch (RemoteException ex) {
Rlog.e(TAG, "nvResetConfig RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3046,7 +3171,10 @@ public class TelephonyManager {
*/
public String getIsimIst() {
try {
- return getSubscriberInfo().getIsimIst();
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getIsimIst();
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -3063,7 +3191,10 @@ public class TelephonyManager {
*/
public String[] getIsimPcscf() {
try {
- return getSubscriberInfo().getIsimPcscf();
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getIsimPcscf();
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -3082,7 +3213,10 @@ public class TelephonyManager {
*/
public String getIsimChallengeResponse(String nonce){
try {
- return getSubscriberInfo().getIsimChallengeResponse(nonce);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getIsimChallengeResponse(nonce);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -3102,7 +3236,10 @@ public class TelephonyManager {
*/
public String getIccSimChallengeResponse(int subId, int appType, String data) {
try {
- return getSubscriberInfo().getIccSimChallengeResponse(subId, appType, data);
+ IPhoneSubInfo info = getSubscriberInfo();
+ if (info == null)
+ return null;
+ return info.getIccSimChallengeResponse(subId, appType, data);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -3131,7 +3268,10 @@ public class TelephonyManager {
*/
public String[] getPcscfAddress(String apnType) {
try {
- return getITelephony().getPcscfAddress(apnType);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return new String[0];
+ return telephony.getPcscfAddress(apnType);
} catch (RemoteException e) {
return new String[0];
}
@@ -3145,7 +3285,9 @@ public class TelephonyManager {
*/
public void setImsRegistrationState(boolean registered) {
try {
- getITelephony().setImsRegistrationState(registered);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.setImsRegistrationState(registered);
} catch (RemoteException e) {
}
}
@@ -3163,7 +3305,9 @@ public class TelephonyManager {
*/
public int getPreferredNetworkType() {
try {
- return getITelephony().getPreferredNetworkType();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.getPreferredNetworkType();
} catch (RemoteException ex) {
Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3186,7 +3330,9 @@ public class TelephonyManager {
*/
public boolean setPreferredNetworkType(int networkType) {
try {
- return getITelephony().setPreferredNetworkType(networkType);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.setPreferredNetworkType(networkType);
} catch (RemoteException ex) {
Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3218,7 +3364,9 @@ public class TelephonyManager {
*/
public int getTetherApnRequired() {
try {
- return getITelephony().getTetherApnRequired();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.getTetherApnRequired();
} catch (RemoteException ex) {
Rlog.e(TAG, "hasMatchedTetherApnSetting RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3251,8 +3399,9 @@ public class TelephonyManager {
*/
public boolean hasCarrierPrivileges() {
try {
- return getITelephony().getCarrierPrivilegeStatus() ==
- CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.getCarrierPrivilegeStatus() == CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
} catch (RemoteException ex) {
Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3277,7 +3426,9 @@ public class TelephonyManager {
*/
public boolean setOperatorBrandOverride(String brand) {
try {
- return getITelephony().setOperatorBrandOverride(brand);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.setOperatorBrandOverride(brand);
} catch (RemoteException ex) {
Rlog.e(TAG, "setOperatorBrandOverride RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3309,8 +3460,10 @@ public class TelephonyManager {
List<String> gsmNonRoamingList, List<String> cdmaRoamingList,
List<String> cdmaNonRoamingList) {
try {
- return getITelephony().setRoamingOverride(gsmRoamingList, gsmNonRoamingList,
- cdmaRoamingList, cdmaNonRoamingList);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.setRoamingOverride(gsmRoamingList, gsmNonRoamingList,
+ cdmaRoamingList, cdmaNonRoamingList);
} catch (RemoteException ex) {
Rlog.e(TAG, "setRoamingOverride RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3333,7 +3486,10 @@ public class TelephonyManager {
@SystemApi
public String getCdmaMdn(int subId) {
try {
- return getITelephony().getCdmaMdn(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return null;
+ return telephony.getCdmaMdn(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -3351,7 +3507,10 @@ public class TelephonyManager {
@SystemApi
public String getCdmaMin(int subId) {
try {
- return getITelephony().getCdmaMin(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return null;
+ return telephony.getCdmaMin(subId);
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -3363,7 +3522,9 @@ public class TelephonyManager {
@SystemApi
public int checkCarrierPrivilegesForPackage(String pkgname) {
try {
- return getITelephony().checkCarrierPrivilegesForPackage(pkgname);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.checkCarrierPrivilegesForPackage(pkgname);
} catch (RemoteException ex) {
Rlog.e(TAG, "checkCarrierPrivilegesForPackage RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3376,7 +3537,9 @@ public class TelephonyManager {
@SystemApi
public List<String> getCarrierPackageNamesForIntent(Intent intent) {
try {
- return getITelephony().getCarrierPackageNamesForIntent(intent);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.getCarrierPackageNamesForIntent(intent);
} catch (RemoteException ex) {
Rlog.e(TAG, "getCarrierPackageNamesForIntent RemoteException", ex);
} catch (NullPointerException ex) {
@@ -3389,7 +3552,9 @@ public class TelephonyManager {
@SystemApi
public void dial(String number) {
try {
- getITelephony().dial(number);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.dial(number);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#dial", e);
}
@@ -3399,7 +3564,9 @@ public class TelephonyManager {
@SystemApi
public void call(String callingPackage, String number) {
try {
- getITelephony().call(callingPackage, number);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.call(callingPackage, number);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#call", e);
}
@@ -3409,7 +3576,9 @@ public class TelephonyManager {
@SystemApi
public boolean endCall() {
try {
- return getITelephony().endCall();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.endCall();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#endCall", e);
}
@@ -3420,7 +3589,9 @@ public class TelephonyManager {
@SystemApi
public void answerRingingCall() {
try {
- getITelephony().answerRingingCall();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.answerRingingCall();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#answerRingingCall", e);
}
@@ -3440,7 +3611,9 @@ public class TelephonyManager {
@SystemApi
public boolean isOffhook() {
try {
- return getITelephony().isOffhook();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.isOffhook();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isOffhook", e);
}
@@ -3451,7 +3624,9 @@ public class TelephonyManager {
@SystemApi
public boolean isRinging() {
try {
- return getITelephony().isRinging();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.isRinging();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isRinging", e);
}
@@ -3462,7 +3637,9 @@ public class TelephonyManager {
@SystemApi
public boolean isIdle() {
try {
- return getITelephony().isIdle();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.isIdle();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isIdle", e);
}
@@ -3473,7 +3650,9 @@ public class TelephonyManager {
@SystemApi
public boolean isRadioOn() {
try {
- return getITelephony().isRadioOn();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.isRadioOn();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isRadioOn", e);
}
@@ -3484,7 +3663,9 @@ public class TelephonyManager {
@SystemApi
public boolean isSimPinEnabled() {
try {
- return getITelephony().isSimPinEnabled();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.isSimPinEnabled();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isSimPinEnabled", e);
}
@@ -3495,7 +3676,9 @@ public class TelephonyManager {
@SystemApi
public boolean supplyPin(String pin) {
try {
- return getITelephony().supplyPin(pin);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.supplyPin(pin);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#supplyPin", e);
}
@@ -3506,7 +3689,9 @@ public class TelephonyManager {
@SystemApi
public boolean supplyPuk(String puk, String pin) {
try {
- return getITelephony().supplyPuk(puk, pin);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.supplyPuk(puk, pin);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#supplyPuk", e);
}
@@ -3517,7 +3702,9 @@ public class TelephonyManager {
@SystemApi
public int[] supplyPinReportResult(String pin) {
try {
- return getITelephony().supplyPinReportResult(pin);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.supplyPinReportResult(pin);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#supplyPinReportResult", e);
}
@@ -3528,7 +3715,9 @@ public class TelephonyManager {
@SystemApi
public int[] supplyPukReportResult(String puk, String pin) {
try {
- return getITelephony().supplyPukReportResult(puk, pin);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.supplyPukReportResult(puk, pin);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#]", e);
}
@@ -3539,7 +3728,9 @@ public class TelephonyManager {
@SystemApi
public boolean handlePinMmi(String dialString) {
try {
- return getITelephony().handlePinMmi(dialString);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.handlePinMmi(dialString);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#handlePinMmi", e);
}
@@ -3550,7 +3741,9 @@ public class TelephonyManager {
@SystemApi
public boolean handlePinMmiForSubscriber(int subId, String dialString) {
try {
- return getITelephony().handlePinMmiForSubscriber(subId, dialString);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.handlePinMmiForSubscriber(subId, dialString);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#handlePinMmi", e);
}
@@ -3561,7 +3754,9 @@ public class TelephonyManager {
@SystemApi
public void toggleRadioOnOff() {
try {
- getITelephony().toggleRadioOnOff();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.toggleRadioOnOff();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#toggleRadioOnOff", e);
}
@@ -3571,7 +3766,9 @@ public class TelephonyManager {
@SystemApi
public boolean setRadio(boolean turnOn) {
try {
- return getITelephony().setRadio(turnOn);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.setRadio(turnOn);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setRadio", e);
}
@@ -3582,7 +3779,9 @@ public class TelephonyManager {
@SystemApi
public boolean setRadioPower(boolean turnOn) {
try {
- return getITelephony().setRadioPower(turnOn);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.setRadioPower(turnOn);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setRadioPower", e);
}
@@ -3593,7 +3792,9 @@ public class TelephonyManager {
@SystemApi
public void updateServiceLocation() {
try {
- getITelephony().updateServiceLocation();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.updateServiceLocation();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#updateServiceLocation", e);
}
@@ -3603,7 +3804,9 @@ public class TelephonyManager {
@SystemApi
public boolean enableDataConnectivity() {
try {
- return getITelephony().enableDataConnectivity();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.enableDataConnectivity();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#enableDataConnectivity", e);
}
@@ -3614,7 +3817,9 @@ public class TelephonyManager {
@SystemApi
public boolean disableDataConnectivity() {
try {
- return getITelephony().disableDataConnectivity();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.disableDataConnectivity();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#disableDataConnectivity", e);
}
@@ -3625,7 +3830,9 @@ public class TelephonyManager {
@SystemApi
public boolean isDataConnectivityPossible() {
try {
- return getITelephony().isDataConnectivityPossible();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.isDataConnectivityPossible();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isDataConnectivityPossible", e);
}
@@ -3636,7 +3843,9 @@ public class TelephonyManager {
@SystemApi
public boolean needsOtaServiceProvisioning() {
try {
- return getITelephony().needsOtaServiceProvisioning();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.needsOtaServiceProvisioning();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#needsOtaServiceProvisioning", e);
}
@@ -3654,7 +3863,9 @@ public class TelephonyManager {
public void setDataEnabled(int subId, boolean enable) {
try {
Log.d(TAG, "setDataEnabled: enabled=" + enable);
- getITelephony().setDataEnabled(subId, enable);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.setDataEnabled(subId, enable);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setDataEnabled", e);
}
@@ -3671,7 +3882,9 @@ public class TelephonyManager {
public boolean getDataEnabled(int subId) {
boolean retVal = false;
try {
- retVal = getITelephony().getDataEnabled(subId);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ retVal = telephony.getDataEnabled(subId);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#getDataEnabled", e);
} catch (NullPointerException e) {
@@ -3692,7 +3905,9 @@ public class TelephonyManager {
*/
public int invokeOemRilRequestRaw(byte[] oemReq, byte[] oemResp) {
try {
- return getITelephony().invokeOemRilRequestRaw(oemReq, oemResp);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.invokeOemRilRequestRaw(oemReq, oemResp);
} catch (RemoteException ex) {
} catch (NullPointerException ex) {
}
@@ -3703,7 +3918,9 @@ public class TelephonyManager {
@SystemApi
public void enableVideoCalling(boolean enable) {
try {
- getITelephony().enableVideoCalling(enable);
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ telephony.enableVideoCalling(enable);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#enableVideoCalling", e);
}
@@ -3713,7 +3930,9 @@ public class TelephonyManager {
@SystemApi
public boolean isVideoCallingEnabled() {
try {
- return getITelephony().isVideoCallingEnabled();
+ ITelephony telephony = getITelephony();
+ if (telephony != null)
+ return telephony.isVideoCallingEnabled();
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isVideoCallingEnabled", e);
}
@@ -3773,7 +3992,10 @@ public class TelephonyManager {
*/
public boolean isImsRegistered() {
try {
- return getITelephony().isImsRegistered();
+ ITelephony telephony = getITelephony();
+ if (telephony == null)
+ return false;
+ return telephony.isImsRegistered();
} catch (RemoteException ex) {
return false;
} catch (NullPointerException ex) {