Merge "Avoid unhandled page fault cases on Android Wear" into lmp-mr1-modular-dev

This commit is contained in:
Nick Vaccaro
2015-03-18 23:37:51 +00:00
committed by Android (Google) Code Review

View File

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