diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 1f3d18c759..4d4a6ed158 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,21 +4,29 @@ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000..6560a98983 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,36 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index e082ea7475..3b62eef43d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,4 +7,7 @@ + + \ No newline at end of file diff --git a/.idea/qaplug_profiles.xml b/.idea/qaplug_profiles.xml new file mode 100644 index 0000000000..3dfd21f321 --- /dev/null +++ b/.idea/qaplug_profiles.xml @@ -0,0 +1,465 @@ + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index ee51cfe30a..31b58785e9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,6 +27,12 @@ android { } } } + + packagingOptions { + exclude 'META-INF/proguard/coroutines.pro' + exclude 'META-INF/*' + } + signingConfigs { release { keyAlias = 'CarLauncher' @@ -417,6 +423,7 @@ dependencies { if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.mogocommons implementation rootProject.ext.dependencies.modulecommon + implementation rootProject.ext.dependencies.mogobasewebsocketsdk implementation rootProject.ext.dependencies.modulesearch implementation rootProject.ext.dependencies.mogomoduleauth implementation rootProject.ext.dependencies.modulesplash @@ -430,10 +437,12 @@ dependencies { implementation rootProject.ext.dependencies.modulemap } else { implementation project(':foudations:mogo-commons') + implementation project(':foudations:mogo-base-websocket-sdk') implementation project(':modules:mogo-module-common') implementation project(':modules:mogo-module-search') implementation project(':modules:mogo-module-authorize') implementation project(':modules:mogo-module-service') +// implementation project(':modules:mogo-module-obu') implementation project(':modules:mogo-module-splash') implementation project(':modules:mogo-module-service') implementation project(':modules:mogo-module-v2x') @@ -453,6 +462,7 @@ dependencies { apply from: "./functions/crashreport.gradle" apply from: "./functions/widgets.gradle" apply from: "./functions/tts.gradle" + apply from: "./functions/httpdns.gradle" apply from: "./functions/backwidget.gradle" apply from: "./functions/mediaui.gradle" apply from: "./functions/bizguide.gradle" @@ -489,4 +499,3 @@ android.applicationVariants.all { variant -> } apply from: "./regroup.gradle" - diff --git a/app/functions/baseservices.gradle b/app/functions/baseservices.gradle index c085c57a48..064e9b8b87 100644 --- a/app/functions/baseservices.gradle +++ b/app/functions/baseservices.gradle @@ -11,7 +11,6 @@ project.dependencies { d80xImplementation rootProject.ext.dependencies.mogobaseserviceapk em4Implementation rootProject.ext.dependencies.mogobaseserviceapk e8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk - e8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk f8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk f80xImplementation rootProject.ext.dependencies.mogobaseserviceapk em3Implementation rootProject.ext.dependencies.mogobaseserviceapk diff --git a/app/functions/httpdns.gradle b/app/functions/httpdns.gradle new file mode 100644 index 0000000000..ad62f966ef --- /dev/null +++ b/app/functions/httpdns.gradle @@ -0,0 +1,27 @@ +// 基础服务:仅比亚迪渠道用sdk方式实现,其他都基于apk基础服务 + +project.dependencies { + if (Boolean.valueOf(RELEASE)) { + bydautoImplementation rootProject.ext.dependencies.httpdnsnoop + d82xImplementation rootProject.ext.dependencies.httpdnsnoop + em1Implementation rootProject.ext.dependencies.httpdnsnoop + d8xxImplementation rootProject.ext.dependencies.httpdnsnoop + d80xImplementation rootProject.ext.dependencies.httpdnsnoop + em4Implementation rootProject.ext.dependencies.httpdnsnoop + e8xxImplementation rootProject.ext.dependencies.httpdnsnoop + f8xxImplementation rootProject.ext.dependencies.httpdnstencent + f80xImplementation rootProject.ext.dependencies.httpdnstencent + em3Implementation rootProject.ext.dependencies.httpdnsnoop + } else { + bydautoImplementation project(':foudations:httpdns-noop') + d82xImplementation project(':foudations:httpdns-noop') + em1Implementation project(':foudations:httpdns-noop') + d8xxImplementation project(':foudations:httpdns-noop') + d80xImplementation project(':foudations:httpdns-noop') + em4Implementation project(':foudations:httpdns-noop') + e8xxImplementation project(':foudations:httpdns-noop') + f8xxImplementation project(':foudations:httpdns-tencent') + f80xImplementation project(':foudations:httpdns-tencent') + em3Implementation project(':foudations:httpdns-noop') + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dd500f64d8..bb9630b495 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_shell_name" + android:largeHeap="true" android:supportsRtl="true" android:theme="@style/AppTheme.App" android:resizeableActivity="false" diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index 8aa657a92e..46338739f7 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -1,5 +1,6 @@ package com.mogo.launcher; +import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.os.Process; @@ -22,6 +23,7 @@ import com.mogo.module.push.base.PushUIConstants; import com.mogo.module.service.ServiceConst; import com.mogo.module.share.constant.ShareConstants; import com.mogo.module.v2x.V2XConst; +import com.mogo.module.v2x.utils.ObuConfig; import com.mogo.service.IMogoServiceApis; import com.mogo.service.MogoServicePaths; import com.mogo.service.passport.IMogoTicketCallback; @@ -34,6 +36,11 @@ import com.squareup.leakcanary.LeakCanary; import com.zhidao.boot.persistent.lib.PersistentManager; import com.zhidao.mogo.module.left.panel.LeftPanelConst; +import java.util.List; + +import static com.mogo.module.guide.GuideConstant.PATH_GUIDE_FRAGMENT; +import static com.mogo.module.guide.GuideConstant.PATH_GUIDE_MODULE_NAME; + /** * @author congtaowang * @since 2019-12-18 @@ -88,6 +95,9 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GAODE_AIMLESS_SHARE, "GaoDeAimlessShare" ) ); MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor" ) ); MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) ); +// 碰撞报警模块 + MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_CRASH_WARNING, "CrashWarning" ) ); +// MogoModulePaths.addModule( new MogoModule( IMogoMachineVisionProvider.path, "IMogoMachineVisionProvider" ) ); MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake" ) ); @@ -119,6 +129,8 @@ public class MogoApplication extends AbsMogoApplication { DebugConfig.setUseCustomNavi( BuildConfig.USE_CUSTOM_NAVI ); DebugConfig.setLauncher( BuildConfig.IS_LAUNCHER ); DebugConfig.setActiveAIAssistFlag( BuildConfig.AI_ASSIST_ACTIVE_STAUTS ); + DebugConfig.setUseMockObuData( false ); + ObuConfig.useObuLocation = false; DebugConfig.setCarMachineType( BuildConfig.CAR_MACHINE_TYPE ); DebugConfig.setProductFlavor( BuildConfig.FLAVOR_product ); DebugConfig.setSocketAppId( BuildConfig.SOCKET_APP_ID ); @@ -130,6 +142,7 @@ public class MogoApplication extends AbsMogoApplication { DebugConfig.setMapBased( BuildConfig.IS_MAP_BASED ); DebugConfig.setNeedLoadGuideModule( BuildConfig.IS_NEED_LOAD_GUIDE_MODULE ); DebugConfig.setNeedHideAdasWhenShare( BuildConfig.IS_NEED_HIDE_ADAS_WHEN_SHARE ); +// DebugConfig.setObuType( BuildConfig.OBU_TYPE ); } @Override @@ -191,6 +204,7 @@ public class MogoApplication extends AbsMogoApplication { apis.getLocationInfoApi().provideLocation( location ); } ); } + apis.getWebSocketManagerApi( getApplicationContext() ).init( getApplicationContext(), DebugConfig.getSocketAppId() ); } @Override diff --git a/app2/.gitignore b/app2/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/app2/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app2/build.gradle b/app2/build.gradle new file mode 100644 index 0000000000..5a43bc9ed1 --- /dev/null +++ b/app2/build.gradle @@ -0,0 +1,71 @@ +apply plugin: 'com.android.application' +apply plugin: 'com.alibaba.arouter' + +android { + compileSdkVersion 29 + + defaultConfig { + applicationId "com.freedom.app2" + minSdkVersion 19 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + + javaCompileOptions { + annotationProcessorOptions { + arguments = [AROUTER_MODULE_NAME: project.getName()] + } + } + + multiDexEnabled true + externalNativeBuild { + ndk { + // 设置支持的SO库架构 + abiFilters "armeabi-v7a" + } + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } + + packagingOptions { + exclude 'META-INF/proguard/coroutines.pro' + exclude 'META-INF/*' + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + + implementation rootProject.ext.dependencies.rxjava + implementation rootProject.ext.dependencies.rxandroid + + implementation rootProject.ext.dependencies.boostmultidex + + implementation rootProject.ext.dependencies.arouter + annotationProcessor rootProject.ext.dependencies.aroutercompiler + implementation project(":foudations:mogo-utils") + implementation project(":foudations:mogo-commons") + implementation project(":foudations:httpdns-base") + implementation project(":foudations:httpdns-tencent") + implementation project(":modules:mogo-module-common") + implementation project(':services:mogo-service-api') + implementation project(':services:mogo-service') +} diff --git a/app2/proguard-rules.pro b/app2/proguard-rules.pro new file mode 100644 index 0000000000..481bb43481 --- /dev/null +++ b/app2/proguard-rules.pro @@ -0,0 +1,21 @@ +# 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 \ No newline at end of file diff --git a/app2/src/androidTest/java/com/freedom/app2/ExampleInstrumentedTest.java b/app2/src/androidTest/java/com/freedom/app2/ExampleInstrumentedTest.java new file mode 100644 index 0000000000..ee51d5676d --- /dev/null +++ b/app2/src/androidTest/java/com/freedom/app2/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.freedom.app2; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith( AndroidJUnit4.class ) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals( "com.freedom.app2", appContext.getPackageName() ); + } +} \ No newline at end of file diff --git a/app2/src/main/AndroidManifest.xml b/app2/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..b4d4fa4da4 --- /dev/null +++ b/app2/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app2/src/main/java/com/freedom/app2/ApiServices.java b/app2/src/main/java/com/freedom/app2/ApiServices.java new file mode 100644 index 0000000000..557db4f13f --- /dev/null +++ b/app2/src/main/java/com/freedom/app2/ApiServices.java @@ -0,0 +1,17 @@ +package com.freedom.app2; + +import io.reactivex.Observable; +import retrofit2.http.GET; + +public +/** + * @author congtaowang + * @since 2020/11/18 + * + * 描述 + */ +interface ApiServices { + + @GET( "/test/test" ) + Observable< ResponseBody > requestHttpDns(); +} diff --git a/app2/src/main/java/com/freedom/app2/DemoApplication.java b/app2/src/main/java/com/freedom/app2/DemoApplication.java new file mode 100644 index 0000000000..0ee8970b10 --- /dev/null +++ b/app2/src/main/java/com/freedom/app2/DemoApplication.java @@ -0,0 +1,30 @@ +package com.freedom.app2; + +import android.content.Context; + +import com.bytedance.boost_multidex.BoostMultiDex; +import com.mogo.commons.AbsMogoApplication; +import com.mogo.commons.debug.DebugConfig; + +public +/** + * @author congtaowang + * @since 2020/11/18 + * + * 描述 + */ +class DemoApplication extends AbsMogoApplication { + + + @Override + public void onCreate() { + DebugConfig.setDebug( true ); + super.onCreate(); + } + + @Override + protected void attachBaseContext( Context base ) { + super.attachBaseContext( base ); + BoostMultiDex.install( base ); + } +} diff --git a/app2/src/main/java/com/freedom/app2/MainActivity.java b/app2/src/main/java/com/freedom/app2/MainActivity.java new file mode 100644 index 0000000000..0edc964aba --- /dev/null +++ b/app2/src/main/java/com/freedom/app2/MainActivity.java @@ -0,0 +1,129 @@ +package com.freedom.app2; + +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.commons.network.SubscribeImpl; +import com.mogo.httpdns.IHttpDnsCallback; +import com.mogo.httpdns.IMogoHttpDns; +import com.mogo.httpdns.MogoHttpDnsHandler; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.WorkThreadHandler; +import com.mogo.utils.network.RequestOptions; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + +public class MainActivity extends AppCompatActivity { + + private ApiServices apiServices; + private IMogoHttpDns httpDns; + + private View send; + private View fresh; + private View fresh2; + private TextView content; + + @Override + protected void onCreate( Bundle savedInstanceState ) { + super.onCreate( savedInstanceState ); + setContentView( R.layout.activity_main ); + + send = findViewById( R.id.send ); + fresh = findViewById( R.id.fresh ); + fresh2 = findViewById( R.id.fresh2 ); + content = findViewById( R.id.content ); + + httpDns = MogoHttpDnsHandler.getHttpDnsApi(); + apiServices = MogoApisHandler.getInstance().getApis().getNetworkApi().create( ApiServices.class, "https://dnstest.zhidaozhixing.com" ); + + send.setOnClickListener( new View.OnClickListener() { + @Override + public void onClick( View v ) { + apiServices.requestHttpDns() + .observeOn( AndroidSchedulers.mainThread() ) + .subscribeOn( Schedulers.io() ) + .subscribe( new SubscribeImpl< ResponseBody >( RequestOptions.create( MainActivity.this ).loading( true ) ) { + @Override + public void onSuccess( ResponseBody o ) { + super.onSuccess( o ); + try { + renderResponse( o ); + } catch ( Exception e ) { + content.setText( Log.getStackTraceString( e ) ); + } + } + + @Override + public void onError( Throwable e ) { + super.onError( e ); + content.setText( Log.getStackTraceString( e ) ); + } + } ); + } + } ); + + fresh.setOnClickListener( new View.OnClickListener() { + @Override + public void onClick( View v ) { + WorkThreadHandler.getInstance().post( new Runnable() { + @Override + public void run() { + httpDns.getHttpDnsIp( "dnstest.zhidaozhixing.com", false, new IHttpDnsCallback() { + @Override + public void onParsed( @Nullable String ip ) { + StringBuilder sb = new StringBuilder( "httpDns ip:\n" ); + sb.append( ip ).append( "\n" ); + UiThreadHandler.post( new Runnable() { + @Override + public void run() { + content.setText( sb.toString() ); + } + } ); + } + } ); + } + } ); + } + } ); + + fresh2.setOnClickListener( new View.OnClickListener() { + @Override + public void onClick( View v ) { + WorkThreadHandler.getInstance().post( new Runnable() { + @Override + public void run() { + httpDns.getHttpDnsIp( "dzt-city.zhidaozhixing.com", false, new IHttpDnsCallback() { + @Override + public void onParsed( @Nullable String ip ) { + StringBuilder sb = new StringBuilder( "httpDns ip:\n" ); + sb.append( ip ).append( "\n" ); + UiThreadHandler.post( new Runnable() { + @Override + public void run() { + content.setText( sb.toString() ); + } + } ); + } + } ); + } + } ); + } + } ); + } + + private void renderResponse( ResponseBody body ) { + StringBuilder sb = new StringBuilder( "httpDns ip:\n" ); + String ip = httpDns.getCachedHttpDnsIps( "dnstest.zhidaozhixing.com" ); + sb.append( ip ).append( "\n" ); + sb.append( "\nserverIp: \n" ).append( body.result.serverIp ).append( "\n" ); + content.setText( sb.toString() ); + } +} diff --git a/app2/src/main/java/com/freedom/app2/ResponseBody.java b/app2/src/main/java/com/freedom/app2/ResponseBody.java new file mode 100644 index 0000000000..4123379623 --- /dev/null +++ b/app2/src/main/java/com/freedom/app2/ResponseBody.java @@ -0,0 +1,19 @@ +package com.freedom.app2; + +import com.mogo.commons.data.BaseData; + +public +/** + * @author congtaowang + * @since 2020/11/18 + * + * 描述 + */ +class ResponseBody extends BaseData { + + public Result result; + + public static class Result { + public String serverIp; + } +} diff --git a/app2/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app2/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000..2b068d1146 --- /dev/null +++ b/app2/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app2/src/main/res/drawable/ic_launcher_background.xml b/app2/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000..07d5da9cbf --- /dev/null +++ b/app2/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app2/src/main/res/layout/activity_main.xml b/app2/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000..7bb6c7cfed --- /dev/null +++ b/app2/src/main/res/layout/activity_main.xml @@ -0,0 +1,46 @@ + + + + + +