Merge branch 'renwj/feature_6.3.0' into dev_robotaxi-d_240227_6.3.0

This commit is contained in:
renwj
2024-02-28 19:37:51 +08:00
16 changed files with 348 additions and 221 deletions

View File

@@ -243,6 +243,8 @@ dependencies {
compileOnly rootProject.ext.dependencies.google_auto_service
compileOnly rootProject.ext.dependencies.apm_insight
compileOnly rootProject.ext.dependencies.serialport
}
// implementation rootProject.ext.dependencies.mogocustommap

View File

@@ -1,88 +1,61 @@
//package com.mogo.functions.test
//
//import android.util.*
//import androidx.test.core.app.*
//import androidx.test.ext.junit.runners.*
//import androidx.test.filters.*
//import androidx.test.platform.app.InstrumentationRegistry
//import com.mogo.eagle.core.function.hmi.ui.*
//import com.mogo.eagle.core.function.main.*
//import com.mogo.eagle.core.utilcode.util.*
//import kotlinx.coroutines.*
//import org.junit.*
//import org.junit.runner.*
//import java.util.concurrent.*
//import java.util.concurrent.TimeUnit.MILLISECONDS
//import kotlin.Result
//
//@RunWith(AndroidJUnit4::class)
//@LargeTest
//class ApkInstallerTest {
//
//
// lateinit var launch: ActivityScenario<MainLauncherActivity>
//
// @Before
// fun before() {
// launch = ActivityScenario.launch(MainLauncherActivity::class.java)
// }
//
// @Test
// fun testInstall(): Unit = runBlocking {
// Log.d("RWJ", "wait fragment show ...")
// val f = ensureMoGoHmiFragmentShow()
// Log.d("RWJ", "fragment showed, delay 10s ...")
// delay(10000)
//
// Log.d("RWJ", "10s end, start install ...")
// val context = InstrumentationRegistry.getInstrumentation().context
// ApkInstaller.installApp(f.requireContext(), context.assets.open("190000013.apk")) { code, msg ->
// Log.d("RWJ", "code: $code, msg: $msg")
// }
// Log.d("RWJ", "开始延时10分钟....")
// delay(TimeUnit.MINUTES.toMillis(10))
// Log.d("RWJ", "延时10分钟结束....")
// }
//
//
// @Test
// fun testInstall2(): Unit = runBlocking {
// Log.d("RWJ", "wait fragment show ...")
// val f = ensureMoGoHmiFragmentShow()
// Log.d("RWJ", "fragment showed, delay 10s ...")
// delay(10000)
//
// Log.d("RWJ", "10s end, start install ...")
// val context = InstrumentationRegistry.getInstrumentation().context
// ApkInstaller.installApp(f.requireContext(), context.assets.open("HelloActivity.zip")) { code, msg ->
// Log.d("RWJ", "code: $code, msg: $msg")
// }
// Log.d("RWJ", "开始延时10分钟....")
// delay(TimeUnit.MINUTES.toMillis(10))
// Log.d("RWJ", "延时10分钟结束....")
// }
//
// private suspend fun ensureMoGoHmiFragmentShow(): MoGoHmiFragment = suspendCancellableCoroutine {
// launch.onActivity { itx ->
// val executor = Executors.newSingleThreadScheduledExecutor()
// executor.scheduleAtFixedRate({
// var find =
// itx.supportFragmentManager.fragments.find { it is MoGoHmiFragment } as? MoGoHmiFragment
// while (find == null) {
// find =
// itx.supportFragmentManager.fragments.find { it is MoGoHmiFragment } as? MoGoHmiFragment
// }
// while (!find.isResumed) {
// Thread.sleep(500)
// }
// it.resumeWith(Result.success(find))
// try {
// Thread.sleep(500)
// executor.shutdownNow()
// } catch (e: Throwable) {
// e.printStackTrace()
// }
// }, 50, 500, MILLISECONDS)
// }
// }
//}
package com.mogo.functions.test
import android.util.*
import androidx.test.core.app.*
import androidx.test.ext.junit.runners.*
import androidx.test.filters.*
import androidx.test.platform.app.InstrumentationRegistry
import com.mogo.eagle.core.function.hmi.ui.*
import com.mogo.eagle.core.function.main.*
import com.mogo.eagle.core.utilcode.util.*
import kotlinx.coroutines.*
import org.junit.*
import org.junit.runner.*
import java.io.File
import java.util.concurrent.*
@RunWith(AndroidJUnit4::class)
@LargeTest
class ApkInstallerTest {
lateinit var launch: ActivityScenario<MainLauncherActivity>
@Before
fun before() {
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
}
@Test
fun testInstall(): Unit = runBlocking {
Log.d("RWJ", "wait fragment show ...")
Log.d("RWJ", "fragment showed, delay 10s ...")
delay(10000)
Log.d("RWJ", "10s end, start install ...")
val context = InstrumentationRegistry.getInstrumentation().context
val targetContext = InstrumentationRegistry.getInstrumentation().targetContext
val outFile = File(targetContext.getExternalFilesDir(null), "temp.apk")
val os = outFile.outputStream()
try {
Log.d("RWJ", "将assets目录下的apk文件copy到应用私有目录...")
context.assets.open("HelloActivity.zip").use {
it.copyTo(os)
}
Log.d("RWJ", "copy操作完成")
} finally {
try {
os.close()
} catch (t: Throwable) {
t.printStackTrace()
}
}
Log.d("RWJ", "开始安装...")
ApkInstaller.installApp(targetContext, outFile) { code, msg ->
Log.d("RWJ", "code: $code, msg: $msg")
}
Log.d("RWJ", "开始延时10分钟....")
delay(TimeUnit.MINUTES.toMillis(10))
Log.d("RWJ", "延时10分钟结束....")
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.launcher.lancet.jank.compiler;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.Fragment;
import android.app.Service;
import android.content.BroadcastReceiver;
@@ -16,11 +17,17 @@ import android.view.View;
import android.view.ViewManager;
import android.widget.Toast;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.iflytek.speech.GrammarListener;
import com.iflytek.speech.aidl.IWakeuper;
import com.knightboost.lancet.api.synchronized_lock.ISynchronizedLockHooker;
import com.mogo.core.lancetx.compiler.lib.annotations.LancetXGenerator;
import com.mogo.core.lancetx.compiler.lib.generator.HookType;
import com.mogo.core.lancetx.compiler.lib.generator.Scope;
import com.mogo.core.lancetx.compiler.lib.generator.Type;
import com.mogo.support.serialport.common.core.ICoreBinder;
import com.zhjt.mogo_core_function_devatools.monitor.remote.IUserInterface;
import java.io.File;
import java.io.InputStream;
@@ -412,4 +419,132 @@ class JankPointAutoGenerator {
hookAllPublicMethods = true
)
private BitmapFactory factory;
@LancetXGenerator(
group = "main_block_check",
type = Type.OTHER,
scope = Scope.SELF,
hookType = HookType.REPLACE_INVOKE,
hookAllPublicMethods = true,
onlyHookMethodNames = {
"getConstructors",
"getDeclaredConstructors",
"getFields",
"getDeclaredFields",
"getMethods",
"getDeclaredMethods",
"getAnnotations",
"getDeclaredAnnotations",
"getClasses",
"getDeclaredClasses",
"getMethod",
"getDeclaredMethod",
"getField",
"getDeclaredField",
"getConstructor",
"getDeclaredConstructor"
},
onlyHookMethodDescs = {
"()[Ljava/lang/reflect/Constructor;",
"()[Ljava/lang/reflect/Constructor;",
"()[Ljava/lang/reflect/Field;",
"()[Ljava/lang/reflect/Field;",
"()[Ljava/lang/reflect/Method;",
"()[Ljava/lang/reflect/Method;",
"()[Ljava/lang/annotation/Annotation;",
"()[Ljava/lang/annotation/Annotation;",
"()[Ljava/lang/Class;",
"()[Ljava/lang/Class;",
"(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;",
"(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;",
"(Ljava/lang/String;)Ljava/lang/reflect/Field;",
"(Ljava/lang/String;)Ljava/lang/reflect/Field;",
"([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;",
"([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;"
}
)
private Class clazz;
@LancetXGenerator(
group = "main_block_check",
type = Type.OTHER,
scope = Scope.SELF,
hookType = HookType.REPLACE_INVOKE,
hookAllPublicMethods = true
)
private Gson gson;
@LancetXGenerator(
group = "main_block_check",
type = Type.OTHER,
scope = Scope.SELF,
hookType = HookType.REPLACE_INVOKE,
hookAllPublicMethods = true,
onlyHookMethodNames = {
"getObject",
"getObject",
"getObject",
"toJavaObject",
"toJavaObject"
},
onlyHookMethodDescs = {
"(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;",
"(Ljava/lang/String;Ljava/lang/reflect/Type;)Ljava/lang/Object;",
"(Ljava/lang/String;Lcom/alibaba/fastjson/TypeReference;)Ljava/lang/Object;",
"(Ljava/lang/Class;)Ljava/lang/Object;",
"(Ljava/lang/Class;Lcom/alibaba/fastjson/parser/ParserConfig;I)Ljava/lang/Object;"
}
)
private JSONObject fastJson;
@LancetXGenerator(
group = "main_block_check",
type = Type.IPC,
scope = Scope.SELF,
hookType = HookType.REPLACE_INVOKE,
hookAllPublicMethods = true
)
private IUserInterface userInterface;
@LancetXGenerator(
group = "main_block_check",
type = Type.IPC,
scope = Scope.SELF,
hookType = HookType.REPLACE_INVOKE,
hookAllPublicMethods = true
)
private ICoreBinder coreBinder;
@LancetXGenerator(
group = "main_block_check",
type = Type.IPC,
scope = Scope.SELF,
hookType = HookType.REPLACE_INVOKE,
hookAllPublicMethods = true
)
private IWakeuper wakeuper;
@LancetXGenerator(
group = "main_block_check",
type = Type.IPC,
scope = Scope.SELF,
hookType = HookType.REPLACE_INVOKE,
hookAllPublicMethods = true
)
private GrammarListener clientGrammarListener;
@LancetXGenerator(
group = "main_block_check",
type = Type.IPC,
scope = Scope.SELF,
hookType = HookType.REPLACE_INVOKE,
hookAllPublicMethods = true
)
private AlarmManager alarmManager;
}

View File

@@ -3,7 +3,6 @@ package com.mogo.launcher.lancet.jank.spi
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.os.SystemClock
import com.google.auto.service.AutoService
import com.mogo.eagle.core.block.runtime.config.recorder.IMessageRecorder
import com.mogo.eagle.core.block.runtime.utils.TimeUtils.Companion.now
@@ -25,7 +24,7 @@ class HandlerHookerImpl : IHandlerHooker {
private var dispatchTime = 0L
override fun onMessageDispatchAfter(msg: Message) {
override fun onMessageDispatchAfter(msg: Message, isAsync: Boolean) {
if (msg.target.looper != mainLooper) {
return
}
@@ -33,87 +32,87 @@ class HandlerHookerImpl : IHandlerHooker {
return
}
val duration = now() - dispatchTime
checkIfNeed(msg.target)?.recycle(Msg.acquire(msg.target, msg = msg, duration = duration, elapsed = SystemClock.uptimeMillis() - msg.`when`, enqueue = msg.`when`))
checkIfNeed(msg.target)?.recycle(Msg.acquire(msg.target, msg = msg, duration = duration, isAsync = isAsync))
}
override fun onMessageDispatchBefore(msg: Message) {
override fun onMessageDispatchBefore(msg: Message, isAsync: Boolean) {
if (msg.target.looper != mainLooper) {
return
}
dispatchTime = now()
}
override fun onRemoveCallbacks(handler: Handler, action: Runnable) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, action = action))
override fun onRemoveCallbacks(handler: Handler, action: Runnable, isAsync: Boolean) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, action = action, isAsync = isAsync))
}
override fun onRemoveCallbacksAndMessages(handler: Handler, token: Any?) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, obj = token))
override fun onRemoveCallbacksAndMessages(handler: Handler, token: Any?, isAsync: Boolean) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, obj = token, isAsync = isAsync))
}
override fun onRemoveCallbacksWithToken(handler: Handler, action: Runnable, token: Any?) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, action = action, obj = token))
override fun onRemoveCallbacksWithToken(handler: Handler, action: Runnable, token: Any?, isAsync: Boolean) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, action = action, obj = token, isAsync = isAsync))
}
override fun onRemoveMessages(handler: Handler, what: Int) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, what = what))
override fun onRemoveMessages(handler: Handler, what: Int, isAsync: Boolean) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, what = what, isAsync = isAsync))
}
override fun onRemoveMessages(handler: Handler, what: Int, obj: Any?) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, what = what, obj = obj))
override fun onRemoveMessages(handler: Handler, what: Int, obj: Any?, isAsync: Boolean) {
checkIfNeed(handler)?.remove(Msg.acquire(handler, what = what, obj = obj, isAsync = isAsync))
}
override fun onPost(handler: Handler, action: Runnable) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action))
override fun onPost(handler: Handler, action: Runnable, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, isAsync = isAsync))
}
override fun onPostAtFrontQueue(handler: Handler, action: Runnable) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action))
override fun onPostAtFrontQueue(handler: Handler, action: Runnable, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, isAsync = isAsync))
}
override fun onPostAtTime(handler: Handler, action: Runnable, token: Any?, uptimeMillis: Long) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, obj = token, enqueue = uptimeMillis))
override fun onPostAtTime(handler: Handler, action: Runnable, token: Any?, uptimeMillis: Long, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, obj = token, isAsync = isAsync))
}
override fun onPostAtTime(handler: Handler, action: Runnable, uptimeMillis: Long) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, enqueue = uptimeMillis))
override fun onPostAtTime(handler: Handler, action: Runnable, uptimeMillis: Long, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, isAsync = isAsync))
}
override fun onPostDelayed(handler: Handler, action: Runnable, token: Any?, delayMillis: Long) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, obj = token, delay = delayMillis))
override fun onPostDelayed(handler: Handler, action: Runnable, token: Any?, delayMillis: Long, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, obj = token, delay = delayMillis, isAsync = isAsync))
}
override fun onPostDelayed(handler: Handler, action: Runnable, delayMillis: Long) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, delay = delayMillis))
override fun onPostDelayed(handler: Handler, action: Runnable, delayMillis: Long, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, action = action, delay = delayMillis, isAsync = isAsync))
}
override fun onSendEmptyMessage(handler: Handler, what: Int) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, what = what))
override fun onSendEmptyMessage(handler: Handler, what: Int, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, what = what, isAsync = isAsync))
}
override fun onSendEmptyMessageAtTime(handler: Handler, what: Int, uptimeMillis: Long) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, what = what, enqueue = uptimeMillis))
override fun onSendEmptyMessageAtTime(handler: Handler, what: Int, uptimeMillis: Long, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, what = what, isAsync = isAsync))
}
override fun onSendEmptyMessageDelayed(handler: Handler, what: Int, delayMillis: Long) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, what = what, delay = delayMillis))
override fun onSendEmptyMessageDelayed(handler: Handler, what: Int, delayMillis: Long, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, what = what, delay = delayMillis, isAsync = isAsync))
}
override fun onSendMessage(handler: Handler, msg: Message) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, msg, what = msg.what))
override fun onSendMessage(handler: Handler, msg: Message, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, msg, what = msg.what, isAsync = isAsync))
}
override fun onSendMessageAtFrontOfQueue(handler: Handler, msg: Message) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, msg, what = msg.what))
override fun onSendMessageAtFrontOfQueue(handler: Handler, msg: Message, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, msg, what = msg.what, isAsync = isAsync))
}
override fun onSendMessageAtTime(handler: Handler, msg: Message, uptimeMillis: Long) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, msg = msg, enqueue = uptimeMillis))
override fun onSendMessageAtTime(handler: Handler, msg: Message, uptimeMillis: Long, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, msg = msg, isAsync = isAsync))
}
override fun onSendMessageDelayed(handler: Handler, msg: Message, delayMillis: Long) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, msg = msg, delay = delayMillis))
override fun onSendMessageDelayed(handler: Handler, msg: Message, delayMillis: Long, isAsync: Boolean) {
checkIfNeed(handler)?.insert(Msg.acquire(handler, msg = msg, delay = delayMillis, isAsync = isAsync))
}
private fun checkIfNeed(handler: Handler?): IMessageRecorder? {

View File

@@ -2,18 +2,19 @@ package com.mogo.launcher.lancet.jank.spi;
import android.app.Activity;
import android.os.Looper;
import android.os.SystemClock;
import android.util.Log;
import com.google.auto.service.AutoService;
import com.knightboost.lancet.api.synchronized_lock.SynchronizedLockHooker;
import com.mogo.core.lancetx.compiler.lib.generator.Type;
import com.mogo.core.lancetx.compiler.lib.generator.TypeKt;
import com.mogo.core.lancetx.compiler.lib.hook.IHookInvoker;
import com.mogo.eagle.core.data.deva.chain.ChainConstant;
import com.mogo.eagle.core.function.api.devatools.block.IMoGoBlockProvider;
import com.mogo.eagle.core.function.api.devatools.perf.IMoGoCpuUsageProvider;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.main.ARouterUtils;
import com.mogo.eagle.core.utilcode.util.VLogUtils;
import com.zhjt.service.chain.ChainLog;
import java.util.concurrent.atomic.AtomicReference;
import java.lang.ref.WeakReference;
import java.util.concurrent.locks.Lock;
@@ -26,17 +27,18 @@ public class HookInvokerImpl implements IHookInvoker {
private final ThreadLocal<StringBuilder> message = new ThreadLocal<>();
private final ThreadLocal<Object> monitor = new ThreadLocal<>();
private volatile Object monitor = null;
private final AtomicReference<Thread> holder = new AtomicReference<>();
private final StringBuilder extra = new StringBuilder();
private volatile Object holder = null;
private volatile IMoGoCpuUsageProvider provider;
private volatile boolean getProviderRequested = false;
private volatile boolean isCanDump = false; // 是否可以Dump堆栈加此标记位是防止应用启动过程中由于dump主线程堆栈导致启动耗时
private String aqsInfo = null;
private String synchronizedInfo = null;
// 切记: 请勿在此方法中调用其它模块类中的api,可能会出现StackOverFlowException
@Override
@@ -59,7 +61,6 @@ public class HookInvokerImpl implements IHookInvoker {
}
}, "getProvider").start();
}
if (provider != null) {
if (isMainThread) {
provider.updateMainThreadTime();
@@ -97,10 +98,7 @@ public class HookInvokerImpl implements IHookInvoker {
private void handleAqsLockEnterBefore(boolean isMainThread, Object caller, String methodName, Object[] objects) {
if (isMainThread && caller instanceof Lock) {
if ("lock".equals(methodName) || "lockInterruptibly".equals(methodName)) {
if (extra.length() > 0) {
extra.setLength(0);
}
extra.append(caller);
aqsInfo = caller.toString();
}
}
}
@@ -111,13 +109,13 @@ public class HookInvokerImpl implements IHookInvoker {
Long start = startTime.get();
if (start != null) {
long dur = SystemClock.elapsedRealtime() - start;
handleCostTimeRecord(Type.AQS_LOCK, extra, caller, methodName, dur, objects);
handleCostTimeRecord(Type.AQS_LOCK, aqsInfo, caller, methodName, dur, objects);
}
}
}
}
private void handleCostTimeRecord(Type type, StringBuilder extra, Object caller, String methodName, long cost, Object... args) {
private void handleCostTimeRecord(Type type, String extra, Object caller, String methodName, long cost, Object... args) {
//日志打印阈值
long logThreshold = 5;
if (cost >= logThreshold) {
@@ -132,18 +130,32 @@ public class HookInvokerImpl implements IHookInvoker {
builder
.append(type)
.append("#")
.append(caller == null ? "caller is null" : caller.getClass().getName())
.append(caller == null ? "caller is null" : (caller instanceof Class ? ((Class) caller).getName() : caller.getClass().getName()))
.append("#")
.append(methodName);
if (args.length > 0) {
builder.append("#(");
}
for (Object o : args) {
if (o == null) {
continue;
if (TypeKt.isLifecycle(type) || type == Type.SYNCHRONIZED_LOCK) {
for (Object o : args) {
if (o == null) {
continue;
}
builder.append(o)
.append(",");
}
} else {
if (args.length > 0) {
for (int i = 0; i < args.length - 1; i++) {
Object o = args[i];
if (o == null) {
continue;
}
builder.append(o)
.append(",");
}
}
builder.append(o.getClass().getName())
.append(",");
}
if (args.length > 0) {
@@ -152,26 +164,17 @@ public class HookInvokerImpl implements IHookInvoker {
}
builder.append("#").append(cost);
boolean flag = false;
if (extra != null && extra.length() > 0) {
builder.append("#");
builder.append(extra);
flag = true;
}
// dump堆栈阈值
long dumpStackThreshold = 20;
if (cost >= dumpStackThreshold && isCanDump) {
builder.append("\n");
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
for (StackTraceElement trace: stackTrace) {
builder.append(trace.getClassName()).append("#").append(trace.getMethodName()).append("#").append(trace.getLineNumber()).append("\n");
if (!TypeKt.isLifecycle(type) && type != Type.SYNCHRONIZED_LOCK) {
if (args.length > 0) {
builder.append("\n");
builder.append(args[args.length - 1]);
}
builder.setLength(builder.length() - 1);
}
VLogUtils.w("HookHandler", builder.toString(), 4096);
if (flag) {
extra.setLength(0);
if (extra != null && extra.length() > 0) {
builder.append("\n").append(extra);
}
String msgBlock = builder.toString();
VLogUtils.w("HookHandler", msgBlock, 4096);
}
}
@@ -198,15 +201,6 @@ public class HookInvokerImpl implements IHookInvoker {
}
}
if ("onWindowFocusChanged".equals(methodName)) {
if (args.length > 0) {
boolean hasFocus = (boolean)args[0];
if (hasFocus && !isCanDump) {
isCanDump = true;
}
}
}
if ("onPause".equals(methodName)) {
try {
IMoGoBlockProvider block = CallerDevaToolsManager.INSTANCE.block();
@@ -233,27 +227,38 @@ public class HookInvokerImpl implements IHookInvoker {
private void handleSynchronizedLock(boolean isMainThread,Object caller, String methodName, Object [] objects) {
if (isMainThread) {
if ("onMonitorBefore".equals(methodName)) {
Object monitor = null;
Object arg0 = null;
if (objects.length > 0) {
this.monitor.set(monitor = objects[0]);
arg0 = objects[0];
}
if (arg0 == null) {
return;
}
Object wr = this.monitor;
if (!(wr instanceof WeakReference)) {
return;
}
Object watcher = ((WeakReference)wr).get();
if (watcher == null) {
return;
}
if (arg0 != watcher) {
return;
}
Thread holder = this.holder.get();
StringBuilder sb = new StringBuilder();
String invokerInfo = SynchronizedLockHooker.getInstance().getInvokerInfo();
if (monitor != null) {
sb.append("monitor::").append(monitor.getClass().getName());
}
if (holder != null) {
if (sb.length() > 0) {
sb.append("##holder::").append(holder.getName());
} else {
sb.append("holder::").append(holder);
sb.append("invoker::").append(invokerInfo).append("##").append("monitor::").append(arg0.getClass().getName());
Object hf = this.holder;
if (hf instanceof WeakReference) {
WeakReference whf = (WeakReference) hf;
Object o = whf.get();
if (o instanceof Thread) {
Thread t = (Thread) o;
sb.append("##").append(t.getName()).append("#").append(t.getId());
}
}
if (extra.length() > 0) {
extra.setLength(0);
}
extra.append(sb);
synchronizedInfo = sb.toString();
}
if ("onMonitorEnter".equals(methodName)) {
Long startTime = this.startTime.get();
@@ -261,25 +266,17 @@ public class HookInvokerImpl implements IHookInvoker {
return;
}
long cost = SystemClock.elapsedRealtime() - startTime;
handleCostTimeRecord(Type.SYNCHRONIZED_LOCK, extra, caller, methodName, cost, objects);
}
if ("onMonitorExit".equals(methodName)) {
this.monitor.remove();
handleCostTimeRecord(Type.SYNCHRONIZED_LOCK, synchronizedInfo, caller, methodName, cost, objects);
}
} else {
if ("onMonitorBefore".equals(methodName)) {
if (objects.length > 0) {
this.monitor.set(objects[0]);
this.monitor = new WeakReference<>(objects[0]);
}
}
if ("onMonitorEnter".equals(methodName)) {
holder.set(Thread.currentThread());
}
if ("onMonitorExit".equals(methodName)) {
this.monitor.remove();
holder.set(null);
this.holder = new WeakReference<>(Thread.currentThread());
}
}
}

View File

@@ -7,6 +7,7 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import android.util.StateSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -533,7 +534,7 @@ public class ViewPressedStateLancet {
}
}
} else {
states[1] = new int[] { -android.R.attr.state_pressed };
states[1] = StateSet.WILD_CARD;
colors[1] = defaultColor;
}
ColorStateList newColor = new ColorStateList(states, colors);
@@ -601,11 +602,10 @@ public class ViewPressedStateLancet {
Drawable.ConstantState constantState = old.getConstantState();
if (constantState != null) {
StateListDrawable result = new StateListDrawable();
int[] state = { -android.R.attr.state_pressed };
result.addState(state, old);
Drawable pressed = DrawableCompat.wrap(constantState.newDrawable().mutate());
pressed.setAlpha((int)(255 * alpha));
result.addState(new int[] { android.R.attr.state_pressed }, pressed);
result.addState(StateSet.WILD_CARD, old);
return result;
}
return null;

View File

@@ -34,11 +34,11 @@ buildscript {
classpath "com.mogo.cloud:systrace:${plugin_version}"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
classpath "com.mogo.sticky:service:${plugin_version}"
classpath "io.github.knight-zxw:lancet-plugin:10.60.0"
classpath "io.github.knight-zxw:lancet-plugin:${lancetx_version}"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0"
classpath 'com.mogo.cloud:matrix:1.0.2'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.4.0.2513'
classpath 'com.mogo.eagle.core.handler.proxy:plugin:1.0.0'
classpath 'com.mogo.eagle.core.handler.proxy:plugin:10.0.0'
classpath 'com.gradle:gradle-enterprise-gradle-plugin:3.15.1'
// classpath 'com.bytedance.btrace:rhea-gradle-plugin:2.0.0'
}

View File

@@ -207,11 +207,11 @@ ext {
//========================= LancetX ===================
lancetx_runtime : "io.github.knight-zxw:lancet-runtime:10.50.0",
lancetx_runtime : "io.github.knight-zxw:lancet-runtime:${lancetx_version}",
lancetx_compiler : "com.mogo.eagle.core.lancetx:compiler:1.0.10",
lancetx_compiler : "com.mogo.eagle.core.lancetx:compiler:${lancetx_version}",
lancetx_compiler_lib : "com.mogo.eagle.core.lancetx:runtime:1.0.5",
lancetx_compiler_lib : "com.mogo.eagle.core.lancetx:runtime:${lancetx_version}",
//========================= autosize ======================
androidautoSize : 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1',
@@ -231,13 +231,13 @@ ext {
passport_secret : "com.zhidaoauto:sdk-java:1.0.6-SNAPSHOT",
// 主线程卡顿监测
block_detector : "com.mogo.eagle.core.block:runtime:10.90.60",
block_detector : "com.mogo.eagle.core.block:runtime:20.0.0",
//======================== google auto-service ===============
google_auto_service : "com.google.auto.service:auto-service:1.0-rc7",
//======================== handler-proxy-runtime ==============
handler_proxy_runtime : "com.mogo.eagle.core.handler.proxy:runtime:1.0.0"
handler_proxy_runtime : "com.mogo.eagle.core.handler.proxy:runtime:10.0.0"
]
android = [
fLauncherApplicationId : "com.mogo.launcher.f",

View File

@@ -19,6 +19,8 @@ import com.mogo.eagle.core.function.angle.scenes.Default
import com.mogo.eagle.core.function.angle.scenes.RoadEvent
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.Event
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager.V2NCarTypeCheck
@@ -233,6 +235,7 @@ internal object V2NIdentifyDrawer {
object : IMoGoWarningStatusListener {
override fun onShow() {
super.onShow()
CallerHmiManager.notifyXiaoZhiStatusChanged(Event.V2N, State.START)
CallerVisualAngleManager.changeAngle(
RoadEvent(
lon,
@@ -244,6 +247,7 @@ internal object V2NIdentifyDrawer {
override fun onDismiss() {
super.onDismiss()
CallerHmiManager.notifyXiaoZhiStatusChanged(Event.V2N, State.STOP)
CallerVisualAngleManager.changeAngle(Default())
}
},

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.road;
import android.telecom.Call;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.enums.CommunicationType;
import com.mogo.eagle.core.data.enums.DataSourceType;
@@ -15,6 +17,8 @@ import com.mogo.eagle.core.data.msgbox.V2XMsg;
import com.mogo.eagle.core.function.angle.scenes.Default;
import com.mogo.eagle.core.function.angle.scenes.RoadEvent;
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.Event;
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
@@ -157,6 +161,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void onShow() {
CallerHmiManager.INSTANCE.notifyXiaoZhiStatusChanged(Event.V2N, State.START);
V2XMessageEntity<V2XRoadEventEntity> entity = getV2XMessageEntity();
if (entity != null) {
V2XRoadEventEntity content = entity.getContent();
@@ -185,6 +190,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void onDismiss() {
CallerHmiManager.INSTANCE.notifyXiaoZhiStatusChanged(Event.V2N, State.STOP);
if (isNeedChangeAngle()) {
CallerVisualAngleManager.INSTANCE.changeAngle(new Default(3, TimeUnit.SECONDS));
}

View File

@@ -28,7 +28,8 @@ internal class MoGoBlockProviderImpl: IMoGoBlockProvider, IBlockListener {
.isDebug(false)
.period(5, SECONDS)
.junkRateThreshold(0.6f)
.recorder(null, 500, 500)
.maxDuration(SECONDS.toMillis(15))
.maxCount(1000)
.build())
hasInit = true
}

View File

@@ -41,14 +41,20 @@ internal class StatusAdapter(val ctx: Context, var data: ArrayList<Status>): Rec
}
fun bind(status: Status) {
itemView.onClick {
// ToastUtils.showShort(getText(status))
if (status is OverViewStatus) {
if (status !is OverViewStatus) {
itemView.setOnClickListener(null)
itemView.isClickable = false
if (iv.drawable != null) {
iv.setImageDrawable(null)
}
} else {
if (iv.background != null) {
iv.background = null
}
itemView.onClick {
CallerHmiManager.showStatusSummaryDialog()
}
}
iv.setBackgroundResource(0)
iv.setImageDrawable(null)
when(status) {
is IpcStatus -> {
if (status.enabled) {

View File

@@ -230,7 +230,9 @@ public class RouteOverlayDrawer {
if (colors != null && !colors.isEmpty()) {
builder.colors(colors);
builder.setIsGradient(true);
builder.setLightOn(false);
builder.setLightOn(true);
builder.setLightColor(COLOR_LIGHT);
builder.setLightSpeed(0.5f);
}
}
builder.points(points);

View File

@@ -162,6 +162,7 @@ class InstallApkSessionApi: AppCompatActivity() {
// This test app isn't privileged, so the user has to confirm the install.
val confirmIntent = extras[Intent.EXTRA_INTENT] as? Intent
startActivity(confirmIntent)
finish()
}
STATUS_SUCCESS -> {
Log.i(TAG, "--- InstallApkSessionApi -- install success --")

View File

@@ -5,7 +5,8 @@ LancetX {
blackList = [
"com.mogo.launcher.lancet.jank",
"com.mogo.thread.opt.core",
"com.zhjt.mogo_core_function_devatools.perf"
"com.zhjt.mogo_core_function_devatools.perf",
"com.tencent.matrix"
]
synchronizedLock {
enabled rootProject.isJunkDetectEnable()

View File

@@ -3,5 +3,5 @@ ext {
kotlin_plugin_version = '1.5.30'
plugin_version = '10.0.10_mogo'
service_chain_version = '5.3.14'
lancetx_plugin_version = '10.0.4_mogo'
lancetx_version = '20.10.2'
}