Protect against null ITelephony to fix crash.

Bug: 20066803
Change-Id: I4336e979dab3a4b1b3d53078af572ff3f822377a
This commit is contained in:
Andrew Lee
2015-04-03 14:09:29 -07:00
parent 92c9692ed5
commit 896a1e650c

View File

@@ -3982,7 +3982,10 @@ public class TelephonyManager {
*/
public boolean canChangeDtmfToneLength() {
try {
return getITelephony().canChangeDtmfToneLength();
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.canChangeDtmfToneLength();
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#canChangeDtmfToneLength", e);
}
@@ -3996,7 +3999,10 @@ public class TelephonyManager {
*/
public boolean isWorldPhone() {
try {
return getITelephony().isWorldPhone();
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.isWorldPhone();
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isWorldPhone", e);
}
@@ -4010,7 +4016,10 @@ public class TelephonyManager {
*/
public boolean isTtyModeSupported() {
try {
return getITelephony().isTtyModeSupported();
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.isTtyModeSupported();
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isTtyModeSupported", e);
}
@@ -4025,7 +4034,10 @@ public class TelephonyManager {
*/
public boolean isHearingAidCompatibilitySupported() {
try {
return getITelephony().isHearingAidCompatibilitySupported();
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.isHearingAidCompatibilitySupported();
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isHearingAidCompatibilitySupported", e);
}