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

Commit 73ffd635 authored by TYM Tsai's avatar TYM Tsai Committed by Android (Google) Code Review
Browse files

Merge "Fix CtsAtomicInstallTestCases flaky" into main

parents 803b24ec 3437c571
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1886,7 +1886,14 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
        }

        public void onSessionFinished(final PackageInstallerSession session, boolean success) {
            if (success) {
                // There is a timing issue here, if the callback opens the session again in
                // notifySessionFinished() immediately, the session may not be removed from
                // the mSession. But to avoid adding unknown latency, only notifying failures
                // are moved to the last of posted runnable, notifying success cases are
                // still kept here.
                mCallbacks.notifySessionFinished(session.sessionId, session.userId, success);
            }

            mInstallHandler.post(new Runnable() {
                @Override
@@ -1915,6 +1922,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements

                        mSettingsWriteRequest.runNow();
                    }
                    if (!success) {
                        mCallbacks.notifySessionFinished(
                                session.sessionId, session.userId, success);
                    }
                }
            });
        }