OSDN Git Service

Don't hold lock calling into PackageMgr
authorTodd Kennedy <toddke@google.com>
Tue, 12 Jul 2016 21:07:40 +0000 (14:07 -0700)
committerTodd Kennedy <toddke@google.com>
Tue, 12 Jul 2016 21:07:40 +0000 (14:07 -0700)
commit04918fe02715d330cbefa16d055d5766264273c3
tree268846443c586ad49de09c302ac424f094af38dd
parent0e792f567ac1b37a75e94e1ff1017f2f152494ef
Don't hold lock calling into PackageMgr

There's a subtle deadlock; when dumping state, we obtain the package manager
lock before trying to obtain the package installer session lock. Meanwhile,
creating a new session obtains the locks in the reverse -- the package
installer takes the package installer session lock and then tries to obtain
the package manager lock.

Here, we avoid holding the package installer session lock before we call
into the package manager. Alternatively, we could consider not holding the
package manager lock when dumping package installer state. But, given the
scope of the dumping logic, that's a bigger change with other, unknown
side effects.

Change-Id: I11f08484cd335bb7ad3bc557808eb48d14bd29cf
Fixes: 30089638
services/core/java/com/android/server/pm/PackageInstallerService.java