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

Commit f80ce94f authored by MingWei's avatar MingWei
Browse files

Replace MainContentCaptureSession with MainContentCaptureSessionV2

Test: Cts test.
Bug: 309411951
Change-Id: I5d80dad1cca447fb8cf77829f87cbd503f414c11
parent 8b5fefab
Loading
Loading
Loading
Loading
+5 −16
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.view.contentcapture;
import static android.view.contentcapture.ContentCaptureHelper.sDebug;
import static android.view.contentcapture.ContentCaptureHelper.sVerbose;
import static android.view.contentcapture.ContentCaptureHelper.toSet;
import static android.view.contentcapture.flags.Flags.runOnBackgroundThreadEnabled;

import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
@@ -602,26 +601,16 @@ public final class ContentCaptureManager {
    public ContentCaptureSession getMainContentCaptureSession() {
        synchronized (mLock) {
            if (mMainSession == null) {
                mMainSession = prepareMainSession();
                if (sVerbose) Log.v(TAG, "getMainContentCaptureSession(): created " + mMainSession);
            }
            return mMainSession;
        }
    }

    @NonNull
    @GuardedBy("mLock")
    private ContentCaptureSession prepareMainSession() {
        if (runOnBackgroundThreadEnabled()) {
            return new MainContentCaptureSessionV2(
                mMainSession = new MainContentCaptureSession(
                    mContext,
                    this,
                    prepareUiHandler(),
                    prepareContentCaptureHandler(),
                    mService
                );
        } else {
            return new MainContentCaptureSession(mContext, this, prepareUiHandler(), mService);
                if (sVerbose) Log.v(TAG, "getMainContentCaptureSession(): created " + mMainSession);
            }
            return mMainSession;
        }
    }

+219 −66

File changed.

Preview size limit exceeded, changes collapsed.

+0 −1187

File deleted.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ public class ContentCaptureSessionTest {
        }

        @Override
        MainContentCaptureSession getMainCaptureSession() {
        ContentCaptureSession getMainCaptureSession() {
            throw new UnsupportedOperationException("should not have been called");
        }

+69 −1

File changed.

Preview size limit exceeded, changes collapsed.

Loading