Merge "Prevent PIN/Passwword disappearing during boot" into lmp-dev
diff --git a/res/drawable-hdpi/ic_person_white.png b/res/drawable-hdpi/ic_person_white.png
deleted file mode 100644
index 009524a..0000000
--- a/res/drawable-hdpi/ic_person_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_person_white.png b/res/drawable-mdpi/ic_person_white.png
deleted file mode 100644
index 563f1d1..0000000
--- a/res/drawable-mdpi/ic_person_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_person_white.png b/res/drawable-xhdpi/ic_person_white.png
deleted file mode 100644
index 0200ece..0000000
--- a/res/drawable-xhdpi/ic_person_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_person_white.png b/res/drawable-xxhdpi/ic_person_white.png
deleted file mode 100644
index 6a6f033..0000000
--- a/res/drawable-xxhdpi/ic_person_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_person_white.png b/res/drawable-xxxhdpi/ic_person_white.png
deleted file mode 100644
index 9092553..0000000
--- a/res/drawable-xxxhdpi/ic_person_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/ic_avatar_default_1.xml b/res/drawable/ic_avatar_default_1.xml
deleted file mode 100644
index edd919a..0000000
--- a/res/drawable/ic_avatar_default_1.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/pink_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_2.xml b/res/drawable/ic_avatar_default_2.xml
deleted file mode 100644
index 77918a0..0000000
--- a/res/drawable/ic_avatar_default_2.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/indigo_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_3.xml b/res/drawable/ic_avatar_default_3.xml
deleted file mode 100644
index 49fd6c4..0000000
--- a/res/drawable/ic_avatar_default_3.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/blue_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_4.xml b/res/drawable/ic_avatar_default_4.xml
deleted file mode 100644
index 6992f90..0000000
--- a/res/drawable/ic_avatar_default_4.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/teal_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_5.xml b/res/drawable/ic_avatar_default_5.xml
deleted file mode 100644
index 2aa0db2..0000000
--- a/res/drawable/ic_avatar_default_5.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/green_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_6.xml b/res/drawable/ic_avatar_default_6.xml
deleted file mode 100644
index 7f9bb32..0000000
--- a/res/drawable/ic_avatar_default_6.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/light_green_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_7.xml b/res/drawable/ic_avatar_default_7.xml
deleted file mode 100644
index 1c1c5f3..0000000
--- a/res/drawable/ic_avatar_default_7.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/orange_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_8.xml b/res/drawable/ic_avatar_default_8.xml
deleted file mode 100644
index 478454e..0000000
--- a/res/drawable/ic_avatar_default_8.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/deep_orange_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_guest.xml b/res/drawable/ic_avatar_guest.xml
deleted file mode 100644
index f81fe89..0000000
--- a/res/drawable/ic_avatar_guest.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <size android:width="40dp" android:height="40dp" />
- <solid android:color="@color/grey_500" />
- </shape>
- </item>
- <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
- android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_default_user.png b/res/drawable/ic_default_user.png
deleted file mode 100644
index ddf797f..0000000
--- a/res/drawable/ic_default_user.png
+++ /dev/null
Binary files differ
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 58687c9..1c299f5 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -80,18 +80,6 @@
<color name="setup_wizard_preference_background_color_dark">@*android:color/background_material_dark</color>
<color name="setup_wizard_preference_background_color_light">@*android:color/background_material_light</color>
- <!-- Default avatar colors -->
- <color name="pink_500">#ffe91e63</color>
- <color name="indigo_500">#ff3f51b5</color>
- <color name="blue_500">#ff4285f4</color>
- <color name="teal_500">#ff00bcd4</color>
- <color name="green_500">#ff0f9d58</color>
- <color name="light_green_500">#ff8bc34a</color>
- <color name="orange_500">#ffff9800</color>
- <color name="deep_orange_500">#ffff5722</color>
- <!-- Avatar color used for guest -->
- <color name="grey_500">#ff9e9e9e</color>
-
<color name="wifi_divider">#ffe0e0e0</color>
</resources>
diff --git a/src/com/android/settings/UserSpinnerAdapter.java b/src/com/android/settings/UserSpinnerAdapter.java
index 32ef3be..b44caac 100644
--- a/src/com/android/settings/UserSpinnerAdapter.java
+++ b/src/com/android/settings/UserSpinnerAdapter.java
@@ -31,6 +31,7 @@
import android.widget.SpinnerAdapter;
import android.widget.TextView;
+import com.android.internal.util.UserIcons;
import com.android.settings.drawable.CircleFramedDrawable;
import com.android.settings.R;
@@ -57,7 +58,11 @@
} else {
name = userInfo.name;
Bitmap bitmap = um.getUserIcon(userHandle.getIdentifier());
- icon = (bitmap == null) ? null : CircleFramedDrawable.getInstance(context, bitmap);
+ if (bitmap != null) {
+ icon = CircleFramedDrawable.getInstance(context, bitmap);
+ } else {
+ icon = UserIcons.getDefaultUserIcon(userInfo.id, /* light= */ false);
+ }
}
}
}
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 466944d..60bf226 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -70,6 +70,8 @@
import android.widget.ListView;
import android.widget.TabWidget;
+import com.android.internal.util.ImageUtils;
+import com.android.internal.util.UserIcons;
import com.android.settings.UserSpinnerAdapter.UserDetails;
import com.android.settings.dashboard.DashboardCategory;
import com.android.settings.dashboard.DashboardTile;
@@ -847,10 +849,13 @@
* Returns a circular icon for a user.
*/
public static Drawable getUserIcon(Context context, UserManager um, UserInfo user) {
- if (user.iconPath == null) return null;
- Bitmap icon = um.getUserIcon(user.id);
- if (icon == null) return null;
- return CircleFramedDrawable.getInstance(context, icon);
+ if (user.iconPath != null) {
+ Bitmap icon = um.getUserIcon(user.id);
+ if (icon != null) {
+ return CircleFramedDrawable.getInstance(context, icon);
+ }
+ }
+ return UserIcons.getDefaultUserIcon(user.id, /* light= */ false);
}
/**
diff --git a/src/com/android/settings/accounts/AccountSettings.java b/src/com/android/settings/accounts/AccountSettings.java
index f057cbf..3c0d9e9 100644
--- a/src/com/android/settings/accounts/AccountSettings.java
+++ b/src/com/android/settings/accounts/AccountSettings.java
@@ -117,6 +117,7 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
+ mProfileNotAvailablePreference = new Preference(getActivity());
mAuthorities = getActivity().getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
if (mAuthorities != null) {
mAuthoritiesCount = mAuthorities.length;
diff --git a/src/com/android/settings/applications/ProcessStatsUi.java b/src/com/android/settings/applications/ProcessStatsUi.java
index 03e4b75..30a8817 100644
--- a/src/com/android/settings/applications/ProcessStatsUi.java
+++ b/src/com/android/settings/applications/ProcessStatsUi.java
@@ -404,10 +404,11 @@
mAppListGroup.removeAll();
mAppListGroup.setOrderingAsAdded(false);
+ final long elapsedTime = mStats.mTimePeriodEndRealtime-mStats.mTimePeriodStartRealtime;
+
mMemStatusPref.setOrder(-2);
mAppListGroup.addPreference(mMemStatusPref);
- String durationString = Utils.formatElapsedTime(getActivity(),
- mStats.mTimePeriodEndRealtime-mStats.mTimePeriodStartRealtime, false);
+ String durationString = Utils.formatElapsedTime(getActivity(), elapsedTime, false);
CharSequence memString;
CharSequence[] memStatesStr = getResources().getTextArray(R.array.ram_states);
if (mMemState >= 0 && mMemState < memStatesStr.length) {
@@ -480,6 +481,15 @@
int badnessColor = badColors[1 + Math.round(memBadness*(badColors.length-2))];
colors.setColors(badnessColor, badnessColor, badnessColor);
+ // We are now going to scale the mMemTimes to match the total elapsed time.
+ // These are in uptime, so they will often be smaller than the elapsed time,
+ // but if the user taps on the bar we want to show the times to them. It is confusing
+ // to see them be smaller than what we told them the measured duration is, so just
+ // scaling them up with make things look reasonable with them none the wiser.
+ for (int i=0; i<ProcessStats.ADJ_MEM_FACTOR_COUNT; i++) {
+ mMemTimes[i] = (long)((mMemTimes[i]*(double)elapsedTime)/mTotalTime);
+ }
+
ProcessStats.TotalMemoryUseCollection totalMem = new ProcessStats.TotalMemoryUseCollection(
ProcessStats.ALL_SCREEN_ADJ, memStates);
mStats.computeTotalMemoryUse(totalMem, now);
@@ -728,15 +738,22 @@
if (DEBUG) Log.d(TAG, "-------------------- BUILDING UI");
- for (int i=0, N=(entries != null ? entries.size() : 0); i<N; i++) {
+ // Find where we should stop. Because we have two properties we are looking at,
+ // we need to go from the back looking for the first place either holds.
+ int end = entries != null ? entries.size()-1 : -1;
+ while (end >= 0) {
+ ProcStatsEntry proc = entries.get(end);
+ final double percentOfWeight = (((double)proc.mWeight) / mMaxWeight) * 100;
+ final double percentOfTime = (((double)proc.mDuration) / memTotalTime) * 100;
+ if (percentOfWeight >= 1 || percentOfTime >= 25) {
+ break;
+ }
+ end--;
+ }
+ for (int i=0; i<=end; i++) {
ProcStatsEntry proc = entries.get(i);
final double percentOfWeight = (((double)proc.mWeight) / mMaxWeight) * 100;
final double percentOfTime = (((double)proc.mDuration) / memTotalTime) * 100;
- if (percentOfWeight < 1 && percentOfTime < 33) {
- if (DEBUG) Log.d(TAG, "Skipping " + proc.mName + " weight=" + percentOfWeight
- + " time=" + percentOfTime);
- continue;
- }
ProcessStatsPreference pref = new ProcessStatsPreference(getActivity());
pref.init(null, proc);
proc.evaluateTargetPackage(pm, mStats, totals, sEntryCompare, mUseUss,
diff --git a/src/com/android/settings/applications/RunningProcessesView.java b/src/com/android/settings/applications/RunningProcessesView.java
index 58b37ec..13d9655 100644
--- a/src/com/android/settings/applications/RunningProcessesView.java
+++ b/src/com/android/settings/applications/RunningProcessesView.java
@@ -75,18 +75,19 @@
View mHeader;
ServiceListAdapter mAdapter;
LinearColorBar mColorBar;
+ TextView mBackgroundProcessPrefix;
+ TextView mAppsProcessPrefix;
+ TextView mForegroundProcessPrefix;
TextView mBackgroundProcessText;
TextView mAppsProcessText;
TextView mForegroundProcessText;
-
- int mLastNumBackgroundProcesses = -1;
- int mLastNumForegroundProcesses = -1;
- int mLastNumServiceProcesses = -1;
- long mLastBackgroundProcessMemory = -1;
- long mLastForegroundProcessMemory = -1;
- long mLastServiceProcessMemory = -1;
- long mLastAvailMemory = -1;
-
+
+ long mCurTotalRam = -1;
+ long mCurHighRam = -1; // "System" or "Used"
+ long mCurMedRam = -1; // "Apps" or "Cached"
+ long mCurLowRam = -1; // "Free"
+ boolean mCurShowCached = false;
+
Dialog mCurDialog;
MemInfoReader mMemInfoReader = new MemInfoReader();
@@ -98,7 +99,7 @@
ViewHolder mHolder;
long mFirstRunTime;
boolean mSetBackground;
-
+
void updateTime(Context context, StringBuilder builder) {
TextView uptimeView = null;
@@ -126,7 +127,7 @@
uptimeView = mHolder.uptime;
}
}
-
+
if (uptimeView != null) {
mSetBackground = false;
if (mFirstRunTime >= 0) {
@@ -228,8 +229,7 @@
mShowBackground = showBackground;
mState.setWatchingBackgroundItems(showBackground);
refreshItems();
- notifyDataSetChanged();
- mColorBar.setShowingGreen(mShowBackground);
+ refreshUi(true);
}
}
@@ -329,53 +329,71 @@
mDataAvail = null;
}
+ mMemInfoReader.readMemInfo();
+
+ /*
// This is the amount of available memory until we start killing
// background services.
- mMemInfoReader.readMemInfo();
long availMem = mMemInfoReader.getFreeSize() + mMemInfoReader.getCachedSize()
- SECONDARY_SERVER_MEM;
if (availMem < 0) {
availMem = 0;
}
+ */
synchronized (mState.mLock) {
- if (mLastNumBackgroundProcesses != mState.mNumBackgroundProcesses
- || mLastBackgroundProcessMemory != mState.mBackgroundProcessMemory
- || mLastNumForegroundProcesses != mState.mNumForegroundProcesses
- || mLastForegroundProcessMemory != mState.mForegroundProcessMemory
- || mLastNumServiceProcesses != mState.mNumServiceProcesses
- || mLastServiceProcessMemory != mState.mServiceProcessMemory
- || mLastAvailMemory != availMem) {
- mLastNumBackgroundProcesses = mState.mNumBackgroundProcesses;
- mLastBackgroundProcessMemory = mState.mBackgroundProcessMemory;
- mLastForegroundProcessMemory = mState.mForegroundProcessMemory;
- mLastServiceProcessMemory = mState.mServiceProcessMemory;
- mLastAvailMemory = availMem;
- long freeMem = mLastAvailMemory + mLastBackgroundProcessMemory;
+ if (mCurShowCached != mAdapter.mShowBackground) {
+ mCurShowCached = mAdapter.mShowBackground;
+ if (mCurShowCached) {
+ mForegroundProcessPrefix.setText(getResources().getText(
+ R.string.running_processes_header_used_prefix));
+ mAppsProcessPrefix.setText(getResources().getText(
+ R.string.running_processes_header_cached_prefix));
+ } else {
+ mForegroundProcessPrefix.setText(getResources().getText(
+ R.string.running_processes_header_system_prefix));
+ mAppsProcessPrefix.setText(getResources().getText(
+ R.string.running_processes_header_apps_prefix));
+ }
+ }
+
+ final long totalRam = mMemInfoReader.getTotalSize();
+ final long medRam;
+ final long lowRam;
+ if (mCurShowCached) {
+ lowRam = mMemInfoReader.getFreeSize() + mMemInfoReader.getCachedSize();
+ medRam = mState.mBackgroundProcessMemory;
+ } else {
+ lowRam = mMemInfoReader.getFreeSize() + mMemInfoReader.getCachedSize()
+ + mState.mBackgroundProcessMemory;
+ medRam = mState.mServiceProcessMemory;
+
+ }
+ final long highRam = totalRam - medRam - lowRam;
+
+ if (mCurTotalRam != totalRam || mCurHighRam != highRam || mCurMedRam != medRam
+ || mCurLowRam != lowRam) {
+ mCurTotalRam = totalRam;
+ mCurHighRam = highRam;
+ mCurMedRam = medRam;
+ mCurLowRam = lowRam;
BidiFormatter bidiFormatter = BidiFormatter.getInstance();
String sizeStr = bidiFormatter.unicodeWrap(
- Formatter.formatShortFileSize(getContext(), freeMem));
+ Formatter.formatShortFileSize(getContext(), lowRam));
mBackgroundProcessText.setText(getResources().getString(
R.string.running_processes_header_ram, sizeStr));
sizeStr = bidiFormatter.unicodeWrap(
- Formatter.formatShortFileSize(getContext(),
- mLastForegroundProcessMemory + mLastServiceProcessMemory));
+ Formatter.formatShortFileSize(getContext(), medRam));
mAppsProcessText.setText(getResources().getString(
R.string.running_processes_header_ram, sizeStr));
sizeStr = bidiFormatter.unicodeWrap(
- Formatter.formatShortFileSize(getContext(),
- mMemInfoReader.getTotalSize() - freeMem
- - mLastForegroundProcessMemory - mLastServiceProcessMemory));
+ Formatter.formatShortFileSize(getContext(), highRam));
mForegroundProcessText.setText(getResources().getString(
R.string.running_processes_header_ram, sizeStr));
+ mColorBar.setRatios(highRam/(float)totalRam,
+ medRam/(float)totalRam,
+ lowRam/(float)totalRam);
}
-
- float totalMem = mMemInfoReader.getTotalSize();
- float totalShownMem = availMem + mLastBackgroundProcessMemory
- + mLastServiceProcessMemory;
- mColorBar.setRatios((totalMem-totalShownMem)/totalMem,
- mLastServiceProcessMemory/totalMem,
- mLastBackgroundProcessMemory/totalMem);
}
}
@@ -435,6 +453,9 @@
mColorBar.setColors(res.getColor(R.color.running_processes_system_ram),
res.getColor(R.color.running_processes_apps_ram),
res.getColor(R.color.running_processes_free_ram));
+ mBackgroundProcessPrefix = (TextView)mHeader.findViewById(R.id.freeSizePrefix);
+ mAppsProcessPrefix = (TextView)mHeader.findViewById(R.id.appsSizePrefix);
+ mForegroundProcessPrefix = (TextView)mHeader.findViewById(R.id.systemSizePrefix);
mBackgroundProcessText = (TextView)mHeader.findViewById(R.id.freeSize);
mAppsProcessText = (TextView)mHeader.findViewById(R.id.appsSize);
mForegroundProcessText = (TextView)mHeader.findViewById(R.id.systemSize);
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 1282409..826a451 100755
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -392,7 +392,7 @@
final CachedBluetoothDevice device = (CachedBluetoothDevice) v.getTag();
final Activity activity = getActivity();
- DeviceProfilesSettings profileFrag = (DeviceProfilesSettings)activity.
+ DeviceProfilesSettings profileFragment = (DeviceProfilesSettings)activity.
getFragmentManager().findFragmentById(R.id.bluetooth_fragment_settings);
if (mSettingsDialogView != null){
@@ -402,23 +402,26 @@
}
}
- if (profileFrag == null) {
+ if (profileFragment == null) {
LayoutInflater inflater = getActivity().getLayoutInflater();
mSettingsDialogView = inflater.inflate(R.layout.bluetooth_device_settings, null);
- profileFrag = (DeviceProfilesSettings)activity.getFragmentManager()
+ profileFragment = (DeviceProfilesSettings)activity.getFragmentManager()
.findFragmentById(R.id.bluetooth_fragment_settings);
// To enable scrolling we store the name field in a seperate header and add to
- // the ListView of the profileFrag.
+ // the ListView of the profileFragment.
View header = inflater.inflate(R.layout.bluetooth_device_settings_header, null);
- profileFrag.getListView().addHeaderView(header);
+ profileFragment.getListView().addHeaderView(header);
}
final View dialogLayout = mSettingsDialogView;
AlertDialog.Builder settingsDialog = new AlertDialog.Builder(activity);
- profileFrag.setDevice(device);
+ profileFragment.setDevice(device);
final EditText deviceName = (EditText)dialogLayout.findViewById(R.id.name);
deviceName.setText(device.getName(), TextView.BufferType.EDITABLE);
+
+ final DeviceProfilesSettings dpsFragment = profileFragment;
+ final Context context = v.getContext();
settingsDialog.setView(dialogLayout);
settingsDialog.setTitle(R.string.bluetooth_preference_paired_devices);
settingsDialog.setPositiveButton(R.string.okay,
@@ -429,7 +432,7 @@
device.setName(deviceName.getText().toString());
}
});
- final Context context = v.getContext();
+
settingsDialog.setNegativeButton(R.string.forget,
new DialogInterface.OnClickListener() {
@Override
@@ -442,6 +445,16 @@
}
});
+ // We must ensure that the fragment gets destroyed to avoid duplicate fragments.
+ settingsDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
+ public void onDismiss(final DialogInterface dialog) {
+ if (!activity.isDestroyed()) {
+ activity.getFragmentManager().beginTransaction().remove(dpsFragment)
+ .commitAllowingStateLoss();
+ }
+ }
+ });
+
AlertDialog dialog = settingsDialog.create();
dialog.create();
dialog.show();
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
index ee25300..5c2beba 100755
--- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
+++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
@@ -232,7 +232,7 @@
status == BluetoothProfile.STATE_CONNECTED;
if (isConnected) {
- askDisconnect(getActivity(), profile);
+ askDisconnect(mManager.getForegroundActivity(), profile);
} else {
if (profile.isPreferred(device)) {
// profile is preferred but not connected: disable auto-connect
diff --git a/src/com/android/settings/drawable/CircleFramedDrawable.java b/src/com/android/settings/drawable/CircleFramedDrawable.java
index f68dace..97c96a0 100644
--- a/src/com/android/settings/drawable/CircleFramedDrawable.java
+++ b/src/com/android/settings/drawable/CircleFramedDrawable.java
@@ -107,7 +107,7 @@
canvas.drawPath(fillPath, mPaint);
// mask in the icon where the bitmap is opaque
- mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
+ mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(icon, cropRect, circleRect, mPaint);
// prepare paint for frame drawing
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
index 7aebb17..c16708d 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
@@ -1011,7 +1011,7 @@
mTimeRemainPath.close();
}
- if (mStartWallTime > 0) {
+ if (mStartWallTime > 0 && mEndWallTime > mStartWallTime) {
// Create the time labels at the bottom.
boolean is24hr = is24Hour();
Calendar calStart = Calendar.getInstance();
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index f5ea6aa..0d7b279 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -16,10 +16,6 @@
package com.android.settings.users;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
@@ -37,7 +33,6 @@
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -60,6 +55,7 @@
import android.view.View.OnClickListener;
import android.widget.SimpleAdapter;
+import com.android.internal.util.UserIcons;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.ChooseLockGeneric;
import com.android.settings.OwnerInfoSettings;
@@ -70,6 +66,10 @@
import com.android.settings.Utils;
import com.android.settings.drawable.CircleFramedDrawable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
/**
* Screen that manages the list of users on the device.
* Guest user is an always visible entry, even if the guest is not currently
@@ -119,19 +119,6 @@
private static final String KEY_ADD_USER_LONG_MESSAGE_DISPLAYED =
"key_add_user_long_message_displayed";
- static final int[] USER_DRAWABLES = {
- R.drawable.ic_avatar_default_1,
- R.drawable.ic_avatar_default_2,
- R.drawable.ic_avatar_default_3,
- R.drawable.ic_avatar_default_4,
- R.drawable.ic_avatar_default_5,
- R.drawable.ic_avatar_default_6,
- R.drawable.ic_avatar_default_7,
- R.drawable.ic_avatar_default_8
- };
-
- private static final int GUEST_DRAWABLE_ID = R.drawable.ic_avatar_guest;
-
private static final String KEY_TITLE = "title";
private static final String KEY_SUMMARY = "summary";
@@ -154,10 +141,8 @@
private EditUserInfoController mEditUserInfoController =
new EditUserInfoController();
- // A place to cache the generated guest avatar
- private Drawable mGuestDrawable;
// A place to cache the generated default avatar
- private Drawable mDefaultAvatarDrawable;
+ private Drawable mDefaultIconDrawable;
private Handler mHandler = new Handler() {
@Override
@@ -325,7 +310,7 @@
private void loadProfile() {
if (mIsGuest) {
// No need to load profile information
- mMePreference.setIcon(getEncircledGuestDrawable());
+ mMePreference.setIcon(getEncircledDefaultIcon());
mMePreference.setTitle(R.string.user_exit_guest_title);
return;
}
@@ -423,9 +408,7 @@
Secure.putIntForUser(getContentResolver(),
Secure.LOCATION_MODE, Secure.LOCATION_MODE_OFF, userId);
mUserManager.setUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, true, user);
- Bitmap bitmap = createBitmapFromDrawable(
- USER_DRAWABLES[userId % UserSettings.USER_DRAWABLES.length]);
- mUserManager.setUserIcon(userId, bitmap);
+ assignDefaultPhoto(newUserInfo);
// Add shared accounts
AccountManager am = AccountManager.get(getActivity());
Account [] accounts = am.getAccounts();
@@ -437,15 +420,6 @@
return newUserInfo;
}
- private Bitmap createBitmapFromDrawable(int resId) {
- Drawable icon = getResources().getDrawable(resId);
- icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
- Bitmap bitmap = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(),
- Bitmap.Config.ARGB_8888);
- icon.draw(new Canvas(bitmap));
- return bitmap;
- }
-
private UserInfo createTrustedUser() {
UserInfo newUserInfo = mUserManager.createUser(
getResources().getString(R.string.user_new_user_name), 0);
@@ -787,13 +761,15 @@
}
if (user.iconPath != null) {
if (mUserIcons.get(user.id) == null) {
+ // Icon not loaded yet, print a placeholder
missingIcons.add(user.id);
- pref.setIcon(getEncircledDefaultAvatar());
+ pref.setIcon(getEncircledDefaultIcon());
} else {
setPhotoId(pref, user);
}
} else {
- pref.setIcon(getEncircledDefaultAvatar());
+ // Icon not available yet, print a placeholder
+ pref.setIcon(getEncircledDefaultIcon());
}
}
@@ -803,7 +779,7 @@
null, null);
pref.setEnabled(false);
pref.setTitle(R.string.user_new_user_name);
- pref.setIcon(getEncircledDefaultAvatar());
+ pref.setIcon(getEncircledDefaultIcon());
mUserListCategory.addPreference(pref);
}
@@ -826,7 +802,7 @@
mIsOwner && voiceCapable? this : null /* settings icon handler */,
null /* delete icon handler */);
pref.setTitle(R.string.user_guest);
- pref.setIcon(getEncircledGuestDrawable());
+ pref.setIcon(getEncircledDefaultIcon());
pref.setOnPreferenceClickListener(this);
mUserListCategory.addPreference(pref);
}
@@ -854,7 +830,8 @@
for (int userId : values[0]) {
Bitmap bitmap = mUserManager.getUserIcon(userId);
if (bitmap == null) {
- bitmap = createBitmapFromDrawable(R.drawable.ic_avatar_default_1);
+ bitmap = UserIcons.convertToBitmap(UserIcons.getDefaultUserIcon(userId,
+ /* light= */ false));
}
mUserIcons.append(userId, bitmap);
}
@@ -870,24 +847,17 @@
}
private void assignDefaultPhoto(UserInfo user) {
- Bitmap bitmap = createBitmapFromDrawable(
- USER_DRAWABLES[user.id % UserSettings.USER_DRAWABLES.length]);
+ Bitmap bitmap = UserIcons.convertToBitmap(UserIcons.getDefaultUserIcon(user.id,
+ /* light= */ false));
mUserManager.setUserIcon(user.id, bitmap);
}
- private Drawable getEncircledGuestDrawable() {
- if (mGuestDrawable == null) {
- mGuestDrawable = encircle(createBitmapFromDrawable(GUEST_DRAWABLE_ID));
+ private Drawable getEncircledDefaultIcon() {
+ if (mDefaultIconDrawable == null) {
+ mDefaultIconDrawable = encircle(UserIcons.convertToBitmap(
+ UserIcons.getDefaultUserIcon(UserHandle.USER_NULL, /* light= */ false)));
}
- return mGuestDrawable;
- }
-
- private Drawable getEncircledDefaultAvatar() {
- if (mDefaultAvatarDrawable == null) {
- mDefaultAvatarDrawable =
- encircle(createBitmapFromDrawable(R.drawable.ic_avatar_default_1));
- }
- return mDefaultAvatarDrawable;
+ return mDefaultIconDrawable;
}
private void setPhotoId(Preference pref, UserInfo user) {