Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit bb89d23c authored by Hui Yu's avatar Hui Yu
Browse files

Increase startForeground() timeout to 30 seconds.

Right now there is 10 seconds grace period from Context.startForegroudService() to Service.startForeground() call, afterwards
we crash the app and thow ForegroundServiceDidNotStartInTimeException, at the same time generate ANR report.

Make the startForegroundService() to startForeground() grace period
configurable, increase the default value from 10 seconds to 30 seconds.
This value can be changed by command "adb shell device_config put activity_manager
service_start_foreground_timeout_ms 30000"

After the 30 seconds service_start_foreground_timeout_ms and ForegroundServiceDidNotStartInTimeException, delay the ANR generation for another 10
seconds configurable by service_start_foreground_anr_delay_ms.
This value can be changed by "adb shell device_config put activity_manager service_start_foreground_anr_delay_ms 10000".
At the end of service_start_foreground_anr_delay_ms, if the app's
process is still alive, the ANR report will be taken. Otherwise, there
is no ANR report.

Bug: 219514357
Test: adb shell device_config put activity_manager service_start_foreground_timeout_ms,
adb shell device_config put activity_manager service_start_foreground_anr_delay_ms,
Manual test, in test app, startForegroundService() but not call startForeground(), 30 seconds later, observe the ForegroundServiceDidNotStartInTimeException, 10 seconds later, try to take the ANR report.

Change-Id: I5f30d0996bff23f8a302cedef01eaa31e6ff29ce
parent 40ca086c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment