diff --git a/res/layout/manage_applications.xml b/res/layout/manage_applications.xml
index 078322ace63..2d6678a958f 100755
--- a/res/layout/manage_applications.xml
+++ b/res/layout/manage_applications.xml
@@ -43,9 +43,11 @@
android:layout_height="wrap_content"
android:layout_marginTop="-5dp"
android:orientation="horizontal"
+ android:clipChildren="false"
+ android:clipToPadding="false"
android:paddingTop="30dp"
- android:paddingLeft="2dp"
- android:paddingRight="2dp"
+ android:paddingLeft="4dp"
+ android:paddingRight="4dp"
android:paddingBottom="1dp">
diff --git a/res/layout/running_processes_view.xml b/res/layout/running_processes_view.xml
index 9f01eda3cf3..2e62c487f0e 100644
--- a/res/layout/running_processes_view.xml
+++ b/res/layout/running_processes_view.xml
@@ -41,9 +41,11 @@
android:layout_height="wrap_content"
android:layout_marginTop="-5dp"
android:orientation="horizontal"
+ android:clipChildren="false"
+ android:clipToPadding="false"
android:paddingTop="30dp"
- android:paddingLeft="2dp"
- android:paddingRight="2dp"
+ android:paddingLeft="4dp"
+ android:paddingRight="4dp"
android:paddingBottom="1dp">
diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java
index 95156249313..c08ae5a6502 100644
--- a/src/com/android/settings/applications/ApplicationsState.java
+++ b/src/com/android/settings/applications/ApplicationsState.java
@@ -21,6 +21,7 @@ import android.os.SystemClock;
import android.text.format.Formatter;
import android.util.Log;
+import java.io.File;
import java.text.Collator;
import java.text.Normalizer;
import java.text.Normalizer.Form;
@@ -66,14 +67,17 @@ public class ApplicationsState {
}
public static class AppEntry {
- final String label;
+ final File apkFile;
final long id;
+ String label;
long size;
long cacheSize;
long codeSize;
long dataSize;
+ boolean mounted;
+
String getNormalizedLabel() {
if (normalizedLabel != null) {
return normalizedLabel;
@@ -92,12 +96,47 @@ public class ApplicationsState {
String normalizedLabel;
AppEntry(Context context, ApplicationInfo info, long id) {
- CharSequence label = info.loadLabel(context.getPackageManager());
- this.label = label != null ? label.toString() : info.packageName;
+ apkFile = new File(info.sourceDir);
this.id = id;
this.info = info;
this.size = SIZE_UNKNOWN;
this.sizeStale = true;
+ ensureLabel(context);
+ }
+
+ void ensureLabel(Context context) {
+ if (this.label == null || !this.mounted) {
+ if (!this.apkFile.exists()) {
+ this.mounted = false;
+ this.label = info.packageName;
+ } else {
+ this.mounted = true;
+ CharSequence label = info.loadLabel(context.getPackageManager());
+ this.label = label != null ? label.toString() : info.packageName;
+ }
+ }
+ }
+
+ boolean ensureIconLocked(Context context, PackageManager pm) {
+ if (this.icon == null) {
+ if (this.apkFile.exists()) {
+ this.icon = this.info.loadIcon(pm);
+ return true;
+ } else {
+ this.mounted = false;
+ this.icon = context.getResources().getDrawable(
+ com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
+ }
+ } else if (!this.mounted) {
+ // If the app wasn't mounted but is now mounted, reload
+ // its icon.
+ if (this.apkFile.exists()) {
+ this.mounted = true;
+ this.icon = this.info.loadIcon(pm);
+ return true;
+ }
+ }
+ return false;
}
}
@@ -217,9 +256,11 @@ public class ApplicationsState {
return;
}
boolean avail = Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(actionStr);
- for (String pkgName : pkgList) {
- if (avail) addPackage(pkgName);
- else removePackage(pkgName);
+ if (avail) {
+ for (String pkgName : pkgList) {
+ removePackage(pkgName);
+ addPackage(pkgName);
+ }
}
}
}
@@ -312,6 +353,13 @@ public class ApplicationsState {
for (int i=0; i=0; i--) {
+ sum += mAppEntries.get(i).cacheSize;
+ }
+ }
+ return sum;
+ }
+
int indexOfApplicationInfoLocked(String pkgName) {
for (int i=mApplications.size()-1; i>=0; i--) {
if (mApplications.get(i).packageName.equals(pkgName)) {
@@ -630,16 +687,17 @@ public class ApplicationsState {
synchronized (mEntriesMap) {
for (int i=0; i parent, View view, int position,
long id) {
@@ -738,8 +751,8 @@ public class ManageApplications extends TabActivity implements
for (int i=0; i