[2.13.0-arch-opt] remove acc
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
package com.mogo.commons.module.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.commons.module.ServiceConst;
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.commons.utils.CarSeries;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/5
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
public class AccStatusIntentHandler implements IntentHandler {
|
||||
|
||||
private static volatile AccStatusIntentHandler sInstance;
|
||||
|
||||
private AccStatusIntentHandler() {
|
||||
}
|
||||
|
||||
public static AccStatusIntentHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AccStatusIntentHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new AccStatusIntentHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) {
|
||||
if ( CarSeries.isF8xxSeries() ) {
|
||||
MogoStatusManager.getInstance().setAccStatus( ServiceConst.TYPE, true );
|
||||
}
|
||||
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) {
|
||||
if ( CarSeries.isF8xxSeries() ) {
|
||||
MogoStatusManager.getInstance().setAccStatus( ServiceConst.TYPE, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,6 @@ public class IntentHandlerFactory {
|
||||
private IntentHandlerFactory() {
|
||||
// private constructor
|
||||
mHandlers.put( MogoReceiver.ACTION_VOICE_UI, new VoiceUiIntentHandler() );
|
||||
mHandlers.put( Intent.ACTION_POWER_CONNECTED, AccStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.commons.module.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.commons.module.intent.IntentHandlerFactory;
|
||||
|
||||
|
||||
public class AccStatusReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
IntentHandlerFactory.getInstance().handle( context, intent.getAction(), intent );
|
||||
}
|
||||
}
|
||||
@@ -23,20 +23,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isVoiceShow();
|
||||
|
||||
/**
|
||||
* v2x UI 是否在展示
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isV2XShow();
|
||||
|
||||
/**
|
||||
* 是否开机
|
||||
*
|
||||
* @return true - 开机 false - 关机
|
||||
*/
|
||||
boolean isAccOn();
|
||||
|
||||
/**
|
||||
* 主页是否显示
|
||||
*
|
||||
@@ -79,23 +65,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setVoiceUIShow( String tag, boolean show );
|
||||
|
||||
/**
|
||||
* 设置 V2X UI 状态
|
||||
* <p>
|
||||
*
|
||||
* @param tag 业务类型
|
||||
* @param show true - 显示 false - 隐藏
|
||||
*/
|
||||
void setV2XUIShow( String tag, boolean show );
|
||||
|
||||
/**
|
||||
* 设置 acc 状态
|
||||
*
|
||||
* @param tag 业务类型
|
||||
* @param isOn true - on, false - off
|
||||
*/
|
||||
void setAccStatus( String tag, boolean isOn );
|
||||
|
||||
/**
|
||||
* 主页 resume 状态
|
||||
*
|
||||
|
||||
@@ -58,16 +58,6 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
return get_bool_val(StatusDescriptor.VR_MODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isV2XShow() {
|
||||
return get_bool_val(StatusDescriptor.V2X_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccOn() {
|
||||
return get_bool_val(StatusDescriptor.ACC_STATUS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMainPageOnResume() {
|
||||
return get_bool_val(StatusDescriptor.MAIN_PAGE_RESUME);
|
||||
@@ -103,16 +93,6 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
doSetStatus(tag, StatusDescriptor.VOICE_UI, show);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setV2XUIShow(String tag, boolean show) {
|
||||
doSetStatus(tag, StatusDescriptor.V2X_UI, show);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccStatus(String tag, boolean isOn) {
|
||||
doSetStatus(tag, StatusDescriptor.ACC_STATUS, isOn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainPageResumeStatus(String tag, boolean resume) {
|
||||
doSetStatus(tag, StatusDescriptor.MAIN_PAGE_RESUME, resume);
|
||||
|
||||
@@ -8,21 +8,11 @@ package com.mogo.commons.module.status;
|
||||
*/
|
||||
public enum StatusDescriptor {
|
||||
|
||||
/**
|
||||
* v2x UI
|
||||
*/
|
||||
V2X_UI,
|
||||
|
||||
/**
|
||||
* 小智语音交互 UI
|
||||
*/
|
||||
VOICE_UI,
|
||||
|
||||
/**
|
||||
* 开机状态
|
||||
*/
|
||||
ACC_STATUS,
|
||||
|
||||
/**
|
||||
* 主页 resume 状态
|
||||
*/
|
||||
@@ -43,7 +33,6 @@ public enum StatusDescriptor {
|
||||
*/
|
||||
SEEK_HELPING,
|
||||
|
||||
|
||||
/**
|
||||
* 是否已经进入vr模式
|
||||
*/
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.mogo.commons.utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-26
|
||||
* <p>
|
||||
* 车机类型
|
||||
*/
|
||||
public class CarSeries {
|
||||
|
||||
private static boolean invokeFlag = false;
|
||||
private static boolean isF8xxSeries = false;
|
||||
|
||||
public static boolean isF8xxSeries() {
|
||||
if ( invokeFlag ) {
|
||||
return isF8xxSeries;
|
||||
}
|
||||
isF8xxSeries = DebugConfig.getProductFlavor().startsWith( "f" );
|
||||
invokeFlag = true;
|
||||
return isF8xxSeries;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_C80X = 10;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_D80X = 20;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_D81X = 21;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_D82X = 22;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_D84X = 23;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_F80X = 30;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_G80X = 40;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E84X = 50;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E84XCD = 51;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E85X = 50;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E85XCD = 51;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E85XJD = 51;
|
||||
|
||||
@Deprecated
|
||||
public static int CAR_SERIES = 0;
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
* Use {@link DebugConfig#getProductFlavor()} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getSeries() {
|
||||
if ( CAR_SERIES != 0 ) {
|
||||
return CAR_SERIES;
|
||||
}
|
||||
synchronized ( CarSeries.class ) {
|
||||
if ( CAR_SERIES != 0 ) {
|
||||
return CAR_SERIES;
|
||||
}
|
||||
String device = get( "ro.fota.device" );
|
||||
if ( TextUtils.isEmpty( device ) ) {
|
||||
return CAR_SERIES_F80X;
|
||||
}
|
||||
|
||||
if ( "FG166".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_C80X;
|
||||
} else if ( "D801-802".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_D80X;
|
||||
} else if ( "D801B-802B".equals( device ) ) {
|
||||
// 2+16G
|
||||
CAR_SERIES = CAR_SERIES_D80X;
|
||||
} else if ( "D811-812".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_D81X;
|
||||
} else if ( "D821-822".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_D82X;
|
||||
} else if ( "D841-842".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_D84X;
|
||||
} else if ( "G801-802".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_G80X;
|
||||
} else if ( "F801-802".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_F80X;
|
||||
} else if ( "E841-842".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E84X;
|
||||
} else if ( "E84XCD".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E84XCD;
|
||||
} else if ( "E851-852".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E85X;
|
||||
} else if ( "E85XCD".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E85XCD;
|
||||
} else if ( "E85XJD".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E85XJD;
|
||||
} else if ( device.startsWith( "E85" ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E85XJD;
|
||||
} else {
|
||||
CAR_SERIES = CAR_SERIES_F80X;
|
||||
}
|
||||
return CAR_SERIES;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static String get( String key ) {
|
||||
String value = "";
|
||||
try {
|
||||
Class< ? > c = Class.forName( "android.os.SystemProperties" );
|
||||
Method get = c.getMethod( "get", new Class[]{String.class, String.class} );
|
||||
value = ( String ) get.invoke( c, new Object[]{key, "unknown"} );
|
||||
} catch ( Exception e ) {
|
||||
value = "";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user