+ // Updates the memory usage bar graph.
+ private static final int MSG_UI_UPDATE_INTERNAL_APPROXIMATE = 1;
+
+ // Updates the memory usage bar graph.
+ private static final int MSG_UI_UPDATE_INTERNAL_EXACT = 2;
+
+ // Updates the memory usage stats for external.
+ private static final int MSG_UI_UPDATE_EXTERNAL_APPROXIMATE = 3;
+
+ private Handler mUpdateHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_UI_UPDATE_INTERNAL_APPROXIMATE: {
+ Bundle bundle = msg.getData();
+ final long totalSize = bundle.getLong(MemoryMeasurement.TOTAL_SIZE);
+ final long availSize = bundle.getLong(MemoryMeasurement.AVAIL_SIZE);
+ updateUiApproximate(totalSize, availSize);
+ break;
+ }
+ case MSG_UI_UPDATE_INTERNAL_EXACT: {
+ Bundle bundle = msg.getData();
+ final long totalSize = bundle.getLong(MemoryMeasurement.TOTAL_SIZE);
+ final long availSize = bundle.getLong(MemoryMeasurement.AVAIL_SIZE);
+ final long mediaUsed = bundle.getLong(MemoryMeasurement.MEDIA_USED);
+ final long appsUsed = bundle.getLong(MemoryMeasurement.APPS_USED);
+ updateUiExact(totalSize, availSize, mediaUsed, appsUsed);
+ break;
+ }
+ case MSG_UI_UPDATE_EXTERNAL_APPROXIMATE: {
+ Bundle bundle = msg.getData();
+ final long totalSize = bundle.getLong(MemoryMeasurement.TOTAL_SIZE);
+ final long availSize = bundle.getLong(MemoryMeasurement.AVAIL_SIZE);
+ updateExternalStorage(totalSize, availSize);
+ break;
+ }
+ }
+ }
+ };
+
+ private MemoryMeasurement mMeasurement;
+