Merge "Add getCurrentImeTouchRegion to the WindowManager API" into oc-dr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4bf79089c4
@@ -50268,6 +50268,7 @@ package android.view {
|
||||
}
|
||||
|
||||
public abstract interface WindowManager implements android.view.ViewManager {
|
||||
method public abstract android.graphics.Region getCurrentImeTouchRegion();
|
||||
method public abstract android.view.Display getDefaultDisplay();
|
||||
method public abstract void removeViewImmediate(android.view.View);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.view;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.SystemService;
|
||||
import android.annotation.TestApi;
|
||||
@@ -27,6 +28,7 @@ import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -169,6 +171,18 @@ public interface WindowManager extends ViewManager {
|
||||
*/
|
||||
public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
|
||||
|
||||
/**
|
||||
* Return the touch region for the current IME window, or an empty region if there is none.
|
||||
*
|
||||
* @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
|
||||
* region or there was an error.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
|
||||
public Region getCurrentImeTouchRegion();
|
||||
|
||||
public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
|
||||
/**
|
||||
* X position for this window. With the default gravity it is ignored.
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.view;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.graphics.Region;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
@@ -145,4 +146,13 @@ public final class WindowManagerImpl implements WindowManager {
|
||||
public Display getDefaultDisplay() {
|
||||
return mContext.getDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region getCurrentImeTouchRegion() {
|
||||
try {
|
||||
return WindowManagerGlobal.getWindowManagerService().getCurrentImeTouchRegion();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,14 @@ package com.android.server.wm;
|
||||
import static android.Manifest.permission.MANAGE_APP_TOKENS;
|
||||
import static android.Manifest.permission.READ_FRAME_BUFFER;
|
||||
import static android.Manifest.permission.REGISTER_WINDOW_MANAGER_LISTENERS;
|
||||
import static android.Manifest.permission.RESTRICTED_VR_ACCESS;
|
||||
import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
|
||||
import static android.app.AppOpsManager.OP_SYSTEM_ALERT_WINDOW;
|
||||
import static android.app.StatusBarManager.DISABLE_MASK;
|
||||
import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED;
|
||||
import static android.content.Intent.ACTION_USER_REMOVED;
|
||||
import static android.content.Intent.EXTRA_USER_HANDLE;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.os.Process.ROOT_UID;
|
||||
import static android.os.Process.SHELL_UID;
|
||||
import static android.os.Process.SYSTEM_UID;
|
||||
@@ -6305,6 +6307,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
@Override
|
||||
public Region getCurrentImeTouchRegion() {
|
||||
if (mContext.checkCallingOrSelfPermission(RESTRICTED_VR_ACCESS) != PERMISSION_GRANTED) {
|
||||
throw new SecurityException("getCurrentImeTouchRegion is restricted to VR services");
|
||||
}
|
||||
synchronized (mWindowMap) {
|
||||
final Region r = new Region();
|
||||
if (mInputMethodWindow != null) {
|
||||
|
||||
Reference in New Issue
Block a user