1 /* 2 * Copyright (C) 2023 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.annotation.NonNull; 20 import android.os.IBinder; 21 import android.view.WindowManager; 22 23 /** 24 * Callback the IME targeting window visibility change state for 25 * {@link com.android.server.inputmethod.InputMethodManagerService} to manage the IME surface 26 * visibility and z-ordering. 27 */ 28 public interface ImeTargetChangeListener { 29 /** 30 * Called when a non-IME-focusable overlay window being the IME layering target (e.g. a 31 * window with {@link android.view.WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE} and 32 * {@link android.view.WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM} flags) 33 * has changed its window visibility. 34 * 35 * @param overlayWindowToken the window token of the overlay window. 36 * @param windowType the window type of the overlay window. 37 * @param visible the visibility of the overlay window, {@code true} means visible 38 * and {@code false} otherwise. 39 * @param removed Whether the IME target overlay window has being removed. 40 */ onImeTargetOverlayVisibilityChanged(@onNull IBinder overlayWindowToken, @WindowManager.LayoutParams.WindowType int windowType, boolean visible, boolean removed)41 default void onImeTargetOverlayVisibilityChanged(@NonNull IBinder overlayWindowToken, 42 @WindowManager.LayoutParams.WindowType int windowType, 43 boolean visible, boolean removed) { 44 } 45 46 /** 47 * Called when the visibility of IME input target window has changed. 48 * 49 * @param imeInputTarget the window token of the IME input target window. 50 * @param visible the new window visibility made by {@param imeInputTarget}. visible is 51 * {@code true} when switching to the new visible IME input target 52 * window and started input, or the same input target relayout to 53 * visible from invisible. In contrast, visible is {@code false} when 54 * closing the input target, or the same input target relayout to 55 * invisible from visible. 56 * @param removed Whether the IME input target window has being removed. 57 */ onImeInputTargetVisibilityChanged(@onNull IBinder imeInputTarget, boolean visible, boolean removed)58 default void onImeInputTargetVisibilityChanged(@NonNull IBinder imeInputTarget, boolean visible, 59 boolean removed) { 60 } 61 } 62