frameworks\base\services\core\java\com\android\server\am\ActivityManagerService.java

    1. boolean startHomeActivityLocked(int userId, String reason) {
    2. if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL
    3. && mTopAction == null) {
    4. // We are running in factory test mode, but unable to find
    5. // the factory test app, so just sit around displaying the
    6. // error message and don't try to start anything.
    7. return false;
    8. }
    9. Intent intent = getHomeIntent();
    10. ActivityInfo aInfo =
    11. resolveActivityInfo(intent, STOCK_PM_FLAGS, userId);
    12. if (aInfo != null) {
    13. intent.setComponent(new ComponentName(
    14. aInfo.applicationInfo.packageName, aInfo.name));
    15. // Don't do this if the home app is currently being
    16. // instrumented.
    17. aInfo = new ActivityInfo(aInfo);
    18. aInfo.applicationInfo = getAppInfoForUser(aInfo.applicationInfo, userId);
    19. ProcessRecord app = getProcessRecordLocked(aInfo.processName,
    20. aInfo.applicationInfo.uid, true);
    21. if (app == null || app.instrumentationClass == null) {
    22. intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
    23. mStackSupervisor.startHomeActivity(intent, aInfo, reason);
    24. }
    25. }
    26. //START. Start Custom App after boot. By ShawnXiaFei@20181214.
    27. try {
    28. Intent fcsIntent = new Intent();
    29. fcsIntent.setClassName("com.fcs.bestring", "com.fcs.bestring.activities.CompanyLoginActivity");
    30. fcsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    31. mContext.startActivity(fcsIntent);
    32. }
    33. catch (Exception e) {
    34. android.util.Slog.e("Shawn", "Start custom app Failed. error = " + Log.getStackTraceString(e));
    35. }
    36. //END. Start Custom App after boot. By ShawnXiaFei@20181214.
    37. return true;
    38. }