[BUG] Initial activity relaunch on first app install

Hardware: Samsung S20FE (also reproducible on other Samsung devices)
Software: One UI 5.1, Android 13

I’ve found a strange bug.

Steps to reproduce:

  1. Create new Android app with simple activity
class MainActivity : AppCompatActivity() {
  val TAG = "TAG"
  override fun onResume() {
    Log.d(TAG, "onResume: ")
    super.onResume()
  }

  override fun onDestroy() {
    Log.d(TAG, "onDestroy: ")
    super.onDestroy()
  }
}
  1. Add an activity into AndroidManifest.xml
   <activity
        android:name=".MainActivity"
        android:exported="true">

      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  1. Open the app on Samsung device.
  2. Check the logs and see that additional onDestroy and onResume is called.
  3. Debug the app and check that onDestroy is being called because of activity relaunching itself without any reason.

Bug happens just on initial app open. Every 2nd and every other time it will works perfectly fine but initial app launch on activity level for some reason is relaunched.

Please let me know if you have faced this issue before and how to fix it. Issue does not happen on Pixel device, seem to be limited to Samsung devices.