How can't install a 338KB app when I have 474MB free? I have a Motorola phone, with 8GB of internal memory.

To my surprise, in a few days, I had 474MB of free space, but couldn't install a 338KB app!! So, clearly the limit of ~25MB referred to in some comments (here and here) are not always the case. A user just told me the following:


  Actually it's "25MB or 10% of the storage", whichever is hit first. So
  with e.g. 10 GB internal storage, it would hit you as soon as you drop
  below 1 GB free. Crazy, but that's what it is.


Actually, that's not correct, because I didn't have to free up 1GB of internal memory. But anyway, half a gigabyte is enough to run a full operational system. I've seen similar complaints of hundreds of MB not enough to install apps ~ 1MB or similar small operations (here and here).

What's wrong here?
Note: the quoted user was me. And here is the reference. To explain why it wasn't 10% in your case, here's an exception from behind the link: "As long as the device maker doesn't change the default settings". So those 10% are the default setting, but obviously can be altered by the "ROM baker". How often that is done I cannot tell; with that post being from 2011, the rule might even have changed meanwhile (though I didn't hear of that either).

So I just applied a little "Google-Fu": Android 4.1.1 still has the comment


  If the free storage on device is less than a tunable threshold value (a secure settings parameter; default 10%) a low memory notification is displayed to alert the user."


(emphasis mine). Note the term "tunable threshold", which makes it obvious this threshold can be modified/adjusted. For Android 4.1.1 you can find it at line 67:

private static final int DEFAULT_THRESHOLD_PERCENTAGE = 10;


This is a class variable; but not being an Android dev myself, I cannot tell how it can be overwritten. It certainly will require system permissions (or just an app with the WRITE_SECURE_SETTINGS permission?). Quoting the latest code:

 * This class implements a service to monitor the amount of disk
 * storage space on the device.  If the free storage on device is less
 * than a tunable threshold value (a secure settings parameter;
 * default 10%) a low memory notification is displayed to alert the
 * user. If the user clicks on the low memory notification the
 * Application Manager application gets launched to let the user free
 * storage space.


You can see, the 10% rule is still there. But the DEFAULT_THRESHOLD_PERCENTAGE variable is gone (and replaced by mMemLowThreshold, which seems to be set in a different class now – see line 361).



TL;DR: The very same 10% threshold still applies, but the "ROM baker" (who creates the ROM) might adjust that. A developer with some more insight might be able to tell if it can be adjusted by other means, e.g. a special app with the WRITE_SECURE_SETTINGS permission, or even simply via ADB.