Loading core/java/android/app/usage/StorageStatsManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -81,9 +81,9 @@ public class StorageStatsManager { /** * Return the free space on the requested storage volume. * <p> * The free space is equivalent to {@link File#getFreeSpace()} plus the size * of any cached data that can be automatically deleted by the system as * additional space is needed. * The free space is equivalent to {@link File#getUsableSpace()} plus the * size of any cached data that can be automatically deleted by the system * as additional space is needed. * <p> * This method may take several seconds to calculate the requested values, * so it should only be called from a worker thread. Loading services/core/java/com/android/server/pm/PackageManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ public class PackageManagerService extends IPackageManager.Stub { private static final boolean HIDE_EPHEMERAL_APIS = false; private static final boolean ENABLE_FREE_CACHE_V2 = SystemProperties.getBoolean("fw.free_cache_v2", false); SystemProperties.getBoolean("fw.free_cache_v2", true); private static final int RADIO_UID = Process.PHONE_UID; private static final int LOG_UID = Process.LOG_UID; services/usage/java/com/android/server/usage/StorageStatsService.java +13 −7 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ public class StorageStatsService extends IStorageStatsManager.Stub { invalidateMounts(); mHandler = new H(IoThread.get().getLooper()); mHandler.sendEmptyMessageDelayed(H.MSG_LOAD_CACHED_QUOTAS_FROM_FILE, DELAY_IN_MILLIS); mHandler.sendEmptyMessage(H.MSG_LOAD_CACHED_QUOTAS_FROM_FILE); mStorage.registerListener(new StorageEventListener() { @Override Loading Loading @@ -137,7 +137,8 @@ public class StorageStatsService extends IStorageStatsManager.Stub { android.Manifest.permission.PACKAGE_USAGE_STATS, TAG); return; default: throw new SecurityException("Blocked by mode " + mode); throw new SecurityException("Package " + callingPackage + " from UID " + callingUid + " blocked by mode " + mode); } } Loading Loading @@ -169,16 +170,21 @@ public class StorageStatsService extends IStorageStatsManager.Stub { enforcePermission(Binder.getCallingUid(), callingPackage); long cacheBytes = 0; final long token = Binder.clearCallingIdentity(); try { for (UserInfo user : mUser.getUsers()) { final StorageStats stats = queryStatsForUser(volumeUuid, user.id, null); cacheBytes += stats.cacheBytes; } } finally { Binder.restoreCallingIdentity(token); } if (volumeUuid == StorageManager.UUID_PRIVATE_INTERNAL) { return Environment.getDataDirectory().getFreeSpace() + cacheBytes; return Environment.getDataDirectory().getUsableSpace() + cacheBytes; } else { final VolumeInfo vol = mStorage.findVolumeByUuid(volumeUuid); return vol.getPath().getFreeSpace() + cacheBytes; return vol.getPath().getUsableSpace() + cacheBytes; } } Loading Loading
core/java/android/app/usage/StorageStatsManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -81,9 +81,9 @@ public class StorageStatsManager { /** * Return the free space on the requested storage volume. * <p> * The free space is equivalent to {@link File#getFreeSpace()} plus the size * of any cached data that can be automatically deleted by the system as * additional space is needed. * The free space is equivalent to {@link File#getUsableSpace()} plus the * size of any cached data that can be automatically deleted by the system * as additional space is needed. * <p> * This method may take several seconds to calculate the requested values, * so it should only be called from a worker thread. Loading
services/core/java/com/android/server/pm/PackageManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ public class PackageManagerService extends IPackageManager.Stub { private static final boolean HIDE_EPHEMERAL_APIS = false; private static final boolean ENABLE_FREE_CACHE_V2 = SystemProperties.getBoolean("fw.free_cache_v2", false); SystemProperties.getBoolean("fw.free_cache_v2", true); private static final int RADIO_UID = Process.PHONE_UID; private static final int LOG_UID = Process.LOG_UID;
services/usage/java/com/android/server/usage/StorageStatsService.java +13 −7 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ public class StorageStatsService extends IStorageStatsManager.Stub { invalidateMounts(); mHandler = new H(IoThread.get().getLooper()); mHandler.sendEmptyMessageDelayed(H.MSG_LOAD_CACHED_QUOTAS_FROM_FILE, DELAY_IN_MILLIS); mHandler.sendEmptyMessage(H.MSG_LOAD_CACHED_QUOTAS_FROM_FILE); mStorage.registerListener(new StorageEventListener() { @Override Loading Loading @@ -137,7 +137,8 @@ public class StorageStatsService extends IStorageStatsManager.Stub { android.Manifest.permission.PACKAGE_USAGE_STATS, TAG); return; default: throw new SecurityException("Blocked by mode " + mode); throw new SecurityException("Package " + callingPackage + " from UID " + callingUid + " blocked by mode " + mode); } } Loading Loading @@ -169,16 +170,21 @@ public class StorageStatsService extends IStorageStatsManager.Stub { enforcePermission(Binder.getCallingUid(), callingPackage); long cacheBytes = 0; final long token = Binder.clearCallingIdentity(); try { for (UserInfo user : mUser.getUsers()) { final StorageStats stats = queryStatsForUser(volumeUuid, user.id, null); cacheBytes += stats.cacheBytes; } } finally { Binder.restoreCallingIdentity(token); } if (volumeUuid == StorageManager.UUID_PRIVATE_INTERNAL) { return Environment.getDataDirectory().getFreeSpace() + cacheBytes; return Environment.getDataDirectory().getUsableSpace() + cacheBytes; } else { final VolumeInfo vol = mStorage.findVolumeByUuid(volumeUuid); return vol.getPath().getFreeSpace() + cacheBytes; return vol.getPath().getUsableSpace() + cacheBytes; } } Loading