增加开机充电检测
authorCaisking <3449750381@qq.com>
Thu, 21 Mar 2024 01:37:19 +0000 (09:37 +0800)
committerCaisking <3449750381@qq.com>
Thu, 21 Mar 2024 01:37:19 +0000 (09:37 +0800)
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp

index 5b4f8d4..a41f9e0 100644 (file)
@@ -12,6 +12,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "battery_service.h"
+#include "DialModelCharge.h"
 
 #include "NativeLauncher.h"
 #include "SliceProxy.h"
@@ -314,7 +316,7 @@ namespace OHOS
 
     void NativeLauncher::InitNativeLauncher()
     {
-        
+
         // 初始化语言
         GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE, OHOS::VECTOR_FONT_DIR, DEFAULT_VECTOR_FONT_FILENAME);
         WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "NativeLauncher::InitNativeLauncher");
@@ -328,6 +330,11 @@ namespace OHOS
 #endif
         /* ------------------------------- ConfigModel ------------------------------ */
         ConfigModel::GetInstance()->Init();
+        // 开机检测充电状态
+        if (get_charge_stat() == 1)
+        {
+            DialModelCharge::GetInstance()->UpdateChargeStuaut(1);
+        }
         /* -------------------------------------------------------------------------- */
 
         // 初始化所有预加载slice
@@ -344,7 +351,7 @@ namespace OHOS
         // 初始化默认首页
         ScreenModels::GetInstance()->PreLoadAppimages();
         NativeAbility::GetInstance().SetDefaultSliceId(VIEW_MAIN);
-        //注册长按重启或关机事件
+        // 注册长按重启或关机事件
         RebootModel::GetInstance()->RegisterLongPressEvents();
     }