From 36ffb0494dd1045c164b7479b68165e206f8c759 Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Fri, 5 Dec 2014 11:10:30 -0800 Subject: Add subId as parameter for get/setDataEnabled. Bug: 18279333 Change-Id: I2496a2fd92b154e5e6981cbf6b5b5939cda59122 --- .../java/android/telephony/TelephonyManager.java | 22 +++++++++++++++++++--- .../com/android/internal/telephony/ITelephony.aidl | 4 ++-- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'telephony/java') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 751e11b..e015469 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3490,8 +3490,15 @@ public class TelephonyManager { /** @hide */ @SystemApi public void setDataEnabled(boolean enable) { + setDataEnabled(SubscriptionManager.getDefaultDataSubId(), enable); + } + + /** @hide */ + @SystemApi + public void setDataEnabled(int subId, boolean enable) { try { - getITelephony().setDataEnabled(enable); + Log.d(TAG, "setDataEnabled: enabled=" + enable); + getITelephony().setDataEnabled(subId, enable); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#setDataEnabled", e); } @@ -3500,12 +3507,21 @@ public class TelephonyManager { /** @hide */ @SystemApi public boolean getDataEnabled() { + return getDataEnabled(SubscriptionManager.getDefaultDataSubId()); + } + + /** @hide */ + @SystemApi + public boolean getDataEnabled(int subId) { + boolean retVal; try { - return getITelephony().getDataEnabled(); + retVal = getITelephony().getDataEnabled(subId); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#getDataEnabled", e); + retVal = false; } - return false; + Log.d(TAG, "getDataEnabled: retVal=" + retVal); + return retVal; } /** diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index bf7f332..a9e9f5e 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -679,14 +679,14 @@ interface ITelephony { * * @param enable true to turn on, else false */ - void setDataEnabled(boolean enable); + void setDataEnabled(int subId, boolean enable); /** * Get the user enabled state of Mobile Data. * * @return true on enabled */ - boolean getDataEnabled(); + boolean getDataEnabled(int subId); /** * Get P-CSCF address from PCO after data connection is established or modified. -- cgit v1.1