summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/SurfaceControl.java13
-rw-r--r--core/jni/android_view_SurfaceControl.cpp24
-rw-r--r--services/core/java/com/android/server/wm/InputMonitor.java2
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java17
4 files changed, 41 insertions, 15 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 63ee927ded3d..aa05787359eb 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -225,7 +225,7 @@ public final class SurfaceControl implements Parcelable {
private static native void nativeSetFixedTransformHint(long transactionObj, long nativeObject,
int transformHint);
private static native void nativeSetFocusedWindow(long transactionObj, IBinder toToken,
- IBinder focusedToken, int displayId);
+ String windowName, IBinder focusedToken, String focusedWindowName, int displayId);
private static native void nativeSetFrameTimelineVsync(long transactionObj,
long frameTimelineVsyncId);
private static native void nativeAddJankDataListener(long nativeListener,
@@ -3282,8 +3282,10 @@ public final class SurfaceControl implements Parcelable {
*
* @hide
*/
- public Transaction setFocusedWindow(@NonNull IBinder token, int displayId) {
- nativeSetFocusedWindow(mNativeObject, token, null /* focusedToken */, displayId);
+ public Transaction setFocusedWindow(@NonNull IBinder token, String windowName,
+ int displayId) {
+ nativeSetFocusedWindow(mNativeObject, token, windowName,
+ null /* focusedToken */, null /* focusedWindowName */, displayId);
return this;
}
@@ -3298,9 +3300,12 @@ public final class SurfaceControl implements Parcelable {
* @hide
*/
public Transaction requestFocusTransfer(@NonNull IBinder token,
+ String windowName,
@NonNull IBinder focusedToken,
+ String focusedWindowName,
int displayId) {
- nativeSetFocusedWindow(mNativeObject, token, focusedToken, displayId);
+ nativeSetFocusedWindow(mNativeObject, token, windowName, focusedToken,
+ focusedWindowName, displayId);
return this;
}
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index b8e18072d6e5..7c670e1cb692 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -1593,7 +1593,9 @@ static jlong nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) {
}
static void nativeSetFocusedWindow(JNIEnv* env, jclass clazz, jlong transactionObj,
- jobject toTokenObj, jobject focusedTokenObj, jint displayId) {
+ jobject toTokenObj, jstring windowNameJstr,
+ jobject focusedTokenObj, jstring focusedWindowNameJstr,
+ jint displayId) {
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
if (toTokenObj == NULL) return;
@@ -1602,8 +1604,22 @@ static void nativeSetFocusedWindow(JNIEnv* env, jclass clazz, jlong transactionO
if (focusedTokenObj != NULL) {
focusedToken = ibinderForJavaObject(env, focusedTokenObj);
}
- transaction->setFocusedWindow(toToken, focusedToken, systemTime(SYSTEM_TIME_MONOTONIC),
- displayId);
+
+ FocusRequest request;
+ request.token = toToken;
+ if (windowNameJstr != NULL) {
+ ScopedUtfChars windowName(env, windowNameJstr);
+ request.windowName = windowName.c_str();
+ }
+
+ request.focusedToken = focusedToken;
+ if (focusedWindowNameJstr != NULL) {
+ ScopedUtfChars focusedWindowName(env, focusedWindowNameJstr);
+ request.focusedWindowName = focusedWindowName.c_str();
+ }
+ request.timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
+ request.displayId = displayId;
+ transaction->setFocusedWindow(request);
}
static void nativeSetFrameTimelineVsync(JNIEnv* env, jclass clazz, jlong transactionObj,
@@ -1865,7 +1881,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeGetHandle },
{"nativeSetFixedTransformHint", "(JJI)V",
(void*)nativeSetFixedTransformHint},
- {"nativeSetFocusedWindow", "(JLandroid/os/IBinder;Landroid/os/IBinder;I)V",
+ {"nativeSetFocusedWindow", "(JLandroid/os/IBinder;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;I)V",
(void*)nativeSetFocusedWindow},
{"nativeSetFrameTimelineVsync", "(JJ)V",
(void*)nativeSetFrameTimelineVsync },
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java
index a20d924de058..cc77cfa1e8e5 100644
--- a/services/core/java/com/android/server/wm/InputMonitor.java
+++ b/services/core/java/com/android/server/wm/InputMonitor.java
@@ -407,7 +407,7 @@ final class InputMonitor {
}
mInputFocus = focusToken;
- mInputTransaction.setFocusedWindow(mInputFocus, mDisplayId);
+ mInputTransaction.setFocusedWindow(mInputFocus, focus.getName(), mDisplayId);
EventLog.writeEvent(LOGTAG_INPUT_FOCUS, "Focus request " + focus,
"reason=UpdateInputWindows");
ProtoLog.v(WM_DEBUG_FOCUS_LIGHT, "Focus requested for window=%s", focus);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index d4db0e1a3547..ad884699f755 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -8411,10 +8411,10 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- void grantEmbeddedWindowFocus(Session session, IBinder targetInputToken, boolean grantFocus) {
+ void grantEmbeddedWindowFocus(Session session, IBinder inputToken, boolean grantFocus) {
synchronized (mGlobalLock) {
final EmbeddedWindowController.EmbeddedWindow embeddedWindow =
- mEmbeddedWindowController.get(targetInputToken);
+ mEmbeddedWindowController.get(inputToken);
if (embeddedWindow == null) {
Slog.e(TAG, "Embedded window not found");
return;
@@ -8426,7 +8426,7 @@ public class WindowManagerService extends IWindowManager.Stub
SurfaceControl.Transaction t = mTransactionFactory.get();
final int displayId = embeddedWindow.mDisplayId;
if (grantFocus) {
- t.setFocusedWindow(targetInputToken, displayId).apply();
+ t.setFocusedWindow(inputToken, embeddedWindow.getName(), displayId).apply();
EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
"Focus request " + embeddedWindow.getName(),
"reason=grantEmbeddedWindowFocus(true)");
@@ -8441,7 +8441,8 @@ public class WindowManagerService extends IWindowManager.Stub
embeddedWindow.getName());
return;
}
- t.requestFocusTransfer(newFocusTarget.mInputChannelToken, targetInputToken,
+ t.requestFocusTransfer(newFocusTarget.mInputChannelToken, newFocusTarget.getName(),
+ inputToken, embeddedWindow.getName(),
displayId).apply();
EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
"Transfer focus request " + newFocusTarget,
@@ -8477,13 +8478,17 @@ public class WindowManagerService extends IWindowManager.Stub
}
SurfaceControl.Transaction t = mTransactionFactory.get();
if (grantFocus) {
- t.requestFocusTransfer(targetInputToken, hostWindow.mInputChannel.getToken(),
+ t.requestFocusTransfer(targetInputToken, embeddedWindow.getName(),
+ hostWindow.mInputChannel.getToken(),
+ hostWindow.getName(),
hostWindow.getDisplayId()).apply();
EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
"Transfer focus request " + embeddedWindow.getName(),
"reason=grantEmbeddedWindowFocus(true)");
} else {
- t.requestFocusTransfer(hostWindow.mInputChannel.getToken(), targetInputToken,
+ t.requestFocusTransfer(hostWindow.mInputChannel.getToken(), hostWindow.getName(),
+ targetInputToken,
+ embeddedWindow.getName(),
hostWindow.getDisplayId()).apply();
EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
"Transfer focus request " + hostWindow,