• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #ifndef OHOS_ROSEN_SECONDARY_DISPLAY_FOLD_STATE_SENSOR_MANAGER_H
17 #define OHOS_ROSEN_SECONDARY_DISPLAY_FOLD_STATE_SENSOR_MANAGER_H
18 
19 #include "dm_common.h"
20 #include <transaction/rs_interfaces.h>
21 #include "fold_screen_controller/fold_screen_policy.h"
22 #include "fold_screen_controller/sensor_fold_state_manager/sensor_fold_state_manager.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 class SecondaryDisplaySensorFoldStateManager : public SensorFoldStateManager {
27 public:
28     SecondaryDisplaySensorFoldStateManager();
29     virtual ~SecondaryDisplaySensorFoldStateManager();
30     void HandleAngleOrHallChange(const std::vector<float> &angles,
31         const std::vector<uint16_t> &halls, sptr<FoldScreenPolicy> foldScreenPolicy) override;
32 private:
33     FoldStatus GetNextFoldState(const std::vector<float> &angles, const std::vector<uint16_t> &halls);
34     FoldStatus GetNextFoldStateHalf(float angle, uint16_t hall, FoldStatus myNextStatus,
35         int32_t allowUserSensorForLargeFoldDevice);
36     FoldStatus GetGlobalFoldState(FoldStatus PrimaryFoldState, FoldStatus SecondaryFoldState);
37     FoldStatus UpdateSwitchScreenBoundaryForLargeFoldDeviceAB(float angle, uint16_t hall, FoldStatus state);
38     FoldStatus UpdateSwitchScreenBoundaryForLargeFoldDeviceBC(float angle, uint16_t hall, FoldStatus state);
39     FoldStatus GetFoldStateUnpower(const std::vector<uint16_t> &halls);
40     void ReportSecondaryReflexion(int32_t currentStatus, int32_t nextStatus, bool isSecondaryReflexion);
41     void SendReflexionResult(bool isSecondaryReflexion);
42     int32_t allowUserSensorForLargeFoldDeviceAB = 0;
43     int32_t allowUserSensorForLargeFoldDeviceBC = 0;
44     bool isHasReflexioned = false;
45     FoldStatus mNextStateAB = FoldStatus::UNKNOWN;
46     FoldStatus mNextStateBC = FoldStatus::UNKNOWN;
47 };
48 } // namespace Rosen
49 } // namespace OHOS
50 #endif