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

Commit c632313e authored by Jae Seo's avatar Jae Seo Committed by Android Git Automerger
Browse files

am 2094a702: Merge "Unregister the existing callback when MediaProjection stops" into mnc-dev

* commit '2094a702':
  Unregister the existing callback when MediaProjection stops
parents 64e26348 2094a702
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -127,10 +127,8 @@ public final class MediaProjectionManagerService extends SystemService
        IBinder.DeathRecipient deathRecipient = new IBinder.DeathRecipient() {
            @Override
            public void binderDied() {
                synchronized (mLock) {
                removeCallback(callback);
            }
            }
        };
        synchronized (mLock) {
            mCallbackDelegate.add(callback);
@@ -344,6 +342,7 @@ public final class MediaProjectionManagerService extends SystemService
        public final String packageName;
        public final UserHandle userHandle;

        private IMediaProjectionCallback mCallback;
        private IBinder mToken;
        private IBinder.DeathRecipient mDeathEater;
        private int mType;
@@ -406,7 +405,8 @@ public final class MediaProjectionManagerService extends SystemService
                    throw new IllegalStateException(
                            "Cannot start already started MediaProjection");
                }
                registerCallback(callback);
                mCallback = callback;
                registerCallback(mCallback);
                try {
                    mToken = callback.asBinder();
                    mDeathEater = new IBinder.DeathRecipient() {
@@ -435,8 +435,11 @@ public final class MediaProjectionManagerService extends SystemService
                            + "pid=" + Binder.getCallingPid() + ")");
                    return;
                }
                mToken.unlinkToDeath(mDeathEater, 0);
                stopProjectionLocked(this);
                mToken.unlinkToDeath(mDeathEater, 0);
                mToken = null;
                unregisterCallback(mCallback);
                mCallback = null;
            }
        }