Merge "Use style for buttons in setup wizard flow" into honeycomb
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml
index fff1975..0b68d47 100644
--- a/res/layout/installed_app_details.xml
+++ b/res/layout/installed_app_details.xml
@@ -132,6 +132,7 @@
                     android:maxLines="1" />
 
             </LinearLayout>
+
             <LinearLayout
                 android:id="@+id/info_size"
                 android:layout_width="match_parent"
@@ -169,6 +170,44 @@
                     android:maxLines="1" />
 
             </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:baselineAligned="true"
+                android:paddingTop="-1dip">
+                <TextView
+                    android:id="@+id/external_size_prefix"
+                    android:text="@string/external_size_label"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:maxLines="1"
+                    android:paddingTop="6dip"
+                    android:paddingLeft="6dip"/>
+                <ImageView
+                    android:id="@+id/info_size_dots"
+                    android:src="@drawable/dotted_line_480px"
+                    android:layout_width="0dip"
+                    android:layout_weight="1"
+                    android:layout_height="1px"
+                    android:layout_gravity="bottom"
+                    android:layout_marginLeft="1dip"
+                    android:layout_marginRight="1dip"
+                    android:layout_marginBottom="4dip"
+                    android:scaleType="center" />
+                <TextView
+                    android:id="@+id/external_size_text"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:paddingTop="6dip"
+                    android:paddingRight="6dip"
+                    android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:maxLines="1" />
+
+            </LinearLayout>
+
             <!-- Clear data and install location buttons  -->
             <include
                 layout="@layout/two_buttons_panel"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4107951..a1d58bd 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1969,6 +1969,10 @@
     <string name="application_size_label">Application</string>
     <!-- Manage applications, individual application info screen, label under Storage heading.  The amount of sapce taken up by the app's data (for example, downloaded emails or something like that) -->
     <string name="data_size_label">Data</string>
+    <!--  Manage applications, individual application info screen, label under Storage heading.  The amount of space taken up by the app's data on USB storage [CHARSIZE=40] -->
+    <string name="external_size_label" product="nosdcard">USB storage</string>
+    <!--  Manage applications, individual application info screen, label under Storage heading.  The amount of space taken up by the app's data on the SD card [CHARSIZE=40] -->
+    <string name="external_size_label" product="default">SD card</string>
     <!-- Manage applications, individual application info screen, button label under Storage heading. Button to remove the application from the system. -->
     <string name="uninstall_text">Uninstall</string>
     <!-- [CHAR LIMIT=25] Manage applications, individual application info screen, button label under Storage heading. Button to disable an existing application. -->
diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java
index 6e9f2a2..6de8c7f 100644
--- a/src/com/android/settings/applications/ApplicationsState.java
+++ b/src/com/android/settings/applications/ApplicationsState.java
@@ -71,6 +71,7 @@
         long cacheSize;
         long codeSize;
         long dataSize;
+        long externalSize;
     }
     
     public static class AppEntry extends SizeInfo {
@@ -626,9 +627,16 @@
 
     // --------------------------------------------------------------
 
-    private long getTotalSize(PackageStats ps) {
+    private long getTotalInternalSize(PackageStats ps) {
         if (ps != null) {
-            return ps.codeSize+ps.dataSize;
+            return ps.codeSize + ps.dataSize;
+        }
+        return SIZE_INVALID;
+    }
+
+    private long getTotalExternalSize(PackageStats ps) {
+        if (ps != null) {
+            return ps.externalDataSize + ps.externalMediaSize + ps.externalCacheSize;
         }
         return SIZE_INVALID;
     }
@@ -660,15 +668,18 @@
                         synchronized (entry) {
                             entry.sizeStale = false;
                             entry.sizeLoadStart = 0;
-                            long newSize = getTotalSize(stats);
+                            long externalSize = getTotalExternalSize(stats);
+                            long newSize = externalSize + getTotalInternalSize(stats);
                             if (entry.size != newSize ||
                                     entry.cacheSize != stats.cacheSize ||
                                     entry.codeSize != stats.codeSize ||
-                                    entry.dataSize != stats.dataSize) {
+                                    entry.dataSize != stats.dataSize ||
+                                    entry.externalSize != externalSize) {
                                 entry.size = newSize;
                                 entry.cacheSize = stats.cacheSize;
                                 entry.codeSize = stats.codeSize;
                                 entry.dataSize = stats.dataSize;
+                                entry.externalSize = externalSize;
                                 entry.sizeStr = getSizeStr(entry.size);
                                 if (DEBUG) Log.i(TAG, "Set size of " + entry.label + " " + entry
                                         + ": " + entry.sizeStr);
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index de897eb..06d97fc 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -93,6 +93,7 @@
     private TextView mTotalSize;
     private TextView mAppSize;
     private TextView mDataSize;
+    private TextView mExternalSize;
     private ClearUserDataObserver mClearDataObserver;
     // Views related to cache info
     private TextView mCacheSize;
@@ -107,6 +108,7 @@
     private boolean mHaveSizes = false;
     private long mLastCodeSize = -1;
     private long mLastDataSize = -1;
+    private long mLastExternalSize = -1;
     private long mLastCacheSize = -1;
     private long mLastTotalSize = -1;
     
@@ -317,6 +319,7 @@
         mTotalSize = (TextView)view.findViewById(R.id.total_size_text);
         mAppSize = (TextView)view.findViewById(R.id.application_size_text);
         mDataSize = (TextView)view.findViewById(R.id.data_size_text);
+        mExternalSize = (TextView)view.findViewById(R.id.external_size_text);
         
         // Get Control button panel
         View btnPanel = view.findViewById(R.id.control_buttons_panel);
@@ -504,6 +507,10 @@
                 mLastDataSize = mAppEntry.dataSize;
                 mDataSize.setText(getSizeStr(mAppEntry.dataSize));
             }
+            if (mLastExternalSize != mAppEntry.externalSize) {
+                mLastExternalSize = mAppEntry.externalSize;
+                mExternalSize.setText(getSizeStr(mAppEntry.externalSize));
+            }
             if (mLastCacheSize != mAppEntry.cacheSize) {
                 mLastCacheSize = mAppEntry.cacheSize;
                 mCacheSize.setText(getSizeStr(mAppEntry.cacheSize));