add proguard

This commit is contained in:
zhongchao
2021-01-28 17:11:50 +08:00
parent ff0ea6b18f
commit cf12e2f16b
14 changed files with 117 additions and 49 deletions

View File

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

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,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

@@ -10,12 +10,10 @@ import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.tanlu.api.IRoadInfoSearchCallback;
import com.mogo.cloud.tanlu.bean.RoadInfoRequest;
import com.mogo.cloud.tanlu.bean.RoadInfos;
import com.mogo.cloud.tanlu.bean.location.Location;
import com.mogo.cloud.tanlu.constant.HttpConstant;
import com.mogo.cloud.tanlu.net.TanluApiService;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@@ -50,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);
}
@@ -58,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);