diff --git a/app/build.gradle b/app/build.gradle index adeb8928dd..ec88716351 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,6 +16,11 @@ if (!isAndroidTestBuild()) { logLevel "DEBUG" } } + +if (!isAndroidTestBuild()) { + apply plugin: 'bytex.notsticky.service' +} + if (!isAndroidTestBuild()) { apply plugin: 'chain.log.hook' hooklog{ diff --git a/build.gradle b/build.gradle index f43f1ad7f0..b0159371cc 100644 --- a/build.gradle +++ b/build.gradle @@ -35,6 +35,7 @@ buildscript { classpath 'com.mogo.thread.opt:plg:2.1.5' 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' // classpath ("com.tencent.matrix:matrix-gradle-plugin:0.6.6") { changing = true } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt index 88e1bf6b31..2dc8c466e2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt @@ -2,10 +2,11 @@ package com.mogo.eagle.core.function.hmi.ui.tools import android.annotation.SuppressLint import android.content.Context +import android.content.Intent import android.graphics.Color import android.graphics.drawable.ColorDrawable +import android.os.Process import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.view.View import android.widget.FrameLayout @@ -29,6 +30,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler import kotlinx.android.synthetic.main.view_auto_pilot_check.view.* import mogo.telematics.pad.MessagePad import org.greenrobot.eventbus.EventBus +import kotlin.system.exitProcess /** * @author ChenFufeng @@ -97,6 +99,9 @@ class AutoPilotAndCheckView @JvmOverloads constructor( ivCloseIcon.setOnClickListener { clickListener?.onClose(it) } + rlKillLayout.setOnClickListener { + killApp() + } viewCheckStatus.setOnClickListener { clickListener?.go2CheckPage() } @@ -170,6 +175,16 @@ class AutoPilotAndCheckView @JvmOverloads constructor( } } + private fun killApp() { + Intent(Intent.ACTION_MAIN).apply { + addCategory(Intent.CATEGORY_HOME) + flags = Intent.FLAG_ACTIVITY_NEW_TASK + context.startActivity(this) + Process.killProcess(Process.myPid()) + exitProcess(0) + } + } + fun setClickListener(clickListener: ClickListener) { this.clickListener = clickListener } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java index 3e9ac110d3..c8c2bd0bad 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java @@ -67,7 +67,7 @@ class MogoMainService extends Service implements IMogoLocationListener { @Override public int onStartCommand(Intent intent, int flags, int startId) { - return START_STICKY; + return START_NOT_STICKY; } private void initAndStartLocation() { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/close_nor.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/close_nor.png new file mode 100644 index 0000000000..2e2017cb27 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/close_nor.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml index 1173d0e572..88f719956b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml @@ -107,6 +107,31 @@ android:textSize="32px" /> + + + + + + +