From 9169046175fa01fb3f8cb70437ab3f0c3683a3cd Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Sun, 2 Aug 2020 19:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=88=86=E4=BD=93=E6=9C=BAac?= =?UTF-8?q?c=E7=8A=B6=E6=80=81=E5=92=8C=E8=AF=BA=E7=BB=B4=E8=BE=BEaccDelay?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intent/AccStatusIntentHandler.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java index 554d1ed5dd..5c7ed0e39b 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java @@ -3,9 +3,11 @@ package com.mogo.module.service.intent; import android.content.Context; import android.content.Intent; +import com.mogo.module.common.utils.CarSeries; import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.ServiceConst; import com.mogo.module.service.receiver.AccStatusReceiver; +import com.mogo.utils.TipToast; import com.mogo.utils.logger.Logger; public @@ -19,6 +21,7 @@ class AccStatusIntentHandler implements IntentHandler { public static final byte ACC_ON = 1; public static final byte ACC_OFF = 0; + public static final byte ACC_OFF_DELAY = 3; private static final String TAG = "AccStatusIntentHandler"; @@ -46,21 +49,26 @@ class AccStatusIntentHandler implements IntentHandler { public void handle( Context context, Intent intent ) { String action = intent.getAction(); if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) { - MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true ); - Logger.d( TAG, "acc status: %s", true ); + if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) { + MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true ); + Logger.d( TAG, "acc status: %s", true ); + } } else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) { - MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false ); - Logger.d( TAG, "acc status: %s", false ); + if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) { + MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false ); + Logger.d( TAG, "acc status: %s", false ); + } } else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) { int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF ); - if ( state != ACC_OFF && state != ACC_ON ) { + TipToast.shortTip( "收到acc状态变更:" + state ); + if ( state != ACC_OFF && state != ACC_ON && state != ACC_OFF_DELAY ) { return; } boolean accOn = state == ACC_ON; if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) { return; } - Logger.d( TAG, "acc status: %s", accOn ); + Logger.d( TAG, "acc status: %s", state ); MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn ); } }