I meet a problem when using a version of cm7.
When use CameraMoto.apk to take picture, it is very likely that the phone not response and then force to close or had to kill this apk manually.
when selecting 'OCR' inside of CameraMoto's menu, it force to close and left the camera light on. It can only be solved by reboot the phone.
Then I use poco camera, it is better than CameraMoto. But it has same problem.
After the CameraMoto exited abnormally, something like 'already has a client' appears in logcat when clicking this apk again.
Because the CameraMoto has exited abnormally, android.hardware.Camera.release() is not called and the camera is still be locked. So when android.hardware.Camera.open(int) is called again, it failed to open camera and exited without any prompt.
I tried to kill mediaserver, then open camera successfully. But when kill mediaserver again, the phone reboot(maybe the phone think the system running with major errors).
I found that it will come back to normal after the CameraMoto has exited abnormally and wait the screen standby timeout. In my case, the CameraMoto exited without release camera. Then wait 10 minutes, the screen come to black, and the camera light off. Then CameraMoto can open camera again. So I changed the screen standby timer from 10 minutes to 15 seconds, it works!
So I want to ask a question, when the screen timeout, who released the camera?(Edit:I've found by myself.)
If this can be figured out, I can build an apk to this work.
I also googled much to sovle this probelm and found this link(try hard to use CameraMoto.apk):
https://github.com/CyanogenModXT720...mmit/3a36d300c88439d3fd906d882928e544d17cb526
Does the CameraMoto.apk can works on gingerbread perfectly?
Can I fix this kind of problems by add or repalce these files under /system directory?
Code:
/app/CameraMoto.apk
/framework/com.motorola.android.camera.jar/lib/libcaps.so
/lib/libpanorama.so
/lib/libpanorama_jni.so
/lib/libscalado.so
Thanks in advance for anyone who can give me any advice
Edit1:
I got more logcat.
These lines appears in logcat when then screen off and then on.
It makes the camera start to work again.
Code:
I/power ( 2078): *** set_screen_state 0
D/SurfaceFlinger( 2078): About to give-up screen, flinger = 0x121850
W/PowerManagerService( 2078): AttributeCache cleared
W/SSM ( 1501): no ack
I/CPUSettings( 2230): Screen off or normal max CPU freq not saved. No change.
I/ActivityManager( 2078): Start proc com.bf.sgs for broadcast com.bf.sgs/.MainActivity$ApnReceiver: pid=7865 uid=10058 gids={3003, 1015, 1007}
E/dalvikvm( 7865): could not disable core file generation for pid 7865: Operation not permitted
[B]D/CameraHal( 1497): Resetting overlay q'd buffer status to false
D/CameraHal( 1497): stopPreview
D/CameraHal( 1497): CameraHal release
D/CameraHal( 1497): deinitPvOverlay()
D/CameraHal( 1497): CameraHal destructor
D/CameraHal( 1497): setTorchParameters /0/0
D/CameraHal( 1497): Did you see AF LED Glow?!
I/HPAndroidHAL( 1497): APILOG: ExitHPLibraries
I/HPAndroidHAL( 1497): APILOG: state machine shutting down...
I/HPAndroidHAL( 1497): APILOG: components shutting down...
I/HPAndroidHAL( 1497): APILOG: all components uninitialized.
I/HPAndroidHAL( 1497): APILOG: all components destroyed.
I/HPAndroidHAL( 1497): APILOG: library shutdown complete.
D/CameraHal( 1497): CameraSettings destructor[/B]
I/power ( 2078): *** set_screen_state 1
Who knows how to do this in apk?
And I just tested when the phone connect to pc via usb,my way mentioned is useless.
I'll get a logcat to compare and figure out why?
Edit2:
When the phone connected to pc, CameraHal doesn't restart the camera.
Code:
I/power ( 2078): *** set_screen_state 0
D/SurfaceFlinger( 2078): About to give-up screen, flinger = 0x121850
W/PowerManagerService( 2078): AttributeCache cleared
W/SSM ( 1501): no ack
I/CPUSettings( 2230): Screen off or normal max CPU freq not saved. No change.
I/ActivityManager( 2078): Start proc com.bf.sgs for broadcast com.bf.sgs/.MainActivity$ApnReceiver: pid=8423 uid=10058 gids={3003, 1015, 1007}
E/dalvikvm( 8423): could not disable core file generation for pid 8423: Operation not permitted
I/ActivityManager( 2078): Process com.sina.weibo.servant (pid 8408) has died.
W/ActivityManager( 2078): Scheduling restart of crashed service com.sina.weibo/com.igexin.sdk.GexinMainService in 45304ms
I/ActivityManager( 2078): Low Memory: No more background processes.
I/power ( 2078): *** set_screen_state 1
Edit3:
I found it's the mediaserver【PID=1497】 who restart the camera. So when kill it(which let it restart) the camera can restart to work as I mentioned above.
So does anyone knows how to restart mediaserver without cell phone reboot? Any advice is appreciated.
Code:
media 1497 1 119932 21312 ffffffff afd0b93c S /system/bin/mediaserver