Skip to content

Commit

Permalink
Blue green is observed during camera open
Browse files Browse the repository at this point in the history
When app moves to groundback all the data structure remains in stack
and when app open again , app tries to clear view from cashed data
this is when static camera frames is seen but later app tries to open
with updated surfaces this is when blue screen is observed and blue
screen visible till first camera frames appears.

When app is moving to background we are cleaning all the data by
killing the process so next time camera opens with fresh data.

Tests Done : tested for multiple times camera open\close and no
blue screen is observed.

Tracked-On: OAM-127022
Signed-off-by: shivasku82 <[email protected]>
  • Loading branch information
shivasku82 committed Nov 6, 2024
1 parent 7dea5c9 commit 1e6024f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class FullScreenActivity extends AppCompatActivity {
private CameraBase mCamera;
private RoundedThumbnailView mRoundedThumbnailView;
private BroadcastReceiver mUsbReceiver;

private boolean isSwitchingActivity = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -252,6 +252,7 @@ public void onClick(View v) {
MultiCamera ic_camera = MultiCamera.getInstance();
ic_camera.setIsCameraOrSurveillance(1);
unregisterReceiver(mUsbReceiver);
isSwitchingActivity = true;
Intent intent = new Intent(FullScreenActivity.this, MultiViewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Expand Down Expand Up @@ -434,18 +435,27 @@ private void checkPermissions() {

@Override
protected void onPause() {
Log.v(TAG, "onPause");
closeCamera();
super.onPause();
}

@Override
protected void onResume() {
super.onResume();
Log.e(TAG, "onResume");
Log.v(TAG, "onResume");
isSwitchingActivity = false;
MultiCamera ic_cam = MultiCamera.getInstance();
ic_cam.setIsCameraOrSurveillance(0);

OpenCamera();

}
}
@Override
protected void onStop() {
super.onStop();
Log.v(TAG, "onStop");
if(isSwitchingActivity == false)
System.exit(0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class MultiViewActivity extends AppCompatActivity {

private int isDialogShown;

private boolean isSwitchingActivity = false;
private SettingsPrefUtil Fragment, Fragment1, Fragment2, Fragment3;

public String[] CameraIds;
Expand Down Expand Up @@ -330,6 +331,7 @@ public void onClick(View v) {
closeCamera();
ic_camera.setIsCameraOrSurveillance(0);
unregisterReceiver(mUsbReceiver);
isSwitchingActivity = true;
Intent intent = new Intent(MultiViewActivity.this, SingleCameraActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Expand Down Expand Up @@ -376,6 +378,7 @@ public void onClick(View v) {
closeCamera();
ic_camera.setIsCameraOrSurveillance(0);
unregisterReceiver(mUsbReceiver);
isSwitchingActivity = true;
Intent intent = new Intent(MultiViewActivity.this, SingleCameraActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Expand Down Expand Up @@ -422,6 +425,7 @@ public void onClick(View v) {
ic_camera.setOpenCameraId(2);
closeCamera();
unregisterReceiver(mUsbReceiver);
isSwitchingActivity = true;
Intent intent = new Intent(MultiViewActivity.this, SingleCameraActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Expand Down Expand Up @@ -470,6 +474,7 @@ public void onClick(View v) {
ic_camera.setOpenCameraId(3);
closeCamera();
unregisterReceiver(mUsbReceiver);
isSwitchingActivity = true;
Intent intent = new Intent(MultiViewActivity.this, SingleCameraActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Expand Down Expand Up @@ -643,7 +648,9 @@ private void manageBotmRightCam() {
@Override
protected void onResume() {
super.onResume();
Log.e(TAG, " onResume");

isSwitchingActivity = false;
Log.v(TAG, "onResume");
startCamera();
hideCameraSwitchButton();
}
Expand Down Expand Up @@ -672,12 +679,20 @@ public void closeCamera() {

@Override
protected void onPause() {
System.out.println("onPause");
Log.v(TAG, "onPause");
closeCamera();
super.onPause();

}

@Override
protected void onStop() {
super.onStop();
Log.v(TAG, "onStop");
if(isSwitchingActivity == false)
System.exit(0);
}

public void settingView(View view) {
FrameLayout frameLayout;
Bundle bundle;
Expand Down Expand Up @@ -1285,6 +1300,7 @@ public void enterFullScreen(View view) {

closeCamera();
unregisterReceiver(mUsbReceiver);
isSwitchingActivity = true;
Intent intent = new Intent(MultiViewActivity.this, SingleCameraActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class SingleCameraActivity extends AppCompatActivity {
private RoundedThumbnailView mRoundedThumbnailView;
private BroadcastReceiver mUsbReceiver;
private long mLastClickTime = 0;

private boolean isSwitchingActivity = false;
private SettingsPrefUtil Fragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -191,6 +191,7 @@ public void onClick(View v) {
MultiCamera ic_camera = MultiCamera.getInstance();
ic_camera.setIsCameraOrSurveillance(1);
unregisterReceiver(mUsbReceiver);
isSwitchingActivity = true;
Intent intent = new Intent(SingleCameraActivity.this, MultiViewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Expand Down Expand Up @@ -422,17 +423,27 @@ private void checkPermissions() {

@Override
protected void onPause() {
Log.v(TAG, "onPause");
closeCamera();
super.onPause();
}

@Override
protected void onResume() {
super.onResume();
Log.e(TAG, " onResume");
Log.v(TAG, " onResume");
isSwitchingActivity = false;
MultiCamera ic_cam = MultiCamera.getInstance();
ic_cam.setIsCameraOrSurveillance(0);

OpenCamera();
}
}

@Override
protected void onStop() {
super.onStop();
Log.v(TAG, "onStop");
if(isSwitchingActivity == false)
System.exit(0);
}
}

0 comments on commit 1e6024f

Please sign in to comment.