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

Commit bfcf9a83 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Recycle PooledLambda in CameraDeviceImpl.CameraDeviceCallbacks

PooledRunnable has a nice optional method recycleOnUse(), which can be
used if the Runnable is guaranteed to be executed at most once.

By calling this method, PooledRunnable instance will be auto-recycled
into the internal object pool once it's executed.

Test: presubmit
Change-Id: I6ff341be5d0abddba8134489950be0b7c1affcbb
parent 21ba5d4f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1889,7 +1889,7 @@ public class CameraDeviceImpl extends CameraDevice
            final long ident = Binder.clearCallingIdentity();
            final long ident = Binder.clearCallingIdentity();
            try {
            try {
                CameraDeviceImpl.this.mDeviceExecutor.execute(obtainRunnable(
                CameraDeviceImpl.this.mDeviceExecutor.execute(obtainRunnable(
                            CameraDeviceCallbacks::notifyError, this, code));
                            CameraDeviceCallbacks::notifyError, this, code).recycleOnUse());
            } finally {
            } finally {
                Binder.restoreCallingIdentity(ident);
                Binder.restoreCallingIdentity(ident);
            }
            }