1. 程式人生 > >Android MTK 設定開機啟動自定義Launcher Home鍵換出Launcher切換

Android MTK 設定開機啟動自定義Launcher Home鍵換出Launcher切換

開機進入自定義的Launcher,之後按home鍵會彈出launcher選擇提示框,可以通過系統設定取消該launcher的預設設定

1

frameworks\base\core\java\com\android\internal\app\ResolverActivity.java


ResolverActivity類就是選擇開啟方式的彈出框
mAdapter = new ResolveListAdapter(this, intent, initialIntents, rList,
                mLaunchedFromUid);
        int count = mAdapter.getCount();//獲取當前存在的Launcher啟動器的數量
if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) 
            // Gulp!
            finish();
            return;
        } else if (count > 1) {
           //add default start launcher lhw start        
 int temp=Settings.System.getInt(getContentResolver(),"set_default_launcher", 0);
if(temp==0){
   
            Settings.System.putInt(getContentResolver(),"set_default_launcher",1);		
		startActivity(mAdapter.intentForPosition(1));//大於1的時候取陣列中的啟動第二個位置
            mPackageMonitor.unregister();
            mRegistered = false;
            finish();
            return;
         }    
        //add default start launcher lhw end