Merge "Minor cleanup in EncryptionInterstitial" into lmp-mr1-dev
diff --git a/res/layout/select_account_list_item.xml b/res/layout/select_account_list_item.xml
new file mode 100644
index 0000000..d80fef5
--- /dev/null
+++ b/res/layout/select_account_list_item.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!-- Layout of a single item in the InCallUI Account Chooser Dialog. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="4dp" >
+
+ <ImageView android:id="@+id/icon"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:scaleType="center" />
+
+ <TextView android:id="@+id/text"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:gravity="start|center_vertical"
+ android:layout_marginLeft="8dp"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="match_parent" />
+</LinearLayout>
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index 5887519..5ee4fa0 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -23,6 +23,7 @@
import android.content.IntentFilter;
import android.graphics.drawable.Drawable;
import android.os.BatteryStats;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -287,6 +288,9 @@
if (percentOfTotal < 10) {
continue;
}
+ if ("user".equals(Build.TYPE)) {
+ continue;
+ }
}
if (sipper.drainType == BatterySipper.DrainType.UNACCOUNTED) {
// Don't show over-counted unless it is at least 1/2 the size of
@@ -297,6 +301,9 @@
if (percentOfTotal < 5) {
continue;
}
+ if ("user".equals(Build.TYPE)) {
+ continue;
+ }
}
final UserHandle userHandle = new UserHandle(UserHandle.getUserId(sipper.getUid()));
final BatteryEntry entry = new BatteryEntry(getActivity(), mHandler, mUm, sipper);
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index cd556b6..e1272ff 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -360,7 +360,10 @@
if (value != 0) {
sir = mAvailableSubInfos.get(value -1);
SubscriptionManager.setDefaultVoiceSubId(sir.subId);
- } //have to figure out value of subid when user selects "ask everytime"
+ } else {
+ SubscriptionManager
+ .setDefaultVoiceSubId(SubscriptionManager.ASK_USER_SUB_ID);
+ }
} else if (id == SMS_PICK) {
sir = mAvailableSubInfos.get(value);
SubscriptionManager.setDefaultSmsSubId(sir.subId);
@@ -381,11 +384,13 @@
String[] arr = new String[availableSubInfoLength];
arr = list.toArray(arr);
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
- android.R.layout.simple_list_item_1, arr);
-
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ ListAdapter adapter = new SelectAccountListAdapter(
+ builder.getContext(),
+ R.layout.select_account_list_item,
+ arr);
+
if (id == DATA_PICK) {
builder.setTitle(R.string.select_sim_for_data);
} else if (id == CALLS_PICK) {
@@ -398,6 +403,49 @@
.create();
}
+ private class SelectAccountListAdapter extends ArrayAdapter<String> {
+ private Context mContext;
+ private int mResId;
+
+ public SelectAccountListAdapter(
+ Context context, int resource, String[] arr) {
+ super(context, resource, arr);
+ mContext = context;
+ mResId = resource;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ LayoutInflater inflater = (LayoutInflater)
+ mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ View rowView;
+ final ViewHolder holder;
+
+ if (convertView == null) {
+ // Cache views for faster scrolling
+ rowView = inflater.inflate(mResId, null);
+ holder = new ViewHolder();
+ holder.textView = (TextView) rowView.findViewById(R.id.text);
+ holder.imageView = (ImageView) rowView.findViewById(R.id.icon);
+ rowView.setTag(holder);
+ }
+ else {
+ rowView = convertView;
+ holder = (ViewHolder) rowView.getTag();
+ }
+
+ holder.textView.setText(getItem(position));
+ holder.imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_sim_sd));
+ return rowView;
+ }
+
+ private class ViewHolder {
+ TextView textView;
+ ImageView imageView;
+ }
+ }
+
private void setActivity(Preference preference, SubInfoRecord sir) {
final String key = preference.getKey();
@@ -431,6 +479,8 @@
if (mSubInfoRecord != null) {
if(TextUtils.isEmpty(mSubInfoRecord.displayName)) {
setTitle(getCarrierName());
+ mSubInfoRecord.displayName = getCarrierName();
+ SubscriptionManager.setDisplayName(getCarrierName(), mSubInfoRecord.subId);
} else {
setTitle(mSubInfoRecord.displayName);
}
@@ -498,6 +548,9 @@
SubscriptionManager.setDisplayName(mSubInfoRecord.displayName,
mSubInfoRecord.subId);
+ findRecordBySubId(mSubInfoRecord.subId).displayName =
+ nameText.getText().toString();
+
updateAllOptions();
update();
}