Merge "Uses SurfacePackage instead of SurfaceControl on inline suggestion" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
78160dc4c0
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.service.autofill.IInlineSuggestionUiCallback;
|
||||
import android.service.autofill.InlinePresentation;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Slog;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.SurfaceControlViewHost;
|
||||
import android.view.autofill.AutofillId;
|
||||
import android.view.autofill.AutofillManager;
|
||||
import android.view.autofill.AutofillValue;
|
||||
@@ -328,7 +328,7 @@ public final class InlineSuggestionFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContent(SurfaceControl surface)
|
||||
public void onContent(SurfaceControlViewHost.SurfacePackage surface)
|
||||
throws RemoteException {
|
||||
callback.onContent(surface);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user