/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BaseElement, element } from '../../base-ui/BaseElement';
import '../../base-ui/popover/LitPopover';
import '../../base-ui/button/LitButton';
import { LitMainMenuGroup } from '../../base-ui/menu/LitMainMenuGroup';
import { LitMainMenuItem } from '../../base-ui/menu/LitMainMenuItem';
import { SpRecordSetting } from './setting/SpRecordSetting';
import { LitMainMenu, MenuGroup, MenuItem } from '../../base-ui/menu/LitMainMenu';
import { SpProbesConfig } from './setting/SpProbesConfig';
import { SpTraceCommand } from './setting/SpTraceCommand';
import { HdcStream } from '../../hdc/hdcclient/HdcStream';
import { FlagsConfig } from './SpFlags';
import LitSwitch from '../../base-ui/switch/lit-switch';
import { LitSlider } from '../../base-ui/slider/LitSlider';
import { CreateSessionRequest } from './setting/bean/ProfilerServiceTypes';
import { PluginConvertUtils } from './setting/utils/PluginConvertUtils';
import { SpAllocations } from './setting/SpAllocations';
import { SpRecordPerf } from './setting/SpRecordPerf';
import { HdcDeviceManager } from '../../hdc/HdcDeviceManager';
import { LitButton } from '../../base-ui/button/LitButton';
import { SpApplication } from '../SpApplication';
import { LitSearch } from './trace/search/Search';
import { LitProgressBar } from '../../base-ui/progress-bar/LitProgressBar';
import { log } from '../../log/Log';
import { CmdConstant } from '../../command/CmdConstant';
import { Cmd } from '../../command/Cmd';
import { SpFileSystem } from './setting/SpFileSystem';
import { SpSdkConfig } from './setting/SpSdkConfig';
import { SpVmTracker } from './setting/SpVmTracker';
import { SpHisysEvent } from './setting/SpHisysEvent';
import { SpRecordTemplate } from './setting/SpRecordTemplate';
import { SpStatisticsHttpUtil } from '../../statistics/util/SpStatisticsHttpUtil';
import { SpArkTs } from './setting/SpArkTs';
import { SpWebHdcShell } from './setting/SpWebHdcShell';
import { SpHilogRecord } from './setting/SpHilogRecord';
import { SpXPowerRecord } from './setting/SpXPowerRecord';
import { LongTraceDBUtils } from '../database/LongTraceDBUtils';
import {
createFpsPluginConfig,
createHTracePluginConfig,
createHiPerfConfig,
createMemoryPluginConfig,
createMonitorPlugin,
createNativePluginConfig,
createSessionRequest,
createSystemConfig,
createSdkConfig,
createHiSystemEventPluginConfig,
createArkTsConfig,
createHiLogConfig, createFFRTPluginConfig,
createXPowerConfig,
} from './SpRecordConfigModel';
import { SpRecordTraceHtml } from './SpRecordTrace.html';
import { SpFFRTConfig } from './setting/SpFFRTConfig';
import { shadowRootInput } from '../../trace/component/trace/base/shadowRootInput';
const DEVICE_NOT_CONNECT =
'
1.请确认抓取设备上是否已勾选并确认总是允许smartPerf-Host调试的弹窗
' +
'2.请关闭DevEco Studio,DevEco Testing等会占用hdc端口的应用
' +
'3.请使用系统管理员权限打开cmd窗口,并执行hdc kill,确保PC端任务管理器中没有hdc进程
' +
'4.若没有效果,请重新插拔一下手机。紧急情况可拷贝trace命令,在cmd窗口离线抓取
';
@element('sp-record-trace')
export class SpRecordTrace extends BaseElement {
public static serialNumber: string = '';
public static selectVersion: string | null;
public static isVscode = false;
public static cancelRecord = false;
static supportVersions = ['3.2', '4.0+', '5.0+'];
public deviceSelect: HTMLSelectElement | undefined;
public deviceVersion: HTMLSelectElement | undefined;
private _menuItems: Array