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

Commit dfa20acd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Refine performance for calling into ContentCapture" into rvc-dev am: a42c95cd

Change-Id: I04cd6d1bd1e2901b530d08280590217874331fdc
parents 05b6703f a42c95cd
Loading
Loading
Loading
Loading
+24 −25
Original line number Diff line number Diff line
@@ -9581,18 +9581,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        // First check if context has client, so it saves a service lookup when it doesn't
        if (mContext.getContentCaptureOptions() == null) return;
        // Then check if it's enabled in the context...
        final ContentCaptureManager ccm = ai != null ? ai.getContentCaptureManager(mContext)
                : mContext.getSystemService(ContentCaptureManager.class);
        if (ccm == null || !ccm.isContentCaptureEnabled()) return;
        // ... and finally at the view level
        // NOTE: isImportantForContentCapture() is more expensive than cm.isContentCaptureEnabled()
        if (!isImportantForContentCapture()) return;
        ContentCaptureSession session = getContentCaptureSession();
        if (session == null) return;
        if (appeared) {
            if (!isLaidOut() || getVisibility() != VISIBLE
                    || (mPrivateFlags4 & PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED) != 0) {
@@ -9607,15 +9595,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                }
                return;
            }
            setNotifiedContentCaptureAppeared();
            if (ai != null) {
                ai.delayNotifyContentCaptureEvent(session, this, appeared);
            } else {
                if (DEBUG_CONTENT_CAPTURE) {
                    Log.w(CONTENT_CAPTURE_LOG_TAG, "no AttachInfo on appeared for " + this);
                }
            }
        } else {
            if ((mPrivateFlags4 & PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED) == 0
                    || (mPrivateFlags4 & PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED) != 0) {
@@ -9630,6 +9609,26 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                }
                return;
            }
        }
        ContentCaptureSession session = getContentCaptureSession();
        if (session == null) return;
        // ... and finally at the view level
        // NOTE: isImportantForContentCapture() is more expensive than cm.isContentCaptureEnabled()
        if (!isImportantForContentCapture()) return;
        if (appeared) {
            setNotifiedContentCaptureAppeared();
            if (ai != null) {
                ai.delayNotifyContentCaptureEvent(session, this, appeared);
            } else {
                if (DEBUG_CONTENT_CAPTURE) {
                    Log.w(CONTENT_CAPTURE_LOG_TAG, "no AttachInfo on appeared for " + this);
                }
            }
        } else {
            mPrivateFlags4 |= PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED;
            mPrivateFlags4 &= ~PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED;