[2.13.0-arch-opt] mofang view and status bar opt , pnvView add catch in enum

This commit is contained in:
zhongchao
2023-02-09 18:40:26 +08:00
parent fd2a92f8eb
commit 78849ef5d7
42 changed files with 70 additions and 516 deletions

View File

@@ -52,7 +52,6 @@ dependencies {
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation rootProject.ext.dependencies.amapsearch
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")

View File

@@ -23,9 +23,8 @@ ext {
// amapnavi3dmap : "com.amap.api:navi-3dmap:8.0.1_3dmap8.0.1",
// amapsearch : "com.amap.api:search:7.9.0",
// amaplocation : "com.amap.api:location:5.5.0",
amapnavi3dmap : "com.amap.api:navi-3dmap:9.5.1_3dmap9.5.0",
amapsearch : "com.amap.api:search:9.5.0",
amaplocation : "com.amap.api:location:6.2.0",
amapnavi3dmap : "com.amap.api:navi-3dmap:9.6.0_3dmap9.6.0",
// json 转换
gson : "com.google.code.gson:gson:2.8.4",
// 内存泄漏检测
@@ -136,10 +135,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

@@ -8,7 +8,7 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import com.mogo.eagle.core.data.mofang.MfConstants
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.updateMfStatusView
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager.invokeMoFangStatus
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_F
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
@@ -96,7 +96,7 @@ class MoFangManager private constructor() {
BluetoothDevice.ACTION_ACL_CONNECTED -> { //蓝牙设备已连接
if (!isMfConnect) {
// showBondedDevice(mBluetoothAdapter)
updateMfStatusView(TAG, true)
invokeMoFangStatus(true)
isMfConnect = true
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean(MfConstants.BLUETOOTH_STATUS, true) }
}
@@ -106,7 +106,7 @@ class MoFangManager private constructor() {
BluetoothDevice.ACTION_ACL_DISCONNECTED -> { //蓝牙设备已断开 主动更新
CallerLogger.d("$M_F${TAG}","bluetoothMonitorReceiver ACTION_ACL_DISCONNECTED ----- isMfConnect = $isMfConnect ")
if (isMfConnect) {
updateMfStatusView(TAG, false)
invokeMoFangStatus(false)
isMfConnect = false
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean(MfConstants.BLUETOOTH_STATUS, false) }
}

View File

@@ -80,18 +80,17 @@ dependencies {
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
compileOnly rootProject.ext.dependencies.mogocommons
compileOnly rootProject.ext.dependencies.mogo_core_res
api rootProject.ext.dependencies.mogo_core_res
compileOnly rootProject.ext.dependencies.mogo_core_utils
compileOnly rootProject.ext.dependencies.mogo_core_function_datacenter
compileOnly rootProject.ext.dependencies.mogo_core_function_call
compileOnly project(':libraries:mogo-adas')
} else {
api project(':test:crashreport-upgrade')
api project(':test:crashreport-apmbyte')
compileOnly project(':core:function-impl:mogo-core-function-datacenter')
compileOnly project(':foudations:mogo-commons')
compileOnly project(':core:mogo-core-res')
api project(':core:mogo-core-res')
compileOnly project(':core:mogo-core-utils')
compileOnly project(':core:mogo-core-function-call')
compileOnly project(':libraries:mogo-adas')

View File

@@ -87,10 +87,6 @@ class MoGoHmiProvider : IMoGoHmiProvider {
)
}
override fun updateMfStatus(tag: String, status: Boolean) {
CallerHmiViewControlListenerManager.updateMfStatus(StatusBarView.TAG, tag, status)
}
/**
* 不展示顶部弹窗,其它保留
*/

View File

@@ -77,8 +77,11 @@ class PncActionsView @JvmOverloads constructor(
UiThreadHandler.post {
var actions: String? = null
planningActionMsg.actionMsg?.let { it ->
try {
actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number)
} catch (e:Exception){
e.printStackTrace()
}
//如果是存在云端红绿灯数据条件下,设置云端数据
if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number)
&& mTrafficLightResult != null

View File

@@ -4,7 +4,13 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.RelativeLayout
import com.mogo.eagle.core.data.mofang.MfConstants
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import kotlinx.android.synthetic.main.view_blue_tooth.view.*
import kotlinx.android.synthetic.main.view_status_bar.view.*
/**
* 魔戒蓝牙控件
@@ -14,10 +20,38 @@ class BlueToothView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RelativeLayout(context, attrs, defStyleAttr) {
) : RelativeLayout(context, attrs, defStyleAttr),IMoGoDevaToolsListener {
companion object{
private const val TAG = "BlueToothView"
}
init {
LayoutInflater.from(context).inflate(R.layout.view_blue_tooth, this, true)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val isBluetoothConnect =
SharedPrefsMgr.getInstance(context).getBoolean(MfConstants.BLUETOOTH_STATUS, false)
if (isBluetoothConnect) {
mofangStatus(true)
}
CallerDevaToolsListenerManager.addListener(TAG, this)
}
override fun mofangStatus(status: Boolean) {
super.mofangStatus(status)
if (status) {
mofangView.setImageResource(R.drawable.icon_bluetooth_p)
} else {
mofangView.setImageResource(R.drawable.blue_tooth)
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerDevaToolsListenerManager.removeListener(TAG)
}
}

View File

@@ -7,14 +7,12 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.LinearLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.mofang.MfConstants
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import kotlinx.android.synthetic.main.view_status_bar.view.*
import java.util.concurrent.CopyOnWriteArrayList
@@ -39,11 +37,6 @@ class StatusBarView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
viewStatusBarRight.addView(BatteryGroupView(this.context))
val isBluetoothConnect =
SharedPrefsMgr.getInstance(context).getBoolean(MfConstants.BLUETOOTH_STATUS, false)
if (isBluetoothConnect) {
updateMfStatus("MoFangManager", true)
}
//添加view控制
CallerHmiViewControlListenerManager.addListener(TAG,this)
@@ -106,14 +99,6 @@ class StatusBarView @JvmOverloads constructor(
}
}
override fun updateMfStatus(tag: String, status: Boolean) {
if (status) {
viewMofangStatus.setImageResource(R.drawable.icon_bluetooth_p)
} else {
viewMofangStatus.setImageResource(R.drawable.blue_tooth)
}
}
private fun setTextColor(color: Int) {
viewTextClock.setTextColor(color)
viewStatusBarTag.setTextColor(color)

View File

@@ -104,7 +104,7 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
decorView.clipToPadding = false
var statusBarView = decorView.findViewWithTag<View>("status_bar")
if (statusBarView == null) {
statusBarView = StatusBarView(this)
statusBarView = statusBar
statusBarView.setTag("status_bar")
}
val statusBarLP = FrameLayout.LayoutParams(
@@ -117,10 +117,10 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
}
/**
* 修改statusBar 重写实现,需要继承 StatusBarViewxml中基础系统控件不要修改其id拿来即用
* 修改statusBar重新赋值
* @return StatusBarView
*/
protected val statusBarView: StatusBarView
protected val statusBar: View
get() = StatusBarView(this)
override fun onCreate(savedInstanceState: Bundle?) {
@@ -353,30 +353,4 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
}
}
/**
* 由于应用是单页面的所以采用Fragment将各模块的UI进行分割解耦合
*
* @param newFragment 功能UI
* @param tagName UI绑定的Tag
* @param containerId 要加入的资源ID
*/
private fun addFragment(newFragment: Fragment, tagName: String, containerId: Int) {
var fragment = supportFragmentManager.findFragmentByTag(tagName)
if (fragment == null) {
fragment = newFragment
}
if (fragment == null) {
e(
SceneConstant.M_HMI + TAG,
"add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(
applicationContext, containerId
)
)
return
}
supportFragmentManager.beginTransaction()
.replace(containerId, fragment, tagName)
.commitAllowingStateLoss()
}
}

View File

@@ -55,14 +55,11 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
return;
}
start = System.currentTimeMillis();
connectAmiIp();
// Crash 日志收集
initCrashConfig();
initLogConfig();
initTipToast();
initModules();
//查询是否有版本的更新
queryAppUpgrade();
if (ProcessUtils.isMainProcess(this)) {
initOverviewDb();
if (DebugConfig.isDebug()) {
@@ -80,15 +77,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
return true;
}
private void queryAppUpgrade() {
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
CallerDevaToolsManager.INSTANCE.queryAppUpgrade();
}
},9000);
}
@SuppressLint("SimpleDateFormat")
private void clearMessageBoxTable() {
new Thread(() -> {
@@ -197,14 +185,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
CallerFuncBizManager.getBizProvider().initOverViewDb(this);
}
/**
* 连接ami
*/
private void connectAmiIp() {
String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199");
// AmiClientManager.getInstance().setObuIp(ipAddress);
}
private void initModules() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "initModules");
// OBU 模块

View File

@@ -5,10 +5,11 @@
android:layout_height="@dimen/dp_54">
<ImageView
android:scaleType="fitXY"
android:src="@drawable/blue_tooth"
android:id="@+id/mofangView"
android:layout_width="@dimen/dp_54"
android:layout_height="@dimen/dp_54"
android:scaleType="fitXY"
android:src="@drawable/blue_tooth"
tools:ignore="ContentDescription" />
</RelativeLayout>

View File

@@ -29,6 +29,7 @@
android:textColor="@color/color_2C2E30"
android:textSize="@dimen/dp_35" />
<!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:layout_width="@dimen/dp_54"
android:layout_height="@dimen/dp_54"
@@ -36,8 +37,7 @@
android:layout_marginStart="@dimen/dp_18" />
<!--魔方连接状态-->
<ImageView
android:id="@+id/viewMofangStatus"
<com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/blue_tooth"

View File

@@ -114,7 +114,6 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
// 设置是否是直播推流的主播
clientConfig.isAnchor = true
when (DebugConfig.getCarMachineType()) {
DebugConfig.CAR_MACHINE_TYPE_BYD -> clientConfig.thirdPartyAppKey = "bydauto"
DebugConfig.CAR_MACHINE_TYPE_LENOVO -> clientConfig.thirdPartyAppKey = "pfieouqg"
else -> clientConfig.thirdPartyAppKey = "wbvpzgar"
}
@@ -133,8 +132,6 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
} else {
clientConfig.thirdPartyDeviceId = Utils.getDevicesId()
}
// 设置循环检测间隔时间每隔2小时loop一次httpDnsConfig
clientConfig.loopCheckDelay = (60 * 60 * 2 * 1000).toLong()
//设置长链接的secretKey //todo 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ"

View File

@@ -51,4 +51,8 @@ interface IMoGoDevaToolsListener {
}
fun mofangStatus(status:Boolean){
}
}

View File

@@ -36,9 +36,4 @@ interface IViewControlListener {
*/
fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int){}
/**
* 更新魔方的连接状态
*/
fun updateMfStatus(tag: String, status: Boolean){}
}

View File

@@ -136,9 +136,5 @@ interface IMoGoHmiProvider :IProvider{
*/
fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int)
/**
* 更新魔方的连接状态
*/
fun updateMfStatus(tag: String, status: Boolean)
}

View File

@@ -55,4 +55,11 @@ object CallerDevaToolsListenerManager : CallerBase<IMoGoDevaToolsListener>() {
}
}
fun invokeMoFangStatus(status:Boolean){
M_LISTENERS.forEach {
val listener = it.value
listener.mofangStatus(status)
}
}
}

View File

@@ -212,11 +212,4 @@ object CallerHmiManager {
hmiProviderApi?.updateStatusBarDownloadView(insert, tag, progress)
}
/**
* 更新魔方的链接状态
*/
fun updateMfStatusView(tag: String, status: Boolean) {
hmiProviderApi?.updateMfStatus(tag, status)
}
}

View File

@@ -45,8 +45,4 @@ object CallerHmiViewControlListenerManager : CallerBase<IViewControlListener>()
M_LISTENERS[tag]?.updateStatusBarDownloadView(insert, tag, progress)
}
fun updateMfStatus(tag: String, viewTag: String, status: Boolean) {
M_LISTENERS[tag]?.updateMfStatus(viewTag, status)
}
}

View File

@@ -243,6 +243,7 @@ object CallerVisualAngleManager {
PriorityQueue<Record>()
}
@Volatile
private var mLevel:Boolean = false
fun updateLongSightLevel(level:Boolean){

View File

@@ -43,9 +43,7 @@ public abstract class AbsMogoApplication extends Application {
AppStateManager.INSTANCE.init(this);
initRxJavaErrorHandler();
FinalizeCrashFixer.fix();
// if (!shouldInit()) {
AutoSize.checkAndInit(this);
// }
ScreenHelper.setScreenConfig(this);
Utils.init(this);
@@ -71,8 +69,7 @@ public abstract class AbsMogoApplication extends Application {
return null;
}
try {
View contentView = generateToastView(context, message, tipDrawable);
return contentView;
return generateToastView(context, message, tipDrawable);
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -8,7 +8,6 @@ import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.text.TextUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentHandlerFactory;
import com.mogo.commons.module.intent.IntentManager;
@@ -18,7 +17,6 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.config.CloudPoiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.realtime.api.MoGoAiCloudRealTime;
import java.util.List;
@@ -57,10 +55,6 @@ public class MogoServices implements IMogoIntentListener {
Intent intent = new Intent("com.freedom.ser.ACTION");
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
mContext.sendBroadcast(intent);
// if (DebugConfig.isNeedUploadCoordinatesDurationInTime()) {
// MoGoAiCloudRealTime.startRealTime(mContext, DebugConfig.getSocketAppId());
// }
}
private void registerMogoReceiver(Context context) {
@@ -105,9 +99,6 @@ public class MogoServices implements IMogoIntentListener {
public void destroy() {
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "MogoServices do nothings.");
// if (DebugConfig.isNeedUploadCoordinatesDurationInTime()) {
// MoGoAiCloudRealTime.stopRealTime();
// }
}
}

View File

@@ -85,7 +85,7 @@ MOGO_LOCATION_VERSION=1.4.3.32-beta3
MOGO_TELEMATIC_VERSION=1.4.3.32-beta2
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=2.10.0.2
MAP_SDK_VERSION=2.10.0.2_test_03
MAP_SDK_OPERATION_VERSION=1.1.4.1
# websocket
WEBSOCKET_VERSION=1.1.7
@@ -119,10 +119,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

@@ -139,7 +139,7 @@ public class AMapWrapper implements IMogoMap {
}
});
long time = markerOptionsArrayList.get(0).getTime();
//todo 最后一个参数,是否管理锚点的删除
// 最后一个参数,是否管理锚点的删除
MarkerHelper.INSTANCE.updateBatchMarkerPositon(markerOptionsArrayList, false, FunctionBuildConfig.isBeautyMode ? 8.0f : 0f, 1, time, 0);
}

View File

@@ -17,7 +17,6 @@
:test:crashreport
:test:crashreport-apm
:test:crashreport-noop
:test:crashreport-upgrade
:core:function-impl:mogo-core-function-datacenter
:core:function-impl:mogo-core-function-hmi
:core:function-impl:mogo-core-function-map

View File

@@ -55,9 +55,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:1.6.1'
//其中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:1.6.1'
//其中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 = DebugConfig.getMapVersion();
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>