Alright so I'm having an issue with my live wallpaper i've created, but I've only found this issue to occur on a stock nexus one running 2.3.3 using the stock launcher. This works great on the rest of the devices i've tested on: Moto Droid 2.3.3, Nexus S 2.3.4, HTC MyTouch 4G 2.3.3, and i've only had reports of crashes on nexus ones.
The live wallpaper displays a preview of your camera on your wallpaper. After click set wallpaper you the stack trace below prints. You can see it sets up the camera and starts the preview, but then immediately calls to onDestroy and then force closes due the the errors after that. The screen is black this entire time. (This is once they choose set wallpaper, I'm not doing anything on the little wallpaper preview screen).
Any clue what's happening? Not a single stack trace dips into my code. So i'm not sure where to look. And I've tried to debug it but it won't ever trigger a single one of my breakpoints, even the ones in the code it seems to be hitting and printing my logs from?
05-31 17:14:53.945: ERROR/CameraWallpaper(1426): Camera is null, opening camera
05-31 17:14:53.955: ERROR/CameraWallpaper(1426): Target Height: 800
05-31 17:14:53.955: DEBUG/CameraWallpaper(1426): Setting effect
05-31 17:14:53.955: DEBUG/CameraWallpaper(1426): Setting mode
05-31 17:14:53.965: ERROR/CameraWallpaper(1426): Parameters set: 640x480
05-31 17:14:53.965: ERROR/CameraWallpaper(1426): Starting Preview
05-31 17:14:54.095: ERROR/CameraWallpaper(1426): Preview Started
05-31 17:14:54.105: ERROR/CameraWallpaper(1426): onDestroy
05-31 17:14:54.125: WARN/WallpaperService(1426): Ignoring updateSurface: destroyed
05-31 17:14:54.125: WARN/InputQueue-JNI(1426): Input channel is not initialized.
05-31 17:14:54.125: WARN/WindowManager(99): Failed looking up window
05-31 17:14:54.125: WARN/WindowManager(99): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@40741808 does not exist
05-31 17:14:54.125: WARN/WindowManager(99): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:8174)
05-31 17:14:54.125: WARN/WindowManager(99): at com.android.server.WindowManagerService.addWindow(WindowManagerService.java:1811)
05-31 17:14:54.125: WARN/WindowManager(99): at com.android.server.WindowManagerService$Session.add(WindowManagerService.java:5658)
05-31 17:14:54.125: WARN/WindowManager(99): at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:68)
05-31 17:14:54.125: WARN/WindowManager(99): at com.android.server.WindowManagerService$Session.onTransact(WindowManagerService.java:5630)
05-31 17:14:54.125: WARN/WindowManager(99): at android.os.Binder.execTransact(Binder.java:320)
05-31 17:14:54.125: WARN/WindowManager(99): at dalvik.system.NativeStart.run(Native Method)
05-31 17:14:54.125: WARN/WindowManager(99): Attempted to add window with token that is not a window: android.os.BinderProxy@40741808. Aborting.
05-31 17:14:54.135: DEBUG/AndroidRuntime(1426): Shutting down VM
05-31 17:14:54.135: WARN/dalvikvm(1426): threadid=1: thread exiting with uncaught exception (group=0x40015560)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): FATAL EXCEPTION: main
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): java.lang.RuntimeException: Failed to register input channel. Check logs for details.
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at android.view.InputQueue.nativeRegisterInputChannel(Native Method)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at android.view.InputQueue.registerInputChannel(InputQueue.java:92)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at android.service.wallpaper.WallpaperService$Engine.updateSurface(WallpaperService.java:521)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:904)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): a开发者_开发技巧t com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at android.os.Looper.loop(Looper.java:123)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at java.lang.reflect.Method.invokeNative(Native Method)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at java.lang.reflect.Method.invoke(Method.java:507)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-31 17:14:54.135: ERROR/AndroidRuntime(1426): at dalvik.system.NativeStart.main(Native Method)
05-31 17:14:58.875: INFO/Process(1426): Sending signal. PID: 1426 SIG: 9
05-31 17:14:58.905: INFO/ActivityManager(99): Process com.brayden.camera (pid 1426) has died.
I made a camera live wallpaper for kicks before and it works on API 8 through 11. Noting that N1 does not ship with stock 2.3.3, what ROM are you using? I've experienced problems with custom ROMs where the Camera hardware XML is simply poorly configured and fails mysteriously, and is fixed when the hardware is forced tore-create it. Furthermore:
you're not catching the RuntimeException being thrown, and you haven't implemented the Camera.ErrorCallback. Are you using the API 1 Camera.open()? If so, you should try calling the Camera.open(int) provided with API 9+ when Gingerbread+ is detected.
精彩评论