apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.6k stars 1.53k forks source link

Android 13 device goes to lock screen after quit app when showing splashscreen #1513

Open TruyenNV opened 1 year ago

TruyenNV commented 1 year ago

Bug Report

Problem

What is expected to happen?

Doesn't lock screen

What does actually happen?

Goes to lock screen when quit app at splashscreen

Information

Only happen with Cordova-Android@11 and Android 13 device

Command or Code

Environment, Platform, Device

Cordova-Android@11 and Android 13 device

Version information

My Ionic info:

Ionic:

Ionic CLI : 6.20.3 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : ionic-angular 3.9.9 @ionic/app-scripts : 3.2.4

Cordova:

Cordova CLI : 11.0.0 Cordova Platforms : android 11.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 3 other plugins)

Utility:

cordova-res : 0.15.4 native-run : 1.7.1

System:

Android SDK Tools : 26.1.1 (/Users/truyenn/Library/Android/sdk/) ios-deploy : 1.9.4 ios-sim : 8.0.0 NodeJS : v14.20.1 (/usr/local/bin/node) npm : 6.14.17 OS : macOS Monterey Xcode : Xcode 13.4.1 Build version 13F100

cordova plugin ls cordova-plugin-device 2.0.2 "Device" cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard" cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar"

Checklist

terreng commented 1 year ago

This is an Android 12/13 bug specific to Pixel phones. It should be fixed in the latest/upcoming Android 13 release. Here's the bug report in the issue tracker: https://issuetracker.google.com/issues/242118185

A workaround is suggested for affected Android versions:

If the developer seeing this on eailer android verion(13-), the workaround might try to defer the finish call after activity resumed if that activity has register #setOnExitAnimationListener, or call #clearOnExitAnimationListener before finish and onResume.

I believe the Pixel 3 hasn't gotten any updates past Android 12, so it would be a good idea to implement this workaround to avoid the issue.

To reproduce this issue, simply close the app immediately after opening it, while it's still on the SplashScreen. This will crash System UI and kick you back to the lock screen. Only happens on Pixel devices running Android 12/13.

breautek commented 1 year ago

Moving this from the 11.0.1 milestone to 12.0.0 milestone because master already has the major version bump.

breautek commented 1 year ago

The link issue states the issue has been fixed upstream in the "android framework" however it's unclear where that fix is landed or what package really needs to be updated.

However, current master is using v1.0.0 (upgraded from v1.0.0 release candidate), so maybe it's worth testing again against a development version of the platform to see if the issue persists.