OSDN Git Service

Fix issue #65359137: Apps with target API 26 can bypass background...
authorDianne Hackborn <hackbod@google.com>
Tue, 5 Sep 2017 23:44:36 +0000 (16:44 -0700)
committerDianne Hackborn <hackbod@google.com>
Wed, 6 Sep 2017 16:47:16 +0000 (09:47 -0700)
commita857e65c53957f87036b7962750bbdece6012b53
treed5dd9f477ef2b4e4987606903b01f62711bb587f
parentbff95c0d661571c4757a86fdae9b5fae090bb118
Fix issue #65359137: Apps with target API 26 can bypass background...

...limit introduced in Oreo by swiping away from the task list

There was an edge case where, when restarting a service, if the
process wasn't already running we would bring it up directly in
the idle state and never go through the mechanism of force stopping
services once an app goes idle.

The fix for now is pretty targeted, detecting when we have a new
uid that is immediately idle, and in that case doing the same
thing we do when an existing uid goes idle (stopping any services
in it).  This means that in this flow you will get a glitch of
the service starting and then immediately stopping when idle is
applied at that point, but we do end up ultimately in the correct
final state.

Test: manual
Bug: 65359137

Change-Id: I64c29975ad75e7d7390512bf59673d423df16cf2
services/core/java/com/android/server/am/ActivityManagerService.java