• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 
16 #include "scene_state_collection.h"
17 
18 #include <algorithm>
19 
20 #include "constants.h"
21 #include "file_operation.h"
22 #include "securec.h"
23 #include "string_operation.h"
24 #include "thermal_service.h"
25 #include "thermal_common.h"
26 
27 namespace OHOS {
28 namespace PowerMgr {
29 namespace {
30 auto g_service = DelayedSpSingleton<ThermalService>::GetInstance();
31 }
Init()32 bool SceneStateCollection::Init()
33 {
34     return true;
35 }
36 
InitParam(std::string & params)37 bool SceneStateCollection::InitParam(std::string& params)
38 {
39     return true;
40 }
41 
GetState()42 std::string SceneStateCollection::GetState()
43 {
44     return "";
45 }
46 
SetState()47 void SceneStateCollection::SetState()
48 {
49 }
50 
DecideState(const std::string & value)51 bool SceneStateCollection::DecideState(const std::string& value)
52 {
53     THERMAL_HILOGD(COMP_SVC, "Enter");
54     if ((!g_service->GetScene().empty()) && (g_service->GetScene() == value)) {
55         std::string scene = g_service->GetScene();
56         THERMAL_HILOGD(COMP_SVC, "scene = %{public}s", scene.c_str());
57         return true;
58     }
59 
60     return false;
61 }
62 } // namespace PowerMgr
63 } // namespace OHOS