diff --git a/app/build.gradle b/app/build.gradle index 5da6dde1f4..3a14cfac1c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,6 +36,15 @@ if (!isAndroidTestBuild()) { apply plugin: 'apm-plugin' } +if (!isAndroidTestBuild()) { + apply plugin: 'bytex.threadOpt' + thread_opt { + enable !isReleaseBuild + enableInDebug !isReleaseBuild + logLevel "DEBUG" + } +} + if (!isAndroidTestBuild()) { apply plugin: 'LancetX' LancetX { @@ -281,6 +290,10 @@ dependencies { androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core androidTestImplementation rootProject.ext.dependencies.localbroadcastmanager androidTestImplementation rootProject.ext.dependencies.mogo_v2x + + if (isAndroidTestBuild()) { + implementation "com.mogo.thread.opt:lib:${THREAD_OPT_VERSION}" + } } if (!isAndroidTestBuild()) { diff --git a/build.gradle b/build.gradle index baa9304574..0eb109a8a4 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,7 @@ buildscript { classpath "com.mogo.cloud:hook:${HOOK_LOG_VERSION}" classpath "com.mogo.cloud:bizconfig:${BIZCONFIG_VERSION}" classpath 'com.volcengine:apm_insight_plugin:1.4.1' + classpath "com.mogo.thread.opt:plg:${THREAD_OPT_VERSION}" classpath 'com.mogo.cloud:systrace:1.0.1' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18' classpath 'com.mogo.sticky:service:1.0.8' diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java index deb9940ad2..f2bf122979 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java @@ -212,29 +212,29 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis @Override public boolean onKeyDown(int keyCode, KeyEvent event) { -// if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { //向上长按 开启自动驾驶 -// long currentTime = System.currentTimeMillis() / (1000); -// long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_up", 0); -//// Log.d("liyz", "time = " + (currentTime - oldTime)); -// if (currentTime - oldTime > 6) { -// SharedPrefsMgr.getInstance(getContext()).putLong("old_time_up", System.currentTimeMillis() / 1000); -//// ToastUtils.showShort("长按 ↑↑↑ 开启自动驾驶"); -//// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true); -// CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters()); -// -// } -// -// return true; -// } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { //下和中间键盘长按,减速为-2 -// long currentTime = System.currentTimeMillis() / (1000); -// long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_down", 0); -// if (currentTime - oldTime > 6) { -// SharedPrefsMgr.getInstance(getContext()).putLong("old_time_down", System.currentTimeMillis() / 1000); -//// ToastUtils.showShort("长按 ↓↓↓ 减速 -2 "); -// sendAcc(true, -2); -// } -// return true; -// } + if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { //向上长按 开启自动驾驶 + long currentTime = System.currentTimeMillis() / (1000); + long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_up", 0); +// Log.d("liyz", "time = " + (currentTime - oldTime)); + if (currentTime - oldTime > 6) { + SharedPrefsMgr.getInstance(getContext()).putLong("old_time_up", System.currentTimeMillis() / 1000); +// ToastUtils.showShort("长按 ↑↑↑ 开启自动驾驶"); +// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true); + CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters()); + + } + + return true; + } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { //下和中间键盘长按,减速为-2 + long currentTime = System.currentTimeMillis() / (1000); + long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_down", 0); + if (currentTime - oldTime > 6) { + SharedPrefsMgr.getInstance(getContext()).putLong("old_time_down", System.currentTimeMillis() / 1000); +// ToastUtils.showShort("长按 ↓↓↓ 减速 -2 "); + sendAcc(true, -2); + } + return true; + } // Log.e("liyz", "onKeyDown keyCode = " + keyCode + "--action = " + event.getAction() + "---" + event); return super.onKeyDown(keyCode, event);