1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.wm; 18 19 import android.util.proto.ProtoOutputStream; 20 import android.view.IWindow; 21 22 /** 23 * Common interface between focusable objects. 24 * 25 * Both WindowState and EmbeddedWindows can receive input. This consolidates some common properties 26 * of both targets. 27 */ 28 interface InputTarget { 29 /* Get the WindowState associated with the target. */ getWindowState()30 WindowState getWindowState(); 31 32 /* Display id of the target. */ getDisplayId()33 int getDisplayId(); 34 35 /* Client IWindow for the target. */ getIWindow()36 IWindow getIWindow(); 37 38 /* Owning pid of the target. */ getPid()39 int getPid(); getUid()40 int getUid(); 41 42 /** 43 * Indicates whether a target should receive focus from server side 44 * tap outside focus detection. For example, this is false in the case of 45 * EmbeddedWindows in a client view hierarchy, where the client will do internal 46 * tap detection and invoke grantEmbeddedWindowFocus itself 47 */ receiveFocusFromTapOutside()48 boolean receiveFocusFromTapOutside(); 49 50 // Gaining focus handleTapOutsideFocusInsideSelf()51 void handleTapOutsideFocusInsideSelf(); 52 // Losing focus handleTapOutsideFocusOutsideSelf()53 void handleTapOutsideFocusOutsideSelf(); 54 55 // Whether this input target can control the IME itself shouldControlIme()56 boolean shouldControlIme(); 57 // Whether this input target can be screenshoted by the IME system canScreenshotIme()58 boolean canScreenshotIme(); 59 getActivityRecord()60 ActivityRecord getActivityRecord(); 61 isInputMethodClientFocus(int uid, int pid)62 boolean isInputMethodClientFocus(int uid, int pid); 63 getDisplayContent()64 DisplayContent getDisplayContent(); getImeControlTarget()65 InsetsControlTarget getImeControlTarget(); 66 dumpProto(ProtoOutputStream proto, long fieldId, @WindowTraceLogLevel int logLevel)67 void dumpProto(ProtoOutputStream proto, long fieldId, 68 @WindowTraceLogLevel int logLevel); 69 } 70 71