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

Commit 36705ec2 authored by Adrian Roos's avatar Adrian Roos Committed by android-build-merger
Browse files

ServiceConnection: Properly serialize events

am: a9b43182

Change-Id: I3571754de4d659aaf6b4a61fa14ae8256ca29f7a
parents 2b74cb0f a9b43182
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -1396,18 +1396,6 @@ public final class LoadedApk {
        }

        public void death(ComponentName name, IBinder service) {
            ServiceDispatcher.ConnectionInfo old;

            synchronized (this) {
                old = mActiveConnections.remove(name);
                if (old == null || old.binder != service) {
                    // Death for someone different than who we last
                    // reported...  just ignore it.
                    return;
                }
                old.binder.unlinkToDeath(old.deathMonitor, 0);
            }

            if (mActivityThread != null) {
                mActivityThread.post(new RunConnection(name, service, 1));
            } else {
@@ -1456,7 +1444,7 @@ public final class LoadedApk {
                }
            }

            // If there was an old service, it is not disconnected.
            // If there was an old service, it is now disconnected.
            if (old != null) {
                mConnection.onServiceDisconnected(name);
            }
@@ -1467,6 +1455,17 @@ public final class LoadedApk {
        }

        public void doDeath(ComponentName name, IBinder service) {
            synchronized (this) {
                ConnectionInfo old = mActiveConnections.get(name);
                if (old == null || old.binder != service) {
                    // Death for someone different than who we last
                    // reported...  just ignore it.
                    return;
                }
                mActiveConnections.remove(name);
                old.binder.unlinkToDeath(old.deathMonitor, 0);
            }

            mConnection.onServiceDisconnected(name);
        }