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

Commit f74076cb authored by MingWei Liao's avatar MingWei Liao Committed by Android (Google) Code Review
Browse files

Merge "Replace MainContentCaptureSession with MainContentCaptureSessionV2" into main

parents 8d9d7e2a f80ce94f
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