am cd4428ce: Storage banner when device in low disk state.

* commit 'cd4428ce2c03fd355a3093fad6553636da9cef9b':
  Storage banner when device in low disk state.
This commit is contained in:
Jeff Sharkey
2012-06-12 18:54:49 -07:00
committed by Android Git Automerger
2 changed files with 25 additions and 1 deletions

View File

@@ -1848,7 +1848,7 @@
<!-- SD card & phone storage settings summary. Displayed when the total memory usage is being calculated. Will be replaced with a number like "12.3 GB" when finished calucating. [CHAR LIMIT=30] --> <!-- SD card & phone storage settings summary. Displayed when the total memory usage is being calculated. Will be replaced with a number like "12.3 GB" when finished calucating. [CHAR LIMIT=30] -->
<string name="memory_calculating_size">Calculating\u2026</string> <string name="memory_calculating_size">Calculating\u2026</string>
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of applications installed. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] --> <!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of applications installed. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
<string name="memory_apps_usage">Apps</string> <string name="memory_apps_usage">Apps (app data &amp; media content)</string>
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of media on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] --> <!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of media on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
<string name="memory_media_usage">Media</string> <string name="memory_media_usage">Media</string>
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of /sdcard/Download on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] --> <!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of /sdcard/Download on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
@@ -1918,6 +1918,11 @@
<!-- SD card eject progress text --> <!-- SD card eject progress text -->
<string name="sd_ejecting_summary">Unmount in progress</string> <string name="sd_ejecting_summary">Unmount in progress</string>
<!-- Settings item title when storage is running low [CHAR LIMIT=32] -->
<string name="storage_low_title">Storage space is running out</string>
<!-- Settings item summary when storage is running low [CHAR LIMIT=NONE] -->
<string name="storage_low_summary">Some system functions, such as syncing, may not work correctly. Try to free space by deleting or unpinning items, such as apps or media content.</string>
<!-- Storage setting. Menu option for USB transfer settings [CHAR LIMIT=30]--> <!-- Storage setting. Menu option for USB transfer settings [CHAR LIMIT=30]-->
<string name="storage_menu_usb">USB computer connection</string> <string name="storage_menu_usb">USB computer connection</string>

View File

@@ -16,9 +16,11 @@
package com.android.settings.deviceinfo; package com.android.settings.deviceinfo;
import android.app.ActivityThread;
import android.app.DownloadManager; import android.app.DownloadManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.IPackageManager;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RectShape; import android.graphics.drawable.shapes.RectShape;
@@ -26,6 +28,7 @@ import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.RemoteException;
import android.os.storage.StorageManager; import android.os.storage.StorageManager;
import android.os.storage.StorageVolume; import android.os.storage.StorageVolume;
import android.preference.Preference; import android.preference.Preference;
@@ -53,6 +56,7 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory implemen
private Preference[] mPreferences; private Preference[] mPreferences;
private Preference mMountTogglePreference; private Preference mMountTogglePreference;
private Preference mFormatPreference; private Preference mFormatPreference;
private Preference mStorageLow;
private int[] mColors; private int[] mColors;
private Resources mResources; private Resources mResources;
@@ -204,6 +208,18 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory implemen
mFormatPreference.setTitle(R.string.sd_format); mFormatPreference.setTitle(R.string.sd_format);
mFormatPreference.setSummary(R.string.sd_format_summary); mFormatPreference.setSummary(R.string.sd_format_summary);
} }
final IPackageManager pm = ActivityThread.getPackageManager();
try {
if (pm.isStorageLow()) {
mStorageLow = new Preference(getContext());
mStorageLow.setTitle(R.string.storage_low_title);
mStorageLow.setSummary(R.string.storage_low_summary);
} else {
mStorageLow = null;
}
} catch (RemoteException e) {
}
} }
public StorageVolume getStorageVolume() { public StorageVolume getStorageVolume() {
@@ -227,6 +243,9 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory implemen
} }
addPreference(mUsageBarPreference); addPreference(mUsageBarPreference);
if (mStorageLow != null) {
addPreference(mStorageLow);
}
for (int i = 0; i < numberOfCategories; i++) { for (int i = 0; i < numberOfCategories; i++) {
addPreference(mPreferences[i]); addPreference(mPreferences[i]);
} }