* commit '0acee36bd8b5b5fdb36ef0b80ebe7e736041cecd': Fix race condition in PackageManager.
This commit is contained in:
@@ -871,7 +871,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
public void onServiceDisconnected(ComponentName name) {
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
if (DEBUG_SD_INSTALL) Log.i(TAG, "onServiceDisconnected");
|
if (DEBUG_SD_INSTALL) Log.i(TAG, "onServiceDisconnected");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// Recordkeeping of restore-after-install operations that are currently in flight
|
// Recordkeeping of restore-after-install operations that are currently in flight
|
||||||
// between the Package Manager and the Backup Manager
|
// between the Package Manager and the Backup Manager
|
||||||
@@ -883,7 +883,8 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
args = _a;
|
args = _a;
|
||||||
res = _r;
|
res = _r;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
final SparseArray<PostInstallData> mRunningInstalls = new SparseArray<PostInstallData>();
|
final SparseArray<PostInstallData> mRunningInstalls = new SparseArray<PostInstallData>();
|
||||||
int mNextInstallToken = 1; // nonzero; will be wrapped back to 1 when ++ overflows
|
int mNextInstallToken = 1; // nonzero; will be wrapped back to 1 when ++ overflows
|
||||||
|
|
||||||
@@ -1109,13 +1110,18 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
mContainerService = (IMediaContainerService) msg.obj;
|
mContainerService = (IMediaContainerService) msg.obj;
|
||||||
}
|
}
|
||||||
if (mContainerService == null) {
|
if (mContainerService == null) {
|
||||||
// Something seriously wrong. Bail out
|
if (!mBound) {
|
||||||
|
// Something seriously wrong since we are not bound and we are not
|
||||||
|
// waiting for connection. Bail out.
|
||||||
Slog.e(TAG, "Cannot bind to media container service");
|
Slog.e(TAG, "Cannot bind to media container service");
|
||||||
for (HandlerParams params : mPendingInstalls) {
|
for (HandlerParams params : mPendingInstalls) {
|
||||||
// Indicate service bind error
|
// Indicate service bind error
|
||||||
params.serviceError();
|
params.serviceError();
|
||||||
}
|
}
|
||||||
mPendingInstalls.clear();
|
mPendingInstalls.clear();
|
||||||
|
} else {
|
||||||
|
Slog.w(TAG, "Waiting to connect to media container service");
|
||||||
|
}
|
||||||
} else if (mPendingInstalls.size() > 0) {
|
} else if (mPendingInstalls.size() > 0) {
|
||||||
HandlerParams params = mPendingInstalls.get(0);
|
HandlerParams params = mPendingInstalls.get(0);
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user