summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSridhar Dubbaka <sdubbaka@codeaurora.org>2015-09-26 00:27:26 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:21:22 -0600
commitab02f0cedd25ba3b2e839412518aadd9e43abd18 (patch)
tree4d1e2a52712e2956d3c49a8fcfaba97b952c01d4 /src
parentd6cbd3ea2c2cd6ee5bfa3a06649962661b909ca0 (diff)
downloadpackages_apps_Settings-ab02f0cedd25ba3b2e839412518aadd9e43abd18.zip
packages_apps_Settings-ab02f0cedd25ba3b2e839412518aadd9e43abd18.tar.gz
packages_apps_Settings-ab02f0cedd25ba3b2e839412518aadd9e43abd18.tar.bz2
Telephony(MSIM): Add Sms Prompt support
In Msim, Whenver user selects Ask every time option in Sim settings, Mms app will prompt for slection of sub from composemessageactivity, on which SMS to be sent. Change-Id: I39b1e1e3963779c717ea2aa49de94b6f0088984b
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/sim/SimDialogActivity.java45
-rw-r--r--src/com/android/settings/sim/SimSettings.java29
2 files changed, 64 insertions, 10 deletions
diff --git a/src/com/android/settings/sim/SimDialogActivity.java b/src/com/android/settings/sim/SimDialogActivity.java
index 03a9daf..d54336c 100644
--- a/src/com/android/settings/sim/SimDialogActivity.java
+++ b/src/com/android/settings/sim/SimDialogActivity.java
@@ -23,6 +23,8 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -33,12 +35,14 @@ import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
import android.widget.Toast;
+import com.android.internal.telephony.IExtTelephony;
import com.android.settings.R;
import com.android.settings.Utils;
import java.util.ArrayList;
@@ -56,6 +60,9 @@ public class SimDialogActivity extends Activity {
public static final int SMS_PICK = 2;
public static final int PREFERRED_PICK = 3;
+ private IExtTelephony mExtTelephony = IExtTelephony.Stub.
+ asInterface(ServiceManager.getService("extphone"));
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -152,6 +159,7 @@ public class SimDialogActivity extends Activity {
public Dialog createDialog(final Context context, final int id) {
final ArrayList<String> list = new ArrayList<String>();
final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
+ final ArrayList<SubscriptionInfo> smsSubInfoList = new ArrayList<SubscriptionInfo>();
final List<SubscriptionInfo> subInfoList =
subscriptionManager.getActiveSubscriptionInfoList();
final int selectableSubInfoLength = subInfoList == null ? 0 : subInfoList.size();
@@ -177,8 +185,26 @@ public class SimDialogActivity extends Activity {
value < 1 ? null : phoneAccountsList.get(value - 1));
break;
case SMS_PICK:
- sir = subInfoList.get(value);
- setDefaultSmsSubId(context, sir.getSubscriptionId());
+ boolean isSmsPrompt = false;
+ if (value < 1) {
+ isSmsPrompt = true;
+ } else {
+ sir = smsSubInfoList.get(value);
+ if ( sir != null) {
+ setDefaultSmsSubId(context, sir.getSubscriptionId());
+ } else {
+ isSmsPrompt = true;
+ }
+ Log.d(TAG, "SubscriptionInfo:" + sir);
+ }
+ Log.d(TAG, "isSmsPrompt: " + isSmsPrompt);
+ try {
+ mExtTelephony.setSMSPromptEnabled(isSmsPrompt);
+ } catch (RemoteException ex) {
+ Log.e(TAG, "RemoteException @setSMSPromptEnabled" + ex);
+ } catch (NullPointerException ex) {
+ Log.e(TAG, "NullPointerException @setSMSPromptEnabled" + ex);
+ }
break;
default:
throw new IllegalArgumentException("Invalid dialog type "
@@ -222,6 +248,18 @@ public class SimDialogActivity extends Activity {
callsSubInfoList.add(null);
}
}
+ } else if ((id == SMS_PICK)){
+ list.add(getResources().getString(R.string.sim_sms_ask_first_prefs_title));
+ smsSubInfoList.add(null);
+ for (int i = 0; i < selectableSubInfoLength; ++i) {
+ final SubscriptionInfo sir = subInfoList.get(i);
+ smsSubInfoList.add(sir);
+ CharSequence displayName = sir.getDisplayName();
+ if (displayName == null) {
+ displayName = "";
+ }
+ list.add(displayName.toString());
+ }
} else {
for (int i = 0; i < selectableSubInfoLength; ++i) {
final SubscriptionInfo sir = subInfoList.get(i);
@@ -238,7 +276,8 @@ public class SimDialogActivity extends Activity {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
ListAdapter adapter = new SelectAccountListAdapter(
- id == CALLS_PICK ? callsSubInfoList : subInfoList,
+ id == CALLS_PICK ? callsSubInfoList :
+ (id == SMS_PICK ? smsSubInfoList: subInfoList),
builder.getContext(),
R.layout.select_account_list_item,
arr, id);
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index f39f349..604608e 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -85,6 +85,9 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
private static final String SIM_ACTIVITIES_CATEGORY = "sim_activities";
private static final String KEY_PRIMARY_SUB_SELECT = "select_primary_sub";
+ private IExtTelephony mExtTelephony = IExtTelephony.Stub.
+ asInterface(ServiceManager.getService("extphone"));
+
/**
* By UX design we use only one Subscription Information(SubInfo) record per SIM slot.
* mAvalableSubInfos is the list of SubInfos we present to the user.
@@ -210,14 +213,23 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
private void updateSmsValues() {
final Preference simPref = findPreference(KEY_SMS);
- final SubscriptionInfo sir = mSubscriptionManager.getDefaultSmsSubscriptionInfo();
simPref.setTitle(R.string.sms_messages_title);
- if (DBG) log("[updateSmsValues] mSubInfoList=" + mSubInfoList);
-
- if (sir != null) {
+ boolean isSMSPrompt = false;
+ SubscriptionInfo sir = mSubscriptionManager.getActiveSubscriptionInfo(
+ mSubscriptionManager.getDefaultSmsSubId());
+ try {
+ isSMSPrompt = mExtTelephony.isSMSPromptEnabled();
+ } catch (RemoteException ex) {
+ loge("RemoteException @isSMSPromptEnabled" + ex);
+ } catch (NullPointerException ex) {
+ loge("NullPointerException @isSMSPromptEnabled" + ex);
+ }
+ log("[updateSmsValues] isSMSPrompt: " + isSMSPrompt);
+ if (isSMSPrompt || sir == null) {
+ simPref.setSummary(mContext.getResources().getString(
+ R.string.sim_sms_ask_first_prefs_title));
+ } else {
simPref.setSummary(sir.getDisplayName());
- } else if (sir == null) {
- simPref.setSummary(R.string.sim_selection_required_pref);
}
simPref.setEnabled(mSelectableSubInfos.size() > 1);
}
@@ -322,6 +334,9 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
return true;
}
+ private void loge(String msg) {
+ if (DBG) Log.e(TAG + "message", msg);
+ }
private void simEnablerUpdate() {
if (isAdded()) {
@@ -846,7 +861,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
}
private void loge(String msg) {
- if (DBG) Log.e(TAG + "(" + mSlotId + ")", msg);
+ Log.e(TAG + "(" + mSlotId + ")", msg);
}
}