Merge "Refine performance for calling into ContentCapture" into rvc-dev am: a42c95cd64 am: f24340af5b am: 35c5d19b9b
Change-Id: I698c170e47f1e21486c5522b1048cb95176f8398
This commit is contained in:
@@ -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) {
|
||||
@@ -9601,12 +9589,36 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
+ isLaidOut() + ", visibleToUser=" + isVisibleToUser()
|
||||
+ ", visible=" + (getVisibility() == VISIBLE)
|
||||
+ ": alreadyNotifiedAppeared=" + ((mPrivateFlags4
|
||||
& PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED) != 0)
|
||||
& PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED) != 0)
|
||||
+ ", alreadyNotifiedDisappeared=" + ((mPrivateFlags4
|
||||
& PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED) != 0));
|
||||
& PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED) != 0));
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if ((mPrivateFlags4 & PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED) == 0
|
||||
|| (mPrivateFlags4 & PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED) != 0) {
|
||||
if (DEBUG_CONTENT_CAPTURE) {
|
||||
Log.v(CONTENT_CAPTURE_LOG_TAG, "Ignoring 'disappeared' on " + this + ": laid="
|
||||
+ isLaidOut() + ", visibleToUser=" + isVisibleToUser()
|
||||
+ ", visible=" + (getVisibility() == VISIBLE)
|
||||
+ ": alreadyNotifiedAppeared=" + ((mPrivateFlags4
|
||||
& PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED) != 0)
|
||||
+ ", alreadyNotifiedDisappeared=" + ((mPrivateFlags4
|
||||
& PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED) != 0));
|
||||
}
|
||||
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) {
|
||||
@@ -9617,19 +9629,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((mPrivateFlags4 & PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED) == 0
|
||||
|| (mPrivateFlags4 & PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED) != 0) {
|
||||
if (DEBUG_CONTENT_CAPTURE) {
|
||||
Log.v(CONTENT_CAPTURE_LOG_TAG, "Ignoring 'disappeared' on " + this + ": laid="
|
||||
+ isLaidOut() + ", visibleToUser=" + isVisibleToUser()
|
||||
+ ", visible=" + (getVisibility() == VISIBLE)
|
||||
+ ": alreadyNotifiedAppeared=" + ((mPrivateFlags4
|
||||
& PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED) != 0)
|
||||
+ ", alreadyNotifiedDisappeared=" + ((mPrivateFlags4
|
||||
& PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED) != 0));
|
||||
}
|
||||
return;
|
||||
}
|
||||
mPrivateFlags4 |= PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED;
|
||||
mPrivateFlags4 &= ~PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user