From 1bc9616846b0953b82a0ab8a5feaf103e6739f3c Mon Sep 17 00:00:00 2001 From: shivasku82 Date: Tue, 8 Oct 2024 08:24:23 +0530 Subject: [PATCH] wait to allow HAL closes all camera camera close call is aync call, multi camera exit soon after placing request which create issue in camera HAL as buffer release fail. wait for 100 msec to allow HAL release all the buffers. Tracked-On: OAM-125256 Signed-off-by: shivasku82 --- .../com/intel/multicamera/FullScreenActivity.java | 10 +++++++++- .../com/intel/multicamera/MultiViewActivity.java | 12 ++++++++++-- .../com/intel/multicamera/SingleCameraActivity.java | 10 +++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/camera/MultiCameraApplication/java/com/intel/multicamera/FullScreenActivity.java b/camera/MultiCameraApplication/java/com/intel/multicamera/FullScreenActivity.java index 948189a..5dc4ff7 100644 --- a/camera/MultiCameraApplication/java/com/intel/multicamera/FullScreenActivity.java +++ b/camera/MultiCameraApplication/java/com/intel/multicamera/FullScreenActivity.java @@ -455,7 +455,15 @@ protected void onResume() { protected void onStop() { super.onStop(); Log.v(TAG, "onStop"); - if(isSwitchingActivity == false) + if(isSwitchingActivity == false) { + closeCamera(); + try { + // Sleep for 100ms to allow all camera to close properly + TimeUnit.MILLISECONDS.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } System.exit(0); } } +} diff --git a/camera/MultiCameraApplication/java/com/intel/multicamera/MultiViewActivity.java b/camera/MultiCameraApplication/java/com/intel/multicamera/MultiViewActivity.java index 7364406..caa251a 100644 --- a/camera/MultiCameraApplication/java/com/intel/multicamera/MultiViewActivity.java +++ b/camera/MultiCameraApplication/java/com/intel/multicamera/MultiViewActivity.java @@ -689,8 +689,16 @@ protected void onPause() { protected void onStop() { super.onStop(); Log.v(TAG, "onStop"); - if(isSwitchingActivity == false) - System.exit(0); + if(isSwitchingActivity == false) { + closeCamera(); + try { + // Sleep for 100 milliseconds + TimeUnit.MILLISECONDS.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.exit(0); + } } public void settingView(View view) { diff --git a/camera/MultiCameraApplication/java/com/intel/multicamera/SingleCameraActivity.java b/camera/MultiCameraApplication/java/com/intel/multicamera/SingleCameraActivity.java index 0547e2e..2ae4e7e 100644 --- a/camera/MultiCameraApplication/java/com/intel/multicamera/SingleCameraActivity.java +++ b/camera/MultiCameraApplication/java/com/intel/multicamera/SingleCameraActivity.java @@ -443,7 +443,15 @@ protected void onResume() { protected void onStop() { super.onStop(); Log.v(TAG, "onStop"); - if(isSwitchingActivity == false) + if(isSwitchingActivity == false) { + closeCamera(); + try { + // Sleep for 100ms to allow all camera to close properly + TimeUnit.MILLISECONDS.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } System.exit(0); } } +}