summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/IWindow.aidl35
-rw-r--r--core/java/android/view/ViewRootImpl.java33
2 files changed, 15 insertions, 53 deletions
diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl
index 5e6d3d19fa2f..c06a1fe0a257 100644
--- a/core/java/android/view/IWindow.aidl
+++ b/core/java/android/view/IWindow.aidl
@@ -71,41 +71,18 @@ oneway interface IWindow {
void dispatchGetNewSurface();
/**
- * Tell the window that it is either gaining or losing focus.
- *
- * @param hasFocus {@code true} if window has focus, {@code false} otherwise.
- * @param inTouchMode {@code true} if screen is in touch mode, {@code false} otherwise.
- * @param reportToClient {@code true} when need to report to child view with
- * {@link View#onWindowFocusChanged(boolean)}, {@code false} otherwise.
- * <p>
- * Note: In the previous design, there is only one window focus state tracked by
- * WindowManagerService.
- * For multi-display, the window focus state is tracked by each display independently.
- * <p>
- * It will introduce a problem if the window was already focused on one display and then
- * switched to another display, since the window focus state on each display is independent,
- * there is no global window focus state in WindowManagerService, so the window focus state of
- * the former display remains unchanged.
- * <p>
- * When switched back to former display, some flows that rely on the global window focus state
- * in view root will be missed due to the window focus state remaining unchanged.
- * (i.e: Showing single IME window when switching between displays.)
- * <p>
- * To solve the problem, WindowManagerService tracks the top focused display change and then
- * callbacks to the client via this method to make sure that the client side will request the
- * IME on the top focused display, and then set {@param reportToClient} as {@code false} to
- * ignore reporting to the application, since its focus remains unchanged on its display.
- *
+ * Tell the window that it is either gaining or losing focus. Keep it up
+ * to date on the current state showing navigational focus (touch mode) too.
*/
- void windowFocusChanged(boolean hasFocus, boolean inTouchMode, boolean reportToClient);
-
+ void windowFocusChanged(boolean hasFocus, boolean inTouchMode);
+
void closeSystemDialogs(String reason);
-
+
/**
* Called for wallpaper windows when their offsets change.
*/
void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync);
-
+
void dispatchWallpaperCommand(String action, int x, int y,
int z, in Bundle extras, boolean sync);
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 9a1e93187a5d..3f7a5127339d 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2765,7 +2765,7 @@ public final class ViewRootImpl implements ViewParent,
}
}
- private void handleWindowFocusChanged(boolean reportToClient) {
+ private void handleWindowFocusChanged() {
final boolean hasWindowFocus;
final boolean inTouchMode;
synchronized (this) {
@@ -2800,9 +2800,8 @@ public final class ViewRootImpl implements ViewParent,
} catch (RemoteException ex) {
}
// Retry in a bit.
- final Message msg = mHandler.obtainMessage(MSG_WINDOW_FOCUS_CHANGED);
- msg.arg1 = reportToClient ? 1 : 0;
- mHandler.sendMessageDelayed(msg, 500);
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(
+ MSG_WINDOW_FOCUS_CHANGED), 500);
return;
}
}
@@ -2819,15 +2818,8 @@ public final class ViewRootImpl implements ViewParent,
}
if (mView != null) {
mAttachInfo.mKeyDispatchState.reset();
- // We dispatch onWindowFocusChanged to child view only when window is gaining /
- // losing focus.
- // If the focus is updated from top display change but window focus on the display
- // remains unchanged, will not callback onWindowFocusChanged again since it may
- // be redundant & can affect the state when it callbacks.
- if (reportToClient) {
- mView.dispatchWindowFocusChanged(hasWindowFocus);
- mAttachInfo.mTreeObserver.dispatchOnWindowFocusChange(hasWindowFocus);
- }
+ mView.dispatchWindowFocusChanged(hasWindowFocus);
+ mAttachInfo.mTreeObserver.dispatchOnWindowFocusChange(hasWindowFocus);
if (mAttachInfo.mTooltipHost != null) {
mAttachInfo.mTooltipHost.hideTooltip();
}
@@ -4428,7 +4420,7 @@ public final class ViewRootImpl implements ViewParent,
}
break;
case MSG_WINDOW_FOCUS_CHANGED: {
- handleWindowFocusChanged(msg.arg1 != 0 /* reportToClient */);
+ handleWindowFocusChanged();
} break;
case MSG_DIE:
doDie();
@@ -7372,7 +7364,7 @@ public final class ViewRootImpl implements ViewParent,
}
if (stage != null) {
- handleWindowFocusChanged(true /* reportToClient */);
+ handleWindowFocusChanged();
stage.deliver(q);
} else {
finishInputEvent(q);
@@ -7712,11 +7704,6 @@ public final class ViewRootImpl implements ViewParent,
}
public void windowFocusChanged(boolean hasFocus, boolean inTouchMode) {
- windowFocusChanged(hasFocus, inTouchMode, true /* reportToClient */);
- }
-
- public void windowFocusChanged(boolean hasFocus, boolean inTouchMode,
- boolean reportToClient) {
synchronized (this) {
mWindowFocusChanged = true;
mUpcomingWindowFocus = hasFocus;
@@ -7724,7 +7711,6 @@ public final class ViewRootImpl implements ViewParent,
}
Message msg = Message.obtain();
msg.what = MSG_WINDOW_FOCUS_CHANGED;
- msg.arg1 = reportToClient ? 1 : 0;
mHandler.sendMessage(msg);
}
@@ -8286,11 +8272,10 @@ public final class ViewRootImpl implements ViewParent,
}
@Override
- public void windowFocusChanged(boolean hasFocus, boolean inTouchMode,
- boolean reportToClient) {
+ public void windowFocusChanged(boolean hasFocus, boolean inTouchMode) {
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (viewAncestor != null) {
- viewAncestor.windowFocusChanged(hasFocus, inTouchMode, reportToClient);
+ viewAncestor.windowFocusChanged(hasFocus, inTouchMode);
}
}