Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2bd8e97f authored by oleksii stepanian's avatar oleksii stepanian Committed by Android (Google) Code Review
Browse files

Merge "Fix race condition in PackageManager." into mnc-dev

parents a0f5c76f 161bd9aa
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -871,7 +871,7 @@ public class PackageManagerService extends IPackageManager.Stub {
        public void onServiceDisconnected(ComponentName name) {
            if (DEBUG_SD_INSTALL) Log.i(TAG, "onServiceDisconnected");
        }
    };
    }
    // Recordkeeping of restore-after-install operations that are currently in flight
    // between the Package Manager and the Backup Manager
@@ -883,7 +883,8 @@ public class PackageManagerService extends IPackageManager.Stub {
            args = _a;
            res = _r;
        }
    };
    }
    final SparseArray<PostInstallData> mRunningInstalls = new SparseArray<PostInstallData>();
    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;
                    }
                    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");
                            for (HandlerParams params : mPendingInstalls) {
                                // Indicate service bind error
                                params.serviceError();
                            }
                            mPendingInstalls.clear();
                        } else {
                            Slog.w(TAG, "Waiting to connect to media container service");
                        }
                    } else if (mPendingInstalls.size() > 0) {
                        HandlerParams params = mPendingInstalls.get(0);
                        if (params != null) {