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

Commit a5efb2c8 authored by Mihir Patel's avatar Mihir Patel Committed by Android (Google) Code Review
Browse files

Merge "Notifying the on-device intelligence service when view window insets...

Merge "Notifying the on-device intelligence service when view window insets have changed" into rvc-dev
parents 5f003f4e b73c4217
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -56741,6 +56741,7 @@ package android.view.contentcapture {
    method public final void notifySessionResumed();
    method public final void notifyViewAppeared(@NonNull android.view.ViewStructure);
    method public final void notifyViewDisappeared(@NonNull android.view.autofill.AutofillId);
    method public final void notifyViewInsetsChanged(@NonNull android.graphics.Insets);
    method public final void notifyViewTextChanged(@NonNull android.view.autofill.AutofillId, @Nullable CharSequence);
    method public final void notifyViewsDisappeared(@NonNull android.view.autofill.AutofillId, @NonNull long[]);
    method public final void setContentCaptureContext(@Nullable android.view.contentcapture.ContentCaptureContext);
+2 −0
Original line number Diff line number Diff line
@@ -13191,6 +13191,7 @@ package android.view.contentcapture {
    method public long getEventTime();
    method @Nullable public android.view.autofill.AutofillId getId();
    method @Nullable public java.util.List<android.view.autofill.AutofillId> getIds();
    method @Nullable public android.graphics.Insets getInsets();
    method @Nullable public CharSequence getText();
    method public int getType();
    method @Nullable public android.view.contentcapture.ViewNode getViewNode();
@@ -13201,6 +13202,7 @@ package android.view.contentcapture {
    field public static final int TYPE_SESSION_RESUMED = 7; // 0x7
    field public static final int TYPE_VIEW_APPEARED = 1; // 0x1
    field public static final int TYPE_VIEW_DISAPPEARED = 2; // 0x2
    field public static final int TYPE_VIEW_INSETS_CHANGED = 9; // 0x9
    field public static final int TYPE_VIEW_TEXT_CHANGED = 3; // 0x3
    field public static final int TYPE_VIEW_TREE_APPEARED = 5; // 0x5
    field public static final int TYPE_VIEW_TREE_APPEARING = 4; // 0x4
+2 −0
Original line number Diff line number Diff line
@@ -5085,6 +5085,7 @@ package android.view.contentcapture {
    method public long getEventTime();
    method @Nullable public android.view.autofill.AutofillId getId();
    method @Nullable public java.util.List<android.view.autofill.AutofillId> getIds();
    method @Nullable public android.graphics.Insets getInsets();
    method @Nullable public CharSequence getText();
    method public int getType();
    method @Nullable public android.view.contentcapture.ViewNode getViewNode();
@@ -5095,6 +5096,7 @@ package android.view.contentcapture {
    field public static final int TYPE_SESSION_RESUMED = 7; // 0x7
    field public static final int TYPE_VIEW_APPEARED = 1; // 0x1
    field public static final int TYPE_VIEW_DISAPPEARED = 2; // 0x2
    field public static final int TYPE_VIEW_INSETS_CHANGED = 9; // 0x9
    field public static final int TYPE_VIEW_TEXT_CHANGED = 3; // 0x3
    field public static final int TYPE_VIEW_TREE_APPEARED = 5; // 0x5
    field public static final int TYPE_VIEW_TREE_APPEARING = 4; // 0x4
+26 −9
Original line number Diff line number Diff line
@@ -29099,8 +29099,33 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            mTreeObserver = new ViewTreeObserver(context);
        }
        @Nullable
        ContentCaptureManager getContentCaptureManager(@NonNull Context context) {
            if (mContentCaptureManager != null) {
                return mContentCaptureManager;
            }
            mContentCaptureManager = context.getSystemService(ContentCaptureManager.class);
            return mContentCaptureManager;
        }
        void delayNotifyContentCaptureInsetsEvent(@NonNull Insets insets) {
            if (mContentCaptureManager == null) {
                return;
            }
            ArrayList<Object> events = ensureEvents(
                        mContentCaptureManager.getMainContentCaptureSession());
            events.add(insets);
        }
        private void delayNotifyContentCaptureEvent(@NonNull ContentCaptureSession session,
                @NonNull View view, boolean appeared) {
            ArrayList<Object> events = ensureEvents(session);
            events.add(appeared ? view : view.getAutofillId());
        }
        @NonNull
        private ArrayList<Object> ensureEvents(@NonNull ContentCaptureSession session) {
            if (mContentCaptureEvents == null) {
                // Most of the time there will be just one session, so intial capacity is 1
                mContentCaptureEvents = new SparseArray<>(1);
@@ -29112,16 +29137,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                events = new ArrayList<>();
                mContentCaptureEvents.put(sessionId, events);
            }
            events.add(appeared ? view : view.getAutofillId());
        }
        @Nullable
        ContentCaptureManager getContentCaptureManager(@NonNull Context context) {
            if (mContentCaptureManager != null) {
                return mContentCaptureManager;
            }
            mContentCaptureManager = context.getSystemService(ContentCaptureManager.class);
            return mContentCaptureManager;
            return events;
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.FrameInfo;
import android.graphics.HardwareRenderer.FrameDrawingCallback;
import android.graphics.Insets;
import android.graphics.Matrix;
import android.graphics.PixelFormat;
import android.graphics.Point;
@@ -2254,6 +2255,7 @@ public final class ViewRootImpl implements ViewParent,
            insets = insets.consumeDisplayCutout();
        }
        host.dispatchApplyWindowInsets(insets);
        mAttachInfo.delayNotifyContentCaptureInsetsEvent(insets.getInsets(Type.all()));
        Trace.traceEnd(Trace.TRACE_TAG_VIEW);
    }

@@ -3118,6 +3120,8 @@ public final class ViewRootImpl implements ViewParent,
                        ViewStructure structure = session.newViewStructure(view);
                        view.onProvideContentCaptureStructure(structure, /* flags= */ 0);
                        session.notifyViewAppeared(structure);
                    } else if (event instanceof Insets) {
                        mainSession.notifyViewInsetsChanged(sessionId, (Insets) event);
                    } else {
                        Log.w(mTag, "invalid content capture event: " + event);
                    }
Loading