Merge remote-tracking branch 'origin/master'

This commit is contained in:
董宏宇
2021-01-28 17:43:24 +08:00
17 changed files with 209 additions and 47 deletions

1
.idea/gradle.xml generated
View File

@@ -23,6 +23,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -19,6 +19,10 @@ android {
}
buildTypes {
debug{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

View File

@@ -0,0 +1,87 @@
package com.mogo.cloud.util;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.telephony.CellLocation;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Created by congtaowang on 2018/3/29.
*/
public class Utils {
public static String getCellId( Context context ) {
TelephonyManager tm = ( TelephonyManager ) context.getSystemService( Context.TELEPHONY_SERVICE );
if ( tm == null ) {
return "";
}
PackageManager pm = context.getPackageManager();
boolean accessCoarseLocationPermission = ( PackageManager.PERMISSION_GRANTED ==
pm.checkPermission( Manifest.permission.ACCESS_COARSE_LOCATION, context.getPackageName() ) );
boolean accessFineLocationPermission = ( PackageManager.PERMISSION_GRANTED ==
pm.checkPermission( Manifest.permission.ACCESS_FINE_LOCATION, context.getPackageName() ) );
if ( !accessCoarseLocationPermission || !accessFineLocationPermission )
return "noPermission";
CellLocation location = null;
try {
location = tm.getCellLocation();
} catch ( Exception e ) {
e.printStackTrace();
}
if ( location != null ) {
// Gsm网络 , 联通移动的网络属于这一套
if ( location instanceof GsmCellLocation ) {
GsmCellLocation gsmLoc = ( GsmCellLocation ) location;
int cellid = gsmLoc.getCid();
return String.valueOf( cellid );
// Cdma网络 , 电信网络属于这一种
} else if ( location instanceof CdmaCellLocation ) {
CdmaCellLocation cdmaLoc = ( CdmaCellLocation ) location;
return String.valueOf( cdmaLoc.getBaseStationId() );
}
}
return "";
}
public static final String GET = "get";
public static final String GSM_SERIAL = "gsm.serial";
public static final String BYD_SERIAL = "ro.serialno";
public static final String FOTA_VERSION = "ro.fota.version";
public static final String PROPERTIES = "android.os.SystemProperties";
public static String getSn() {
return getSystemProperties( GSM_SERIAL );
}
public static String getFotaVersion() {
return getSystemProperties( FOTA_VERSION );
}
public static String getSystemProperties( String name ) {
String value = "";
try {
Class< ? > c = Class.forName( PROPERTIES );
Method get = c.getMethod( GET, String.class );
value = ( String ) get.invoke( c, name );
} catch ( ClassNotFoundException var3 ) {
var3.printStackTrace();
} catch ( NoSuchMethodException var4 ) {
var4.printStackTrace();
} catch ( InvocationTargetException var5 ) {
var5.printStackTrace();
} catch ( IllegalAccessException var6 ) {
var6.printStackTrace();
}
return value;
}
}

View File

@@ -0,0 +1,2 @@
-keep class com.mogo.cloud.httpdns.bean.*{*;}
-keep class com.mogo.cloud.httpdns.util.ApiManager{*;}

View File

@@ -0,0 +1,2 @@
-keep class com.mogo.cloud.network.BaseData{*;}
-keep class com.mogo.cloud.network.NetConstants{*;}

View File

@@ -0,0 +1,55 @@
-keep class com.zhidao.thirdlogin.*{*;}
-keep class com.zhidao.cosupload.*{*;}
-keep class com.zhidao.ptech.*{*;}
-keep class com.zhidao.utils.*{*;}
-keep class com.elegant.**{*;}
-keep class com.mogo.utils.*{*;}
-keep class com.hw.videoprocessor.*{*;}
-keep class net.surina.soundtouch.*{*;}
-keep class com.tencent.**{*;}
-keep class org.apache.commons.codec.*{*;}
#-----Netty-----
-keepattributes Signature,InnerClasses
-keep class io.netty.** {*;}
-keep class org.apache.** {*;}
-keep class org.apache.logging.**{*;}
-keepclasseswithmembers class io.netty.** {*;}
-keepclasseswithmembers class org.apache.logging.**{*;}
-keep class org.apache.http.**{*;}
-dontwarn io.netty.**
-dontwarn sun.**
#-----ProtoBuf-----
-keep class com.google.protobuf.** {*;}
#-----Gson-----
-dontwarn sun.misc.**
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
#-----Glide-----
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule {
<init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
*** rewind();
}
#如果你的 target API 低于 Android API 27,请添加:
-dontwarn com.bumptech.glide.load.resource.bitmap.VideoDecoder

View File

@@ -0,0 +1,6 @@
-keep class com.zhidao.locupload.*{*;}
-keep class com.zhidao.socket.*{*;}
-keep class com.mogo.cloud.socket.MsgBody{*;}
-keep class com.mogo.cloud.socket.WebSocketData{*;}
-keep class com.mogo.cloud.socket.WebSocketMsgType{*;}
-keep class com.mogo.cloud.socket.SocketServicesConstants{*;}

View File

@@ -0,0 +1,5 @@
-keep class com.mogo.realtime.entity.*{*;}
-keep class com.mogo.realtime.Interface.*{*;}
-keep class com.mogo.realtime.socket.IMogoCloudOnMsgListener{*;}
-keep class com.mogo.realtime.socket.IMogoCloudOnAckListener{*;}
-keep class com.mogo.realtime.util.MogoLatLng{*;}

View File

@@ -2,6 +2,8 @@ package com.mogo.realtime.core;
import android.os.SystemClock;
import androidx.annotation.Keep;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.realtime.util.MogoLatLng;
@@ -245,7 +247,9 @@ public class SimpleLocationCorrectStrategy {
return x * 180 / Math.PI;
}
@Keep
public interface RecordLocationListener {
@Keep
void onRecordFinish(List<CloudLocationInfo> history, List<CloudLocationInfo> correct, List<CloudLocationInfo> valid, List<CloudLocationInfo> err);
}
}

View File

@@ -5,7 +5,6 @@ import android.content.Context;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.realtime.spi.RealTimeProviderImp;
import com.mogo.realtime.location.MogoRTKLocation;
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
import com.mogo.realtime.socket.SocketHandler;
/**

View File

@@ -3,6 +3,8 @@ package com.mogo.realtime.core;
import android.os.Handler;
import android.os.Message;
import androidx.annotation.Keep;
import com.mogo.utils.WorkThreadHandler;
/**
@@ -79,11 +81,13 @@ public class UploadInTimeHandler {
/**
* 实时上报数据回调
*/
@Keep
public interface IUploadInTimeListener {
/**
* 上报自车数据
*/
@Keep
void sendLocationData();
}

View File

@@ -29,7 +29,6 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid

View File

@@ -0,0 +1,4 @@
-keep class com.mogo.cloud.tanlu.api.*{*;}
-keep class com.mogo.cloud.tanlu.bean.*{*;}
-keep class com.mogo.cloud.tanlu.constant.*{*;}
-keep class com.mogo.cloud.tanlu.net.*{*;}

View File

@@ -48,7 +48,7 @@ public class MogoRoadSearchManager {
return sInstance;
}
public void init () {
public void init() {
apiService = RetrofitFactory.INSTANCE.getInstance(NetConstants.LAUNCHER_SNAPSHOT_HOST)
.create(TanluApiService.class);
}
@@ -56,53 +56,41 @@ public class MogoRoadSearchManager {
/**
* 通过经纬度信息查询 TanluModelData
*
* @param roadInfoRequest
* @param callback
*/
public void queryRoadInfo(RoadInfoRequest roadInfoRequest, IRoadInfoSearchCallback callback) {
// ArrayList list = new ArrayList();
// list.add("10007");
//
// //北京市朝阳区小黄庄北街2号
// Location location = new Location();
// location.setLatitude(39.968139);
// location.setLongitude(116.411468);
// RoadInfoRequest request = new RoadInfoRequest(location, "", list, false, false);
// Map<String, Object> map = new HashMap<>();
// map.put("sn", "F803EB2046PZD00228");
// map.put("data", GsonUtil.jsonFromObject(request));
Map<String, Object> map = new HashMap<>();
map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
map.put("data", GsonUtil.jsonFromObject(roadInfoRequest));
apiService.queryRoadInfos(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseData<RoadInfos>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onSubscribe ");
}
apiService.queryRoadInfos(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseData<RoadInfos>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onSubscribe ");
}
@Override
public void onNext(@NonNull BaseData<RoadInfos> roadInfos) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onNext roadInfos = " + roadInfos.getResult().getData());
callback.onSuccess(roadInfos);
}
@Override
public void onNext(@NonNull BaseData<RoadInfos> roadInfos) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onNext roadInfos = " + roadInfos.getResult().getData());
callback.onSuccess(roadInfos);
}
@Override
public void onError(@NonNull Throwable e) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onError ");
callback.onError(e);
}
@Override
public void onError(@NonNull Throwable e) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onError ");
callback.onError(e);
}
@Override
public void onComplete() {
Log.d(HttpConstant.TANLU, "queryRoadInfos onComplete ");
}
});
@Override
public void onComplete() {
Log.d(HttpConstant.TANLU, "queryRoadInfos onComplete ");
}
});
}

View File

@@ -16,6 +16,7 @@ import com.mogo.cloud.tanlu.net.TanluApiService;
import java.util.HashMap;
import java.util.Map;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
@@ -32,7 +33,7 @@ public class UploadManager {
private TanluApiService apiService;
private UploadManager (Context context) {
private UploadManager(Context context) {
mContext = context;
}
@@ -46,17 +47,15 @@ public class UploadManager {
return sInstance;
}
public void init () {
public void init() {
apiService = RetrofitFactory.INSTANCE.getInstance(NetConstants.DEVA_HOST)
.create(TanluApiService.class);
}
/**
*
* @param informationBody
* @param callback
*
*/
public void loadUpload(InformationBody informationBody, ITanluUploadCallback callback) {
Gson gson = new Gson();
@@ -64,9 +63,6 @@ public class UploadManager {
map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
map.put("data", gson.toJson(informationBody));
Log.d(HttpConstant.TANLU, "info = " + gson.toJson(informationBody));
// map.put("sn", "F803EB2046PZD00228");
// map.put("data", "{\"addr\":\"北京市东城区小黄庄北街2号靠近中国银行(北京安贞桥支行)\",\"areaCode\":\"110101\",\"areaName\":\"东城区\",\"cityCode\":\"010\",\"cityName\":\"北京市\",\"data\":\"[{\\\"thumbnail\\\":\\\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/F803EB2046PZD00228/F803EB2046PZD00228_20210121165329/Thumbnail1611219200669.jpg\\\",\\\"url\\\":\\\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/F803EB2046PZD00228/F803EB2046PZD00228_20210121165329/compress_video_20210121165307.mp4\\\"}]\",\"direction\":0.0,\"fromType\":\"2\",\"generateTime\":1611219213616,\"infoTimeout\":240,\"infoType\":1,\"isShare\":false,\"lat\":39.968317,\"lon\":116.410892,\"mainInfoId\":0,\"poiType\":\"10008\",\"provinceName\":\"北京市\",\"sn\":\"F803EB2046PZD00228\",\"speed\":0.0,\"street\":\"小黄庄北街\",\"trafficInfoType\":\"\",\"type\":1,\"uid\":0}");
Log.d(HttpConstant.TANLU, "sn = " + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
apiService.uploadInformation(map)
.subscribeOn(Schedulers.io())

View File

@@ -4,6 +4,7 @@ import android.graphics.Bitmap
import android.media.MediaMetadataRetriever
import android.os.Environment
import android.util.Log
import androidx.annotation.Keep
import java.io.*
import java.text.SimpleDateFormat
import java.util.*
@@ -13,6 +14,7 @@ import java.util.*
* @description 文件处理类
* @since 2021/1/26
*/
@Keep
fun deletePicFile(filePath: String?): Boolean {
var file = File(filePath)
if (file.exists()) {
@@ -100,7 +102,7 @@ fun bitmapToFile(bitmap: Bitmap?, filePath: String): Boolean {
return true
}
@Keep
fun getVideoPicPath(): String {
val moviesDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES
@@ -125,6 +127,7 @@ fun getVideoPicPath(): String {
//获取压缩后的视频路径 /storage/emulated/0/Movies/compress_video_20210126174432.mp4
@Keep
fun getCompressVideoPath(): String {
val moviesDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_MOVIES

View File

@@ -1,5 +1,7 @@
package com.mogo.cloud.tanlu.utils;
import androidx.annotation.Keep;
import java.util.regex.Pattern;
/**
@@ -9,6 +11,7 @@ import java.util.regex.Pattern;
*/
public class TanluUtils {
@Keep
public static boolean isVideo(String path) {
String reg = "(mp4|flv|avi|rm|rmvb|wmv)";
Pattern p = Pattern.compile(reg);