opt
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-26
|
||||
* <p>
|
||||
* 车机类型
|
||||
*/
|
||||
public class CarSeries {
|
||||
|
||||
public static final int CAR_SERIES_C80X = 10;
|
||||
public static final int CAR_SERIES_D80X = 20;
|
||||
public static final int CAR_SERIES_D81X = 21;
|
||||
public static final int CAR_SERIES_D82X = 22;
|
||||
public static final int CAR_SERIES_D84X = 23;
|
||||
public static final int CAR_SERIES_F80X = 30;
|
||||
public static final int CAR_SERIES_G80X = 40;
|
||||
|
||||
public static int CAR_SERIES = 0;
|
||||
|
||||
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 ( "FG166".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_C80X;
|
||||
} else if ( "D801-802".equals( device ) ) {
|
||||
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 {
|
||||
CAR_SERIES = CAR_SERIES_F80X;
|
||||
}
|
||||
return CAR_SERIES;
|
||||
}
|
||||
}
|
||||
|
||||
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