fix: 去除每次首页启动时的 是否主屏幕 应用的检查;

refactor: 开机广播 manifest xml中配置修改;
This commit is contained in:
aibingbing
2023-05-08 16:31:56 +08:00
committed by yangyakun
parent b9a721faee
commit d924f2f746
3 changed files with 52 additions and 4 deletions

View File

@@ -32,6 +32,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application>
@@ -69,8 +70,6 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER_APP" />
<category android:name="android.intent.category.DEFAULT" />
<!--调试用暂时开启LAUNCHER这个属性-->
<category android:name="android.intent.category.HOME" />
</intent-filter>
<intent-filter>
<data
@@ -180,5 +179,14 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name="com.mogo.eagle.core.function.hmi.receiver.BootCompleteReceiver"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.hmi.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.eagle.core.utilcode.util.AppUtils
/**
* 开机启动广播
*/
class BootCompleteReceiver : BroadcastReceiver() {
val TAG = "BootCompleteReceiver"
override fun onReceive(context: Context, intent: Intent) {
if (Intent.ACTION_BOOT_COMPLETED == intent.action) {
Log.d(TAG, "ACTION_BOOT_COMPLETED")
val packageName = AppUtils.getAppPackageName()
AppUtils.launchApp(packageName)
}
}
}

View File

@@ -27,8 +27,8 @@ import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils;
import com.rousetime.android_startup.model.CostTimesModel;
import com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
@@ -49,6 +49,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
private final static Handler handlerV2XEvent = new Handler();
private static Runnable runnableV2XEvent;
private static long lastKeyDownTimeMillis;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -59,7 +61,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void onResume() {
super.onResume();
ActivityUtils.setDefaultL(this);
//ActivityUtils.setDefaultL(this);
}
@Override
@@ -185,9 +187,25 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
long currentTimeMillis = System.currentTimeMillis();
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (currentTimeMillis - lastKeyDownTimeMillis < 2000) {
finish();
System.exit(0);
} else {
ToastUtils.showLong(R.string.hint_exit_app_again);
lastKeyDownTimeMillis = System.currentTimeMillis();
}
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
/**
* 魔方按键分发
*