We are facing a weird problem. Another app are crashing and throwing an exception to our app, and it was caught by firebase. We have no idea of how protect our app against this. Does anyone have any idea about this? Above is the stacktrace:
Fatal Exception: java.lang.IllegalArgumentException: removeChild: container=Task=2 is not a child of container=Stack=0 current parent={stackId=2 tasks=[{taskId=2 appTokens=[AppWindowToken{c4159f token=Token{b94233e ActivityRecord{61177f9 u0 **br.com.hbsis.gda/.view.activity.HomeActivity** t2}}}] mdr=false}]}
at android.os.Parcel.createException(Parcel.java:1970)
at android.os.Parcel.readException(Parcel.java:1934)
at android.os.Parcel.readException(Parcel.java:1884)
at android.app.IActivityManager$Stub$Proxy.finishActivity(IActivityManager.java:3644)
at android.app.Activity.finish(Activity.java:5739)
at android.app.Activity.finish(Activity.java:5763)
at android.app.Activity.finishAfterTransition(Activity.java:5818)
at android.app.Activity.onBackPressed(Activity.java:3205)
at androidx.activity.ComponentActivity.access$001(ComponentActivity.java:50)
at androidx.activity.ComponentActivity$1.run(ComponentActivity.java:72)
at androidx.activity.OnBackPressedDispatcher.onBackPressed(OnBackPressedDispatcher.java:194)
at androidx.activity.ComponentActivity.onBackPressed(ComponentActivity.java:286)
at br.com.our.app.commons.ui.MainActivity.onBackPressed(MainActivity.java:243)
at android.app.Activity.onKeyUp(Activity.java:3176)
at android.view.KeyEvent.dispatch(KeyEvent.java:3389)
at android.app.Activity.dispatchKeyEvent(Activity.java:3466)
at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:122)
at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:84)
at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:140)
at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:569)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:3031)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:602)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6160)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6015)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5468)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5521)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5487)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5646)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5495)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5703)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5468)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5521)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5487)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5495)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5468)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5521)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5487)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5679)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5848)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3395)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2842)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2833)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3372)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:326)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7258)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by android.os.RemoteException: Remote stack trace:
at com.android.server.wm.WindowContainer.positionChildAt(WindowContainer.java:425)
at com.android.server.wm.TaskStack.positionChildAt(TaskStack.java:837)
at com.android.server.wm.TaskStack.positionChildAt(TaskStack.java:825)
at com.android.server.wm.StackWindowController.positionChildAtTop(StackWindowController.java:146)
at com.android.server.am.ActivityStack.insertTaskAtTop(ActivityStack.java:3441)
It seems that another app is crashing and our app is getting the error, I have no idea what is happening. The link to download that app on playstore is the following: https://play.google.com/store/apps/details?id=br.com.hbsis.gda&hl=pt_BR
This another app is probably a launcher and can probably control the device.
We have a floating button that can overlap another app. We use this library for this: https://github.com/recruit-lifestyle/FloatingView/tree/master/library/src/main/java/jp/co/recruit_lifestyle/android/floatingview The crash is happening on this.