OSDN Git Service

Don't hold lock when calling externally
authorTodd Kennedy <toddke@google.com>
Wed, 27 Apr 2016 00:06:38 +0000 (17:06 -0700)
committerTodd Kennedy <toddke@google.com>
Wed, 27 Apr 2016 00:06:38 +0000 (17:06 -0700)
commitd5e295f9192522176796271cb29558a53d37c875
tree42e8b8bba2121d902a4995b78a771dc63d6d0d16
parent34510eb2933b98f0c8c73f9a7be5eae911a14210
Don't hold lock when calling externally

Wound up in a deadlock. We held mPackages lock and called the mount
service. This called into the AppOps service which tried to obtain
its lock. On another thread, we held the AppOps service lock which
called into PackageManager service and tried to take mPackages.

Ideally, we'd never hold an internal lock when calling externally.
In practice, that's not always fixable [for example, code change
would be too great to not hold the AppOps lock when calling into
the PackageManager service].

Bug: 28169075
Change-Id: If0a7f1361c7be9385b1f629f68ebc0556b08ab06
services/core/java/com/android/server/pm/PackageManagerService.java