Skip to content

Camera plugin: Black screen on Samsung note 4 (Android 6.0.1) and Tecno C9 (Android 6.0) #14053

@MichaelSowah

Description

@MichaelSowah

Steps to Reproduce

Create a new project
and camera plugin to pubspec.yaml
camera: "^0.0.2" to dependence and run the basic example:

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';

List<CameraDescription> cameras;

Future<Null> main() async {
  cameras = await availableCameras();
  runApp(new CameraApp());
}

class CameraApp extends StatefulWidget {
  @override
  _CameraAppState createState() => new _CameraAppState();
}

class _CameraAppState extends State<CameraApp> {
  CameraController controller;

  @override
  void initState() {
    super.initState();
    controller = new CameraController(cameras[0], ResolutionPreset.medium);
    controller.initialize().then((_) {
      if (!mounted) {
        return;
      }
      setState(() {});
    });
  }

  @override
  void dispose() {
    controller?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    if (!controller.value.initialized) {
      return new Container();
    }
    return new AspectRatio(
        aspectRatio:
        controller.value.aspectRatio,
        child: new CameraPreview(controller));
  }
}

worked on all device I tested on except Samsung note 4 (Android 6.0.1) and Tecno C9 (Android 6.0)

Logs

D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
I/BufferQueueProducer( 3428): [SurfaceTexture-0-3428-0](this:0xdadbd000,id:0,api:1,p:3428,c:3428) queueBuffer: fps=28.64 dur=1012.60 max=77.69 min=21.99
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
D/Surface ( 3428): Surface::setBuffersUserDimensions(this=0xdda54a00,w=1920,h=1080)
I/RequestQueue( 3428): Repeating capture request cancelled.
D/Surface ( 3428): Surface::disconnect(this=0xdda54a00,api=1)
I/BufferQueueProducer( 3428): [SurfaceTexture-0-3428-0](this:0xdadbd000,id:0,api:1,p:-1,c:3428) disconnect(P): api 1
I/BufferQueueConsumer( 3428): [SurfaceTexture-0-3428-0](this:0xdadbd000,id:0,api:1,p:-1,c:3428) getReleasedBuffers: returning mask 0xfffffffffffffffe
D/Surface ( 3428): Surface::disconnect(this=0xdda54a00,api=1)
I/BufferQueueProducer( 3428): [SurfaceTexture-0-3428-0](this:0xdadbd000,id:0,api:1,p:-1,c:3428) disconnect(P): api 1
I/BufferQueueConsumer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) disconnect(C)
D/GraphicBuffer( 3428): unregister, handle(0xee93c720) (w:1920 h:1080 s:1920 f:0x32315659 u:0x000133)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93c720), client(54), share_fd(86)
D/GraphicBuffer( 3428): unregister, handle(0xee93c860) (w:1920 h:1080 s:1920 f:0x32315659 u:0x000133)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93c860), client(54), share_fd(84)
D/GraphicBuffer( 3428): unregister, handle(0xee93c9a0) (w:1920 h:1080 s:1920 f:0x32315659 u:0x000133)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93c9a0), client(54), share_fd(82)
D/GraphicBuffer( 3428): unregister, handle(0xee93cc20) (w:1920 h:1080 s:1920 f:0x32315659 u:0x000133)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93cc20), client(54), share_fd(83)
D/GraphicBuffer( 3428): unregister, handle(0xee93cae0) (w:1920 h:1080 s:1920 f:0x32315659 u:0x000133)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93cae0), client(54), share_fd(89)
D/GraphicBuffer( 3428): unregister, handle(0xee93cea0) (w:1920 h:1080 s:1920 f:0x32315659 u:0x000133)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93cea0), client(54), share_fd(87)
D/GraphicBuffer( 3428): unregister, handle(0xee93cfe0) (w:1920 h:1080 s:1920 f:0x32315659 u:0x000133)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93cfe0), client(54), share_fd(96)
D/GraphicBuffer( 3428): unregister, handle(0xf483e3e0) (w:1920 h:1080 s:1920 f:0x32315659 u:0x000133)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xf483e3e0), client(54), share_fd(80)
E/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) queueBuffer: BufferQueue has been abandoned
D/Camera-JNI( 3428): (tid:3576)[native_release] + context=0xee919a20 camera=0xee92c508
D/Camera-JNI( 3428): [native_release] context->getStrongCount(2) camera->getStrongCount(2)
E/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) dequeueBuffer: BufferQueue has been abandoned
D/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: slot 2
E/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: BufferQueue has been abandoned
D/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: slot 3
E/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: BufferQueue has been abandoned
D/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: slot 4
E/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: BufferQueue has been abandoned
D/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: slot 5
E/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: BufferQueue has been abandoned
D/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: slot 7
E/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:289,c:-1) cancelBuffer: BufferQueue has been abandoned
I/BufferQueueProducer( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:-1,c:-1) disconnect(P): api 4
D/Camera-JNI( 3428): (tid:3576)[release camera] - X context=0xee919a20
D/ActivityThread( 3428): ACT-AM_ON_PAUSE_CALLED ActivityRecord{994ee81 token=android.os.BinderProxy@ddb0b26 {com.yourcompany.playground/com.yourcompany.playground.MainActivity}}
D/ActivityThread( 3428): ACT-PAUSE_ACTIVITY handled : 3 / android.os.BinderProxy@ddb0b26
D/Camera-JNI( 3428): (tid:3447)[~MtkJNICameraContext] this:0xee919a20
V/ActivityThread( 3428): Finishing stop of ActivityRecord{994ee81 token=android.os.BinderProxy@ddb0b26 {com.yourcompany.playground/com.yourcompany.playground.MainActivity}}: show=false win=com.android.internal.policy.PhoneWindow@2bffe10
V/PhoneWindow( 3428): DecorView setVisiblity: visibility = 4 ,Parent =ViewRoot{13346ba com.yourcompany.playground/com.yourcompany.playground.MainActivity,ident = 0}, this =com.android.internal.policy.PhoneWindow$DecorView{35cb3b2 I.E...... R......D 0,0-1080,1920}
D/ActivityThread( 3428): ACT-STOP_ACTIVITY_HIDE handled : 0 / android.os.BinderProxy@ddb0b26
I/SurfaceView( 3428): updateWindow -- onWindowVisibilityChanged, visibility = 4, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/SurfaceView( 3428): Changes: creating=false format=false size=false visible=true left=false top=false mUpdateWindowNeeded=false mReportDrawNeeded=false redrawNeeded=false forceSizeChanged=false mVisible=true mRequestedVisible=false, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/SurfaceView( 3428): Cur surface: Surface(name=null)/@0x23fcc8, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/SurfaceView( 3428): New surface: Surface(name=null)/@0x107c161, vis=false, frame=Rect(0, 0 - 1080, 1920), this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/SurfaceView( 3428): Callback --> surfaceDestroyed, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/SurfaceView( 3428): surfaceDestroyed callback +, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/GLConsumer( 3428): [SurfaceTexture-0-3428-0] detachFromContext
D/Surface ( 3428): Surface::disconnect(this=0xdda52700,api=1)
D/GraphicBuffer( 3428): unregister, handle(0xf483ec00) (w:1080 h:1920 s:1088 f:0x1 u:0x000b00)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xf483ec00), client(54), share_fd(62)
D/GraphicBuffer( 3428): unregister, handle(0xf483eac0) (w:1080 h:1920 s:1088 f:0x1 u:0x000b00)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xf483eac0), client(54), share_fd(53)
D/Surface ( 3428): Surface::disconnect(this=0xdda52700,api=1)
I/SurfaceView( 3428): surfaceDestroyed callback -, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
V/SurfaceView( 3428): Layout: x=0 y=0 w=1080 h=1920, frame=Rect(0, 0 - 1080, 1920), this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
D/Surface ( 3428): Surface::disconnect(this=0xdda52000,api=1)
D/GraphicBuffer( 3428): unregister, handle(0xee93b460) (w:1080 h:1920 s:1088 f:0x1 u:0x000b00)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93b460), client(54), share_fd(55)
D/GraphicBuffer( 3428): unregister, handle(0xee93c400) (w:1080 h:1920 s:1088 f:0x1 u:0x000b00)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93c400), client(54), share_fd(79)
D/GraphicBuffer( 3428): unregister, handle(0xee93bfa0) (w:1080 h:1920 s:1088 f:0x1 u:0x000b00)
I/[MALI][Gralloc]( 3428): [-]r_hnd(0xee93bfa0), client(54), share_fd(58)
D/Surface ( 3428): Surface::disconnect(this=0xdda52000,api=1)
I/SurfaceView( 3428): updateWindow -- OnPreDrawListener, mHaveFrame = true, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/SurfaceView( 3428): updateWindow -- onWindowVisibilityChanged, visibility = 8, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/SurfaceView( 3428): updateWindow -- OnPreDrawListener, mHaveFrame = true, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/SurfaceView( 3428): updateWindow -- OnPreDrawListener, mHaveFrame = true, this = io.flutter.view.FlutterView{d856d62 VFED..... .F...... 0,0-1080,1920}
I/System  ( 3428): FinalizerDaemon: finalize objects = 62
D/Camera-JNI( 3428): (tid:3443)[release camera] - X context=0x0
D/Camera-JNI( 3428): (tid:3443)[release camera] - X context=0x0
D/Camera-JNI( 3428): (tid:3443)[release camera] - X context=0x0
D/Camera-JNI( 3428): (tid:3443)[release camera] - X context=0x0
I/BufferQueue( 3428): [SurfaceTexture-1-3428-1](this:0xdacc2c00,id:2,api:4,p:-1,c:-1) ~BufferQueueCore
Lost connection to device.

Metadata

Metadata

Assignees

Labels

dependency: skiaSkia team may need to help usengineflutter/engine related. See also e: labels.waiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions