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 TransitionType from "../flickerlib/tags/TransitionType"; 18 19/** 20 * Should be kept in sync with ENUM is in Google3 under: 21 * google3/wireless/android/tools/android_bug_tool/extension/common/actions 22 */ 23const WebContentScriptMessageType = { 24 UNKNOWN: 0, 25 CONVERT_OBJECT_URL: 1, 26 CONVERT_OBJECT_URL_RESPONSE: 2, 27}; 28 29const NAVIGATION_STYLE = { 30 GLOBAL: 'Global', 31 FOCUSED: 'Focused', 32 CUSTOM: 'Custom', 33 TARGETED: 'Targeted', 34}; 35 36const SEARCH_TYPE = { 37 TRANSITIONS: 'Transitions', 38 ERRORS: 'Errors', 39 TIMESTAMP: 'Timestamp', 40}; 41 42const logLevel = { 43 INFO: 'info', 44 DEBUG: 'debug', 45 VERBOSE: 'verbose', 46 WARN: 'warn', 47 ERROR: 'error', 48 WTF: 'wtf', 49}; 50 51const transitionMap = new Map([ 52 [TransitionType.ROTATION, {desc: 'Rotation', color: '#9900ffff'}], 53 [TransitionType.PIP_ENTER, {desc: 'Entering PIP mode', color: '#4a86e8ff'}], 54 [TransitionType.PIP_RESIZE, {desc: 'Resizing PIP mode', color: '#2b9e94ff'}], 55 [TransitionType.PIP_CLOSE, {desc: 'Closing PIP mode', color: 'rgb(57, 57, 182)'}], 56 [TransitionType.PIP_EXIT, {desc: 'Exiting PIP mode', color: 'darkblue'}], 57 [TransitionType.APP_LAUNCH, {desc: 'Launching app', color: '#ef6befff'}], 58 [TransitionType.APP_CLOSE, {desc: 'Closing app', color: '#d10ddfff'}], 59 [TransitionType.IME_APPEAR, {desc: 'IME appearing', color: '#ff9900ff'}], 60 [TransitionType.IME_DISAPPEAR, {desc: 'IME disappearing', color: '#ad6800ff'}], 61 [TransitionType.APP_PAIRS_ENTER, {desc: 'Entering app pairs mode', color: 'rgb(58, 151, 39)'}], 62 [TransitionType.APP_PAIRS_EXIT, {desc: 'Exiting app pairs mode', color: 'rgb(45, 110, 32)'}], 63]) 64 65//used to split timestamp search input by unit, to convert to nanoseconds 66const regExpTimestampSearch = new RegExp(/^\d+$/); 67 68export { WebContentScriptMessageType, NAVIGATION_STYLE, SEARCH_TYPE, logLevel, transitionMap, regExpTimestampSearch }; 69