Skip to content

Android: RNCallKeepModule onHostDestroy crashes Android instrumentation test runner #797

Open
@mleppanen-sorenson

Description

@mleppanen-sorenson

Bug report

  • Reproduced on:
  • Android

Description

The following code in RNCallKeepModule.java for onHostDestroy causes the Android instrumentation test runner to crash:

   Log.d(TAG, "[RNCallKeepModule] onHostDestroy executed");
   // This line will kill the android process after ending all calls
   android.os.Process.killProcess(android.os.Process.myPid());

Proposed Solution

The following code would cleanly close the app without crashing the Android instrumentation test runner:

   Log.d(TAG, "[RNCallKeepModule] onHostDestroy executed");
   // This line will cleanly close the app after ending all calls
   getCurrentReactActivity().finishAffinity();

Steps to Reproduce

Create and run an Android Espresso UI Test

Versions

- Callkeep: 4.3.12
- React Native: 0.72.3
- Android: any
- Phone model: any

Logs

2024-07-19 10:06:37.970 12560-12560 RNCallKeep               D  [RNCallKeepModule] onHostDestroy called
2024-07-19 10:06:37.978 12560-12560 RNCallKeep               D  [RNCallKeepModule] stopListenToNativeCallsState
2024-07-19 10:06:37.978 12560-12560 RNCallKeep               D  [RNCallKeepModule] onHostDestroy executed
2024-07-19 10:06:37.978 12560-12560 Process                  I  Sending signal. PID: 12560 SIG: 9
2024-07-19 10:06:38.072 13142-13142 WindowOnBackDispatcher   W  sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda11@cf6b1b2
2024-07-19 10:06:38.097  1488-2809  ActivityManager          W  Crash of app com.xxxx.xxxx running instrumentation ComponentInfo{com.xxxx.xxxx.test/androidx.test.runner.AndroidJUnitRunner}

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