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 Original line Diff line number Diff line
@@ -17,7 +17,7 @@
package android.service.autofill;
package android.service.autofill;


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


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


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


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


/**
/**
@@ -30,31 +29,10 @@ import android.view.SurfaceView;
 */
 */
public class InlineContentView extends SurfaceView {
public class InlineContentView extends SurfaceView {
    public InlineContentView(@NonNull Context context,
    public InlineContentView(@NonNull Context context,
            @NonNull SurfaceControl surfaceControl) {
            @NonNull SurfaceControlViewHost.SurfacePackage surfacePackage) {
        super(context);
        super(context);
        setZOrderOnTop(true);
        setZOrderOnTop(true);
        getHolder().addCallback(new SurfaceHolder.Callback() {
        setChildSurfacePackage(surfacePackage);
            @Override
        getHolder().setFormat(PixelFormat.TRANSPARENT);
            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();
            }
        });
    }
    }
}
}
+3 −3
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.os.RemoteException;
import android.util.Size;
import android.util.Size;
import android.util.Slog;
import android.util.Slog;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.View;
import android.view.View;
import android.view.inline.InlineContentView;
import android.view.inline.InlineContentView;
import android.view.inline.InlinePresentationSpec;
import android.view.inline.InlinePresentationSpec;
@@ -151,7 +151,7 @@ public final class InlineSuggestion implements Parcelable {
        }
        }


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


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


package com.android.internal.view.inline;
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.
 * Binder interface to send the inline content from one process to the other.
 * {@hide}
 * {@hide}
 */
 */
oneway interface IInlineContentCallback {
oneway interface IInlineContentCallback {
    void onContent(in SurfaceControl content);
    void onContent(in SurfaceControlViewHost.SurfacePackage content);
}
}
Loading