Emulator's camera built-in app buggy in Froyo / 2.2?

荒凉一梦 提交于 2019-12-17 18:33:41

问题


the Emulator's camera worked fine for taking pictures in 2.1 Eclair. What did not work was recording videos, obviously.
Now running an app which worked merely flawless on 2.1 Emulator causes the camera app to crash. I fire up an intent to launch it:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(TEMP_PHOTO_FILE)));
startActivityForResult(intent, REQUEST_CAMERA);

This starts the camera app but after a few seconds it crashes. The output is:

06-01 09:57:15.593: DEBUG/libEGL(5212): egl.cfg not found, using default config
06-01 09:57:15.593: DEBUG/libEGL(5212): loaded /system/lib/egl/libGLES_android.so
06-01 09:57:15.733: ERROR/AndroidRuntime(5212): FATAL EXCEPTION: GLThread 11
06-01 09:57:15.733: ERROR/AndroidRuntime(5212): java.lang.IllegalArgumentException: No configs match configSpec
06-01 09:57:15.733: ERROR/AndroidRuntime(5212):     at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:760)
06-01 09:57:15.733: ERROR/AndroidRuntime(5212):     at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:916)
06-01 09:57:15.733: ERROR/AndroidRuntime(5212):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1246)
06-01 09:57:15.733: ERROR/AndroidRuntime(5212):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)

Actually I just wanted to see if the bug which made you receive a small image from the camera even though EXTRA_OUTPUT was specified has been fixed in FroYo. Unfortunately, I don't even get to test it.
Does anyone run into similiar issues?

Thanks,
Steff


回答1:


It looks there's a mistmatch between the EGLConfig the Camera is requesting and the EGLConfigs currently supported by the s/w GL renderer that comes in Froyo. See if you can request an RGB565 EGL Config.

Moreover, the below changes worked for me. It basically remove the Stencil buffer out of the EGLConfig as that configuration seems to be not supported at all in the s/w GL renderer in Froyo. Add the original config back if you're testing on real devices such as the Droid.

diff --git a/src/com/android/camera/ui/GLRootView.java b/src/com/android/camera/ui/GLRootView.java
index d8ae0f8..545c66a

--- a/src/com/android/camera/ui/GLRootView.java  
+++ b/src/com/android/camera/ui/GLRootView.java  
@@ -174,7 +174,8 @@ public class GLRootView extends GLSurfaceView  

     private void initialize() {  
         mFlags |= FLAG_INITIALIZED;  
-        setEGLConfigChooser(8, 8, 8, 8, 0, 4);  
+        setEGLConfigChooser(8, 8, 8, 8, 0, 0);  
         getHolder().setFormat(PixelFormat.TRANSLUCENT);  
         setZOrderOnTop(true);  



回答2:


emulator 2.2 is broken.
Please vote for this: code.google.com/p/android/issues/detail?id=9376 so we can get a fix.

Workaround: Create an AVD with 2.1 as the target.



来源:https://stackoverflow.com/questions/2948809/emulators-camera-built-in-app-buggy-in-froyo-2-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!