Merge "[FRP] Transitions for lock screen setup" into lmp-mr1-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 33d96b7..86dada9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2037,6 +2037,15 @@
android:resource="@id/sim_settings" />
</activity>
+ <activity android:name=".sim.SimDialogActivity"
+ android:theme="@android:style/Theme.Material.Light.Dialog.NoActionBar"
+ android:label="@string/sim_settings_title">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
<provider
android:name=".search.SettingsSearchIndexablesProvider"
android:authorities="com.android.settings"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 37239ff..3e115ad 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2113,6 +2113,10 @@
<string name="sim_change_data_title">Change data SIM?</string>
<!-- Message confirming the user wishes to change the default data SIM from one to another. [CHAR LIMIT=NONE] -->
<string name="sim_change_data_message">Use <xliff:g id="new_sim">%1$s</xliff:g> instead of <xliff:g id="old_sim">%2$s</xliff:g> for cellular data?</string>
+ <!-- Title for the dialog asking to user to change the preferred SIM [CHAR LIMIT=30] -->
+ <string name="sim_preferred_title">Update preferred SIM card?</string>
+ <!-- Message for the dialog asking to user to change the preferred SIM [CHAR LIMIT=NONE] -->
+ <string name="sim_preferred_message"><xliff:g id="new_sim">%1$s</xliff:g> is the only SIM in your device. Do you want to use this SIM for cellular data, calls, and SMS messages?</string>
<!-- Instructions telling the user that they entered the wrong SIM PIN for the last time.
Displayed in a dialog box. [CHAR LIMIT=100] -->
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index 58208fa..1c17ce5 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -761,20 +761,25 @@
mDataEnabledSupported = isOwner;
mDisableAtLimitSupported = true;
- // TODO: remove mobile tabs when SIM isn't ready
+ // TODO: remove mobile tabs when SIM isn't ready probably by
+ // TODO: using SubscriptionManager.getActiveSubscriptionInfoList.
+ if (LOGD) Log.d(TAG, "updateBody() isMobileTab=" + isMobileTab(currentTab));
if (isMobileTab(currentTab)) {
+ if (LOGD) Log.d(TAG, "updateBody() mobile tab");
setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_mobile);
setPreferenceTitle(mDisableAtLimitView, R.string.data_usage_disable_mobile_limit);
mTemplate = buildTemplateMobileAll(getActiveSubscriberId(context,getSubId(currentTab)));
mDataEnabledSupported = isMobileDataAvailable(getSubId(currentTab));
} else if (TAB_3G.equals(currentTab)) {
+ if (LOGD) Log.d(TAG, "updateBody() 3g tab");
setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_3g);
setPreferenceTitle(mDisableAtLimitView, R.string.data_usage_disable_3g_limit);
// TODO: bind mDataEnabled to 3G radio state
mTemplate = buildTemplateMobile3gLower(getActiveSubscriberId(context));
} else if (TAB_4G.equals(currentTab)) {
+ if (LOGD) Log.d(TAG, "updateBody() 4g tab");
setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_4g);
setPreferenceTitle(mDisableAtLimitView, R.string.data_usage_disable_4g_limit);
// TODO: bind mDataEnabled to 4G radio state
@@ -782,17 +787,20 @@
} else if (TAB_WIFI.equals(currentTab)) {
// wifi doesn't have any controls
+ if (LOGD) Log.d(TAG, "updateBody() wifi tab");
mDataEnabledSupported = false;
mDisableAtLimitSupported = false;
mTemplate = buildTemplateWifiWildcard();
} else if (TAB_ETHERNET.equals(currentTab)) {
// ethernet doesn't have any controls
+ if (LOGD) Log.d(TAG, "updateBody() ethernet tab");
mDataEnabledSupported = false;
mDisableAtLimitSupported = false;
mTemplate = buildTemplateEthernet();
} else {
+ if (LOGD) Log.d(TAG, "updateBody() unknown tab");
throw new IllegalStateException("unknown tab: " + currentTab);
}
@@ -1389,12 +1397,15 @@
@Deprecated
private boolean isMobilePolicySplit() {
final Context context = getActivity();
+ boolean retVal;
if (hasReadyMobileRadio(context)) {
final TelephonyManager tele = TelephonyManager.from(context);
- return mPolicyEditor.isMobilePolicySplit(getActiveSubscriberId(context));
+ retVal = mPolicyEditor.isMobilePolicySplit(getActiveSubscriberId(context));
} else {
- return false;
+ retVal = false;
}
+ if (LOGD) Log.d(TAG, "isMobilePolicySplit: retVal=" + retVal);
+ return retVal;
}
@Deprecated
@@ -1402,6 +1413,7 @@
final Context context = getActivity();
if (hasReadyMobileRadio(context)) {
final TelephonyManager tele = TelephonyManager.from(context);
+ if (LOGD) Log.d(TAG, "setMobilePolicySplit: split=" + split);
mPolicyEditor.setMobilePolicySplit(getActiveSubscriberId(context), split);
}
}
@@ -1409,12 +1421,16 @@
private static String getActiveSubscriberId(Context context) {
final TelephonyManager tele = TelephonyManager.from(context);
final String actualSubscriberId = tele.getSubscriberId();
- return SystemProperties.get(TEST_SUBSCRIBER_PROP, actualSubscriberId);
+ String retVal = SystemProperties.get(TEST_SUBSCRIBER_PROP, actualSubscriberId);
+ if (LOGD) Log.d(TAG, "getActiveSubscriberId=" + retVal + " actualSubscriberId=" + actualSubscriberId);
+ return retVal;
}
private static String getActiveSubscriberId(Context context, int subId) {
final TelephonyManager tele = TelephonyManager.from(context);
- return tele.getSubscriberId(subId);
+ String retVal = tele.getSubscriberId(subId);
+ if (LOGD) Log.d(TAG, "getActiveSubscriberId=" + retVal + " subId=" + subId);
+ return retVal;
}
private DataUsageChartListener mChartListener = new DataUsageChartListener() {
@@ -2367,14 +2383,23 @@
SubscriptionManager.from(context).getActiveSubscriptionInfoList();
// No activated Subscriptions
if (subInfoList == null) {
+ if (LOGD) Log.d(TAG, "hasReadyMobileRadio: subInfoList=null");
return false;
}
// require both supported network and ready SIM
boolean isReady = true;
for (SubscriptionInfo subInfo : subInfoList) {
isReady = isReady & tele.getSimState(subInfo.getSimSlotIndex()) == SIM_STATE_READY;
+ if (LOGD) Log.d(TAG, "hasReadyMobileRadio: subInfo=" + subInfo);
}
- return conn.isNetworkSupported(TYPE_MOBILE) && isReady;
+ boolean retVal = conn.isNetworkSupported(TYPE_MOBILE) && isReady;
+ if (LOGD) {
+ Log.d(TAG, "hasReadyMobileRadio:"
+ + " conn.isNetworkSupported(TYPE_MOBILE)="
+ + conn.isNetworkSupported(TYPE_MOBILE)
+ + " isReady=" + isReady);
+ }
+ return retVal;
}
/*
@@ -2390,7 +2415,11 @@
final int slotId = SubscriptionManager.getSlotId(subId);
final boolean isReady = tele.getSimState(slotId) == SIM_STATE_READY;
- return conn.isNetworkSupported(TYPE_MOBILE) && isReady;
+ boolean retVal = conn.isNetworkSupported(TYPE_MOBILE) && isReady;
+ if (LOGD) Log.d(TAG, "hasReadyMobileRadio: subId=" + subId
+ + " conn.isNetworkSupported(TYPE_MOBILE)=" + conn.isNetworkSupported(TYPE_MOBILE)
+ + " isReady=" + isReady);
+ return retVal;
}
/**
@@ -2616,6 +2645,8 @@
mTabHost.addTab(buildTabSpec(mMobileTagMap.get(subInfo.getSubscriptionId()),
subInfo.getDisplayName()));
}
+ } else {
+ if (LOGD) Log.d(TAG, "addMobileTab: subInfoList is null");
}
}
@@ -2640,17 +2671,13 @@
* @return The map or null if no activated subscription
*/
private Map<Integer, String> initMobileTabTag(List<SubscriptionInfo> subInfoList) {
- final Context context = getActivity();
Map<Integer, String> map = null;
if (subInfoList != null) {
String mobileTag;
map = new HashMap<Integer, String>();
- for (int i = 0; i < mTelephonyManager.getSimCount(); i++) {
- final SubscriptionInfo subInfo = Utils.findRecordBySlotId(context, i);
- mobileTag = TAB_MOBILE + i;
- if (subInfo != null) {
- map.put(subInfo.getSubscriptionId(), mobileTag);
- }
+ for (SubscriptionInfo subInfo : subInfoList) {
+ mobileTag = TAB_MOBILE + String.valueOf(subInfo.getSubscriptionId());
+ map.put(subInfo.getSubscriptionId(), mobileTag);
}
}
return map;
diff --git a/src/com/android/settings/fuelgauge/BatterySaverSettings.java b/src/com/android/settings/fuelgauge/BatterySaverSettings.java
index 94620cc..e6b90a7 100644
--- a/src/com/android/settings/fuelgauge/BatterySaverSettings.java
+++ b/src/com/android/settings/fuelgauge/BatterySaverSettings.java
@@ -63,7 +63,10 @@
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- if (mCreated) return;
+ if (mCreated) {
+ mSwitchBar.show();
+ return;
+ }
mCreated = true;
addPreferencesFromResource(R.xml.battery_saver_settings);
diff --git a/src/com/android/settings/sim/SimBootReceiver.java b/src/com/android/settings/sim/SimBootReceiver.java
index d3fb996..213a585 100644
--- a/src/com/android/settings/sim/SimBootReceiver.java
+++ b/src/com/android/settings/sim/SimBootReceiver.java
@@ -38,6 +38,7 @@
import java.util.List;
public class SimBootReceiver extends BroadcastReceiver {
+ private static final String TAG = "SimBootReceiver";
private static final int SLOT_EMPTY = -1;
private static final int NOTIFICATION_ID = 1;
private static final String SHARED_PREFERENCES_NAME = "sim_state";
@@ -61,6 +62,9 @@
private void detectChangeAndNotify() {
final int numSlots = mTelephonyManager.getSimCount();
+ boolean notificationSent = false;
+ int numSIMsDetected = 0;
+ int lastSIMSlotDetected = -1;
// Do not create notifications on single SIM devices.
if (numSlots < 2) {
@@ -82,16 +86,32 @@
final int lastSubId = getLastSubId(key);
if (sir != null) {
+ numSIMsDetected++;
final int currentSubId = sir.getSubscriptionId();
if (lastSubId != currentSubId) {
createNotification(mContext);
setLastSubId(key, currentSubId);
+ notificationSent = true;
}
+ lastSIMSlotDetected = i;
} else if (lastSubId != SLOT_EMPTY) {
createNotification(mContext);
setLastSubId(key, SLOT_EMPTY);
+ notificationSent = true;
}
}
+
+ if (notificationSent) {
+ Intent intent = new Intent(mContext, SimDialogActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ if (numSIMsDetected == 1) {
+ intent.putExtra(SimDialogActivity.DIALOG_TYPE_KEY, SimDialogActivity.PREFERRED_PICK);
+ intent.putExtra(SimDialogActivity.PREFERRED_SIM, lastSIMSlotDetected);
+ } else {
+ intent.putExtra(SimDialogActivity.DIALOG_TYPE_KEY, SimDialogActivity.DATA_PICK);
+ }
+ mContext.startActivity(intent);
+ }
}
private int getLastSubId(String strSlotId) {
@@ -141,4 +161,5 @@
detectChangeAndNotify();
}
};
+
}
diff --git a/src/com/android/settings/sim/SimDialogActivity.java b/src/com/android/settings/sim/SimDialogActivity.java
new file mode 100644
index 0000000..cf3ccdf
--- /dev/null
+++ b/src/com/android/settings/sim/SimDialogActivity.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.sim;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.telecom.PhoneAccount;
+import android.telecom.PhoneAccountHandle;
+import android.telecom.TelecomManager;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListAdapter;
+import android.widget.TextView;
+
+import com.android.settings.R;
+import com.android.settings.Utils;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class SimDialogActivity extends Activity {
+ private static String TAG = "SimDialogActivity";
+
+ public static String PREFERRED_SIM = "preferred_sim";
+ public static String DIALOG_TYPE_KEY = "dialog_type";
+ public static final int INVALID_PICK = -1;
+ public static final int DATA_PICK = 0;
+ public static final int CALLS_PICK = 1;
+ public static final int SMS_PICK = 2;
+ public static final int PREFERRED_PICK = 3;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ final Bundle extras = getIntent().getExtras();
+ final int dialogType = extras.getInt(DIALOG_TYPE_KEY, INVALID_PICK);
+
+ switch (dialogType) {
+ case DATA_PICK:
+ case CALLS_PICK:
+ case SMS_PICK:
+ createDialog(this, dialogType).show();
+ break;
+ case PREFERRED_PICK:
+ displayPreferredDialog(extras.getInt(PREFERRED_SIM));
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid dialog type " + dialogType + " sent.");
+ }
+
+ }
+
+ private void displayPreferredDialog(final int slotId) {
+ final Resources res = getResources();
+ final Context context = getApplicationContext();
+ final SubscriptionInfo sir = Utils.findRecordBySlotId(context, slotId);
+
+ AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
+ alertDialogBuilder.setTitle(R.string.sim_preferred_title);
+ alertDialogBuilder.setMessage(res.getString(
+ R.string.sim_preferred_message, sir.getDisplayName()));
+
+ alertDialogBuilder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ final int subId = sir.getSubscriptionId();
+ PhoneAccountHandle phoneAccountHandle = subscriptionIdToPhoneAccountHandle(subId);
+ setDefaultDataSubId(context, subId);
+ setDefaultSmsSubId(context, subId);
+ setUserSelectedOutgoingPhoneAccount(phoneAccountHandle);
+ finish();
+ }
+ });
+ alertDialogBuilder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog,int id) {
+ finish();
+ }
+ });
+
+ alertDialogBuilder.create().show();
+ }
+
+ private static void setDefaultDataSubId(final Context context, final int subId) {
+ final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
+ subscriptionManager.setDefaultDataSubId(subId);
+ }
+
+ private static void setDefaultSmsSubId(final Context context, final int subId) {
+ final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
+ subscriptionManager.setDefaultSmsSubId(subId);
+ }
+
+ private void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle phoneAccount) {
+ final TelecomManager telecomManager = TelecomManager.from(this);
+ telecomManager.setUserSelectedOutgoingPhoneAccount(phoneAccount);
+ }
+
+ private PhoneAccountHandle subscriptionIdToPhoneAccountHandle(final int subId) {
+ final TelecomManager telecomManager = TelecomManager.from(this);
+ final Iterator<PhoneAccountHandle> phoneAccounts =
+ telecomManager.getCallCapablePhoneAccounts().listIterator();
+
+ while (phoneAccounts.hasNext()) {
+ final PhoneAccountHandle phoneAccountHandle = phoneAccounts.next();
+ final PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle);
+ final String phoneAccountId = phoneAccountHandle.getId();
+
+ if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)
+ && TextUtils.isDigitsOnly(phoneAccountId)
+ && Integer.parseInt(phoneAccountId) == subId){
+ return phoneAccountHandle;
+ }
+ }
+
+ return null;
+ }
+
+ public Dialog createDialog(final Context context, final int id) {
+ final ArrayList<String> list = new ArrayList<String>();
+ final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
+ final List<SubscriptionInfo> subInfoList =
+ subscriptionManager.getActiveSubscriptionInfoList();
+ final int selectableSubInfoLength = subInfoList.size();
+
+ final DialogInterface.OnClickListener selectionListener =
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int value) {
+
+ final SubscriptionInfo sir;
+
+ switch (id) {
+ case DATA_PICK:
+ sir = subInfoList.get(value);
+ setDefaultDataSubId(context, sir.getSubscriptionId());
+ break;
+ case CALLS_PICK:
+ final TelecomManager telecomManager =
+ TelecomManager.from(context);
+ final List<PhoneAccountHandle> phoneAccountsList =
+ telecomManager.getCallCapablePhoneAccounts();
+ setUserSelectedOutgoingPhoneAccount(
+ value < 1 ? null : phoneAccountsList.get(value - 1));
+ break;
+ case SMS_PICK:
+ sir = subInfoList.get(value);
+ setDefaultSmsSubId(context, sir.getSubscriptionId());
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid dialog type "
+ + id + " in SIM dialog.");
+ }
+
+ finish();
+ }
+ };
+
+ Dialog.OnKeyListener keyListener = new Dialog.OnKeyListener() {
+ @Override
+ public boolean onKey(DialogInterface arg0, int keyCode,
+ KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_BACK) {
+ finish();
+ }
+ return true;
+ }
+ };
+
+ if (id == CALLS_PICK) {
+ final TelecomManager telecomManager = TelecomManager.from(context);
+ final Iterator<PhoneAccountHandle> phoneAccounts =
+ telecomManager.getCallCapablePhoneAccounts().listIterator();
+
+ list.add(getResources().getString(R.string.sim_calls_ask_first_prefs_title));
+ while (phoneAccounts.hasNext()) {
+ final PhoneAccount phoneAccount =
+ telecomManager.getPhoneAccount(phoneAccounts.next());
+ list.add((String)phoneAccount.getLabel());
+ }
+ } else {
+ for (int i = 0; i < selectableSubInfoLength; ++i) {
+ final SubscriptionInfo sir = subInfoList.get(i);
+ CharSequence displayName = sir.getDisplayName();
+ if (displayName == null) {
+ displayName = "";
+ }
+ list.add(displayName.toString());
+ }
+ }
+
+ String[] arr = list.toArray(new String[0]);
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+
+ ListAdapter adapter = new SelectAccountListAdapter(
+ subInfoList,
+ builder.getContext(),
+ R.layout.select_account_list_item,
+ arr, id);
+
+ switch (id) {
+ case DATA_PICK:
+ builder.setTitle(R.string.select_sim_for_data);
+ break;
+ case CALLS_PICK:
+ builder.setTitle(R.string.select_sim_for_calls);
+ break;
+ case SMS_PICK:
+ builder.setTitle(R.string.sim_card_select_title);
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid dialog type "
+ + id + " in SIM dialog.");
+ }
+
+ Dialog dialog = builder.setAdapter(adapter, selectionListener).create();
+ dialog.setOnKeyListener(keyListener);
+
+ return dialog;
+
+ }
+
+ private class SelectAccountListAdapter extends ArrayAdapter<String> {
+ private Context mContext;
+ private int mResId;
+ private int mDialogId;
+ private final float OPACITY = 0.54f;
+ private List<SubscriptionInfo> mSubInfoList;
+
+ public SelectAccountListAdapter(List<SubscriptionInfo> subInfoList,
+ Context context, int resource, String[] arr, int dialogId) {
+ super(context, resource, arr);
+ mContext = context;
+ mResId = resource;
+ mDialogId = dialogId;
+ mSubInfoList = subInfoList;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ LayoutInflater inflater = (LayoutInflater)
+ mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View rowView;
+ final ViewHolder holder;
+ SubscriptionInfo sir;
+
+ if (convertView == null) {
+ // Cache views for faster scrolling
+ rowView = inflater.inflate(mResId, null);
+ holder = new ViewHolder();
+ holder.title = (TextView) rowView.findViewById(R.id.title);
+ holder.summary = (TextView) rowView.findViewById(R.id.summary);
+ holder.icon = (ImageView) rowView.findViewById(R.id.icon);
+ rowView.setTag(holder);
+ } else {
+ rowView = convertView;
+ holder = (ViewHolder) rowView.getTag();
+ }
+
+ if (mDialogId == CALLS_PICK) {
+ holder.title.setText(getItem(position));
+ holder.summary.setText("");
+ holder.icon.setImageDrawable(getResources()
+ .getDrawable(R.drawable.ic_live_help));
+ holder.icon.setAlpha(OPACITY);
+ } else {
+ sir = mSubInfoList.get(position);
+ holder.title.setText(sir.getDisplayName());
+ holder.summary.setText(sir.getNumber());
+ holder.icon.setImageBitmap(sir.createIconBitmap(mContext));
+ }
+ return rowView;
+ }
+
+ private class ViewHolder {
+ TextView title;
+ TextView summary;
+ ImageView icon;
+ }
+ }
+}
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index 69dbbe0..6c3ddb5 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.content.ContentUris;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Paint;
@@ -264,14 +265,21 @@
@Override
public boolean onPreferenceTreeClick(final PreferenceScreen preferenceScreen,
final Preference preference) {
+ final Context context = getActivity();
+ Intent intent = new Intent(context, SimDialogActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
if (preference instanceof SimPreference) {
((SimPreference)preference).createEditDialog((SimPreference)preference);
} else if (findPreference(KEY_CELLULAR_DATA) == preference) {
- showDialog(DATA_PICK);
+ intent.putExtra(SimDialogActivity.DIALOG_TYPE_KEY, SimDialogActivity.DATA_PICK);
+ context.startActivity(intent);
} else if (findPreference(KEY_CALLS) == preference) {
- showDialog(CALLS_PICK);
+ intent.putExtra(SimDialogActivity.DIALOG_TYPE_KEY, SimDialogActivity.CALLS_PICK);
+ context.startActivity(intent);
} else if (findPreference(KEY_SMS) == preference) {
- showDialog(SMS_PICK);
+ intent.putExtra(SimDialogActivity.DIALOG_TYPE_KEY, SimDialogActivity.SMS_PICK);
+ context.startActivity(intent);
}
return true;