New API and implementation of DB and memory-backed FDs

This depends on a kernel patch that implements read(2)
in the ashmem driver.

Bug http://b/issue?id=2595601

Change-Id: Ie3b10aa471aada21812b35e63954c1b2f0a7b042
This commit is contained in:
Bjorn Bringert
2010-04-14 14:43:26 +01:00
parent 7eb84256e5
commit a006b47298
13 changed files with 263 additions and 375 deletions

View File

@@ -18,7 +18,6 @@ package android.graphics;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.os.MemoryFile;
import android.util.DisplayMetrics;
import android.util.TypedValue;
@@ -532,18 +531,6 @@ public class BitmapFactory {
* @return the decoded bitmap, or null
*/
public static Bitmap decodeFileDescriptor(FileDescriptor fd, Rect outPadding, Options opts) {
try {
if (MemoryFile.isMemoryFile(fd)) {
int mappedlength = MemoryFile.getSize(fd);
MemoryFile file = new MemoryFile(fd, mappedlength, "r");
InputStream is = file.getInputStream();
Bitmap bm = decodeStream(is, outPadding, opts);
return finishDecode(bm, outPadding, opts);
}
} catch (IOException ex) {
// invalid filedescriptor, no need to call nativeDecodeFileDescriptor()
return null;
}
Bitmap bm = nativeDecodeFileDescriptor(fd, outPadding, opts);
return finishDecode(bm, outPadding, opts);
}
@@ -630,12 +617,6 @@ public class BitmapFactory {
*/
public static LargeBitmap createLargeBitmap(
FileDescriptor fd, boolean isShareable) throws IOException {
if (MemoryFile.isMemoryFile(fd)) {
int mappedlength = MemoryFile.getSize(fd);
MemoryFile file = new MemoryFile(fd, mappedlength, "r");
InputStream is = file.getInputStream();
return createLargeBitmap(is, isShareable);
}
return nativeCreateLargeBitmap(fd, isShareable);
}