From 4b3808dff7c0e055e216b04afdd56372797de8f6 Mon Sep 17 00:00:00 2001 From: Muhammed Siju Date: Mon, 14 Apr 2014 11:56:18 +0530 Subject: Add support for default data subscription setting. Default data subscription setting holds the default preference for data subscription. It will be updated when user changes data preference, sub deactivated or card removal. Current set preferred data subscription API does not update the default data subscription preference. This change is to handle temporary DDS switch by apps like MMS. New APIs to update and retrieve the default data subscription are added. Change-Id: I495266cff2a5319c57279d9decb77d6a87bbfae8 CRs-Fixed: 642210 --- core/java/android/provider/Settings.java | 13 ++++++++++ .../android/telephony/MSimTelephonyManager.java | 30 ++++++++++++++++++++++ .../internal/telephony/msim/ITelephonyMSim.aidl | 16 ++++++++++-- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 889355c3037..e63d269c5ce 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -7591,6 +7591,19 @@ public final class Settings { */ public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call"; + /** + * Subscription set by user for data call on a multi sim device. The difference from + * MULTI_SIM_DATA_CALL_SUBSCRIPTION is that this is the subscription that user set + * originally. Where as MULTI_SIM_DATA_CALL_SUBSCRIPTION holds the current data call + * subscription value, which could be different from user preferred value due to + * temporary DDS switch for say a silent DDS switch for MMS transaction. + * The value may change dynamically in case of a SIM removal or de activation. + * The supported values are 0 = SUB1, 1 = SUB2, 2 = SUB3, etc. + * @hide + */ + public static final String MULTI_SIM_DEFAULT_DATA_CALL_SUBSCRIPTION + = "multi_sim_defaut_data_call"; + /** * Subscription to be used for SMS on a multi sim device. The supported values * are 0 = SUB1, 1 = SUB2 and etc. diff --git a/telephony/java/android/telephony/MSimTelephonyManager.java b/telephony/java/android/telephony/MSimTelephonyManager.java index 4993bad2ab2..8a08869c989 100644 --- a/telephony/java/android/telephony/MSimTelephonyManager.java +++ b/telephony/java/android/telephony/MSimTelephonyManager.java @@ -1029,8 +1029,24 @@ public class MSimTelephonyManager { } } + /** + * Returns the default preferred data subscription value. + */ + public int getDefaultDataSubscription() { + try { + return getITelephonyMSim().getDefaultDataSubscription(); + } catch (RemoteException ex) { + return MSimConstants.DEFAULT_SUBSCRIPTION; + } catch (NullPointerException ex) { + return MSimConstants.DEFAULT_SUBSCRIPTION; + } + } + /** * Sets the designated data subscription. + * This API may be used by apps which needs to switch the DDS temporarily + * like MMS app. Default data subscription setting will not be updated by + * this API. */ public boolean setPreferredDataSubscription(int subscription) { try { @@ -1042,6 +1058,20 @@ public class MSimTelephonyManager { } } + /** + * Sets the designated data subscription and updates the default data + * subscription setting. + */ + public boolean setDefaultDataSubscription(int subscription) { + try { + return getITelephonyMSim().setDefaultDataSubscription(subscription); + } catch (RemoteException ex) { + return false; + } catch (NullPointerException ex) { + return false; + } + } + /** * Returns the preferred voice subscription. */ diff --git a/telephony/java/com/android/internal/telephony/msim/ITelephonyMSim.aidl b/telephony/java/com/android/internal/telephony/msim/ITelephonyMSim.aidl index 3689e909cbc..275e194cab1 100644 --- a/telephony/java/com/android/internal/telephony/msim/ITelephonyMSim.aidl +++ b/telephony/java/com/android/internal/telephony/msim/ITelephonyMSim.aidl @@ -359,15 +359,27 @@ interface ITelephonyMSim { int getPreferredVoiceSubscription(); /** - * get user prefered data subscription + * get current prefered data subscription * @return subscription id */ int getPreferredDataSubscription(); + /** + * get default prefered data subscription + * @return subscription id + */ + int getDefaultDataSubscription(); + /* - * Set user prefered data subscription + * Set current prefered data subscription temporarily. * @return true if success */ boolean setPreferredDataSubscription(int subscription); + + /* + * Set prefered data subscription and updates default data subscription. + * @return true if success + */ + boolean setDefaultDataSubscription(int subscription); } -- cgit v1.2.3