Android系统中的HOME属性

一、默认Launcher

1.packages/apps/Launcher2/AndroidManifest.xml

        
            
                
                
                
                
            
        

2.frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java

    boolean startHomeActivityLocked(int userId) {
      Intent intent = getHomeIntent();
      ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, userId);
    }
    Intent getHomeIntent() {
        Intent intent = new Intent(mTopAction, mTopData != null ? Uri.parse(mTopData) : null);
        intent.setComponent(mTopComponent);
        if (mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
            intent.addCategory(Intent.CATEGORY_HOME);
        }
        return intent;
    }
    private ActivityInfo resolveActivityInfo(Intent intent, int flags, int userId) {
        ActivityInfo ai = null;
        ComponentName comp = intent.getComponent();
        try {
            if (comp != null) {
                ai = AppGlobals.getPackageManager().getActivityInfo(comp, flags, userId);
            } else {
                ResolveInfo info = AppGlobals.getPackageManager().resolveIntent(
                        intent,
                        intent.resolveTypeIfNeeded(mContext.getContentResolver()),
                            flags, userId);

                if (info != null) {
                    ai = info.activityInfo;
                }
            }
        } catch (RemoteException e) {
            // ignore
        }

        return ai;
    }


你可能感兴趣的:(移动操作系统之Android)