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

Commit 795f3ee4 authored by Yara Hassan's avatar Yara Hassan Committed by Automerger Merge Worker
Browse files

Add finish() method to DataShare Read and Write Adapters am: dc699fb8

Change-Id: Ie391d155a80ec2656d28bce9dc3ca2d9d0c05757
parents b93b20a4 dc699fb8
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -677,10 +677,6 @@ public abstract class ContentCaptureService extends Service {
                throws RemoteException {
            synchronized (mLock) {
                executeAdapterMethodLocked(adapter -> adapter.onStart(fd), "onStart");

                // Client app and Service successfully connected, so this object would be kept alive
                // until the session has finished.
                clearHardReferences();
            }
        }

@@ -693,6 +689,13 @@ public abstract class ContentCaptureService extends Service {
            }
        }

        @Override
        public void finish() throws RemoteException {
            synchronized (mLock) {
                clearHardReferences();
            }
        }

        private void executeAdapterMethodLocked(Consumer<DataShareReadAdapter> adapterFn,
                String methodName) {
            LocalDataShareAdapterResourceManager resourceManager = mResourceManagerReference.get();
+1 −0
Original line number Diff line number Diff line
@@ -22,4 +22,5 @@ import android.os.ICancellationSignal;
oneway interface IDataShareReadAdapter {
    void start(in ParcelFileDescriptor fd);
    void error(int errorCode);
    void finish();
}
+5 −4
Original line number Diff line number Diff line
@@ -761,10 +761,6 @@ public final class ContentCaptureManager {
        public void write(ParcelFileDescriptor destination)
                throws RemoteException {
            executeAdapterMethodLocked(adapter -> adapter.onWrite(destination), "onWrite");

            // Client app and Service successfully connected, so this object would be kept alive
            // until the session has finished.
            clearHardReferences();
        }

        @Override
@@ -779,6 +775,11 @@ public final class ContentCaptureManager {
            clearHardReferences();
        }

        @Override
        public void finish() throws RemoteException  {
            clearHardReferences();
        }

        private void executeAdapterMethodLocked(Consumer<DataShareWriteAdapter> adapterFn,
                String methodName) {
            LocalDataShareAdapterResourceManager resourceManager = mResourceManagerReference.get();
+1 −0
Original line number Diff line number Diff line
@@ -25,4 +25,5 @@ oneway interface IDataShareWriteAdapter {
    void write(in ParcelFileDescriptor destination);
    void error(int errorCode);
    void rejected();
    void finish();
}