其他分享
首页 > 其他分享> > mt8788 android 9.0 通过包名启动APK

mt8788 android 9.0 通过包名启动APK

作者:互联网

假设底层提供的键值是F3

+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -6489,9 +6524,29 @@ public class PhoneWindowManager implements WindowManagerPolicy {

+            case KeyEvent.KEYCODE_F3:{
+                               if(down)
+                               {
+                                       ActivityManager manager = (ActivityManager)mContext.getSystemService(Context.ACTIVITY_SERVICE);
+                                       ActivityManager.RunningTaskInfo info = manager.getRunningTasks(1).get(0);
+                                       String packageName = info.topActivity.getPackageName();
+                                       if(packageName!=null&&!packageName.equals("com.wzict.tacticalsystem")){
+                                               Intent mintent = new Intent();
+                                               ComponentName componentName = new ComponentName("com.wzict.tacticalsystem","com.wzict.tacticalsystem.activity.FirstActivity");
+                                               mintent.setComponent(componentName);
+                                               mintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                                               mContext.startActivity(mintent);
+                                       }
+                               }
+                               break;
+                       }

标签:包名,ActivityManager,mintent,wzict,tacticalsystem,APK,mt8788,Intent,com
来源: https://blog.csdn.net/woaiminghui/article/details/117069950