Skip to content
Commit c0067011 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Don't schedule restart service if it will be bring down

Originally, the log "Scheduling restart of crashed service"
will show even when a service is died with condition:
 (1) Force-stop package
 (2) Exceed max delivery count without connections
 (3) Not sticky without connections
But all of these conditions will bring down the service and
cancel the restart. That is unnecessary and the printed log
is confusing.

(1) is fixed by changing the parameter "allowRestart" to false
when killing the package. This also involves the condition to
restart the provider that should be always-remove instead of
always-restart.
(2) and (3) are fixed by the early return (in the method
ActiveServices#scheduleServiceRestartLocked) that checks if the
service is no longer started and doesn't have connections.

Also print the reason when scheduling restart service so it has
clearer information to know the condition.

The original FrameworksCoreTests:ServiceTest is replaced because
the same tests already exist in CTS.

Bug: 133842309
Test: atest FrameworksCoreTests:ServiceTest
Test: atest CtsAppTestCases:ServiceTest

Change-Id: Iea3a97b10b3872241e069de602450b929cd3fa7b
parent 4b235cb0
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