需要修改的路径代码路径: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="http://schemas.android.com/apk/res/android"android:orientation="horizontal"android:layout_width="match_parent"android:layout_height="match_parent">
</LinearLayout>
编译刷机完成之后打开设置,可以看到桌面设置菜单项
点击它
这样就完成了这个需求