Application hangs / freeze when using camera.open() - Restart of device needed

android, camera, freeze

Solution

The problem is related to your updated Rom data that is installed to your mobile phone, there is no way to do anything unless you updated your Rom in your mobile phone.

Problem

My application is quite basic and simple, I just need to open the camera (Not even displaying images, I commented the code) So, basically, I have something like: ``` @Override public void onResume() { super.onResume(); if (camera != null) { //Just to be sure camera.stopPreview(); camera.setPreviewCallback(null); camera.release(); camera = null; } Log.e("DebugCam", "Before"); camera = Camera.open(); Log.e("DebugCam", "After"); } @Override protected void onPause() { super.onPause(); if (camera != null) { camera.stopPreview(); camera.release(); camera = null; } } ``` But my logcat is just displaying the first message: ``` Before ``` The app is just hanging, and I have to restart the device to make it work again!!! I really don't understand where is the problem or how I could at least avoid the freeze that is really annoying. I really don't get how I could debug this... Edit: I have seen this on Android bug tracking, sounds like I need a workaround as the patch was released in June) https://code.google.com/p/android/issues/detail?id=1578

Original source