Make sure to handle exceptions for setDataEnabled am: dfaf434b20 am: 007a98c58f am: 2f008b5256

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1358928

Change-Id: I9c69dfd7cdb68b423c3ea261b58c786ae2a7acb7
This commit is contained in:
Sooraj Sasindran
2020-11-02 23:11:48 +00:00
committed by Automerger Merge Worker

View File

@@ -9178,7 +9178,11 @@ public class TelephonyManager {
@Deprecated
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setDataEnabled(int subId, boolean enable) {
setDataEnabledWithReason(subId, DATA_ENABLED_REASON_USER, enable);
try {
setDataEnabledWithReason(subId, DATA_ENABLED_REASON_USER, enable);
} catch (RuntimeException e) {
Log.e(TAG, "Error calling setDataEnabledWithReason e:" + e);
}
}
/**
@@ -9385,7 +9389,12 @@ public class TelephonyManager {
@Deprecated
@SystemApi
public boolean getDataEnabled(int subId) {
return isDataEnabledWithReason(DATA_ENABLED_REASON_USER);
try {
return isDataEnabledWithReason(DATA_ENABLED_REASON_USER);
} catch (RuntimeException e) {
Log.e(TAG, "Error calling isDataEnabledWithReason e:" + e);
}
return false;
}
/**
@@ -10951,7 +10960,11 @@ public class TelephonyManager {
@SystemApi
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setCarrierDataEnabled(boolean enabled) {
setDataEnabledWithReason(DATA_ENABLED_REASON_CARRIER, enabled);
try {
setDataEnabledWithReason(DATA_ENABLED_REASON_CARRIER, enabled);
} catch (RuntimeException e) {
Log.e(TAG, "Error calling setDataEnabledWithReason e:" + e);
}
}
/**
@@ -11043,7 +11056,11 @@ public class TelephonyManager {
@Deprecated
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setPolicyDataEnabled(boolean enabled) {
setDataEnabledWithReason(DATA_ENABLED_REASON_POLICY, enabled);
try {
setDataEnabledWithReason(DATA_ENABLED_REASON_POLICY, enabled);
} catch (RuntimeException e) {
Log.e(TAG, "Error calling setDataEnabledWithReason e:" + e);
}
}
/** @hide */