OSDN Git Service

Solve the infinite loop on clearExternalStorageDataSync
authorTetsutoki Shiozawa <tetsutoki.x.shiozawa@sonymobile.com>
Wed, 8 Jun 2016 04:45:47 +0000 (13:45 +0900)
committerTodd Kennedy <toddke@google.com>
Fri, 10 Jun 2016 21:31:59 +0000 (14:31 -0700)
5000 msec timeout is set for waiting DefaultContainerService, but
it's not working. It's not possible to exit a wait loop even if it
takes over 5000 msec.

Bug: 29232999

Change-Id: I74a45637e0a3fa5a7b151e6b3dc0b3aaece96d53

services/core/java/com/android/server/pm/PackageManagerService.java

index 27ca62a..a7bd4ab 100644 (file)
@@ -16341,8 +16341,9 @@ public class PackageManagerService extends IPackageManager.Stub {
                 for (int curUser : users) {
                     long timeout = SystemClock.uptimeMillis() + 5000;
                     synchronized (conn) {
-                        long now = SystemClock.uptimeMillis();
-                        while (conn.mContainerService == null && now < timeout) {
+                        long now;
+                        while (conn.mContainerService == null &&
+                                (now = SystemClock.uptimeMillis()) < timeout) {
                             try {
                                 conn.wait(timeout - now);
                             } catch (InterruptedException e) {