From cb30035faf92175bf7883e9a535904e84dab7982 Mon Sep 17 00:00:00 2001 From: hanpengx Date: Fri, 11 Apr 2014 01:23:21 +0800 Subject: Deactivate the MiniThumbFile when it is not needed. Issue description: Unable to use camera after deleting all files in internal storage from PC with MTP. The toast message "Connect USB storage before using the camera" is poped up when we launch camera after deleting all files in internal storage from PC with MTP. Steps to reproduce the issue: 1. Launch Camera and take a picture. 2. Connect device to PC with MTP mode. 3. Delete all files on Internal stoage from PC. 4. Launch Camera after step 3 finished. Then we find that we are unable to use camera and the toast message is poped up. Root cause: The .thumbdata3--xxxxx in /sdcard/DCIM/.thumbnails/ is opened in android.process.media process when we take picture in step 1. But the file is never closed. So camera cannot create the directories(/sdcard/DCIM/Camera) it needs to store captured pictures because "Device busy" error. Solution: Deactivate the MiniThumbFile when it is not needed. Change-Id: I0faab5ffd95c5626f7f9ef1bc02b2ae56e2eb19b Signed-off-by: hanpengx --- src/com/android/providers/media/MediaThumbRequest.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/com/android/providers/media/MediaThumbRequest.java b/src/com/android/providers/media/MediaThumbRequest.java index 7695312e..34d54c88 100644 --- a/src/com/android/providers/media/MediaThumbRequest.java +++ b/src/com/android/providers/media/MediaThumbRequest.java @@ -234,5 +234,6 @@ class MediaThumbRequest { } else { Log.w(TAG, "can't create bitmap for thumbnail."); } + miniThumbFile.deactivate(); } } -- cgit v1.2.3