[Android] Handle native thread finishing when not commanded from the Java side