change the callerlogger
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.location.Location;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.function.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -17,7 +20,6 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.eagle.core.function.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
|
||||
import com.zhidao.adasconfig.listener.IAdasSettingUIListener;
|
||||
@@ -49,9 +51,9 @@ public class EventDispatchCenter implements
|
||||
}
|
||||
|
||||
public static EventDispatchCenter getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( EventDispatchCenter.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (EventDispatchCenter.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new EventDispatchCenter();
|
||||
}
|
||||
}
|
||||
@@ -62,13 +64,13 @@ public class EventDispatchCenter implements
|
||||
private static final String TAG = "DispatchCenter";
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() );
|
||||
if ( listener != null ) {
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener(marker.getOwner());
|
||||
if (listener != null) {
|
||||
try {
|
||||
return listener.onMarkerClicked( marker );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
return listener.onMarkerClicked(marker);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMarkerClicked error : " + e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -76,34 +78,34 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public boolean onStaticMarkerClicked(IMogoMarker marker) {
|
||||
ArrayList<IMogoMarkerClickListener> list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener( marker.getOwner() );
|
||||
if(list == null){
|
||||
ArrayList<IMogoMarkerClickListener> list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener(marker.getOwner());
|
||||
if (list == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
for (IMogoMarkerClickListener listener : list) {
|
||||
return listener.onStaticMarkerClicked( marker );
|
||||
return listener.onStaticMarkerClicked(marker);
|
||||
}
|
||||
} catch ( Exception e){
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStaticMarkerClicked error : " + e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location latLng ) {
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
|
||||
Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoCarLocationChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
MogoLatLng target = null;
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoCarLocationChangedListener listener = iterator.next();
|
||||
if ( listener instanceof IMogoCarLocationChangedListener2 ) {
|
||||
if (listener instanceof IMogoCarLocationChangedListener2) {
|
||||
try {
|
||||
( ( IMogoCarLocationChangedListener2 ) listener ).onCarLocationChanged2( latLng );
|
||||
} catch ( Exception e ) {
|
||||
((IMogoCarLocationChangedListener2) listener).onCarLocationChanged2(latLng);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -115,118 +117,118 @@ public class EventDispatchCenter implements
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
void setMapLoadedCallback( Runnable callback ) {
|
||||
void setMapLoadedCallback(Runnable callback) {
|
||||
this.mMapLoadedCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
if ( mMapLoadedCallback != null ) {
|
||||
if (mMapLoadedCallback != null) {
|
||||
mMapLoadedCallback.run();
|
||||
mMapLoadedCallback = null;
|
||||
}
|
||||
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapLoaded();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapLoaded error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onTouch(MotionEvent motionEvent) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onTouch( motionEvent );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onTouch(motionEvent);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onTouch error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick( MogoPoi poi ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onPOIClick(MogoPoi poi) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onPOIClick( poi );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onPOIClick(poi);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onPOIClick error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick( MogoLatLng latLng ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onMapClick(MogoLatLng latLng) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapClick( latLng );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onMapClick(latLng);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapClick error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onLockMap(boolean isLock) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onLockMap( isLock );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onLockMap(isLock);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onLockMap error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onMapModeChanged(EnumMapUI ui) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapModeChanged( ui );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onMapModeChanged(ui);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapModeChanged error :" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,56 +236,56 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapVisualAngleChanged( visualAngleMode );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onMapVisualAngleChanged(visualAngleMode);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapVisualAngleChanged error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
public void onMapChanged(MogoLatLng location, float zoom, float tilt, float bearing) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapChanged( location, zoom, tilt, bearing );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onMapChanged(location, zoom, tilt, bearing);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapChanged error :" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.i( TAG, "onMapChanged event cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
CallerLogger.INSTANCE.i(M_MAIN +TAG, "onMapChanged event cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onInitNaviFailure();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onInitNaviFailure error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,36 +293,36 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onInitNaviSuccess();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onInitNaviSuccess error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
if ( iterator == null ) {
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onNaviInfoUpdate( naviinfo );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onNaviInfoUpdate(naviinfo);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onNaviInfoUpdate error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,18 +330,18 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
if ( iterator == null ) {
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onStartNavi();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStartNavi error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,17 +349,17 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onStopNavi();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStopNavi error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -365,17 +367,17 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onCalculateSuccess();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onCalculateSuccess error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,17 +385,17 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onoCalculateFailed();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onoCalculateFailed error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,19 +403,19 @@ public class EventDispatchCenter implements
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
|
||||
Iterator< IMogoLocationListener > iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoLocationListener> iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoLocationListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onLocationChanged( location );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onLocationChanged(location);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onLocationChanged error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,95 +423,95 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void northModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.NorthUP_2D );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onMapUiModeChanged(EnumMapUI.NorthUP_2D);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "northModel error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void carHeadUp() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.CarUp_2D );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onMapUiModeChanged(EnumMapUI.CarUp_2D);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "carHeadUp error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchCarChat( EnumCarChatIncognitoMode enumCarChatIncognitoMode ) {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
public void switchCarChat(EnumCarChatIncognitoMode enumCarChatIncognitoMode) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onCarStatusChanged( enumCarChatIncognitoMode == EnumCarChatIncognitoMode.OPEN );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onCarStatusChanged(enumCarChatIncognitoMode == EnumCarChatIncognitoMode.OPEN);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "switchCarChat error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whiteModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.Type_Light );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onMapUiModeChanged(EnumMapUI.Type_Light);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "whiteModel error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blackModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.Type_Night );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onMapUiModeChanged(EnumMapUI.Type_Night);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "blackModel error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
import static com.mogo.eagle.core.function.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
|
||||
|
||||
import android.content.Intent;
|
||||
@@ -7,7 +8,6 @@ import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
@@ -24,12 +24,12 @@ import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.service.MogoMainService;
|
||||
import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper;
|
||||
import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
@@ -159,14 +159,14 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
// 过滤掉异常启动时间
|
||||
if (coldStartTime < 50000) {
|
||||
// 上传冷启动时间coldStartTime
|
||||
Logger.i(TAG, "coldStartTime:" + coldStartTime);
|
||||
CallerLogger.INSTANCE.i(M_MAIN + TAG, "coldStartTime:" + coldStartTime);
|
||||
properties.put("app_launch_coldStartTime", coldStartTime);
|
||||
}
|
||||
} else if (hotStartTime > 0) {
|
||||
// 过滤掉异常启动时间
|
||||
if (hotStartTime < 30000) {
|
||||
// 上传热启动时间hotStartTime
|
||||
Logger.i(TAG, "hotStartTime:" + hotStartTime);
|
||||
CallerLogger.INSTANCE.i(M_MAIN + TAG, "hotStartTime:" + hotStartTime);
|
||||
properties.put("app_launch_hotStartTime", hotStartTime);
|
||||
}
|
||||
}
|
||||
@@ -198,20 +198,17 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
if (DebugConfig.isMapBased()) {
|
||||
EventDispatchCenter.getInstance().setMapLoadedCallback(() -> {
|
||||
Logger.d(TAG, "map loaded." + Thread.currentThread().getName());
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "map loaded." + Thread.currentThread().getName());
|
||||
// 延时加载其他模块
|
||||
getWindow().getDecorView().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadOthersModules();
|
||||
loadFunctionFragment();
|
||||
getWindow().getDecorView().postDelayed(() -> {
|
||||
loadOthersModules();
|
||||
loadFunctionFragment();
|
||||
|
||||
// TODO 这里临时兼容进入VR模式
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
|
||||
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR);
|
||||
}
|
||||
// TODO 这里临时兼容进入VR模式
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
|
||||
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR);
|
||||
}, 3000);
|
||||
Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
CallerLogger.INSTANCE.i(M_MAIN + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
});
|
||||
loadFunctionMapView();
|
||||
} else {
|
||||
@@ -279,7 +276,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
@Override
|
||||
public void loadFunctionFragment() {
|
||||
Logger.d(TAG, "loadFunctionFragment……");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadFunctionFragment……");
|
||||
// 加载 HMI 图层
|
||||
BaseFragment fragmentHdMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation();
|
||||
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_waring_fragment);
|
||||
@@ -392,7 +389,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
mServiceApis.getMapServiceApi().getMapUIController().destroy();
|
||||
AdasConfigApiController.getInstance().release();
|
||||
mServiceApis.getAdasControllerApi().release();
|
||||
Logger.d(TAG, "destroy.");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy.");
|
||||
ContextHolderUtil.releaseContext();
|
||||
MogoModulesManager.getInstance().onDestroy();
|
||||
SchemeIntent.getInstance().clear();
|
||||
@@ -447,7 +444,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
Logger.d(TAG, "requestCode: " + requestCode + " resultCode: " + resultCode);
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "requestCode: " + requestCode + " resultCode: " + resultCode);
|
||||
if (requestCode == REQUEST_CODE_DIALOG) {
|
||||
//申请悬浮窗权限
|
||||
|
||||
@@ -467,7 +464,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
fragment = newFragment;
|
||||
}
|
||||
if (fragment == null) {
|
||||
Logger.e(TAG, "add fragment fail cause fragment == null, container is %s", ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
return;
|
||||
}
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -25,17 +26,16 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener {
|
||||
private static final String TAG = "MainLauncherActivity";
|
||||
protected boolean mIsHomeKeyDown = false;
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private final static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
DebugConfig.setNeedRequestUserInfo(true);
|
||||
Log.d(TAG, "onCreate");
|
||||
CallerLogger.INSTANCE.i(M_MAIN +TAG, "onCreate");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
@@ -71,7 +71,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void loadOthersModules() {
|
||||
super.loadOthersModules();
|
||||
Logger.d(TAG, "loadOthersModules");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadOthersModules");
|
||||
loadOCHModule();
|
||||
}
|
||||
|
||||
@@ -113,12 +113,12 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
intent.putExtra("type", 0);
|
||||
}
|
||||
sendBroadcast(intent);
|
||||
Logger.d(TAG, "send msg to AI Voice");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "send msg to AI Voice");
|
||||
}
|
||||
|
||||
|
||||
private void stopCountDown() {
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
if (runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Process;
|
||||
import android.util.Log;
|
||||
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
|
||||
@@ -20,11 +21,10 @@ import com.mogo.eagle.core.data.constants.MoGoConfig;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.notice.PushUIConstants;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||
import com.mogo.map.MapApiPath;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -38,7 +38,6 @@ import com.mogo.test.crashreport.CrashReportConstants;
|
||||
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants;
|
||||
import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
import com.zhjt.service.chain.core.ChainTraceStarter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@@ -71,7 +70,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
|
||||
@Override
|
||||
protected boolean shouldInit() {
|
||||
Logger.w(TAG, "evaluate shouldInit() with: %s", ProcessUtils.getProcessName(Process.myPid()));
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "evaluate shouldInit() with: " + ProcessUtils.getProcessName(Process.myPid()));
|
||||
return ProcessUtils.isMainProcess(this);
|
||||
}
|
||||
|
||||
@@ -215,7 +214,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
e.printStackTrace();
|
||||
httpDnsSimpleLocation = new HttpDnsSimpleLocation("010", 1, 1);
|
||||
}
|
||||
Logger.i(TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation);
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation);
|
||||
}
|
||||
return httpDnsSimpleLocation;
|
||||
});
|
||||
@@ -225,7 +224,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
new IMoGoTokenCallback() {
|
||||
@Override
|
||||
public void onTokenGot(String token, String sn) {
|
||||
Logger.d("TEST-SOCKET", "onTokenGot ");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "onTokenGot ");
|
||||
// 异步初始化NetConfig
|
||||
asyncInit();
|
||||
// HttpDns ttl回调 --- socketTTL
|
||||
@@ -236,7 +235,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
Log.d(TAG, "初始化MogoAiCloudSdk failed ,reason : " + msg + " , 未能开启长链服务和初始化Modules服务");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "初始化MogoAiCloudSdk failed ,reason : " + msg + " , 未能开启长链服务和初始化Modules服务");
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -247,7 +246,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
*/
|
||||
private void connectAmiIp() {
|
||||
String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199");
|
||||
//Logger.d("OnAdasListenerAdapter", "application --ipAddress = " + ipAddress);
|
||||
AmiClientManager.getInstance().setObuIp(ipAddress);
|
||||
}
|
||||
|
||||
@@ -265,26 +263,26 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
}
|
||||
|
||||
private void startSocketService() {
|
||||
Logger.d(TAG, "startSocketService");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "startSocketService");
|
||||
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
||||
// 关闭长链服务
|
||||
apis.getSocketManagerApi(getApplicationContext()).destroy();
|
||||
apis.getSocketManagerApi(this).registerLifecycleListener(10020, new IMogoLifecycleListener() {
|
||||
@Override
|
||||
public void onConnectFailure() {
|
||||
Logger.d(TAG, "socket-onConnectFailure");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectFailure");
|
||||
DebugConfig.setDownloadSnapshot(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
Logger.d(TAG, "socket-onConnectSuccess");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectSuccess");
|
||||
DebugConfig.setDownloadSnapshot(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectLost() {
|
||||
Logger.d(TAG, "socket-onConnectLost");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectLost");
|
||||
DebugConfig.setDownloadSnapshot(false);
|
||||
}
|
||||
});
|
||||
@@ -299,7 +297,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
}
|
||||
|
||||
private void initModules() {
|
||||
Logger.d(TAG, "initModules");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "initModules");
|
||||
//mogo deva tools
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_DEVA_TOOLS, "IMoGoDevaToolsProvider"));
|
||||
// 初始化 bugly 升级
|
||||
@@ -311,7 +309,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
|
||||
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
|
||||
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
|
||||
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
|
||||
|
||||
// 域控制器模块(新)
|
||||
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AUTO_PILOT, "IMoGoAutoPilotProvider"));
|
||||
@@ -352,7 +350,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
.getInstance().initManager(this);
|
||||
}
|
||||
|
||||
Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
CallerLogger.INSTANCE.i(M_MAIN+TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.CommonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -47,7 +48,7 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
|
||||
private static class IntentWrapper {
|
||||
public Intent mIntent;
|
||||
public long mDelay = 0L;
|
||||
public long mDelay;
|
||||
|
||||
public IntentWrapper(Intent intent, long delay) {
|
||||
this.mIntent = intent;
|
||||
@@ -118,7 +119,7 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
handleSwitch2Action(target);
|
||||
break;
|
||||
case "/main/share":
|
||||
Logger.d(TAG, "收到打开分享框的scheme,准备打开分享框");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "收到打开分享框的scheme,准备打开分享框");
|
||||
// Map<String, Object> properties = new HashMap<>();
|
||||
// properties.put("from", "1");
|
||||
// mApis.getAnalyticsApi().track("v2x_share_click", properties);
|
||||
@@ -146,7 +147,7 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
return;
|
||||
}
|
||||
Log.d("语音打开事件面板type", type);
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "语音打开事件面板" + type);
|
||||
switch (type) {
|
||||
case TYPE_LAUNCH:
|
||||
handleLaunchIntent(target);
|
||||
@@ -179,7 +180,7 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
* 语音打开事件面板
|
||||
* */
|
||||
private void handleShowEventPanel(int item) {
|
||||
Logger.d(TAG, "语音打开事件面板" + item);
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "语音打开事件面板" + item);
|
||||
//mApis.getEventPanelManager().showPanelWithSelectedItem(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.main.cards;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -9,11 +11,11 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.main.MainActivity;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.eagle.core.function.main.MainActivity;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -34,17 +36,17 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
private MainActivity mActivity;
|
||||
private Application mApp;
|
||||
|
||||
private Map< MogoModule, IMogoModuleProvider > mModuleProviders = new HashMap<>();
|
||||
private Map<MogoModule, IMogoModuleProvider> mModuleProviders = new HashMap<>();
|
||||
// 空间换效率
|
||||
private Map< String, IMogoModuleProvider > mModuleNameProviders = new HashMap<>();
|
||||
private Map<String, IMogoModuleProvider> mModuleNameProviders = new HashMap<>();
|
||||
|
||||
// 架构升级后的加载功能模块的方式
|
||||
private Map< MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
|
||||
private Map< String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
|
||||
private Map<MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
|
||||
private Map<String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
|
||||
|
||||
// 架构升级后的加载功能模块的方式
|
||||
private Map< MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
|
||||
private Map< String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
|
||||
private Map<MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
|
||||
private Map<String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
|
||||
|
||||
private static volatile MogoModulesManager sInstance;
|
||||
|
||||
@@ -52,9 +54,9 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
}
|
||||
|
||||
public static MogoModulesManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoModulesManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoModulesManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoModulesManager();
|
||||
}
|
||||
}
|
||||
@@ -66,9 +68,9 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void init( MainActivity activity ) {
|
||||
if ( activity == null ) {
|
||||
throw new NullPointerException( "activity can't be null." );
|
||||
public void init(MainActivity activity) {
|
||||
if (activity == null) {
|
||||
throw new NullPointerException("activity can't be null.");
|
||||
}
|
||||
this.mActivity = activity;
|
||||
mApp = mActivity.getApplication();
|
||||
@@ -84,14 +86,14 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
@Override
|
||||
public void loadModules() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModules();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMogoModuleProvider provider = load( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleProviders.put( module, provider );
|
||||
mModuleNameProviders.put( module.getName(), provider );
|
||||
final List<MogoModule> modules = MogoModulePaths.getModules();
|
||||
if (modules != null && !modules.isEmpty()) {
|
||||
for (MogoModule module : modules) {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
|
||||
IMogoModuleProvider provider = load(module.getPath());
|
||||
if (provider != null) {
|
||||
mModuleProviders.put(module, provider);
|
||||
mModuleNameProviders.put(module.getName(), provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,14 +101,14 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
@Override
|
||||
public void loadFunctionModules() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModuleFunctions();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMoGoFunctionProvider provider = loadFunction( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleFunctionProviders.put( module, provider );
|
||||
mModuleNameFunctionProviders.put( module.getName(), provider );
|
||||
final List<MogoModule> modules = MogoModulePaths.getModuleFunctions();
|
||||
if (modules != null && !modules.isEmpty()) {
|
||||
for (MogoModule module : modules) {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
|
||||
IMoGoFunctionProvider provider = loadFunction(module.getPath());
|
||||
if (provider != null) {
|
||||
mModuleFunctionProviders.put(module, provider);
|
||||
mModuleNameFunctionProviders.put(module.getName(), provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,14 +116,14 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
@Override
|
||||
public void loadFunctionModulesServer() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModuleFunctionServers();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMoGoFunctionServerProvider provider = loadFunctionServer( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleFunctionServerProviders.put( module, provider );
|
||||
mModuleNameFunctionServerProviders.put( module.getName(), provider );
|
||||
final List<MogoModule> modules = MogoModulePaths.getModuleFunctionServers();
|
||||
if (modules != null && !modules.isEmpty()) {
|
||||
for (MogoModule module : modules) {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
|
||||
IMoGoFunctionServerProvider provider = loadFunctionServer(module.getPath());
|
||||
if (provider != null) {
|
||||
mModuleFunctionServerProviders.put(module, provider);
|
||||
mModuleNameFunctionServerProviders.put(module.getName(), provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,124 +131,124 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
@Override
|
||||
public void loadBaseModule() {
|
||||
List< MogoModule > baseModules = MogoModulePaths.getBaseModules();
|
||||
for ( MogoModule baseModule : baseModules ) {
|
||||
if ( baseModule == null ) {
|
||||
List<MogoModule> baseModules = MogoModulePaths.getBaseModules();
|
||||
for (MogoModule baseModule : baseModules) {
|
||||
if (baseModule == null) {
|
||||
continue;
|
||||
}
|
||||
Logger.d( TAG, "加载基本模块:%s", baseModule.getPath() );
|
||||
loadBaseProvider( baseModule.getPath() );
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块 : " + baseModule.getPath());
|
||||
loadBaseProvider(baseModule.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private IProvider loadBaseProvider(String path ) {
|
||||
private IProvider loadBaseProvider(String path) {
|
||||
try {
|
||||
return ( IProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
return (IProvider) ARouter.getInstance().build(path).navigation(getContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMogoModuleProvider load( String path ) {
|
||||
private IMogoModuleProvider load(String path) {
|
||||
try {
|
||||
return ( IMogoModuleProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
return (IMogoModuleProvider) ARouter.getInstance().build(path).navigation(getContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMoGoFunctionProvider loadFunction( String path ) {
|
||||
private IMoGoFunctionProvider loadFunction(String path) {
|
||||
try {
|
||||
return ( IMoGoFunctionProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
return (IMoGoFunctionProvider) ARouter.getInstance().build(path).navigation(getContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMoGoFunctionServerProvider loadFunctionServer(String path ) {
|
||||
private IMoGoFunctionServerProvider loadFunctionServer(String path) {
|
||||
try {
|
||||
return ( IMoGoFunctionServerProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
return (IMoGoFunctionServerProvider) ARouter.getInstance().build(path).navigation(getContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void addFragment( IMogoModuleProvider provider, int containerId ) {
|
||||
if ( provider == null ) {
|
||||
Logger.e( TAG, "add fragment fail cause provider == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) );
|
||||
private void addFragment(IMogoModuleProvider provider, int containerId) {
|
||||
if (provider == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause provider == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
return;
|
||||
}
|
||||
Fragment fragment = null;
|
||||
fragment = mActivity.getSupportFragmentManager().findFragmentByTag( provider.getModuleName() );
|
||||
if ( fragment == null ) {
|
||||
fragment = provider.createFragment( getContext(), null );
|
||||
fragment = mActivity.getSupportFragmentManager().findFragmentByTag(provider.getModuleName());
|
||||
if (fragment == null) {
|
||||
fragment = provider.createFragment(getContext(), null);
|
||||
}
|
||||
if ( fragment == null ) {
|
||||
Logger.e( TAG, "add fragment fail cause fragment == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) );
|
||||
if (fragment == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
return;
|
||||
}
|
||||
mActivity.getSupportFragmentManager().beginTransaction()
|
||||
.replace( containerId, fragment, provider.getModuleName() )
|
||||
.replace(containerId, fragment, provider.getModuleName())
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if ( mModuleNameProviders != null ) {
|
||||
Collection< IMogoModuleProvider > modules = mModuleNameProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMogoModuleProvider module : modules ) {
|
||||
if (mModuleNameProviders != null) {
|
||||
Collection<IMogoModuleProvider> modules = mModuleNameProviders.values();
|
||||
if (modules != null) {
|
||||
for (IMogoModuleProvider module : modules) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getModuleName() );
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getModuleName());
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameProviders.clear();
|
||||
}
|
||||
if ( mModuleProviders != null ) {
|
||||
if (mModuleProviders != null) {
|
||||
mModuleProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionProviders != null ) {
|
||||
Collection< IMoGoFunctionProvider > modules = mModuleFunctionProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMoGoFunctionProvider module : modules ) {
|
||||
if (mModuleFunctionProviders != null) {
|
||||
Collection<IMoGoFunctionProvider> modules = mModuleFunctionProviders.values();
|
||||
if (modules != null) {
|
||||
for (IMoGoFunctionProvider module : modules) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getFunctionName() );
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getFunctionName());
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionProviders != null ) {
|
||||
if (mModuleFunctionProviders != null) {
|
||||
mModuleFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionServerProviders != null ) {
|
||||
Collection< IMoGoFunctionServerProvider > modules = mModuleFunctionServerProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMoGoFunctionServerProvider module : modules ) {
|
||||
if (mModuleFunctionServerProviders != null) {
|
||||
Collection<IMoGoFunctionServerProvider> modules = mModuleFunctionServerProviders.values();
|
||||
if (modules != null) {
|
||||
for (IMoGoFunctionServerProvider module : modules) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getFunctionName() );
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getFunctionName());
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionServerProviders != null ) {
|
||||
if (mModuleFunctionServerProviders != null) {
|
||||
mModuleFunctionServerProviders.clear();
|
||||
}
|
||||
mActivity = null;
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
@@ -25,7 +24,6 @@ import okhttp3.RequestBody;
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckUtil implements Handler.Callback {
|
||||
private static final String TAG = "DelayCheckUtil";
|
||||
private final Handler handler = new Handler(this);
|
||||
|
||||
private static final int MSG_CHECK_NET_CONNECT_STATUS = 1001;
|
||||
@@ -51,11 +49,10 @@ public class DelayCheckUtil implements Handler.Callback {
|
||||
* 每5s检查一下网络状态,网络状态为连接状态时,开始空接口请求以及后续的参数上报
|
||||
*/
|
||||
public void waitingForCheck() {
|
||||
Logger.d(TAG, "waitingForCheck===");
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, FIRST_CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
private long requestTime, netDelay, requestStartSystemTime,requestEndSystem;
|
||||
private long requestTime, netDelay, requestStartSystemTime, requestEndSystem;
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
@@ -77,43 +74,40 @@ public class DelayCheckUtil implements Handler.Callback {
|
||||
}
|
||||
|
||||
private void startEmptyRequest() {
|
||||
Logger.d(TAG, "start empty request");
|
||||
requestTime = SystemClock.elapsedRealtime();
|
||||
requestStartSystemTime = System.currentTimeMillis();
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl())
|
||||
.emptyInterface().subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
requestEndSystem = System.currentTimeMillis();
|
||||
netDelay = SystemClock.elapsedRealtime() - requestTime;
|
||||
startUpload();
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
requestEndSystem = System.currentTimeMillis();
|
||||
netDelay = SystemClock.elapsedRealtime() - requestTime;
|
||||
startUpload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startUpload() {
|
||||
Logger.d(TAG, "start upload");
|
||||
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
if (lastLocation == null) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "lastLocation: " + lastLocation);
|
||||
DelayCheckUploadRequest request = new DelayCheckUploadRequest();
|
||||
request.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
request.setStartTime(requestStartSystemTime);
|
||||
@@ -131,27 +125,26 @@ public class DelayCheckUtil implements Handler.Callback {
|
||||
.create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl())
|
||||
.uploadDelayCheckData(params).observeOn(Schedulers.io()).subscribeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<DelayCheckResponse>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(DelayCheckResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "上报时延成功 " + o);
|
||||
DelayCheckResult result = o.getResult();
|
||||
if(result.isNecessary()) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(DelayCheckResponse o) {
|
||||
super.onSuccess(o);
|
||||
DelayCheckResult result = o.getResult();
|
||||
if (result.isNecessary()) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.mogo.eagle.core.function.main.monitoring;
|
||||
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -33,10 +35,10 @@ public class VehicleMonitoring implements Handler.Callback {
|
||||
|
||||
public void vehicleCheck() {
|
||||
if (AutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
Log.d(TAG, "自动驾驶中...");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "自动驾驶中...");
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
|
||||
} else {
|
||||
Log.d(TAG, "非自动驾驶状态");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "非自动驾驶状态");
|
||||
//非自动驾驶状态只展示一次
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY);
|
||||
}
|
||||
@@ -61,7 +63,7 @@ public class VehicleMonitoring implements Handler.Callback {
|
||||
}
|
||||
|
||||
public void vehicleMonitor() {
|
||||
Log.d(TAG, "vehicleMonitor");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "vehicleMonitor");
|
||||
CallerCheckManager.checkMonitor(mContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.main.service;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
@@ -10,16 +12,16 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.main.EventDispatchCenter;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil;
|
||||
import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.eagle.core.function.main.EventDispatchCenter;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil;
|
||||
import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
|
||||
public
|
||||
@@ -42,11 +44,11 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Logger.d(TAG, "基本服务启动");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "基本服务启动");
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
initAndStartLocation();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Logger.d(TAG, "5秒已过,启动基础服务……");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "5秒已过,启动基础服务……");
|
||||
loadBaseModules();
|
||||
initADAS();
|
||||
initGpsSimulatorListener();
|
||||
@@ -73,7 +75,7 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
}
|
||||
|
||||
private void initAndStartLocation() {
|
||||
Logger.d(TAG, "开始定位");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "开始定位");
|
||||
if (mServiceApis != null) {
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||
mLocationClient.addLocationListener(this);
|
||||
@@ -85,12 +87,12 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
* 初始化自车定位监听
|
||||
*/
|
||||
private void initGpsSimulatorListener() {
|
||||
Logger.d(TAG, "注册自车位置监听");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "注册自车位置监听");
|
||||
MogoCarLocationChangedListenerRegister.getInstance().registerCarLocationChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d(TAG, "加载基本模块");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块");
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mogo.eagle.core.function.main.windowview;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,7 +18,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
*/
|
||||
public class FloatingViewHandler {
|
||||
|
||||
private static final String TAG = "WindowViewHandler";
|
||||
private static final String TAG = "FloatingViewHandler";
|
||||
|
||||
/**
|
||||
* 上次显示的优先级
|
||||
@@ -38,11 +40,11 @@ public class FloatingViewHandler {
|
||||
|
||||
private static FrameLayout sFloatingLayout = null;
|
||||
|
||||
public static void init( FrameLayout frameLayout ) {
|
||||
public static void init(FrameLayout frameLayout) {
|
||||
sFloatingLayout = frameLayout;
|
||||
}
|
||||
|
||||
public static void clear(){
|
||||
public static void clear() {
|
||||
sFloatingLayout = null;
|
||||
}
|
||||
|
||||
@@ -54,20 +56,20 @@ public class FloatingViewHandler {
|
||||
* @param y
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
public static void addView(View view, int x, int y, boolean movable) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
if (sFloatingLayout == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.leftMargin = x;
|
||||
params.topMargin = y;
|
||||
sFloatingLayout.addView( view, params );
|
||||
sFloatingLayout.addView(view, params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,16 +79,16 @@ public class FloatingViewHandler {
|
||||
* @param params
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
public static void addView(View view, FrameLayout.LayoutParams params, boolean movable) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
if (sFloatingLayout == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.addView( view, params );
|
||||
sFloatingLayout.addView(view, params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,27 +100,27 @@ public class FloatingViewHandler {
|
||||
* @param y
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int priority, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
public static void addView(View view, int priority, int x, int y, boolean movable) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
if (sFloatingLayout == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
if (sView == view) {
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "改布局已添加且没有移除,不操作");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
if (sView != null) {
|
||||
if (priority < sPriority) {
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "过滤低优先级布局");
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( sView );
|
||||
sFloatingLayout.removeView(sView);
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
@@ -136,27 +138,27 @@ public class FloatingViewHandler {
|
||||
* @param params
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int priority, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
public static void addView(View view, int priority, FrameLayout.LayoutParams params, boolean movable) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
if (sFloatingLayout == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
if (sView == view) {
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "改布局已添加且没有移除,不操作");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
if (sView != null) {
|
||||
if (priority < sPriority) {
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "过滤低优先级布局");
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( sView );
|
||||
sFloatingLayout.removeView(sView);
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
@@ -165,15 +167,15 @@ public class FloatingViewHandler {
|
||||
addView();
|
||||
}
|
||||
|
||||
public static void removeView( View view ) {
|
||||
if ( sFloatingLayout == null ) {
|
||||
public static void removeView(View view) {
|
||||
if (sFloatingLayout == null) {
|
||||
return;
|
||||
}
|
||||
if ( view == null ) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( view );
|
||||
if ( sView == view ) {
|
||||
sFloatingLayout.removeView(view);
|
||||
if (sView == view) {
|
||||
sView = null;
|
||||
sPriority = Integer.MIN_VALUE;
|
||||
sMovable = false;
|
||||
@@ -182,34 +184,34 @@ public class FloatingViewHandler {
|
||||
}
|
||||
|
||||
private static void addView() {
|
||||
if ( sView == null ) {
|
||||
if (sView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = sParams;
|
||||
if ( params == null ) {
|
||||
params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
if (params == null) {
|
||||
params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.leftMargin = sX;
|
||||
params.topMargin = sY;
|
||||
}
|
||||
sFloatingLayout.addView( sView, params );
|
||||
sFloatingLayout.addView(sView, params);
|
||||
}
|
||||
|
||||
public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) {
|
||||
if ( view == null ) {
|
||||
public static void attachMovementEvent(View view, WindowManager.LayoutParams params) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
view.setOnTouchListener( ( v, event ) -> {
|
||||
view.setOnTouchListener((v, event) -> {
|
||||
DispatchTouchEventWrapper.getInstance()
|
||||
.attach( view, params )
|
||||
.handle( event );
|
||||
.attach(view, params)
|
||||
.handle(event);
|
||||
return false;
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
public static void setVisible( boolean visible ) {
|
||||
if ( sFloatingLayout != null ) {
|
||||
sFloatingLayout.setVisibility( visible ? View.VISIBLE : View.INVISIBLE );
|
||||
public static void setVisible(boolean visible) {
|
||||
if (sFloatingLayout != null) {
|
||||
sFloatingLayout.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user