Merge branch 'dev_robotaxi-d_231206_6.2.4' into 'master'

[6.2.4] fix bug of sound play helper , devices extends lenovo , npl of map init

See merge request SCA/L4HA/AndroidApp/MoGoEagleEye!846
This commit is contained in:
pangfan
2023-12-18 13:02:15 +00:00
7 changed files with 44 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.media.*;
import android.content.*;
import android.app.*;
import android.util.Log;
public class SoundPoolHelper {
private SoundPool mSoundPool;
@@ -38,7 +39,9 @@ public class SoundPoolHelper {
//init settings
private void init(){
// AudioManager audio settings for adjusting the volume
mAudioManager = (AudioManager)this.mContext. getSystemService(Context.AUDIO_SERVICE);
if(mAudioManager == null){
mAudioManager = (AudioManager)this.mContext. getSystemService(Context.AUDIO_SERVICE);
}
// Current volumn Index of particular stream type.
float currentVolumeIndex = (float) mAudioManager.getStreamVolume(streamType);
@@ -87,6 +90,10 @@ public class SoundPoolHelper {
//play the sound res
private void playSound(){
if(mSoundPool == null){
Log.e("SoundPoolHelper","playSound mSoundPool is null");
return;
}
float leftVolume = volume;
float rightVolume = volume;
// Play sound of gunfire. Returns the ID of the new stream.

View File

@@ -119,6 +119,11 @@ class AiRoadMarker {
countDown.incrementAndGet()
realMark(marker, wrapper, l1, l2, location.heading)
})
}else{
wrapper.onRemoved = { id ->
aiMakers.remove(id)
}
MarkerRemoveManager.addMarker(wrapper)
}
}
}

View File

@@ -22,7 +22,7 @@ import com.mogo.map.location.IMogoGDLocationClient
class MogoMapService : IMogoMapService {
override fun getMapUIController(mapTag:String): IMogoMapUIController? {
return mapInstance.getMogoMap().uiController
return mapInstance.getMogoMap()?.uiController
}
override fun getOverlayManager(): IMoGoOverlayManager {

View File

@@ -313,7 +313,7 @@ public final class DeviceUtils {
}
public static Boolean isLenovoModel(){
return getModel().contains("Lenovo");
return getModel().contains("Lenovo") || getBrand().contains("Lenovo");
}
public static Boolean isEB5Model(){
@@ -336,6 +336,16 @@ public final class DeviceUtils {
return model;
}
public static String getBrand() {
String brand = Build.BRAND;
if (brand != null) {
brand = brand.trim().replaceAll("\\s*", "");
} else {
brand = "";
}
return brand;
}
/**
* Return an ordered list of ABIs supported by this device. The most preferred ABI is the first
* element in the list.

View File

@@ -36,12 +36,12 @@ class MogoMap private constructor() {
/**
* 业务使用时根据地图是否加载来判定 是否获取IMogoMap实例
*/
fun getMogoMap(instance: String = DEFAULT): IMogoMap {
fun getMogoMap(instance: String = DEFAULT): IMogoMap? {
return if (mapCache[instance] == null) {
CallerLogger.e("$M_MAP$TAG", "getMogoMap func has error with no instance in mapCache")
mapCache[DEFAULT]!!
mapCache[DEFAULT]
} else {
mapCache[instance]!!
mapCache[instance]
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.map.identify;
import com.mogo.map.IMogoMap;
import com.mogo.map.MogoMap;
import com.mogo.map.identity.IMogoIdentifyManager;
import java.util.HashMap;
@@ -32,7 +33,10 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
@Override
public void removeMarker(String uuidString) {
try {
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).removeMarker(uuidString);
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT);
if(iMogoMap != null){
iMogoMap.removeMarker(uuidString);
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -44,7 +48,10 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
@Override
public void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList) {
try {
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).updateBatchMarkerPosition(optionsArrayList);
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT);
if(iMogoMap != null){
iMogoMap.updateBatchMarkerPosition(optionsArrayList);
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -53,7 +60,10 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
@Override
public void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList) {
try {
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).updateBatchAiMarkerPosition(optionsArrayList);
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT);
if(iMogoMap != null){
iMogoMap.updateBatchAiMarkerPosition(optionsArrayList);
}
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -28,7 +28,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
point.setOptions(options)
return key
} else {
val p = mapInstance.getMogoMap(mapTag).addPoint(options)
val p = mapInstance.getMogoMap(mapTag)?.addPoint(options)
if (p != null) {
p.onRemove { removed ->
val keys = points.filterKeys { it.id == removed }
@@ -232,7 +232,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
line.setOptions(options)
return key
} else {
val newLine = mapInstance.getMogoMap(mapTag).addLine(options)
val newLine = mapInstance.getMogoMap(mapTag)?.addLine(options)
if (newLine != null) {
newLine.onRemove { removed ->
val keys = lines.filterKeys { it.id == removed }
@@ -259,7 +259,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
private fun moveToCenter(mapTag:String, id: String, eventLon: Double, eventLat: Double, carLon: Double, carLat: Double) {
try {
mapInstance.getMogoMap(mapTag).uiController?.showBounds(
mapInstance.getMogoMap(mapTag)?.uiController?.showBounds(
id,
MogoLatLng(carLat, carLon),
listOf(MogoLatLng(eventLat, eventLon)),