Loading packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java +29 −20 Original line number Diff line number Diff line Loading @@ -339,22 +339,31 @@ public class ApplicationsState { synchronized (mEntriesMap) { AppEntry entry = mEntriesMap.get(userId).get(packageName); if (entry != null && (entry.info.flags & ApplicationInfo.FLAG_INSTALLED) != 0) { mBackgroundHandler.post(() -> { mBackgroundHandler.post( () -> { try { final StorageStats stats = mStats.queryStatsForPackage( entry.info.storageUuid, packageName, UserHandle.of(userId)); final StorageStats stats = mStats.queryStatsForPackage( entry.info.storageUuid, packageName, UserHandle.of(userId)); final long cacheQuota = mStats.getCacheQuotaBytes( entry.info.storageUuid.toString(), entry.info.uid); final PackageStats legacy = new PackageStats(packageName, userId); legacy.codeSize = stats.getCodeBytes(); legacy.dataSize = stats.getDataBytes(); legacy.cacheSize = stats.getCacheBytes(); legacy.cacheSize = Math.min(stats.getCacheBytes(), cacheQuota); try { mBackgroundHandler.mStatsObserver.onGetStatsCompleted(legacy, true); mBackgroundHandler.mStatsObserver.onGetStatsCompleted( legacy, true); } catch (RemoteException ignored) { } } catch (NameNotFoundException | IOException e) { Log.w(TAG, "Failed to query stats: " + e); try { mBackgroundHandler.mStatsObserver.onGetStatsCompleted(null, false); mBackgroundHandler.mStatsObserver.onGetStatsCompleted( null, false); } catch (RemoteException ignored) { } } Loading Loading
packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java +29 −20 Original line number Diff line number Diff line Loading @@ -339,22 +339,31 @@ public class ApplicationsState { synchronized (mEntriesMap) { AppEntry entry = mEntriesMap.get(userId).get(packageName); if (entry != null && (entry.info.flags & ApplicationInfo.FLAG_INSTALLED) != 0) { mBackgroundHandler.post(() -> { mBackgroundHandler.post( () -> { try { final StorageStats stats = mStats.queryStatsForPackage( entry.info.storageUuid, packageName, UserHandle.of(userId)); final StorageStats stats = mStats.queryStatsForPackage( entry.info.storageUuid, packageName, UserHandle.of(userId)); final long cacheQuota = mStats.getCacheQuotaBytes( entry.info.storageUuid.toString(), entry.info.uid); final PackageStats legacy = new PackageStats(packageName, userId); legacy.codeSize = stats.getCodeBytes(); legacy.dataSize = stats.getDataBytes(); legacy.cacheSize = stats.getCacheBytes(); legacy.cacheSize = Math.min(stats.getCacheBytes(), cacheQuota); try { mBackgroundHandler.mStatsObserver.onGetStatsCompleted(legacy, true); mBackgroundHandler.mStatsObserver.onGetStatsCompleted( legacy, true); } catch (RemoteException ignored) { } } catch (NameNotFoundException | IOException e) { Log.w(TAG, "Failed to query stats: " + e); try { mBackgroundHandler.mStatsObserver.onGetStatsCompleted(null, false); mBackgroundHandler.mStatsObserver.onGetStatsCompleted( null, false); } catch (RemoteException ignored) { } } Loading