1import {nanos_to_string, transform} from './transform.js' 2 3function transform_ime_trace_clients(entries) { 4 return transform({ 5 obj: entries, 6 kind: 'entries', 7 name: 'entries', 8 children: [ 9 [entries.entry, transform_entry_clients] 10 ] 11 }); 12} 13 14function transform_entry_clients(entry) { 15 return transform({ 16 obj: entry, 17 kind: 'entry', 18 name: nanos_to_string(entry.elapsedRealtimeNanos) + " - " + entry.where, 19 children: [ 20 [[entry.client], transform_client_dump] 21 ], 22 timestamp: entry.elapsedRealtimeNanos, 23 stableId: 'entry' 24 }); 25} 26 27function transform_client_dump(entry) { 28 return transform({ 29 obj: transform_input_connection_call(entry), 30 kind: 'Client', 31 name: '\n- methodId ' + entry?.inputMethodManager?.curId 32 + '\n- view ' + entry?.viewRootImpl?.view 33 + '\n- packageName ' + entry?.editorInfo?.packageName, 34 children: [], 35 stableId: 'client' 36 }); 37} 38 39function transform_ime_trace_service(entries) { 40 return transform({ 41 obj: entries, 42 kind: 'entries', 43 name: 'entries', 44 children: [ 45 [entries.entry, transform_entry_service] 46 ] 47 }); 48} 49 50function transform_entry_service(entry) { 51 return transform({ 52 obj: entry, 53 kind: 'entry', 54 name: nanos_to_string(entry.elapsedRealtimeNanos) + " - " + entry.where, 55 children: [ 56 [[entry.inputMethodService], transform_service_dump] 57 ], 58 timestamp: entry.elapsedRealtimeNanos, 59 stableId: 'entry' 60 }); 61} 62 63function transform_service_dump(entry) { 64 return transform({ 65 obj: transform_input_connection_call(entry), 66 kind: 'InputMethodService', 67 name: '\n- windowVisible ' + entry?.windowVisible 68 + '\n- decorViewVisible ' + entry?.decorViewVisible 69 + '\n- packageName ' + entry?.inputEditorInfo?.packageName, 70 children: [], 71 stableId: 'service' 72 }); 73} 74 75function transform_ime_trace_managerservice(entries) { 76 return transform({ 77 obj: entries, 78 kind: 'entries', 79 name: 'entries', 80 children: [ 81 [entries.entry, transform_entry_managerservice] 82 ] 83 }); 84} 85 86function transform_entry_managerservice(entry) { 87 return transform({ 88 obj: entry, 89 kind: 'entry', 90 name: nanos_to_string(entry.elapsedRealtimeNanos) + " - " + entry.where, 91 children: [ 92 [[entry.inputMethodManagerService], transform_managerservice_dump] 93 ], 94 timestamp: entry.elapsedRealtimeNanos, 95 stableId: 'entry' 96 }); 97} 98 99function transform_managerservice_dump(entry) { 100 return transform({ 101 obj: entry, 102 kind: 'InputMethodManagerService', 103 name: '\n- methodId ' + entry?.curMethodId 104 + '\n- curFocusedWindow ' + entry?.curFocusedWindowName 105 + '\n- lastImeTargetWindow ' + entry?.lastImeTargetWindowName 106 + '\n- inputShown ' + entry?.inputShown, 107 children: [], 108 stableId: 'managerservice' 109 }); 110} 111 112function transform_input_connection_call(entry) { 113 const obj = Object.assign({}, entry) 114 if (obj.inputConnectionCall) { 115 Object.getOwnPropertyNames(obj.inputConnectionCall).forEach(name => { 116 const value = Object.getOwnPropertyDescriptor(obj.inputConnectionCall, name) 117 if (!value.value) delete obj.inputConnectionCall[name] 118 }) 119 } 120 return obj 121} 122 123export {transform_ime_trace_clients, transform_ime_trace_service, transform_ime_trace_managerservice}; 124