Merge "Add testApi to query global keys."
This commit is contained in:
committed by
Android (Google) Code Review
commit
990e3600fc
@@ -2942,6 +2942,7 @@ package android.view {
|
||||
public interface WindowManager extends android.view.ViewManager {
|
||||
method public default int getDisplayImePolicy(int);
|
||||
method public default void holdLock(android.os.IBinder, int);
|
||||
method public default boolean isGlobalKey(int);
|
||||
method public default boolean isTaskSnapshotSupported();
|
||||
method public default void setDisplayImePolicy(int, int);
|
||||
method public default void setShouldShowSystemDecors(int, boolean);
|
||||
|
||||
@@ -985,4 +985,12 @@ interface IWindowManager
|
||||
*/
|
||||
oneway void captureDisplay(int displayId, in @nullable ScreenCapture.CaptureArgs captureArgs,
|
||||
in ScreenCapture.ScreenCaptureListener listener);
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the key will be handled globally and not forwarded to all apps.
|
||||
*
|
||||
* @param keyCode the key code to check
|
||||
* @return {@code true} if the key will be handled globally.
|
||||
*/
|
||||
boolean isGlobalKey(int keyCode);
|
||||
}
|
||||
|
||||
@@ -944,6 +944,18 @@ public interface WindowManager extends ViewManager {
|
||||
return DISPLAY_IME_POLICY_FALLBACK_DISPLAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the key will be handled globally and not forwarded to all apps.
|
||||
*
|
||||
* @param keyCode the key code to check
|
||||
* @return {@code true} if the key will be handled globally.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
default boolean isGlobalKey(int keyCode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Returns whether cross-window blur is currently enabled. This affects both window blur behind
|
||||
|
||||
@@ -282,6 +282,15 @@ public final class WindowManagerImpl implements WindowManager {
|
||||
return DISPLAY_IME_POLICY_FALLBACK_DISPLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlobalKey(int keyCode) {
|
||||
try {
|
||||
return WindowManagerGlobal.getWindowManagerService().isGlobalKey(keyCode);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowMetrics getCurrentWindowMetrics() {
|
||||
final Context context = mParentWindow != null ? mParentWindow.getContext() : mContext;
|
||||
|
||||
@@ -5493,6 +5493,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
effectId, always, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlobalKey(int keyCode) {
|
||||
return mGlobalKeyManager.shouldHandleGlobalKey(keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performHapticFeedback(int uid, String packageName, int effectId,
|
||||
boolean always, String reason) {
|
||||
|
||||
@@ -1188,4 +1188,12 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
|
||||
* A new window on default display has been focused.
|
||||
*/
|
||||
default void onDefaultDisplayFocusChangedLw(WindowState newFocus) {}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the key will be handled globally and not forwarded to all apps.
|
||||
*
|
||||
* @param keyCode the key code to check
|
||||
* @return {@code true} if the key will be handled globally.
|
||||
*/
|
||||
boolean isGlobalKey(int keyCode);
|
||||
}
|
||||
|
||||
@@ -9355,4 +9355,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
.setSourceCrop(mTmpRect)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlobalKey(int keyCode) {
|
||||
return mPolicy.isGlobalKey(keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,4 +338,9 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
|
||||
public boolean canDismissBootAnimation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlobalKey(int keyCode) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user