安卓11客制需求:<MtkSettings:添加桌面设置,并且能够正常切换桌面APK>

编程入门 行业动态 更新时间:2024-10-28 07:32:58

安卓11客制需求:<MtkSettings:添加<a href=https://www.elefans.com/category/jswz/34/1767000.html style=桌面设置,并且能够正常切换桌面APK>"/>

安卓11客制需求:<MtkSettings:添加桌面设置,并且能够正常切换桌面APK>

需要修改的路径代码路径:vendor/mediatek/proprietary/packages/apps/MtkSettings/AndroidManifest.xml

		 <!-- 注册一个activity,用于启动 com.android.internal.app.ResolverActivity --><!-- gyh add --><activity android:name=".SetLauncherActivity"android:label="桌面设置"android:taskAffinity=""><intent-filter android:priority="1"><action android:name="com.android.settings.SETLAUNCHERACTIVITY" /><action android:name="android.settings.SETLAUNCHERACTIVITY" /><category android:name="android.intent.category.DEFAULT" /></intent-filter><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.VOICE_LAUNCH" /><category android:name="com.android.settings.SHORTCUT" /></intent-filter><intent-filter android:priority="100"><action android:name="com.android.settings.action.SETTINGS" /></intent-filter><!--此项在主setting位置(ia.homepage)  --><meta-data android:name="com.android.settings.category"android:value="com.android.settings.category.ia.homepage" /><meta-data android:name="com.android.settings.ACTIVITY_ACTION"android:value="com.android.settings.SETLAUNCHERACTIVITY" /><meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"android:value="true" /></activity><!--  end -->

SetLauncherActivity.java的路径:vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings
详细代码:

package com.android.settings;import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;public class SetLauncherActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.setLauncher);Intent intent = new Intent();intent.setAction(Intent.ACTION_MAIN);intent.addCategory(Intent.CATEGORY_HOME);intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setClassName("android","com.android.internal.app.ResolverActivity");startActivity(intent);}
}

setLauncher.xml的路径:vendor/mediatek/proprietary/packages/apps/MtkSettings/res/layout
详细代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""android:orientation="horizontal"android:layout_width="match_parent"android:layout_height="match_parent">   
</LinearLayout>

编译刷机完成之后打开设置,可以看到桌面设置菜单项

点击它


这样就完成了这个需求

更多推荐

安卓11客制需求:<MtkSettings:添加桌面设置,并且能够正常切换桌面APK>

本文发布于:2023-06-29 00:33:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/936320.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:桌面   需求   APK   MtkSettings

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!