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