合并分支
This commit is contained in:
@@ -484,6 +484,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.moduleextensions
|
||||
implementation rootProject.ext.dependencies.modulemap
|
||||
implementation rootProject.ext.dependencies.moduleSmallMap
|
||||
implementation rootProject.ext.dependencies.httpdnsnoop
|
||||
} else {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':foudations:mogo-base-websocket-sdk')
|
||||
@@ -501,6 +502,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-extensions')
|
||||
implementation project(':modules:mogo-module-map')
|
||||
implementation project(':modules:mogo-module-smp')
|
||||
implementation project(':foudations:httpdns-noop')
|
||||
}
|
||||
|
||||
apply from: "./functions/basedmap.gradle"
|
||||
@@ -513,7 +515,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/httpdns.gradle"
|
||||
apply from: "./functions/backwidget.gradle"
|
||||
apply from: "./functions/mediaui.gradle"
|
||||
apply from: "./functions/bizguide.gradle"
|
||||
|
||||
@@ -26,13 +26,13 @@ class HttpDnsNoop implements IMogoHttpDns {
|
||||
|
||||
@Override
|
||||
public String getCachedHttpDnsIps( String host,int type ) {
|
||||
return null;
|
||||
return host;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getHttpDnsIp( String host,int type, boolean useCache, IHttpDnsCallback callback ) {
|
||||
if ( callback != null ) {
|
||||
callback.onParsed( null );
|
||||
callback.onParsed( host );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
@Keep
|
||||
public class WebSocketConstant {
|
||||
|
||||
private static final String HOST_DEV = "ws://62.234.196.121";
|
||||
private static final String HOST_QA = "ws://62.234.196.121";
|
||||
private static final String HOST_DEMO = "ws://62.234.196.121";
|
||||
private static final String HOST_DEV = "ws://119.45.249.167";
|
||||
private static final String HOST_QA = "ws://119.45.249.167";
|
||||
private static final String HOST_DEMO = "ws://119.45.249.167";
|
||||
@Keep
|
||||
private static final String HOST_RELEASE = "ws://62.234.196.121";
|
||||
private static final String HOST_RELEASE = "ws://119.45.249.167";
|
||||
// private static final String PORT = ":14001/ws";
|
||||
@Keep
|
||||
public static final String PATH = "/ws";
|
||||
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.5.5'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.7.4'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1'
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
@@ -70,7 +71,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private IMogoMap mIMap;
|
||||
|
||||
private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
private EnumMapUI mCurrentUIMode;
|
||||
private EnumMapUI mCurrentCarUIMode;
|
||||
|
||||
private boolean mIsCarLocked = false;
|
||||
private int mLockZoom = 16;
|
||||
@@ -86,6 +87,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private Location mLastDriveLocationShadow = null;
|
||||
private EnumMapUI mCurrentUI;
|
||||
private boolean mIsLightStyle = false;
|
||||
private boolean mMapLoaded = false;
|
||||
private boolean mIsFirstLocated = true;
|
||||
private boolean mIsDelayed = false;
|
||||
|
||||
public AMapViewWrapper( MapAutoView mMapView ) {
|
||||
startTime = System.currentTimeMillis();
|
||||
@@ -217,8 +221,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onCreate( bundle );
|
||||
Logger.d( TAG, "map onCreate" );
|
||||
initMapView();
|
||||
initMyLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +244,12 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
public void onDestroy() {
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onDestroy();
|
||||
mMapView.setOnMarkClickListener( null );
|
||||
mMapView.setOnMapLoadedListener( null );
|
||||
mMapView.setOnMapTouchListener( null );
|
||||
mMapView.setOnMapClickListener( null );
|
||||
mMapView.getLocationClient().unRegisterListener( this );
|
||||
mMapView.setMOnCameraChangeListener( null );
|
||||
Logger.d( TAG, "map onDestroy" );
|
||||
}
|
||||
}
|
||||
@@ -298,13 +306,13 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom( float zoom ) {
|
||||
if ( mCurrentUI == EnumMapUI.Type_VR ) {
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
Logger.d( TAG, "changeZoom %s", zoom );
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
if ( mCurrentUI == EnumMapUI.Type_VR ) {
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
getMap().changeZoom( zoom );
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
@@ -314,7 +322,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if ( ui == null ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "ui = %s", ui );
|
||||
Logger.d( TAG, "设置的样式 = %s", ui );
|
||||
if ( checkAMapView() ) {
|
||||
switch ( ui ) {
|
||||
case CarUp_2D:
|
||||
@@ -345,11 +353,11 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void moveToCenter( MogoLatLng latLng ) {
|
||||
|
||||
moveToCenter( latLng, true );
|
||||
}
|
||||
|
||||
private void setUIMode( EnumMapUI ui ) {
|
||||
this.mCurrentUIMode = ui;
|
||||
this.mCurrentCarUIMode = ui;
|
||||
if ( mMapView.getMapAutoViewHelper() != null ) {
|
||||
switch ( ui ) {
|
||||
case CarUp_2D:
|
||||
@@ -357,6 +365,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_UP_CAR );
|
||||
break;
|
||||
case NorthUP_2D:
|
||||
if ( mCurrentUI == EnumMapUI.Type_VR ) {
|
||||
return;
|
||||
}
|
||||
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_UP_NORTH );
|
||||
break;
|
||||
}
|
||||
@@ -440,6 +451,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
if ( mCurrentUI == EnumMapUI.Type_VR ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "锁车" );
|
||||
// mMapView.getMapAutoViewHelper().setZoom(mLockZoom);
|
||||
mMapView.getMapAutoViewHelper().setLockMode( true );
|
||||
@@ -614,7 +628,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
return mCurrentUIMode;
|
||||
return mCurrentCarUIMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -698,8 +712,22 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
|
||||
if ( checkAMapView() ) {
|
||||
MapStyleController.getInstance().onLocationChanged( location, this );
|
||||
if ( checkAMapView() && mMapLoaded ) {
|
||||
// 地图初始化完成后,每隔5s自动判断当前地图的模式
|
||||
if ( mIsFirstLocated ) {
|
||||
if ( !mIsDelayed ) {
|
||||
mIsDelayed = true;
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
Logger.d( TAG, "倒计时结束" );
|
||||
mIsFirstLocated = false;
|
||||
}, 5_000L );
|
||||
}
|
||||
} else {
|
||||
mIsFirstLocated = true;
|
||||
mIsDelayed = false;
|
||||
Logger.d( TAG, "同步定位" );
|
||||
MapStyleController.getInstance().onLocationChanged( location, this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,6 +743,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
public void onMapLoaded() {
|
||||
Logger.i( TAG, "autoop--onMapLoaded: " );
|
||||
MogoMapListenerHandler.getInstance().onMapLoaded();
|
||||
mMapLoaded = true;
|
||||
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
|
||||
if ( cameraPosition != null ) {
|
||||
Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
@@ -724,9 +753,8 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
cameraPosition.getBearing() );
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
getMap().getUIController().setAnchorRate( 0.01f );
|
||||
getMap().getUIController().setAnchorScale( 1.2f, 2.7f );
|
||||
initMapView();
|
||||
initMyLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -747,17 +775,17 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void onMapStatusChanged( int type, int value ) {
|
||||
Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
|
||||
// Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange( int type, int value ) {
|
||||
Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
|
||||
// Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChangeFinish( @Nullable CameraPosition cameraPosition ) {
|
||||
Logger.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) );
|
||||
// Logger.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) );
|
||||
if ( cameraPosition != null ) {
|
||||
Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
MogoMapListenerHandler.getInstance().onMapChanged( ObjectUtils.fromAMap( cameraPosition.getTarget() ),
|
||||
@@ -783,10 +811,14 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
}
|
||||
|
||||
//目前切换完vr之后,会立即回调其他样式,这里做一个判断
|
||||
// private boolean mVrModeAutoChangedFlag = false;
|
||||
|
||||
@Override
|
||||
public void onChangeMapStyle( int i ) {
|
||||
|
||||
EnumMapUI last = mCurrentUI;
|
||||
Logger.d( TAG, "currentMapStyle = %s", i );
|
||||
|
||||
if ( i == MapAutoApi.MAP_STYLE_DAY
|
||||
|| i == MapAutoApi.MAP_STYLE_DAY_NAV ) {
|
||||
@@ -796,10 +828,16 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mCurrentUI = EnumMapUI.Type_Night;
|
||||
} else if ( i == MapAutoApi.MAP_STYLE_VR ) {
|
||||
mCurrentUI = EnumMapUI.Type_VR;
|
||||
} else if ( i == MapAutoApi.MAP_PERSPECTIVE_2D ) {
|
||||
mCurrentUI = EnumMapUI.CarUp_2D;
|
||||
} else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
|
||||
mCurrentUI = EnumMapUI.CarUp_3D;
|
||||
}
|
||||
// else if ( i == MapAutoApi.MAP_PERSPECTIVE_2D ) {
|
||||
// mCurrentUI = EnumMapUI.CarUp_2D;
|
||||
// } else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
|
||||
// mCurrentUI = EnumMapUI.CarUp_3D;
|
||||
// }
|
||||
|
||||
if ( last == mCurrentUI ) {
|
||||
Logger.d( TAG, "currentUI is same as last = %s", mCurrentUI );
|
||||
return;
|
||||
}
|
||||
|
||||
// vr 模式切换到普通模式下,保持之前的白天模式 wtf.
|
||||
@@ -808,7 +846,12 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
changeMapMode( EnumMapUI.Type_Light );
|
||||
return;
|
||||
}
|
||||
// if ( mVrModeAutoChangedFlag ) {
|
||||
// mVrModeAutoChangedFlag = false;
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
if ( mCurrentUI != null ) {
|
||||
UiThreadHandler.post( () -> {
|
||||
try {
|
||||
@@ -830,20 +873,32 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
public void onStyleAutoChanged( boolean isVrMode ) {
|
||||
if ( isVrMode ) {
|
||||
if ( mCurrentUI != EnumMapUI.Type_VR ) {
|
||||
changeZoom( 20 );
|
||||
changeMapMode( EnumMapUI.Type_VR );
|
||||
Logger.d( TAG, "自动切换为vr模式" );
|
||||
// mVrModeAutoChangedFlag = true;
|
||||
changeMapMode( EnumMapUI.Type_VR );
|
||||
}
|
||||
} else {
|
||||
if ( mCurrentUI == EnumMapUI.Type_VR ) {
|
||||
changeZoom( 16 );
|
||||
Logger.d( TAG, "自动切换为2D模式" );
|
||||
if ( mIsLightStyle ) {
|
||||
changeMapMode( EnumMapUI.Type_Light );
|
||||
} else {
|
||||
changeMapMode( EnumMapUI.Type_Night );
|
||||
}
|
||||
Logger.d( TAG, "自动切换为2D模式" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean mRtkEnable = false;
|
||||
|
||||
@Override
|
||||
public void rtkEnable( boolean enable ) {
|
||||
try {
|
||||
mRtkEnable = !mRtkEnable;
|
||||
TipToast.shortTip( mRtkEnable ? "已开启gps道路匹配" : "已开启rtk道路匹配" );
|
||||
mMapView.getLocationClient().rtkEnable( mRtkEnable );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "rtkEnable" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +99,14 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter( 0.734375f, 0.5f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ), NavParams.Companion.init() );
|
||||
MapAutoView mapAutoView = new MapAutoView( context );
|
||||
IMogoMapView mapView = new AMapViewWrapper( mapAutoView );
|
||||
MapAutoView mapAutoView = new MapAutoView(context);
|
||||
Logger.w(TAG, "mapAutoView==" + mapAutoView);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
|
||||
return mapView;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,12 @@ import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -291,4 +289,11 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
public void setAnchorRate( float rate ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rtkEnable( boolean enable ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.rtkEnable( enable );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +238,16 @@ public interface IMogoMapUIController {
|
||||
|
||||
}
|
||||
|
||||
default void testGpsData(){
|
||||
default void testGpsData() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自研地图是否匹配道路
|
||||
*
|
||||
* @param enable
|
||||
*/
|
||||
default void rtkEnable( boolean enable ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,4 +283,11 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
mDelegate.changeBearing( bearing );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rtkEnable( boolean enable ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.rtkEnable( enable );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
# For more information about using CMake with Android Studio, read the
|
||||
# documentation: https://d.android.com/studio/projects/add-native-code.html
|
||||
|
||||
# Sets the minimum version of CMake required to build the native library.
|
||||
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
# Creates and names a library, sets it as either STATIC
|
||||
# or SHARED, and provides the relative paths to its source code.
|
||||
# You can define multiple libraries, and CMake builds them for you.
|
||||
# Gradle automatically packages shared libraries with your APK.
|
||||
|
||||
add_library( # Sets the name of the library.
|
||||
method-hook-lib
|
||||
|
||||
# Sets the library as a shared library.
|
||||
SHARED
|
||||
|
||||
# Provides a relative path to your source file(s).
|
||||
src/main/cpp/method-hook-lib.cpp )
|
||||
|
||||
# Searches for a specified prebuilt library and stores the path as a
|
||||
# variable. Because CMake includes system libraries in the search path by
|
||||
# default, you only need to specify the name of the public NDK library
|
||||
# you want to add. CMake verifies that the library exists before
|
||||
# completing its build.
|
||||
|
||||
find_library( # Sets the name of the path variable.
|
||||
log-lib
|
||||
|
||||
# Specifies the name of the NDK library that
|
||||
# you want CMake to locate.
|
||||
log )
|
||||
|
||||
# Specifies libraries CMake should link to your target library. You
|
||||
# can link multiple libraries, such as libraries you define in this
|
||||
# build script, prebuilt third-party libraries, or system libraries.
|
||||
|
||||
target_link_libraries( # Specifies the target library.
|
||||
method-hook-lib
|
||||
|
||||
# Links the target library to the log library
|
||||
# included in the NDK.
|
||||
${log-lib} )
|
||||
@@ -11,17 +11,6 @@ android {
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++11 -frtti -fexceptions"
|
||||
}
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -44,6 +33,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.callchatprovider
|
||||
api "com.mogo.libs:hook:1.0"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
api rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
#include <jni.h>
|
||||
#include <string.h>
|
||||
|
||||
//
|
||||
// Created by donghongyu on 12/10/20 1:34 PM.
|
||||
// 源码地址 https://github.com/pqpo/methodhook
|
||||
// 方法hook jni类
|
||||
static const char *kClassMethodHookChar = "com/mogo/module/common/hook/MethodHook";
|
||||
|
||||
static struct {
|
||||
jmethodID m1;
|
||||
jmethodID m2;
|
||||
size_t methodSize;
|
||||
} methodHookClassInfo;
|
||||
|
||||
|
||||
/**
|
||||
* 替换指定类中的方法
|
||||
* @param env
|
||||
* @param type
|
||||
* @param srcMethodObj 目标方法对象
|
||||
* @param destMethodObj 替换的方法对象
|
||||
* @return
|
||||
*/
|
||||
static jlong methodHook(JNIEnv *env, jclass type, jobject srcMethodObj, jobject destMethodObj) {
|
||||
// 反射:获取了Java对象的在native层的 ArtMethod指针
|
||||
void *srcMethod = reinterpret_cast<void *>(env->FromReflectedMethod(srcMethodObj));
|
||||
void *destMethod = reinterpret_cast<void *>(env->FromReflectedMethod(destMethodObj));
|
||||
// 定义存储方法ID的数组
|
||||
int *backupMethod = new int[methodHookClassInfo.methodSize];
|
||||
// 使用的内存拷贝函数
|
||||
// 将旧方法ID拷贝到数组中
|
||||
memcpy(backupMethod, srcMethod, methodHookClassInfo.methodSize);
|
||||
// 将新方法替换到旧方法地址上
|
||||
memcpy(srcMethod, destMethod, methodHookClassInfo.methodSize);
|
||||
// 将旧方法ID返回给java层,用来做方法还原使用
|
||||
return reinterpret_cast<long>(backupMethod);
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复指定类中的方法
|
||||
* @param env
|
||||
* @param type
|
||||
* @param srcMethod 目标方法对象
|
||||
* @param methodPtr
|
||||
* @return
|
||||
*/
|
||||
static jobject methodRestore(JNIEnv *env, jclass type, jobject srcMethod, jlong methodPtr) {
|
||||
// 要还原的旧方法 指针
|
||||
int *backupMethod = reinterpret_cast<int *>(methodPtr);
|
||||
// 获取了Java对象的在native层的 ArtMethod指针
|
||||
void *artMethodSrc = reinterpret_cast<void *>(env->FromReflectedMethod(srcMethod));
|
||||
// 将旧方法指针,替换到 artMethodSrc 中
|
||||
memcpy(artMethodSrc, backupMethod, methodHookClassInfo.methodSize);
|
||||
// 删除旧方法备份指针
|
||||
delete[]backupMethod;
|
||||
// 返回旧方法
|
||||
return srcMethod;
|
||||
}
|
||||
|
||||
// 定义要注册的方法
|
||||
static JNINativeMethod gMethods[] = {
|
||||
{
|
||||
"hook_native",
|
||||
"(Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;)J",
|
||||
(void *) methodHook
|
||||
},
|
||||
{
|
||||
"restore_native",
|
||||
"(Ljava/lang/reflect/Method;J)Ljava/lang/reflect/Method;",
|
||||
(void *) methodRestore
|
||||
}
|
||||
};
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jint JNICALL
|
||||
/**
|
||||
* 在jni加载的时候进行方法参数获取
|
||||
* @param vm
|
||||
* @param reserved
|
||||
* @return
|
||||
*/
|
||||
JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||
JNIEnv *env = nullptr;
|
||||
if (vm->GetEnv((void **) &env, JNI_VERSION_1_4) != JNI_OK) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
// 加载指定java class
|
||||
jclass classEvaluateUtil = env->FindClass(kClassMethodHookChar);
|
||||
// 注册
|
||||
if (env->RegisterNatives(classEvaluateUtil, gMethods, sizeof(gMethods) / sizeof(gMethods[0])) <
|
||||
0) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
// 获取 MethodHook m1、m2 的方法ID
|
||||
methodHookClassInfo.m1 = env->GetStaticMethodID(classEvaluateUtil, "m1", "()V");
|
||||
methodHookClassInfo.m2 = env->GetStaticMethodID(classEvaluateUtil, "m2", "()V");
|
||||
// 获取artMethod的大小,
|
||||
methodHookClassInfo.methodSize = reinterpret_cast<size_t>(methodHookClassInfo.m2) -
|
||||
reinterpret_cast<size_t>(methodHookClassInfo.m1);
|
||||
return JNI_VERSION_1_4;
|
||||
}
|
||||
@@ -104,8 +104,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
|
||||
if ( mIsVrMode ) {
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
marker.use3DResource( getVrModel() );
|
||||
} else {
|
||||
marker.getMogoMarkerOptions().set3DMode( false );
|
||||
marker.setIcon( ViewUtils.fromView( inflateView( recognizedListResult, machineVision, 0 ) ) );
|
||||
}
|
||||
}
|
||||
@@ -200,8 +202,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
|
||||
|
||||
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.icon3DRes( getVrModel() );
|
||||
} else {
|
||||
options.set3DMode( false );
|
||||
options.icon( inflateView( recognizedListResult, machineVision, curSpeed ) );
|
||||
}
|
||||
|
||||
@@ -209,7 +213,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
|
||||
private int getVrModel() {
|
||||
return R.raw.taxi;
|
||||
return R.raw.carred;
|
||||
}
|
||||
|
||||
private View inflateView( ADASRecognizedListResult data, boolean machineVision, double curSpeed ) {
|
||||
@@ -225,7 +229,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
// safeType
|
||||
// ) );
|
||||
|
||||
iv.setImageResource( R.drawable.icon_map_marker_car_type_taxi );
|
||||
iv.setImageResource( R.drawable.icon_map_marker_car_gray );
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
// 云端 marker 缓存
|
||||
private Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private int mPurseCounter = 0;
|
||||
|
||||
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
@@ -95,17 +93,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
filterData( data.getAllList() );
|
||||
List< CloudRoadData > allDatumsList = new ArrayList<>();
|
||||
allDatumsList.addAll( data.getAllList() );
|
||||
// allDatumsList.addAll( data.getNearList() );
|
||||
// if ( machineVision ) {
|
||||
// allDatumsList.addAll( data.getAllList() );
|
||||
// allDatumsList.addAll( data.getNearList() );
|
||||
// } else {
|
||||
// allDatumsList.addAll( data.getAllList() );
|
||||
// }
|
||||
mPurseCounter++;
|
||||
if ( mPurseCounter >= 100 ) {
|
||||
mPurseCounter = 0;
|
||||
}
|
||||
purgeCloudSnapshotData( allDatumsList );
|
||||
for ( CloudRoadData cloudRoadData : allDatumsList ) {
|
||||
if ( cloudRoadData == null ) {
|
||||
@@ -119,7 +106,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IMogoMarker marker = null;
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
if ( TextUtils.isEmpty( uniqueKey ) ) {
|
||||
@@ -142,6 +128,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
|
||||
if ( mIsVrMode ) {
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
marker.use3DResource( getVrModel( cloudRoadData ) );
|
||||
} else {
|
||||
marker.getMogoMarkerOptions().set3DMode( false );
|
||||
@@ -159,7 +146,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
|
||||
points.add( new MogoLatLng( target.lat, target.lon ) );
|
||||
marker.startSmoothInMs( points, SystemClock.elapsedRealtime() - mLastReceiveTime );
|
||||
marker.startSmoothInMs( points, 1000 );
|
||||
}
|
||||
} else {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
|
||||
@@ -257,8 +244,10 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
|
||||
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
|
||||
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.icon3DRes( getVrModel( data ) );
|
||||
} else {
|
||||
options.set3DMode( false );
|
||||
options.icon( inflateView( data, machineVision, curSpeed ) );
|
||||
}
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
|
||||
@@ -267,9 +256,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
private int getVrModel( CloudRoadData data ) {
|
||||
switch ( data.getFromType() ) {
|
||||
case CloudRoadData.FROM_ADAS:
|
||||
return R.raw.taxi;
|
||||
// return R.raw.taxi;
|
||||
case CloudRoadData.FROM_ROAD_UNIT:
|
||||
return R.raw.bus;
|
||||
// return R.raw.bus;
|
||||
case CloudRoadData.FROM_MY_LOCATION:
|
||||
default:
|
||||
return R.raw.carred;
|
||||
@@ -296,9 +285,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
private int get2DModel( CloudRoadData data ) {
|
||||
switch ( data.getFromType() ) {
|
||||
case CloudRoadData.FROM_ADAS:
|
||||
return R.drawable.icon_map_marker_car_type_taxi;
|
||||
// return R.drawable.icon_map_marker_car_type_taxi;
|
||||
case CloudRoadData.FROM_ROAD_UNIT:
|
||||
return R.drawable.icon_map_marker_car_type_bus;
|
||||
// return R.drawable.icon_map_marker_car_type_bus;
|
||||
case CloudRoadData.FROM_MY_LOCATION:
|
||||
default:
|
||||
return R.drawable.icon_map_marker_car_gray;
|
||||
|
||||
@@ -90,7 +90,9 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
|
||||
}
|
||||
|
||||
private void loadPoiTypeIconInUiThread(String url,int res) {
|
||||
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon( ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
if (!url.isEmpty()) {
|
||||
ivIcon.setPlaceHolder(res);
|
||||
ivIcon.setFailureHolder(res);
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.mogo.module.common.hook;
|
||||
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 替换管理
|
||||
* Created by donghongyu on 12/29/20 1:34 PM
|
||||
*/
|
||||
public final class HookManager {
|
||||
|
||||
private HookManager() {
|
||||
}
|
||||
|
||||
public static HookManager get() {
|
||||
return InstanceHolder.sInstance;
|
||||
}
|
||||
|
||||
private static class InstanceHolder {
|
||||
private static HookManager sInstance = new HookManager();
|
||||
}
|
||||
|
||||
private Map<Pair<String, String>, MethodHook> methodHookMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 替换方法
|
||||
*
|
||||
* @param originMethod 原始方法
|
||||
* @param hookMethod 替换方法
|
||||
*/
|
||||
public void hookMethod(Method originMethod, Method hookMethod) {
|
||||
if (originMethod == null || hookMethod == null) {
|
||||
throw new IllegalArgumentException("argument cannot be null");
|
||||
}
|
||||
|
||||
Pair<String, String> key = Pair.create(hookMethod.getDeclaringClass().getName(), hookMethod.getName());
|
||||
if (methodHookMap.containsKey(key)) {
|
||||
MethodHook methodHook = methodHookMap.get(key);
|
||||
methodHook.restore();
|
||||
}
|
||||
MethodHook methodHook = new MethodHook(originMethod, hookMethod);
|
||||
methodHookMap.put(key, methodHook);
|
||||
methodHook.hook();
|
||||
}
|
||||
|
||||
public void callOrigin(Object receiver, Object... args) {
|
||||
StackTraceElement stackTrace = Thread.currentThread().getStackTrace()[3];
|
||||
String className = stackTrace.getClassName();
|
||||
String methodName = stackTrace.getMethodName();
|
||||
MethodHook methodHook = methodHookMap.get(Pair.create(className, methodName));
|
||||
if (methodHook != null) {
|
||||
try {
|
||||
methodHook.callOrigin(receiver, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.mogo.module.common.hook;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 替换类与c++代码对应
|
||||
* Created by donghongyu on 12/29/20 1:34 PM
|
||||
*/
|
||||
public class MethodHook {
|
||||
|
||||
public static void m1() {
|
||||
}
|
||||
|
||||
public static void m2() {
|
||||
}
|
||||
|
||||
// 目标方法
|
||||
private Method srcMethod;
|
||||
// 要替换的方法
|
||||
private Method hookMethod;
|
||||
|
||||
// 备份目标替换方法ID
|
||||
private long backupMethodPtr;
|
||||
|
||||
/**
|
||||
* hook方法
|
||||
*
|
||||
* @param src 要替换的方法对象
|
||||
* @param dest 被替换的方法对象
|
||||
*/
|
||||
public MethodHook(Method src, Method dest) {
|
||||
srcMethod = src;
|
||||
hookMethod = dest;
|
||||
srcMethod.setAccessible(true);
|
||||
hookMethod.setAccessible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 native 层,完成替换
|
||||
*/
|
||||
public void hook() {
|
||||
if (backupMethodPtr == 0) {
|
||||
backupMethodPtr = hook_native(srcMethod, hookMethod);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 native 层,完成方法还原
|
||||
*/
|
||||
public void restore() {
|
||||
if (backupMethodPtr != 0) {
|
||||
restore_native(srcMethod, backupMethodPtr);
|
||||
backupMethodPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用原来class 对象中的方法
|
||||
*
|
||||
* @param receiver 接受对象
|
||||
* @param args 方法列表
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public void callOrigin(Object receiver, Object... args)
|
||||
throws InvocationTargetException, IllegalAccessException {
|
||||
if (backupMethodPtr != 0) {
|
||||
restore();
|
||||
srcMethod.invoke(receiver, args);
|
||||
hook();
|
||||
} else {
|
||||
srcMethod.invoke(receiver, args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 native 方法完成 方法替换
|
||||
*
|
||||
* @param src 旧方法
|
||||
* @param dest 新方法
|
||||
* @return 就方法ID
|
||||
*/
|
||||
private static native long hook_native(Method src, Method dest);
|
||||
|
||||
/**
|
||||
* 调用 native 方法完成 方法还原
|
||||
*
|
||||
* @param src
|
||||
* @param methodPtr
|
||||
* @return
|
||||
*/
|
||||
private static native Method restore_native(Method src, long methodPtr);
|
||||
|
||||
static {
|
||||
// 加载本地方法 so
|
||||
System.loadLibrary("method-hook-lib");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -274,7 +274,6 @@ public class MapCenterPointStrategy {
|
||||
Logger.w( TAG, "vr 模式下忽略该设置" );
|
||||
return;
|
||||
}
|
||||
Logger.e( TAG, "scene"+scene );
|
||||
Map< Integer, Map< String, MapCenterPoint > > strategies = sCommonStrategies;
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
strategies = sVrStrategies;
|
||||
|
||||
@@ -839,11 +839,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
handler.post(() -> seekHelpGroup.setVisibility(View.GONE));
|
||||
}
|
||||
} else if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
if (isTrue) {
|
||||
enterVrMode();
|
||||
} else {
|
||||
exitVrMode();
|
||||
try {
|
||||
if (isTrue) {
|
||||
enterVrMode();
|
||||
} else {
|
||||
exitVrMode();
|
||||
}
|
||||
} catch( Exception e ){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.view.VerticalTrafficLightView;
|
||||
|
||||
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_GRAY;
|
||||
|
||||
/**
|
||||
* vr模式下导航信息封装
|
||||
*
|
||||
@@ -28,14 +30,14 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
private final VerticalTrafficLightView turnAroundLight, turnLeftLight, straightLight, turnRightLight;
|
||||
|
||||
private final ImageView ivTurnIcon;
|
||||
private final TextView tvDistance,tvDistanceUnit, tvNextRoad;
|
||||
private final TextView tvDistance, tvDistanceUnit, tvNextRoad;
|
||||
|
||||
private final TextView tvCurrentSpeed;
|
||||
|
||||
private final Handler handler = new Handler(this);
|
||||
|
||||
public VrModeNavInfoView(Context context) {
|
||||
this(context,null);
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public VrModeNavInfoView(Context context, AttributeSet attrs) {
|
||||
@@ -72,7 +74,7 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
}
|
||||
|
||||
public void refreshLimitSpeed(int limitSpeed) {
|
||||
if(getVisibility() != View.VISIBLE){
|
||||
if (getVisibility() != View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
|
||||
@@ -91,6 +93,14 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
private int[] lightArray = new int[4];
|
||||
private String[] surplusTimeArray = new String[4];
|
||||
|
||||
/**
|
||||
* 将红绿灯状态全部置灰,相当于隐藏红绿灯状态
|
||||
*/
|
||||
public void hideTrafficLightStatus() {
|
||||
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
|
||||
refreshTrafficLightStatus(new int[]{TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY}, new String[]{"", "", "", ""});
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新红绿灯显示状态
|
||||
*
|
||||
@@ -107,12 +117,15 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
turnRightLight.setTrafficLightStatus(laneLight[3], surplusTime[3]);
|
||||
// todo 再根据当前所在车道,置灰不需关注的灯
|
||||
|
||||
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
|
||||
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT, HIDE_TRAFFIC_LIGHT_DELAY);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据所在车道,控制红绿灯展示
|
||||
*/
|
||||
public void refreshLaneStatus(){
|
||||
public void refreshLaneStatus() {
|
||||
|
||||
}
|
||||
|
||||
@@ -136,16 +149,24 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
|
||||
public boolean isVisible() {
|
||||
return navGroup.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
private static final int MSG_HIDE_LIMIT_SPEED = 1001;
|
||||
private static final long HIDE_LIMIT_SPEED_DELAY = 5000;
|
||||
|
||||
private static final int MSG_HIDE_TRAFFIC_LIGHT = 1002;
|
||||
private static final long HIDE_TRAFFIC_LIGHT_DELAY = 1000;
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if (!isAttachedToWindow()||getVisibility() != View.VISIBLE) {
|
||||
if (!isAttachedToWindow() || getVisibility() != View.VISIBLE) {
|
||||
return false;
|
||||
}
|
||||
if (msg.what == MSG_HIDE_LIMIT_SPEED) {
|
||||
tvLimitSpeed.setVisibility(View.GONE);
|
||||
return true;
|
||||
} else if (msg.what == MSG_HIDE_TRAFFIC_LIGHT) {
|
||||
hideTrafficLightStatus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -158,8 +158,9 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
String obuLightAction = intent.getStringExtra("action");
|
||||
if ("1".equals(obuLightAction)) {
|
||||
// 隐藏红绿灯
|
||||
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
|
||||
handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
|
||||
vrModeNavInfoView.hideTrafficLightStatus();
|
||||
// handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
|
||||
// handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
|
||||
} else {
|
||||
// 红绿灯处理
|
||||
String data = intent.getStringExtra("data");
|
||||
|
||||
@@ -100,7 +100,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
* @param roadData
|
||||
*/
|
||||
private void addVrCameraMarker(CloudRoadData roadData) {
|
||||
Log.d(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
Log.e(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
|
||||
removeCameraMarker();
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
@@ -127,7 +127,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
* @param roadData
|
||||
*/
|
||||
private void addNormalCameraMarker(CloudRoadData roadData) {
|
||||
Log.d(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
Log.e(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
|
||||
removeCameraMarker();
|
||||
if (mMogoMarker != null) {
|
||||
@@ -178,7 +178,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
if (TextUtils.equals(mCurrentUuid, mCloudRoadData.getUuid())) {
|
||||
if (isVrMode == isVrModeMarker) {
|
||||
// do nothing.
|
||||
Log.e(TAG, "-------------1------------");
|
||||
Log.d(TAG, "-------------1------------");
|
||||
} else {
|
||||
if (isVrMode) {
|
||||
Log.d(TAG, "-------------2------------");
|
||||
|
||||
@@ -389,6 +389,7 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
Logger.d("TopViewAnimHelper", "hideNaviView=====");
|
||||
animNavInfoView.setTranslationY(0);
|
||||
animNavInfoView.setVisibility(View.GONE);
|
||||
vrModeNavInfoView.stopNav();
|
||||
int scene = 0;
|
||||
@@ -441,6 +442,7 @@ public class TopViewAnimHelper {
|
||||
listener.onViewRemoved(child);
|
||||
}
|
||||
}
|
||||
topContainer.setTranslationY(0);
|
||||
topContainer.removeAllViews();
|
||||
hideNaviView();
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
android:id="@+id/module_ext_id_tv_speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/module_ext_navi_in_vr_nav_common_margin_top"
|
||||
android:layout_marginStart="@dimen/module_ext_navi_in_vr_speed_margin_start"
|
||||
android:text="--"
|
||||
android:textColor="#fff"
|
||||
@@ -53,6 +54,8 @@
|
||||
android:id="@+id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
|
||||
android:layout_width="@dimen/module_ext_navi_in_vr_navi_icon_size"
|
||||
android:layout_height="@dimen/module_ext_navi_in_vr_navi_icon_size"
|
||||
android:layout_marginTop="@dimen/module_ext_navi_in_vr_nav_common_margin_top"
|
||||
android:layout_marginStart="@dimen/module_ext_navi_in_vr_limit_speed_margin_start"
|
||||
android:src="@drawable/tc_11"
|
||||
app:layout_constraintBottom_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg"
|
||||
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_traffic_bg"
|
||||
@@ -65,6 +68,7 @@
|
||||
android:text="200"
|
||||
android:textColor="#f1f1f1"
|
||||
android:textSize="@dimen/module_ext_navi_in_vr_next_info_txt_size"
|
||||
app:layout_constraintBottom_toTopOf="@id/module_map_id_navi_next_info_road_in_vr_mode"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
|
||||
app:layout_constraintTop_toTopOf="@id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode" />
|
||||
|
||||
@@ -85,6 +89,7 @@
|
||||
android:text="北三环东路辅路"
|
||||
android:textColor="#f1f1f1"
|
||||
android:textSize="@dimen/module_ext_navi_in_vr_next_info_road_txt_size"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
|
||||
app:layout_constraintLeft_toLeftOf="@id/module_map_id_navi_next_info_distance_in_vr_mode"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_map_id_navi_next_info_distance_in_vr_mode" />
|
||||
|
||||
@@ -94,6 +99,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/module_ext_navi_in_vr_limit_speed_margin_end"
|
||||
android:layout_marginTop="@dimen/module_ext_navi_in_vr_limit_speed_margin_top"
|
||||
android:background="@drawable/module_ext_vr_mode_limit_speed_bg"
|
||||
android:gravity="center"
|
||||
android:text="80"
|
||||
@@ -148,14 +154,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="module_ext_id_tv_speed,module_ext_id_tv_speed_unit"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone" />
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/module_ext_id_group_navi_in_vr_nav_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:visibility="gone"
|
||||
app:constraint_referenced_ids="module_map_id_navi_next_info_road_turn_icon_in_vr_mode,module_map_id_navi_next_info_distance_in_vr_mode,module_map_id_navi_next_info_distance_unit_in_vr_mode,module_map_id_navi_next_info_road_in_vr_mode" />
|
||||
|
||||
<!-- 除了上面两个group以外的其他view的group,方便整体控制显示隐藏,不包含limitSpeed,需要单独控制它的显示隐藏 -->
|
||||
|
||||
@@ -23,12 +23,13 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="12"
|
||||
android:layout_marginTop="@dimen/module_ext_navi_in_vr_traffic_light_left_time_margin_top"
|
||||
android:textColor="#fff"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
android:textSize="@dimen/module_ext_navi_in_vr_traffic_light_left_time_txt_size"
|
||||
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_traffic_light_icon"
|
||||
app:layout_constraintRight_toLeftOf="@id/module_ext_id_traffic_light_left_time_unit"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_ext_id_traffic_light_icon" />
|
||||
app:layout_constraintTop_toTopOf="@id/module_ext_id_traffic_light_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_traffic_light_left_time_unit"
|
||||
|
||||
@@ -226,18 +226,21 @@
|
||||
<dimen name="module_ext_navi_in_vr_traffic_bg_margin_bottom">60px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_speed_text_size">100px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_speed_unit_size">30px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_speed_unit_margin_start">30px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_speed_unit_margin_start">15px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_speed_margin_start">70px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_speed_margin_top">22px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_limit_speed_size">78px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_limit_speed_margin_end">66px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_limit_speed_margin_top">43px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_nav_common_margin_top">23px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_limit_speed_margin_top">30px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_limit_speed_margin_start">20px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_limit_speed_text_size">40px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_bg_corner">20px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_traffic_light_margin_top">17px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_txt_size">36px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_margin_top">60px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_unit_size">21px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">21px</dimen>
|
||||
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">11px</dimen>
|
||||
<dimen name="module_video_window_width_content">400px</dimen>
|
||||
<dimen name="module_video_window_height_content">300px</dimen>
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class MockUtil:Handler.Callback {
|
||||
if (msg.what == 1001) {
|
||||
Logger.d(TAG,"准备添加调试view")
|
||||
val api = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
|
||||
api.windowManagerApi.addView(view, 500, 300, false)
|
||||
api.windowManagerApi.addView(view, 800, 300, false)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -103,8 +103,8 @@ public class MogoServiceProvider implements IMogoModuleProvider {
|
||||
MogoRTKLocation.getInstance().init();
|
||||
}
|
||||
MogoServices.getInstance().preInit( context );
|
||||
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
|
||||
}, 5_000L );
|
||||
}
|
||||
|
||||
|
||||
@@ -326,6 +326,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.TOP_VIEW, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListener );
|
||||
mStatusManager.setAIAssistReady( TAG, AIAssist.getInstance( mContext ).hasFlush() );
|
||||
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
@@ -337,9 +338,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
registerInternalUnWakeupWords();
|
||||
|
||||
mRegisterCenter = MarkerServiceHandler.getRegisterCenter();
|
||||
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoLocationListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoNaviListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoAimlessModeListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerCarLocationChangedListener( ServiceConst.TYPE, this );
|
||||
|
||||
@@ -932,11 +933,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
if ( ui == EnumMapUI.Type_VR ) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
MapCenterPointStrategy.resetByChangeMode();
|
||||
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "你已进入鹰眼模式" );
|
||||
mLastStatusIsVr = true;
|
||||
if ( !mLastStatusIsVr ) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
MapCenterPointStrategy.resetByChangeMode();
|
||||
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "你已进入鹰眼模式" );
|
||||
mLastStatusIsVr = true;
|
||||
}
|
||||
} else {
|
||||
if ( mLastStatusIsVr ) {
|
||||
mLastStatusIsVr = false;
|
||||
|
||||
@@ -383,6 +383,10 @@ public class MockIntentHandler implements IntentHandler {
|
||||
centerMarker.destroy();
|
||||
}
|
||||
break;
|
||||
case 38:
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
||||
.rtkEnable( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ public class SmallMapDirectionView extends RelativeLayout {
|
||||
private AMapNaviView mAMapNaviView;
|
||||
private DirectionRotateAnimation mRotateAnimation;
|
||||
private int lastAngle = 0;
|
||||
private int zoomLevel = 15;
|
||||
|
||||
public SmallMapDirectionView(Context context) {
|
||||
this(context, null);
|
||||
@@ -133,19 +134,19 @@ public class SmallMapDirectionView extends RelativeLayout {
|
||||
options.setNaviArrowVisible(false);
|
||||
// 通过路线是否自动置灰,仅支持驾车导航
|
||||
options.setAfterRouteAutoGray(false);
|
||||
options.setZoom(((int) 9));
|
||||
//options.setZoom(((int) 9));
|
||||
//options.setPointToCenter(0.7D, 0.5D);
|
||||
// 2D模式
|
||||
options.setTilt(0);
|
||||
// 黑夜模式
|
||||
// options.setNaviNight(true);
|
||||
// options.setNaviNight(true);
|
||||
// 自定义地图样式
|
||||
options.setCustomMapStylePath(styleFilePath);
|
||||
mAMapNaviView.setViewOptions(options);
|
||||
}
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
|
||||
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
aMap.moveCamera(cameraUpdate);
|
||||
|
||||
aMap.setOnCameraChangeListener(new AMap.OnCameraChangeListener() {
|
||||
@@ -175,7 +176,7 @@ public class SmallMapDirectionView extends RelativeLayout {
|
||||
}
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
|
||||
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
aMap.moveCamera(cameraUpdate);
|
||||
}
|
||||
});
|
||||
@@ -218,7 +219,7 @@ public class SmallMapDirectionView extends RelativeLayout {
|
||||
}
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
|
||||
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
aMap.moveCamera(cameraUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ import androidx.fragment.app.Fragment;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.amap.api.col.n3.lg;
|
||||
import com.amap.api.col.n3.lg2;
|
||||
import com.mogo.hook.HookManager;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.hook.HookManager;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoSmallMapProvider;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.v2x.scenario.impl;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
@@ -92,7 +93,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
mV2XScenario = new V2XIllegalParkScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
|
||||
mV2XScenario = new V2XEventUgcScenario();
|
||||
mV2XScenario = V2XServiceManager.getMoGoStatusManager().isVrMode() ? null : new V2XEventUgcScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
|
||||
mV2XScenario = new V2XVoiceCallLiveScenario();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario<V2XEventShowEntity>
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) V2XUtils.getApp().getResources()
|
||||
.getDimension(R.dimen.v2x_video_window_height));
|
||||
.getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode()? R.dimen.dp_394:R.dimen.v2x_video_window_height));
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
|
||||
|
||||
@@ -140,20 +140,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#2651A6"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="折行显示文案测试数据"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerParkEvent"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -120,8 +120,4 @@
|
||||
<dimen name="v2x_driving_heigt">46px</dimen>
|
||||
<dimen name="v2x_recommond_route_size">26px</dimen>
|
||||
|
||||
<!--适配贝塞尔曲线-->
|
||||
<dimen name="v2x_bezier_x">1281px</dimen>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -323,6 +323,10 @@ public class MogoADASController implements IMogoADASController {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().showAdas();
|
||||
} catch ( Exception e ) {
|
||||
|
||||
Reference in New Issue
Block a user