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

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

Merge "Uses SurfacePackage instead of SurfaceControl on inline suggestion" into rvc-dev

parents 494960e8 b1f42dd7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package android.service.autofill;

import android.os.IBinder;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;

/**
 * Interface to receive events from inline suggestions.
@@ -26,7 +26,7 @@ import android.view.SurfaceControl;
 */
oneway interface IInlineSuggestionUiCallback {
    void onAutofill();
    void onContent(in SurfaceControl surface);
    void onContent(in SurfaceControlViewHost.SurfacePackage surface);
    void onError();
    void onTransferTouchFocusToImeWindow(in IBinder sourceInputToken, int displayId);
}
+2 −3
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.os.Looper;
import android.os.RemoteException;
import android.util.Log;
import android.view.Display;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.View;
import android.view.WindowManager;
@@ -104,14 +103,14 @@ public abstract class InlineSuggestionRenderService extends Service {
                }
            });

            sendResult(callback, host.getSurfacePackage().getSurfaceControl());
            sendResult(callback, host.getSurfacePackage());
        } finally {
            updateDisplay(Display.DEFAULT_DISPLAY);
        }
    }

    private void sendResult(@NonNull IInlineSuggestionUiCallback callback,
            @Nullable SurfaceControl surface) {
            @Nullable SurfaceControlViewHost.SurfacePackage surface) {
        try {
            callback.onContent(surface);
        } catch (RemoteException e) {
+4 −26
Original line number Diff line number Diff line
@@ -19,8 +19,7 @@ package android.view.inline;
import android.annotation.NonNull;
import android.content.Context;
import android.graphics.PixelFormat;
import android.view.SurfaceControl;
import android.view.SurfaceHolder;
import android.view.SurfaceControlViewHost;
import android.view.SurfaceView;

/**
@@ -30,31 +29,10 @@ import android.view.SurfaceView;
 */
public class InlineContentView extends SurfaceView {
    public InlineContentView(@NonNull Context context,
            @NonNull SurfaceControl surfaceControl) {
            @NonNull SurfaceControlViewHost.SurfacePackage surfacePackage) {
        super(context);
        setZOrderOnTop(true);
        getHolder().addCallback(new SurfaceHolder.Callback() {
            @Override
            public void surfaceCreated(SurfaceHolder holder) {
                holder.setFormat(PixelFormat.TRANSPARENT);
                new SurfaceControl.Transaction()
                        .reparent(surfaceControl, getSurfaceControl())
                        .setVisibility(surfaceControl, /* visible */ true)
                        .apply();
            }

            @Override
            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
                // TODO(b/137800469): implement this.
            }

            @Override
            public void surfaceDestroyed(SurfaceHolder holder) {
                new SurfaceControl.Transaction()
                        .setVisibility(surfaceControl, false)
                        .reparent(surfaceControl, null)
                        .apply();
            }
        });
        setChildSurfacePackage(surfacePackage);
        getHolder().setFormat(PixelFormat.TRANSPARENT);
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.util.Size;
import android.util.Slog;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.View;
import android.view.inline.InlineContentView;
import android.view.inline.InlinePresentationSpec;
@@ -151,7 +151,7 @@ public final class InlineSuggestion implements Parcelable {
        }

        @Override
        public void onContent(SurfaceControl content) {
        public void onContent(SurfaceControlViewHost.SurfacePackage content) {
            final InlineContentCallbackImpl callbackImpl = mCallbackImpl.get();
            if (callbackImpl != null) {
                callbackImpl.onContent(content);
@@ -173,7 +173,7 @@ public final class InlineSuggestion implements Parcelable {
            mCallback = callback;
        }

        public void onContent(SurfaceControl content) {
        public void onContent(SurfaceControlViewHost.SurfacePackage content) {
            if (content == null) {
                mCallbackExecutor.execute(() -> mCallback.accept(/* view */null));
            } else {
+2 −2
Original line number Diff line number Diff line
@@ -16,12 +16,12 @@

package com.android.internal.view.inline;

import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;

/**
 * Binder interface to send the inline content from one process to the other.
 * {@hide}
 */
oneway interface IInlineContentCallback {
    void onContent(in SurfaceControl content);
    void onContent(in SurfaceControlViewHost.SurfacePackage content);
}
Loading