1/*
2 * Copyright 2020, 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
17import { transform, nanos_to_string, get_visible_chip } from './transform.js'
18
19function transform_accessibility(accessibility) {
20  return transform({
21    obj: accessibility,
22    kind: 'accessibility',
23    name: 'accessibility',
24    children: []
25  });
26}
27
28function transform_entry(entry) {
29  return transform({
30    obj: entry,
31    kind: 'entry',
32    name: nanos_to_string(entry.elapsedRealtimeNanos),
33    children: [
34      [entry.accessibilityService, transform_accessibility],
35    ],
36    timestamp: entry.elapsedRealtimeNanos,
37    stableId: 'entry'
38  });
39}
40
41function transform_accessibility_trace(entries) {
42  return transform({
43    obj: entries,
44    kind: 'entries',
45    name: 'entries',
46    children: [
47      [entries.entry, transform_entry],
48    ],
49  });
50}
51
52export { transform_accessibility_trace };
53