Solve the infinite loop on clearExternalStorageDataSync

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
This commit is contained in:
Tetsutoki Shiozawa
2016-06-08 13:45:47 +09:00
committed by Shunta Sato
parent 98cf9d1a60
commit b87ce12359

View File

@@ -13330,8 +13330,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) {