[2.14.0] add func of line id upload

This commit is contained in:
zhongchao
2023-02-09 15:06:21 +08:00
parent 0b40392b25
commit 0d13d80aa5
40 changed files with 121 additions and 426 deletions

View File

@@ -333,6 +333,11 @@ public class BusPassengerModel {
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}

View File

@@ -267,6 +267,11 @@ public class BusPresenter extends Presenter<BusFragment>
onAutopilotStatusResponse(info);
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
BusTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo);

View File

@@ -162,6 +162,11 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
if (autopilotStatusInfo == null) return;

View File

@@ -498,6 +498,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {

View File

@@ -1146,6 +1146,11 @@ public class TaxiModel {
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}

View File

@@ -79,9 +79,7 @@ skinsupportimpl : "com.mogo.skin:skin-support-impl:${MOGO_COMMONS_V
skinsupportnoop : "com.mogo.skin:skin-support-noop:${MOGO_COMMONS_VERSION}",
skinsupportlight : "com.mogo.skin:skin-light:${MOGO_COMMONS_VERSION}",
crashreport : "com.mogo.test:crashreport:${MOGO_COMMONS_VERSION}",
crashreportbugly : "com.mogo.test:crashreport-bugly:${MOGO_COMMONS_VERSION}",
crashreportnoop : "com.mogo.test:crashreport-noop:${MOGO_COMMONS_VERSION}",
crashreportupgrade : "com.mogo.test:crashreport-upgrade:${MOGO_COMMONS_VERSION}",
skinsupportbase : "com.mogo.skin:skin-support-base:${MOGO_COMMONS_VERSION}",
skinsupportappcompat : "com.mogo.skin:skin-support-appcompat:${MOGO_COMMONS_VERSION}",
skinsupportcardview : "com.mogo.skin:skin-support-cardview:${MOGO_COMMONS_VERSION}",

View File

@@ -3,13 +3,10 @@ package com.mogo.launcher.stageone
import android.content.Context
import com.rousetime.android_startup.AndroidStartup
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants
import com.mogo.test.crashreport.CrashReportConstants
class APMStartup : AndroidStartup<Boolean?>() {
override fun create(context: Context): Boolean? {
// bugly
ARouter.getInstance().build(UpgradeReportConstants.PATH).navigation()
// apm
ARouter.getInstance().build(CrashReportConstants.PATH).navigation()
return true

View File

@@ -113,7 +113,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
// 使用中台长链接
clientConfig.isUseOriginSocket = true
// 设置是否输出网络日志
clientConfig.isShowNetDebugLog = false
clientConfig.isShowNetDebugLog = true
// 设置是否是直播推流的主播
clientConfig.isAnchor = true
when (DebugConfig.getCarMachineType()) {

View File

@@ -149,10 +149,8 @@ ext {
mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
kotlingradleplugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}",
crashreport : "com.mogo.test:crashreport:${CRASHREPORT_VERSION}",
crashreportbugly : "com.mogo.test:crashreport-bugly:${CRASHREPORT_BUGLY_VERSION}",
crashreportapmbyte : "com.mogo.test:crashreport-apmbyte:${CRASHREPORT_APMBYTE_VERSION}",
crashreportnoop : "com.mogo.test:crashreport-noop:${CRASHREPORT_NOOP_VERSION}",
crashreportupgrade : "com.mogo.test:crashreport-upgrade:${CRASHREPORT_UPGRADE_VERSION}",
apm_insight : 'com.volcengine:apm_insight:1.4.9.cn-rc.5',
apm_insight_crash : 'com.volcengine:apm_insight_crash:1.4.6-rc.14',
cicle_indicator : 'me.relex:circleindicator:2.1.6',

View File

@@ -350,4 +350,9 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
}

View File

@@ -116,8 +116,6 @@ dependencies {
api project(':services:mogo-service')
api project(':libraries:mogo-map')
api project(':test:crashreport-upgrade')
// api project(':test:crashreport-bugly')
api project(':test:crashreport-apmbyte')
api project(':core:mogo-core-res')

View File

@@ -100,6 +100,11 @@ public class SteeringWheelView extends ConstraintLayout {
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}

View File

@@ -445,6 +445,11 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
private void updateConnectInfoView(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
if (!isFloatingLayerHidden) {// 遮罩层显示的时候
mConnAdapter.updateData(autoPilotStatusInfo);

View File

@@ -124,4 +124,9 @@ public class MogoRouteOverlayManager implements
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
}

View File

@@ -196,4 +196,9 @@ public class SmallMapFragment extends BaseFragment
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
}

View File

@@ -1,20 +1,27 @@
package com.mogo.eagle.core.function.v2x
import android.content.Context
import android.util.Log
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.constants.HostConst
import com.mogo.commons.constants.HostConst.DATA_CENTER_HOST
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.v2x.LineUploadData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel
import com.mogo.eagle.core.function.v2x.road.V2XEventServiceApi
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiCall
import com.mogo.eagle.core.network.request
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlin.properties.Delegates
class LineUploadManager private constructor(context: Context) {
class LineUploadManager private constructor(context: Context) : IMoGoAutopilotStatusListener {
companion object {
@@ -43,33 +50,44 @@ class LineUploadManager private constructor(context: Context) {
mContext = context
}
private var lineId: Long? by Delegates.observable(
CallerAutoPilotStatusListenerManager
.getAutoPilotStatusInfo().autopilotControlParameters?.autoPilotLine?.lineId
) { _, _, newValue ->
CallerLogger.d(TAG, " old line : $lineId , new line : $newValue")
lineId = newValue
// uploadLine()
fun init(){
Log.d("emArrow","LineUploadManager addListener")
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
private fun uploadLine() {
lineId?.let {
val lineUploadData = LineUploadData(it, MoGoAiCloudClientConfig.getInstance().sn)
disposable = MoGoRetrofitFactory.getInstance(HostConst.getHost()) //todo 改域名
.create(V2XEventServiceApi::class.java)
.uploadLineId(lineUploadData)
.retry(3)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { data ->
CallerLogger.d(TAG, " uploadLine : $data")
}
private fun getHost(): String {
return when (DebugConfig.getNetMode()) {
DebugConfig.NET_MODE_DEV, DebugConfig.NET_MODE_QA -> "http://dzt-test.zhidaozhixing.com/"
DebugConfig.NET_MODE_RELEASE -> "http://dzt.zhidaozhixing.com/"
else -> "http://dzt.zhidaozhixing.com/"
}
}
override fun onAutopilotRouteLineId(lineId: Long) {
super.onAutopilotRouteLineId(lineId)
if (lineId > 0) {
uploadLine(lineId)
}
}
private fun uploadLine(lineId: Long) {
val lineUploadData = LineUploadData(lineId, MoGoAiCloudClientConfig.getInstance().sn)
disposable = MoGoRetrofitFactory.getInstance(DATA_CENTER_HOST)
.create(V2XEventServiceApi::class.java)
.uploadLineId(lineUploadData)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe ({ data ->
Log.d("emArrow", " uploadLine : $data")
},{
Log.d("emArrow", "e : ${it.message}")
})
}
fun onDestroy() {
mContext = null
disposable?.dispose()
CallerAutoPilotStatusListenerManager.removeListener(TAG)
}
}

View File

@@ -29,7 +29,10 @@ class V2XProvider : IV2XEventProvider {
SpeedLimitDataManager.getInstance().start()
TrafficLightDispatcher.INSTANCE.initServer(context)
SpeedLimitDispatcher.INSTANCE.initLimit(context)
LineUploadManager.getInstance(context)
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
LineUploadManager.getInstance(context)?.init()
}
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
//不处理
@@ -52,9 +55,13 @@ class V2XProvider : IV2XEventProvider {
} else {
V2XEventManager.onDestroy()
}
mContext?.let {
LineUploadManager.getInstance(it)?.onDestroy()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
mContext?.let {
LineUploadManager.getInstance(it)?.onDestroy()
}
}
// RedLightWarningManager.INSTANCE.onDestroy()
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.v2x.road
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.v2x.LineUploadData
import io.reactivex.Observable
import retrofit2.http.*
@@ -11,7 +12,7 @@ interface V2XEventServiceApi {
fun queryAllV2XEventsByLineId(@Query("lineId") lineId: String, @Query("sn") sn: String): Observable<V2XEventResult>
@Headers("Content-type:application/json;charset=UTF-8" )
@POST( "" )
@POST( "/yycp-data-center-service/carTrack/receiveCarTrack/")
fun uploadLineId(@Body lineId: LineUploadData): Observable<BaseData>
}

View File

@@ -45,7 +45,12 @@ interface IMoGoAutopilotStatusListener {
/**
* 工控机主动查询 AdasManager#sendStatusQueryReq(),后会收到如下回调
*/
fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) { }
fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
/**
* 自动驾驶路线ID回调
*/
fun onAutopilotRouteLineId(lineId: Long){}
companion object {
/**

View File

@@ -1,15 +1,18 @@
package com.mogo.eagle.core.function.call.autopilot
import android.util.Log
import androidx.annotation.Nullable
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.GsonUtils
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.properties.Delegates
/**
* @author xiaoyuzhou
@@ -22,6 +25,16 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
@Volatile
private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo()
private var lineId: Long? by Delegates.observable(0) { _, _, newValue ->
if(newValue == null){
return@observable
}
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotRouteLineId(newValue)
}
}
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotStatusListener> =
ConcurrentHashMap()
@@ -209,6 +222,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
*/
fun updateAutopilotControlParameters(autopilotControlParameters: AutopilotControlParameters? = null) {
mAutopilotStatusInfo.autopilotControlParameters = autopilotControlParameters
lineId = autopilotControlParameters?.autoPilotLine?.lineId
invokeAutoPilotStatus(mAutopilotStatusInfo)
}
}

View File

@@ -12,6 +12,7 @@ public class HostConst {
public static final String CAMERA_STREAM_HOST = "http://dzt-smartTransportationAiCloud.zhidaozhixing.com";
public static final String OPEN_CAMERA_STREAM_HOST = "http://10.0.16.6:18080";
public static final String DATA_CENTER_HOST = "http://dzt-data-center.zhidaozhixing.com";
public static final String CITY_HOST = "http://dzt-city.zhidaozhixing.com";
public static final String SOCKET_CENTER_DOMAIN = "socketRegion";

View File

@@ -131,10 +131,8 @@ MOGO_MODULE_V2X_VERSION=2.1.16.10
MOGO_MODULE_OBU_MOGO_VERSION=2.1.16.10
# bugly
CRASHREPORT_VERSION=2.1.16.10
CRASHREPORT_BUGLY_VERSION=2.1.16.10
CRASHREPORT_NOOP_VERSION=2.1.16.10
CRASHREPORT_APMBYTE_VERSION=2.1.16.10
CRASHREPORT_UPGRADE_VERSION=2.1.16.10
## tts
TTS_BASE_VERSION=2.1.16.10
TTS_DI_VERSION=2.1.16.10

View File

@@ -19,7 +19,6 @@
:test:crashreport
:test:crashreport-apm
:test:crashreport-noop
:test:crashreport-upgrade
:core:function-impl:mogo-core-function-obu-mogo
:core:function-impl:mogo-core-function-check
:services:mogo-service

View File

@@ -76,9 +76,7 @@ include ':tts:tts-pad'
// 测试DEBUG
include ':test:crashreport'
//include ':test:crashreport-bugly'
include ':test:crashreport-noop'
include ':test:crashreport-upgrade'
include ':test:crashreport-apmbyte'
//OCH 业务模块

View File

@@ -1 +0,0 @@
/build

View File

@@ -1,67 +0,0 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'com.alibaba.arouter'
}
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
ndk {
// 设置支持的SO库架构
abiFilters 'armeabi' //, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
//ARouter apt 参数
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
api rootProject.ext.dependencies.crashreport
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogocommons
} else {
api project(":test:crashreport")
implementation project(':core:mogo-core-utils')
implementation project(":foudations:mogo-commons")
}
implementation 'com.tencent.bugly:crashreport_upgrade:latest.release'
//其中latest.release指代最新Bugly SDK版本号也可以指定明确的版本号例如2.1.9
implementation 'com.tencent.bugly:nativecrashreport:latest.release'
//其中latest.release指代最新Bugly NDK版本号也可以指定明确的版本号例如3.0
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,3 +0,0 @@
GROUP=com.mogo.test
POM_ARTIFACT_ID=crashreport-bugly
VERSION_CODE=1

View File

@@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -1,5 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.test.crashreport.bugly">
/
</manifest>

View File

@@ -1,76 +0,0 @@
package com.mogo.test.crashreport.bugly;
import android.content.Context;
import android.text.TextUtils;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.utilcode.util.AppUtils;
import com.mogo.test.crashreport.CrashReportConstants;
import com.mogo.test.crashreport.ITestCrashReportProvider;
import com.tencent.bugly.Bugly;
import com.tencent.bugly.crashreport.CrashReport;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
/**
* @author congtaowang
* @since 2020/9/9
*
* 描述
*/
//@Route(path = CrashReportConstants.PATH)
public class BuglyCrashReportProvider implements ITestCrashReportProvider {
private static final String TAG = "BuglyCrashReportProvider";
@Override
public void init(Context context) {
String packageName = context.getPackageName();
String processName = getProcessName(android.os.Process.myPid());
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
strategy.setUploadProcess(processName == null || processName.equals(packageName));
//该用户本次启动后的异常日志用户ID都将是 sn
CrashReport.setUserId(MoGoAiCloudClientConfig.getInstance().getSn());
String productFlavor = DebugConfig.getProductFlavor();
strategy.setAppChannel(productFlavor);
Bugly.init(context, CrashReportConstants.buglyAppID, true, strategy);
Bugly.putUserData(context, "serial", MoGoAiCloudClientConfig.getInstance().getSn());
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
Bugly.putUserData(context, "MAP_SDK_VERSION", mapSDKVersion);
}
/**
* 获取进程号对应的进程名
*
* @param pid 进程号
* @return 进程名
*/
private static String getProcessName(int pid) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader("/proc/" + pid + "/cmdline"));
String processName = reader.readLine();
if (!TextUtils.isEmpty(processName)) {
processName = processName.trim();
}
return processName;
} catch (Throwable throwable) {
throwable.printStackTrace();
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException exception) {
exception.printStackTrace();
}
}
return null;
}
}

View File

@@ -1 +0,0 @@
/build

View File

@@ -1,63 +0,0 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'com.alibaba.arouter'
}
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
ndk {
// 设置支持的SO库架构
abiFilters 'armeabi' //, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
//ARouter apt 参数
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
api rootProject.ext.dependencies.crashreport
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogocommons
} else {
api project(":test:crashreport")
implementation project(':core:mogo-core-utils')
implementation project(":foudations:mogo-commons")
}
implementation 'com.tencent.bugly:crashreport_upgrade:latest.release'
//其中latest.release指代最新版本号也可以指定明确的版本号例如1.2.0
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,3 +0,0 @@
GROUP=com.mogo.test
POM_ARTIFACT_ID=crashreport-upgrade
VERSION_CODE=1

View File

@@ -1,24 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}
-keep class android.support.**{*;}

View File

@@ -1,22 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mogo.test.crashreport.upgrade">
<application>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
tools:replace="android:authorities"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<activity
android:name="com.tencent.bugly.beta.ui.BetaActivity"
android:configChanges="keyboardHidden|orientation|screenSize|locale"
android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>

View File

@@ -1,15 +0,0 @@
package com.mogo.test.crashreport.upgrade;
/**
* @author donghongyu
* @since 2020/9/9
* <p>
* 描述
*/
public class UpgradeReportConstants {
public static final String PATH = "/upgradereport/api";
public static final String NAME = "UpgradeReportApi";
}

View File

@@ -1,78 +0,0 @@
package com.mogo.test.crashreport.upgrade;
import android.content.Context;
import android.text.TextUtils;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.AppUtils;
import com.mogo.test.crashreport.CrashReportConstants;
import com.tencent.bugly.Bugly;
import com.tencent.bugly.crashreport.CrashReport;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
/**
* @author donghongyu
* @since 2020/9/9
* <p>
* 升级模块
*/
@Route(path = UpgradeReportConstants.PATH)
public class UpgradeReportProvider implements IProvider {
private static final String TAG = "UpgradeReportProvider";
@Override
public void init(Context context) {
String packageName = context.getPackageName();
String processName = getProcessName(android.os.Process.myPid());
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
strategy.setUploadProcess(processName == null || processName.equals(packageName));
String productFlavor = DebugConfig.getProductFlavor();
strategy.setAppChannel(productFlavor);
Bugly.init(context, CrashReportConstants.buglyAppID, true, strategy);
String sn = SharedPrefsMgr.getInstance(context).getString("sn");
if (sn != null && !sn.isEmpty()) {
Bugly.putUserData(context, "serial", sn);
}
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
Bugly.putUserData(context, "MAP_SDK_VERSION", mapSDKVersion);
}
/**
* 获取进程号对应的进程名
*
* @param pid 进程号
* @return 进程名
*/
private static String getProcessName(int pid) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader("/proc/" + pid + "/cmdline"));
String processName = reader.readLine();
if (!TextUtils.isEmpty(processName)) {
processName = processName.trim();
}
return processName;
} catch (Throwable throwable) {
throwable.printStackTrace();
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException exception) {
exception.printStackTrace();
}
}
return null;
}
}

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!-- /storage/emulated/0/Download/${applicationId}/.beta/apk-->
<external-path name="beta_external_path" path="Download/"/>
<!--/storage/emulated/0/Android/data/${applicationId}/files/apk/-->
<external-path name="beta_external_files_path" path="Android/data/"/>
</paths>