Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd4428ce authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Storage banner when device in low disk state.

Bug: 6576409
Change-Id: I25f71935e312bf6efa832d10c22e3edbdc18f4fb
parent 292d7e3b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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] -->
    <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] -->
    <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] -->
    <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] -->
@@ -1918,6 +1918,11 @@
    <!-- SD card eject progress text   -->
    <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]-->
    <string name="storage_menu_usb">USB computer connection</string>

+19 −0
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@

package com.android.settings.deviceinfo;

import android.app.ActivityThread;
import android.app.DownloadManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.IPackageManager;
import android.content.res.Resources;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RectShape;
@@ -26,6 +28,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;
import android.preference.Preference;
@@ -53,6 +56,7 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory implemen
    private Preference[] mPreferences;
    private Preference mMountTogglePreference;
    private Preference mFormatPreference;
    private Preference mStorageLow;
    private int[] mColors;

    private Resources mResources;
@@ -204,6 +208,18 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory implemen
            mFormatPreference.setTitle(R.string.sd_format);
            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() {
@@ -227,6 +243,9 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory implemen
        }

        addPreference(mUsageBarPreference);
        if (mStorageLow != null) {
            addPreference(mStorageLow);
        }
        for (int i = 0; i < numberOfCategories; i++) {
            addPreference(mPreferences[i]);
        }