Make sure to handle exceptions for setDataEnabled am: dfaf434b20 am: 007a98c58f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1358928 Change-Id: If2fd7ae37cc0d9b828b4d7f48a0e125341e504bc
This commit is contained in:
@@ -9178,7 +9178,11 @@ public class TelephonyManager {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public void setDataEnabled(int subId, boolean enable) {
|
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
|
@Deprecated
|
||||||
@SystemApi
|
@SystemApi
|
||||||
public boolean getDataEnabled(int subId) {
|
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
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public void setCarrierDataEnabled(boolean enabled) {
|
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
|
@Deprecated
|
||||||
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public void setPolicyDataEnabled(boolean enabled) {
|
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 */
|
/** @hide */
|
||||||
|
|||||||
Reference in New Issue
Block a user