1/* 2 * Copyright (C) 2022 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 */ 16import {AbstractPresenterInputMethod} from 'viewers/common/abstract_presenter_input_method'; 17 18export class PresenterInputMethodService extends AbstractPresenterInputMethod { 19 protected getHierarchyTableProperties() { 20 const inputMethodService = this.hierarchyPresenter 21 .getCurrentHierarchyTreesForTrace(this.imeTrace) 22 ?.at(0) 23 ?.getChildByName('inputMethodService'); 24 const windowVisible = 25 inputMethodService?.getEagerPropertyByName('windowVisible')?.getValue() ?? 26 false; 27 const decorViewVisible = 28 inputMethodService 29 ?.getEagerPropertyByName('decorViewVisible') 30 ?.getValue() ?? false; 31 const packageName = inputMethodService 32 ?.getEagerPropertyByName('inputEditorInfo') 33 ?.getChildByName('packageName') 34 ?.formattedValue(); 35 36 return { 37 ...new ImServiceTableProperties( 38 windowVisible, 39 decorViewVisible, 40 packageName, 41 ), 42 }; 43 } 44} 45 46class ImServiceTableProperties { 47 constructor( 48 public windowVisible: boolean, 49 public decorViewVisible: boolean, 50 public packageName: string | undefined, 51 ) {} 52} 53