[Tip][CM 10.1/10.2/11] How to reduce the threshold of displaying "Low storage space" warning

Discussion about anything related to Android or this forum here.
Moderator: Forum Moderator

[Tip][CM 10.1/10.2/11] How to reduce the threshold of displaying "Low storage space" warning

Postby soren » Fri Nov 08, 2013 9:40 pm

By default, if the free storage space on device is less than 10%, Android displays a "Low storage space" warning and doesn't allow installing any app even if the free space is 100 MB and the app size is only 5 MB. This could be annoying.

There is a tip to reduce the threshold as follows but it doesn't work on CM 10.1:
To reduce from 10% to 5% warning from your “adb shell”:

Code: Select all
# sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> insert into secure (name, value) VALUES('sys_storage_threshold_percentage','5');
sqlite> insert into gservices (name, value) VALUES('sys_storage_threshold_percentage','5');
sqlite> .quit
# reboot

*** don't include the # or sqlite>, those are the console prompts... ***

http://forum.xda-developers.com/showthread.php?t=877793

I did a search but only found the above tip. So I decided to look at the CM 10.1 source code and found that it uses the global table.
Code: Select all
private long getMemThreshold() {
        long value = Settings.Global.getInt(
                              mContentResolver,
                              Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE,
                              DEFAULT_THRESHOLD_PERCENTAGE);

CM 10.1 DeviceStorageMonitorService

Code: Select all
public static final class Global extends NameValueTable {
   ...
   public static final String
                SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";

CM 10.1 Settings

Therefore, in order to reduce the threshold in CM 10.1, the following code must be used instead:
Code: Select all
# sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> insert into global (name, value) VALUES('sys_storage_threshold_percentage','5');
sqlite> .quit
# reboot

I've tested it and it worked.

Update: This should work on CM 10.2 and CM 11 as well. I looked at CM 10.2 and CM 11 source code. It also uses the global table.
Code: Select all
final StorageManager sm = StorageManager.from(context);
        mMemLowThreshold = sm.getStorageLowBytes(DATA_PATH);

CM 10.2 DeviceStorageMonitorService
CM 11 DeviceStorageMonitorService

Code: Select all
public long getStorageLowBytes(File path) {
        final long lowPercent = Settings.Global.getInt(mResolver,
                Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE, DEFAULT_THRESHOLD_PERCENTAGE);

CM 10.2 StorageManager
CM 11 StorageManager
Last edited by soren on Sun Dec 22, 2013 10:17 pm, edited 1 time in total.
soren
Senior Member
 
Posts: 303
Joined: Mon Jul 08, 2013 12:41 pm
Has thanked: 160 times
Been thanked: 86 times

Advertisement
 

Re: [Tip][CM 10.1/10.2] How to reduce the threshold of displaying "Low storage space" warning

Postby sunitknandi » Wed Dec 18, 2013 12:18 pm

You the man bro, I was looking for this exactly. I have a 4GB ext4 partition on the SD card and even though I have 400 MB of storage space, it doesn't let me update apps.

Thanks, this suggestion helped. :)

EDIT: Thanks, you tip worked. :D
sunitknandi
Junior Member
 
Posts: 9
Joined: Wed Jun 26, 2013 10:12 am
Has thanked: 0 time
Been thanked: 0 time


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron