Merge "Measure external storage application usage" into honeycomb
This commit is contained in:
@@ -132,6 +132,7 @@
|
|||||||
android:maxLines="1" />
|
android:maxLines="1" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/info_size"
|
android:id="@+id/info_size"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -169,6 +170,44 @@
|
|||||||
android:maxLines="1" />
|
android:maxLines="1" />
|
||||||
|
|
||||||
</LinearLayout>
|
</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 -->
|
<!-- Clear data and install location buttons -->
|
||||||
<include
|
<include
|
||||||
layout="@layout/two_buttons_panel"
|
layout="@layout/two_buttons_panel"
|
||||||
|
@@ -1969,6 +1969,10 @@
|
|||||||
<string name="application_size_label">Application</string>
|
<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) -->
|
<!-- 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>
|
<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. -->
|
<!-- 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>
|
<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. -->
|
<!-- [CHAR LIMIT=25] Manage applications, individual application info screen, button label under Storage heading. Button to disable an existing application. -->
|
||||||
|
@@ -71,6 +71,7 @@ public class ApplicationsState {
|
|||||||
long cacheSize;
|
long cacheSize;
|
||||||
long codeSize;
|
long codeSize;
|
||||||
long dataSize;
|
long dataSize;
|
||||||
|
long externalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AppEntry extends SizeInfo {
|
public static class AppEntry extends SizeInfo {
|
||||||
@@ -626,9 +627,16 @@ public class ApplicationsState {
|
|||||||
|
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
|
|
||||||
private long getTotalSize(PackageStats ps) {
|
private long getTotalInternalSize(PackageStats ps) {
|
||||||
if (ps != null) {
|
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;
|
return SIZE_INVALID;
|
||||||
}
|
}
|
||||||
@@ -660,15 +668,18 @@ public class ApplicationsState {
|
|||||||
synchronized (entry) {
|
synchronized (entry) {
|
||||||
entry.sizeStale = false;
|
entry.sizeStale = false;
|
||||||
entry.sizeLoadStart = 0;
|
entry.sizeLoadStart = 0;
|
||||||
long newSize = getTotalSize(stats);
|
long externalSize = getTotalExternalSize(stats);
|
||||||
|
long newSize = externalSize + getTotalInternalSize(stats);
|
||||||
if (entry.size != newSize ||
|
if (entry.size != newSize ||
|
||||||
entry.cacheSize != stats.cacheSize ||
|
entry.cacheSize != stats.cacheSize ||
|
||||||
entry.codeSize != stats.codeSize ||
|
entry.codeSize != stats.codeSize ||
|
||||||
entry.dataSize != stats.dataSize) {
|
entry.dataSize != stats.dataSize ||
|
||||||
|
entry.externalSize != externalSize) {
|
||||||
entry.size = newSize;
|
entry.size = newSize;
|
||||||
entry.cacheSize = stats.cacheSize;
|
entry.cacheSize = stats.cacheSize;
|
||||||
entry.codeSize = stats.codeSize;
|
entry.codeSize = stats.codeSize;
|
||||||
entry.dataSize = stats.dataSize;
|
entry.dataSize = stats.dataSize;
|
||||||
|
entry.externalSize = externalSize;
|
||||||
entry.sizeStr = getSizeStr(entry.size);
|
entry.sizeStr = getSizeStr(entry.size);
|
||||||
if (DEBUG) Log.i(TAG, "Set size of " + entry.label + " " + entry
|
if (DEBUG) Log.i(TAG, "Set size of " + entry.label + " " + entry
|
||||||
+ ": " + entry.sizeStr);
|
+ ": " + entry.sizeStr);
|
||||||
|
@@ -93,6 +93,7 @@ public class InstalledAppDetails extends Fragment
|
|||||||
private TextView mTotalSize;
|
private TextView mTotalSize;
|
||||||
private TextView mAppSize;
|
private TextView mAppSize;
|
||||||
private TextView mDataSize;
|
private TextView mDataSize;
|
||||||
|
private TextView mExternalSize;
|
||||||
private ClearUserDataObserver mClearDataObserver;
|
private ClearUserDataObserver mClearDataObserver;
|
||||||
// Views related to cache info
|
// Views related to cache info
|
||||||
private TextView mCacheSize;
|
private TextView mCacheSize;
|
||||||
@@ -107,6 +108,7 @@ public class InstalledAppDetails extends Fragment
|
|||||||
private boolean mHaveSizes = false;
|
private boolean mHaveSizes = false;
|
||||||
private long mLastCodeSize = -1;
|
private long mLastCodeSize = -1;
|
||||||
private long mLastDataSize = -1;
|
private long mLastDataSize = -1;
|
||||||
|
private long mLastExternalSize = -1;
|
||||||
private long mLastCacheSize = -1;
|
private long mLastCacheSize = -1;
|
||||||
private long mLastTotalSize = -1;
|
private long mLastTotalSize = -1;
|
||||||
|
|
||||||
@@ -317,6 +319,7 @@ public class InstalledAppDetails extends Fragment
|
|||||||
mTotalSize = (TextView)view.findViewById(R.id.total_size_text);
|
mTotalSize = (TextView)view.findViewById(R.id.total_size_text);
|
||||||
mAppSize = (TextView)view.findViewById(R.id.application_size_text);
|
mAppSize = (TextView)view.findViewById(R.id.application_size_text);
|
||||||
mDataSize = (TextView)view.findViewById(R.id.data_size_text);
|
mDataSize = (TextView)view.findViewById(R.id.data_size_text);
|
||||||
|
mExternalSize = (TextView)view.findViewById(R.id.external_size_text);
|
||||||
|
|
||||||
// Get Control button panel
|
// Get Control button panel
|
||||||
View btnPanel = view.findViewById(R.id.control_buttons_panel);
|
View btnPanel = view.findViewById(R.id.control_buttons_panel);
|
||||||
@@ -504,6 +507,10 @@ public class InstalledAppDetails extends Fragment
|
|||||||
mLastDataSize = mAppEntry.dataSize;
|
mLastDataSize = mAppEntry.dataSize;
|
||||||
mDataSize.setText(getSizeStr(mAppEntry.dataSize));
|
mDataSize.setText(getSizeStr(mAppEntry.dataSize));
|
||||||
}
|
}
|
||||||
|
if (mLastExternalSize != mAppEntry.externalSize) {
|
||||||
|
mLastExternalSize = mAppEntry.externalSize;
|
||||||
|
mExternalSize.setText(getSizeStr(mAppEntry.externalSize));
|
||||||
|
}
|
||||||
if (mLastCacheSize != mAppEntry.cacheSize) {
|
if (mLastCacheSize != mAppEntry.cacheSize) {
|
||||||
mLastCacheSize = mAppEntry.cacheSize;
|
mLastCacheSize = mAppEntry.cacheSize;
|
||||||
mCacheSize.setText(getSizeStr(mAppEntry.cacheSize));
|
mCacheSize.setText(getSizeStr(mAppEntry.cacheSize));
|
||||||
|
Reference in New Issue
Block a user