Fix drag and drop (1/3)
Add transferTouchFoucus API in SurfaceControl to pass info to native. Test: Builds Bug: 120463595 Change-Id: Ifb20a135c13de7380176e285dac273eef776ee19
This commit is contained in:
@@ -165,7 +165,8 @@ public class SurfaceControl implements Parcelable {
|
||||
|
||||
private static native void nativeSetInputWindowInfo(long transactionObj, long nativeObject,
|
||||
InputWindowHandle handle);
|
||||
|
||||
private static native void nativeTransferTouchFocus(long transactionObj, IBinder fromToken,
|
||||
IBinder toToken);
|
||||
|
||||
private final CloseGuard mCloseGuard = CloseGuard.get();
|
||||
private final String mName;
|
||||
@@ -1541,6 +1542,21 @@ public class SurfaceControl implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfers touch focus from one window to another. It is possible for multiple windows to
|
||||
* have touch focus if they support split touch dispatch
|
||||
* {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} but this
|
||||
* method only transfers touch focus of the specified window without affecting
|
||||
* other windows that may also have touch focus at the same time.
|
||||
* @param fromToken The token of a window that currently has touch focus.
|
||||
* @param toToken The token of the window that should receive touch focus in
|
||||
* place of the first.
|
||||
*/
|
||||
public Transaction transferTouchFocus(IBinder fromToken, IBinder toToken) {
|
||||
nativeTransferTouchFocus(mNativeObject, fromToken, toToken);
|
||||
return this;
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public Transaction setMatrix(SurfaceControl sc,
|
||||
float dsdx, float dtdx, float dtdy, float dsdy) {
|
||||
|
||||
@@ -348,6 +348,15 @@ static void nativeSetInputWindowInfo(JNIEnv* env, jclass clazz, jlong transactio
|
||||
transaction->setInputWindowInfo(ctrl, *handle->getInfo());
|
||||
}
|
||||
|
||||
static void nativeTransferTouchFocus(JNIEnv* env, jclass clazz, jlong transactionObj,
|
||||
jobject fromTokenObj, jobject toTokenObj) {
|
||||
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
|
||||
|
||||
sp<IBinder> fromToken(ibinderForJavaObject(env, fromTokenObj));
|
||||
sp<IBinder> toToken(ibinderForJavaObject(env, toTokenObj));
|
||||
transaction->transferTouchFocus(fromToken, toToken);
|
||||
}
|
||||
|
||||
static void nativeSetColor(JNIEnv* env, jclass clazz, jlong transactionObj,
|
||||
jlong nativeObject, jfloatArray fColor) {
|
||||
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
|
||||
@@ -1032,7 +1041,9 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
|
||||
{"nativeCaptureLayers", "(Landroid/os/IBinder;Landroid/graphics/Rect;F)Landroid/graphics/GraphicBuffer;",
|
||||
(void*)nativeCaptureLayers },
|
||||
{"nativeSetInputWindowInfo", "(JJLandroid/view/InputWindowHandle;)V",
|
||||
(void*)nativeSetInputWindowInfo },
|
||||
(void*)nativeSetInputWindowInfo },
|
||||
{"nativeTransferTouchFocus", "(JLandroid/os/IBinder;Landroid/os/IBinder;)V",
|
||||
(void*)nativeTransferTouchFocus },
|
||||
{"nativeGetDisplayedContentSamplingAttributes",
|
||||
"(Landroid/os/IBinder;)Landroid/hardware/display/DisplayedContentSamplingAttributes;",
|
||||
(void*)nativeGetDisplayedContentSamplingAttributes },
|
||||
|
||||
Reference in New Issue
Block a user