1/* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15#include <iostream> 16#include <sstream> 17#include "include/sp_utils.h" 18#include "include/Dubai.h" 19#include "include/sp_log.h" 20#include "include/common.h" 21namespace OHOS { 22namespace SmartPerf { 23void Dubai::DumpDubaiBegin() 24{ 25 std::string result; 26 std::string dumpBubaiB = HIDUMPER_CMD_MAP.at(HidumperCmd::DUMPER_DUBAI_B); 27 SPUtils::LoadCmd(dumpBubaiB, result); 28 LOGI("Dubai::DumpDubaiBegin"); 29} 30void Dubai::DumpDubaiFinish() 31{ 32 std::string result; 33 std::string dumpBubaiF = HIDUMPER_CMD_MAP.at(HidumperCmd::DUMPER_DUBAI_F); 34 SPUtils::LoadCmd(dumpBubaiF, result); 35 LOGI("Dubai::DumpDubaiFinish"); 36} 37 38void Dubai::MoveDubaiDb() 39{ 40 std::string result; 41 const std::string dubaiXpower = "/data/service/el2/100/xpower"; 42 const std::string XpowerDb = "/dubai.db"; 43 const std::string Database = "/data/app/el2/100/database/"; 44 const std::string PkgEntry = "/entry/rdb"; 45 const std::string cpDubai = "cp " + dubaiXpower + XpowerDb + " " + Database + dubaiPkgName + PkgEntry; 46 const std::string dubaiPathChmod = "chmod 777 " + Database + dubaiPkgName + PkgEntry + XpowerDb; 47 LOGI("cpDubai: (%s)", cpDubai.c_str()); 48 LOGI("dubaiPathChmod: (%s)", dubaiPathChmod.c_str()); 49 SPUtils::LoadCmd(cpDubai, result); 50 SPUtils::LoadCmd(dubaiPathChmod, result); 51} 52} 53} 54