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 {TraceTreeNode} from 'trace/trace_tree_node'; 17import {ImeAdditionalProperties} from 'viewers/common/ime_additional_properties'; 18import {ImeUtils} from 'viewers/common/ime_utils'; 19import {PresenterInputMethod} from 'viewers/common/presenter_input_method'; 20 21export class PresenterInputMethodManagerService extends PresenterInputMethod { 22 protected updateHierarchyTableProperties() { 23 return { 24 ...new ImManagerServiceTableProperties( 25 this.entry?.obj?.inputMethodManagerService?.curMethodId, 26 this.entry?.obj?.inputMethodManagerService?.curFocusedWindowName, 27 this.entry?.obj?.inputMethodManagerService?.lastImeTargetWindowName, 28 this.entry?.obj?.inputMethodManagerService?.inputShown ?? false 29 ), 30 }; 31 } 32 33 protected override getAdditionalProperties( 34 wmEntry: TraceTreeNode | undefined, 35 sfEntry: TraceTreeNode | undefined 36 ) { 37 return new ImeAdditionalProperties( 38 wmEntry ? ImeUtils.processWindowManagerTraceEntry(wmEntry) : undefined, 39 undefined 40 ); 41 } 42} 43 44class ImManagerServiceTableProperties { 45 constructor( 46 public inputMethodId: string | undefined, 47 public curFocusedWindow: string | undefined, 48 public lastImeTargetWindow: string | undefined, 49 public inputShown: boolean 50 ) {} 51} 52