1.å¦ä½è®¾ç½®ç³»ç»å¯ä¸ç launcher
å¦ä½è®¾ç½®ç³»ç»å¯ä¸ç launcher
ããå®ä¹ä¸ä¸ªç§æçfilteré项ï¼ç¶åç¨è¿ä¸ªé项æ¥è¿æ»¤HOME.
ããä¸è¬æ åµä¸æ们使ç¨Manifestä¸å®ä¹ç<category android:name="android.intent.category.HOME"æ¥è¿æ»¤çï¼
ããæ们ç°å¨å¢å ä¸ä¸ªç§æçHOME_FIRSTè¿æ»¤ã
ããå¨Intent.java(frameworks/base/core/java/android/content/Intent.java)ä¸æ·»å 两è¡ä»£ç
ãã//lixinso:æ·»å CATEGORY_HOME_FIRST
ãã@SdkConstant(SdkConstantType.INTENT_CATEGORY)
ããpublic static final String CATEGORY_HOME_FIRST = "android.intent.category.HOME_FIRST";
ãã3ï¼ä¿®æ¹åCATEGORY_HOMEç¸å ³çææçå°æ¹ï¼é½æ¹æHOME_FIRSTï¼ä¸»è¦æ¯frameworkä¸çè¿å 个å°æ¹ï¼
ããframeworks/base/services/java/com/android/server/am/ActivityManagerService.javaä¸
ãã//intent.addCategory(Intent.CATEGORY_HOME);
ããæ¹æintent.addCategory(Intent.CATEGORY_HOME_FIRST); //lixinso:
ãã//if (r.intent.hasCategory(Intent.CATEGORY_HOME)) {
ããæ¹æif (r.intent.hasCategory(Intent.CATEGORY_HOME_FIRST)) { //lixinso: Intent.CATEGORY_HOME -> Intent.CATEGORY_HOME_FIRST
ããframeworks/base/services/java/com/android/server/am/HistoryRecorder.javaä¸
ãã// _intent.hasCategory(Intent.CATEGORY_HOME) &&
ããæ¹æ _intent.hasCategory(Intent.CATEGORY_HOME_FIRST) && //lixinso: Intent.CATEGORY_HOME->Intent.CATEGORY_HOME_FIRST
ããframeworks/policies/base/mid/com/android/internal/policy/impl/MidWindowManager.javaä¸
ãã//mHomeIntent.addCategory(Intent.CATEGORY_HOME);
ããæ¹æ mHomeIntent.addCategory(Intent.CATEGORY_HOME_FIRST); //lixinso
ããframeworks/policies/base/mid/com/android/internal/policy/impl/RecentApplicationsDialog.javaä¸
ãã//new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME),影视暗雷源码0);
ããæ¹æ new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME_FIRST),0); //lixinso
ããframeworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.javaä¸
ãã//mHomeIntent.addCategory(Intent.CATEGORY_HOME);
ããæ¹æ mHomeIntent.addCategory(Intent.CATEGORY_HOME_FIRST); //lixinso
ããframeworks/policies/base/phone/com/android/internal/policy/impl/RecentApplicationsDialog.javaä¸
ãã//ResolveInfo homeInfo = pm.resolveActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME),0);
ããæ¹æ ResolveInfo homeInfo = pm.resolveActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME_FIRST),0); //lixinso
ãã4) åä¸ä¸ªèªå·±çLauncher.
ããå¯ä»¥åèandroid sampleä¸çLauncherï¼æè androidæºä»£ç ä¸ç /packages/apps/Launcher æ¥åã
ããå¨Launcherä¸æ è®°å ¶æ¯ä¸æ¯Launcherçæå ³é®ç代ç æ¶Manifestä¸çfilter:android:name="android.intent.category.HOME"
ããç°å¨æ们å®ä¹äºèªå·±çfilter,é£ä¹ï¼æ们å¨æ们èªå·±åçLauncherä¸å°Manifestæ¹ä¸ºï¼
ãã<application android:process="android.process.acore3" android:icon="@drawable/icon" android:label="@string/app_name">
ãã<activity android:name=".FirstAppActivity"
ããandroid:label="@string/app_name">
ãã<intent-filter>
ãã<action android:name="android.intent.action.MAIN" />
ãã<category android:name="android.intent.category.HOME_FIRST" />
ãã<category android:name="android.intent.category.DEFAULT" />
ãã<category android:name="android.intent.category.MONKEY" />
ãã</intent-filter>
ãã</activity>
ãã</application>
ããç¶åå°ç¼è¯å¥½çapkæ¾å°/out/target/product/generic/system/appç®å½ä¸ã
ãã5)å°Androidèªå¸¦çLauncherå é¤æï¼å æ¬æºä»£ç (packages/apps/Launcher)åapk(/out/target/product/generic/system/app/Launcher.apk)ã
ãã6)
ããåå®è¿äºå·¥ä½ï¼å°±å¯ä»¥éæ°ç¼è¯Androidäºï¼æ们å¯ä»¥ç¼è¯ä¿®æ¹è¿çå 个ç¸å ³çå ã
ããå¦æä¹åç¼è¯è¿äºAndroidæºç ï¼å¯ä»¥ç¨mmmå½ä»¤æ¥ç¼è¯é¨åçæ¹å¨ã
ããè¿ééè¦è¿æ ·ç¼è¯ï¼
ãã$ . build/envsetup.sh
ãã$ mmm frameworks/base
ãã$ mmm frameworks/base/services/java
ãã$ mmm frameworks/policies/base/mid
ãã$ mmm frameworks/policies/base/phone
ãã7)
ããç¼è¯å®æåéæ°çæimgæ件ã
ãã$ make snod
ãã8) ç°å¨å¯ä»¥å¯å¨Android模æå¨æ¥çææäºã
ããé¦å 设置ç¯å¢åéï¼
ãã$ export ANDROID_PRODUCT_OUT= ./out/target/product/generic
ããç¶ååæ¢å°
ãã$ cd ./out/host/linux-x/bin
ããè¿è¡
ãã$ ./emulator
ããè¿æ ·æ们å¯å¨ç模æå¨éé¢ç¨çimageå°±æ¯æ们åæç¼è¯å¥½çèªå·±å®å¶çä¸è¥¿äºã
ããä»æ¨¡æå¨ä¸å¯ä»¥çå°å¯å¨çLauncheræ¯æ们èªå·±çLauncherï¼ä¸ä¼åºç°é»è®¤çLauncheräºï¼ä¹ä¸ä¼åºç°éæ©çé¢ã