Skip to content

Camera activity crashes after screen unlock #11

Open

Description

@Jame584

I've noticed that the app crashes (i've tried also the TwoInputFilterExample) everytime i lock the screen with the camera activity on focus and then i unlock the screen.
I've tried to manage this with onStop/onRestart but this solve the issue only on some devices (Asus TF201, Galaxy S4) but not in others (Galaxy S, S2).

Activity

  1. Jame584 commented on Mar 17, 2014

    @Jame584
    Author

    Hi! I've tried, on a Nexus 4, the AllFiltersExample bundled with this framework and this bug occurs when i lock and then unlock the screen or i receive a phone call.

    This is the logcat

    03-17 15:40:58.689: E/AndroidRuntime(14304): FATAL EXCEPTION: main
    03-17 15:40:58.689: E/AndroidRuntime(14304): Process: project.android.allfiltersexample, PID: 14304
    03-17 15:40:58.689: E/AndroidRuntime(14304): java.lang.RuntimeException: Unable to pause activity {project.android.allfiltersexample/project.android.allfiltersexample.ImageProcessingActivity}: java.lang.RuntimeException: Method called after release()
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3062)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3017)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3707)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.ActivityThread.access$900(ActivityThread.java:135)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.os.Handler.dispatchMessage(Handler.java:102)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.os.Looper.loop(Looper.java:136)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.ActivityThread.main(ActivityThread.java:5017)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at java.lang.reflect.Method.invokeNative(Native Method)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at java.lang.reflect.Method.invoke(Method.java:515)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at dalvik.system.NativeStart.main(Native Method)
    03-17 15:40:58.689: E/AndroidRuntime(14304): Caused by: java.lang.RuntimeException: Method called after release()
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.hardware.Camera._stopPreview(Native Method)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.hardware.Camera.stopPreview(Camera.java:555)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at project.android.imageprocessing.input.CameraPreviewInput.onPause(CameraPreviewInput.java:179)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at project.android.allfiltersexample.ImageProcessingActivity.onPause(ImageProcessingActivity.java:200)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.Activity.performPause(Activity.java:5335)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1233)
    03-17 15:40:58.689: E/AndroidRuntime(14304): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3048)
    03-17 15:40:58.689: E/AndroidRuntime(14304): ... 12 more

    then, i've tried to switch "super.onPause();" with "((CameraPreviewInput) input).onPause();" in the onPause method and it crashes with this logcat

    03-17 15:43:50.190: E/AndroidRuntime(15513): FATAL EXCEPTION: main 03-17 15:43:50.190: E/AndroidRuntime(15513): Process: project.android.allfiltersexample, PID: 15513 03-17 15:43:50.190: E/AndroidRuntime(15513): java.lang.RuntimeException: Unable to start activity ComponentInfo{project.android.allfiltersexample/project.android.allfiltersexample.ImageProcessingActivity}: java.lang.RuntimeException: Fail to connect to camera service 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.ActivityThread.access$900(ActivityThread.java:135) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.os.Handler.dispatchMessage(Handler.java:102) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.os.Looper.loop(Looper.java:136) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.ActivityThread.main(ActivityThread.java:5017) 03-17 15:43:50.190: E/AndroidRuntime(15513): at java.lang.reflect.Method.invokeNative(Native Method) 03-17 15:43:50.190: E/AndroidRuntime(15513): at java.lang.reflect.Method.invoke(Method.java:515) 03-17 15:43:50.190: E/AndroidRuntime(15513): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 03-17 15:43:50.190: E/AndroidRuntime(15513): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 03-17 15:43:50.190: E/AndroidRuntime(15513): at dalvik.system.NativeStart.main(Native Method) 03-17 15:43:50.190: E/AndroidRuntime(15513): Caused by: java.lang.RuntimeException: Fail to connect to camera service 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.hardware.Camera.native_setup(Native Method) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.hardware.Camera.(Camera.java:350) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.hardware.Camera.open(Camera.java:324) 03-17 15:43:50.190: E/AndroidRuntime(15513): at project.android.imageprocessing.input.CameraPreviewInput.createCamera(CameraPreviewInput.java:54) 03-17 15:43:50.190: E/AndroidRuntime(15513): at project.android.imageprocessing.input.CameraPreviewInput.(CameraPreviewInput.java:43) 03-17 15:43:50.190: E/AndroidRuntime(15513): at project.android.allfiltersexample.ImageProcessingActivity.onCreate(ImageProcessingActivity.java:54) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.Activity.performCreate(Activity.java:5231) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 03-17 15:43:50.190: E/AndroidRuntime(15513): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 03-17 15:43:50.190: E/AndroidRuntime(15513): ... 12 more

    Could you give me some hints to solve this issue? Thanks in advance! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions