I need help in figuring out why my code is not working on an Android device at version 8.1, this same piece of code works fine on version 8.0 and below.
minSdkVersion = 19
targetSdkVersion = 26
compileSdkVersion = 26
Some context, I'm taking a picture through the camera when there are multiple failed passcode attempts, the app is running in the foreground. The app invokes this method which preps the camera device and provides the PictureCallback for a JPEG format.
In the logs I can see
takePicture called
But, onPictureTaken
does not get invoked.
Here is the code:
sLogger.info(TAG + "takePicture called.");
try {
mCamera.takePicture(null, null, null, new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
if (data == null) {
sLogger.error(TAG + "Received null data in onPictureTaken from Camera PictureCallBack");
return;
}
pictureTaken(data, orientation);
}
});
} catch (Exception e) {
lookoutCamFailed();
sLogger.error(TAG + "takePicture failed.", e);
}
Adding Logs:
07-20 01:22:20.206 1264 2946 D ActivityManagerPerformance: AMP_release() ACT_START
07-20 01:22:20.225 27040 29514 I MyApp : [CameraManager.initPreview:742] Cam: Preview started.
07-20 01:22:20.226 599 1485 I QCamera : getCameraInfo: 392: E camera id (1), mNumOfCameras (2)
07-20 01:22:20.226 599 1485 I QCamera : getCamInfo: 8789: camera 1 resource cost is 100
07-20 01:22:20.226 599 1485 I QCamera : getCameraInfo: 409: camera id = 1, facing info = FRONT
07-20 01:22:20.227 599 1485 E QCamera : checkCameraCondition: 1061: camera id(1), camera facing(1), camera type(1)
07-20 01:22:20.227 599 1485 I QCamera : getCameraInfo: 424: X camera id (1)
07-20 01:22:20.230 855 2354 D CameraClient: sendCommand (pid 27040) 07-20 01:22:20.230 855 2354 D CameraClient: ENABLE_SHUTTER_SOUND (0, 0) 07-20 01:22:20.230 855 2354 D CameraClient: enableShutterSound (pid 27040)
07-20 01:22:20.230 27040 29514 I MyApp : [CameraManager.disableShutterSoundIfPossible:531] MyAppCam: call to enableShutterSound succeeded.
07-20 01:22:20.231 27040 29514 I MyApp : [CameraManager.prepAndTakePicture:863] MyAppCam: takePicture called.
07-20 01:22:20.231 855 2354 D CameraClient: takePicture (pid 27040): 0x100
07-20 01:22:20.232 855 2354 D CameraClient: enableMsgType : msg(0x100, 0xd0d)
07-20 01:22:20.232 855 2354 D SecCameraCoreManager: enableMsgType : msg(In:0x100, Out:0xd0d)
07-20 01:22:20.232 855 2354 I ShotCommon: enableMsgType : msg(In:0x100, Out:0xd0d)
07-20 01:22:20.232 855 2354 D SecCameraCoreManager: takePicture 07-20 01:22:20.234 1264 1447 I EDMNativeHelperService: isCameraEnabled 07-20 01:22:20.235 1264 1447 D RestrictionPolicy: isCameraEnabled ret(true) userId(0) cxtInfo.mCallerUid(10034) cxtInfo.mContainerId(0)
07-20 01:22:20.235 855 2354 E SecCameraCoreManager: checkTemperature (0)
07-20 01:22:20.235 855 2354 D SecCameraCoreManager: takePicture:stop IT Policy checking thread
07-20 01:22:20.283 599 29526 I QCamera : procEvtPreviewReadyState: 924: QCAMERA_SM_EVT_GET_PARAMS ReadyState
07-20 01:22:20.285 855 2354 D ShotSingle: takePicture : supportedPictureFormat = jpeg,nv21
07-20 01:22:20.285 855 2354 I ShotSingle: takePicture : backup picture format to jpeg
07-20 01:22:20.285 855 2354 I ShotSingle: takePicture : normal, jpeg 07-20 01:22:20.285 599 1485 I QCamera : take_picture: 1391: [KPI Perf] take_picture: E PROFILE_TAKE_PICTURE camera id 1
07-20 01:22:20.286 599 1485 I QCamera : take_picture: 1409: [KPI Perf] take_picture : X
07-20 01:22:20.286 599 29604 I QCamera : take_picture_thread: 1073: [KPI Perf] take_picture_thread : E
07-20 01:22:20.286 599 29604 I QCamera : take_picture_internal: 1105: [KPI Perf] take_picture_internal: E camera id 1
07-20 01:22:20.286 599 29604 I QCamera : take_picture_internal: 1229: take_picture_internal Flash Mode=0, LLS mode=0, Auto LLS mode=0, NumOfSnaps=1
07-20 01:22:20.286 599 29526 E QCamera : procEvtPreviewReadyState: 1099: Error!! cannot handle evt(25) in state(1)
07-20 01:22:20.286 599 29604 I QCamera : take_picture_internal: 1361: [KPI Perf] take_picture_internal: X
07-20 01:22:20.287 599 29604 I QCamera : take_picture_thread: 1077: [KPI Perf] take_picture_thread : X
07-20 01:22:20.287 27040 29514 I MyApp : [CameraManager$4.run:779] MyAppCam: surfaceDestroyed called.
07-20 01:22:20.321 2750 2750 D io_stats: !@ 179,0 r 553172 42202994 w 299093 5907016 d 11954 2375296 f 81990 82006 iot 648070 657873 th 51200 0 0 pt 0 inp 0 0 67436.843
07-20 01:22:20.330 1264 2292 W zygote : Long monitor contention with owner Binder:1264_1E (12984) at android.content.pm.ParceledListSlice com.android.server.pm.PackageManagerService.getInstalledPackages(int, int)(PackageManagerService.java:11443) waiters=0 in android.content.pm.ApplicationInfo com.android.server.pm.PackageManagerService.getApplicationInfoInternal(java.lang.String, int, int, int) for 540ms
07-20 01:22:20.331 1264 2259 W zygote : Long monitor contention with owner Binder:1264_1E (12984) at android.content.pm.ParceledListSlice com.android.server.pm.PackageManagerService.getInstalledPackages(int, int)(PackageManagerService.java:11443) waiters=1 in java.lang.String com.android.server.pm.PackageManagerService.getInstantAppPackageName(int) for 481ms
07-20 01:22:20.335 1264 2293 W zygote : Long monitor contention with owner Binder:1264_D (2292) at int com