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

Commit c93a8d0f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Merge mContentCaptureSession and mCachedContentCaptureSession."

parents 82bbb652 37148c93
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -5125,6 +5125,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    @Nullable
    private ContentCaptureSession mContentCaptureSession;
    /**
     * Whether {@link ContentCaptureSession} is cached, resets on {@link #invalidate()}.
     */
    private boolean mContentCaptureSessionCached;
    @LayoutRes
    private int mSourceLayoutId = ID_NULL;
@@ -5137,11 +5142,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    @StyleRes
    private int mExplicitStyle;
    /**
     * Cached reference to the {@link ContentCaptureSession}, is reset on {@link #invalidate()}.
     */
    private ContentCaptureSession mCachedContentCaptureSession;
    /**
     * Simple constructor to use when creating a view from code.
     *
@@ -9560,18 +9560,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    @Nullable
    public final ContentCaptureSession getContentCaptureSession() {
        if (mCachedContentCaptureSession != null) {
            return mCachedContentCaptureSession;
        if (mContentCaptureSessionCached) {
            return mContentCaptureSession;
        }
        mCachedContentCaptureSession = getAndCacheContentCaptureSession();
        return mCachedContentCaptureSession;
        mContentCaptureSession = getAndCacheContentCaptureSession();
        mContentCaptureSessionCached = true;
        return mContentCaptureSession;
    }
    @Nullable
    private ContentCaptureSession getAndCacheContentCaptureSession() {
        // First try the session explicitly set by setContentCaptureSession()
        if (mContentCaptureSession != null) return mContentCaptureSession;
        if (mContentCaptureSession != null) {
            return mContentCaptureSession;
        }
        // Then the session explicitly set in an ancestor
        ContentCaptureSession session = null;
@@ -18094,7 +18097,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        // Reset content capture caches
        mPrivateFlags4 &= ~PFLAG4_CONTENT_CAPTURE_IMPORTANCE_MASK;
        mCachedContentCaptureSession = null;
        mContentCaptureSessionCached = false;
        if ((mPrivateFlags & (PFLAG_DRAWN | PFLAG_HAS_BOUNDS)) == (PFLAG_DRAWN | PFLAG_HAS_BOUNDS)
                || (invalidateCache && (mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == PFLAG_DRAWING_CACHE_VALID)