Loading core/java/android/app/ActivityManagerInternal.java +0 −5 Original line number Diff line number Diff line Loading @@ -212,11 +212,6 @@ public abstract class ActivityManagerInternal { */ public abstract boolean shouldConfirmCredentials(int userId); /** * @return The intent used to launch the home activity. */ public abstract Intent getHomeIntent(); public abstract int[] getCurrentProfileIds(); public abstract UserInfo getCurrentUser(); public abstract void ensureNotSpecialUser(int userId); Loading services/core/java/com/android/server/PinnerService.java +4 −1 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import com.android.internal.os.BackgroundThread; import com.android.internal.util.DumpUtils; import com.android.internal.util.function.pooled.PooledLambda; import com.android.server.wm.ActivityTaskManagerInternal; import dalvik.system.DexFile; import dalvik.system.VMRuntime; Loading Loading @@ -103,6 +104,7 @@ public final class PinnerService extends SystemService { public @interface AppKey {} private final Context mContext; private final ActivityTaskManagerInternal mAtmInternal; private final ActivityManagerInternal mAmInternal; private final IActivityManager mAm; private final UserManager mUserManager; Loading Loading @@ -164,6 +166,7 @@ public final class PinnerService extends SystemService { } mPinnerHandler = new PinnerHandler(BackgroundThread.get().getLooper()); mAtmInternal = LocalServices.getService(ActivityTaskManagerInternal.class); mAmInternal = LocalServices.getService(ActivityManagerInternal.class); mAm = ActivityManager.getService(); Loading Loading @@ -380,7 +383,7 @@ public final class PinnerService extends SystemService { } private ApplicationInfo getHomeInfo(int userHandle) { Intent intent = mAmInternal.getHomeIntent(); Intent intent = mAtmInternal.getHomeIntent(); return getApplicationInfoForIntent(intent, userHandle, false); } Loading services/core/java/com/android/server/am/ActivityManagerService.java +10 −152 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.net.NetworkPolicyManager.isProcStateAllowedWhileIdleOrPowerSaveMode; import static android.net.NetworkPolicyManager.isProcStateAllowedWhileOnRestrictBackground; import static android.os.FactoryTest.FACTORY_TEST_OFF; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_HIGH; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL; Loading Loading @@ -1068,17 +1069,10 @@ public class ActivityManagerService extends IActivityManager.Stub */ final StringBuilder mStringBuilder = new StringBuilder(256); /** * Used to control how we initialize the service. */ ComponentName mTopComponent; String mTopAction = Intent.ACTION_MAIN; String mTopData; volatile boolean mProcessesReady = false; volatile boolean mSystemReady = false; volatile boolean mOnBattery = false; volatile int mFactoryTest; final int mFactoryTest; volatile boolean mBooting = false; @GuardedBy("this") boolean mCallFinishBooting = false; Loading Loading @@ -1411,7 +1405,6 @@ public class ActivityManagerService extends IActivityManager.Stub static final int SHOW_ERROR_UI_MSG = 1; static final int SHOW_NOT_RESPONDING_UI_MSG = 2; static final int SHOW_FACTORY_ERROR_UI_MSG = 3; static final int UPDATE_CONFIGURATION_MSG = 4; static final int GC_BACKGROUND_PROCESSES_MSG = 5; static final int WAIT_FOR_DEBUGGER_UI_MSG = 6; Loading Loading @@ -1472,8 +1465,6 @@ public class ActivityManagerService extends IActivityManager.Stub PackageManagerInternal mPackageManagerInt; boolean mHasHeavyWeightFeature; /** * Whether to force background check on all apps (for battery saver) or not. */ Loading Loading @@ -1555,12 +1546,6 @@ public class ActivityManagerService extends IActivityManager.Stub } ensureBootCompleted(); } break; case SHOW_FACTORY_ERROR_UI_MSG: { Dialog d = new FactoryErrorDialog( mUiContext, msg.getData().getCharSequence("msg")); d.show(); ensureBootCompleted(); } break; case WAIT_FOR_DEBUGGER_UI_MSG: { synchronized (ActivityManagerService.this) { ProcessRecord app = (ProcessRecord)msg.obj; Loading Loading @@ -2331,6 +2316,7 @@ public class ActivityManagerService extends IActivityManager.Stub mProcStartHandlerThread = null; mProcStartHandler = null; mHiddenApiBlacklist = null; mFactoryTest = FACTORY_TEST_OFF; } // Note: This method is invoked on the main thread but may need to attach various Loading Loading @@ -3345,17 +3331,9 @@ public class ActivityManagerService extends IActivityManager.Stub if (gids[1] == UserHandle.ERR_GID) gids[1] = gids[2]; } checkTime(startTime, "startProcess: building args"); if (mFactoryTest != FactoryTest.FACTORY_TEST_OFF) { if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopComponent != null && app.processName.equals(mTopComponent.getPackageName())) { if (mAtmInternal.isFactoryTestProcess(app.getWindowProcessController())) { uid = 0; } if (mFactoryTest == FactoryTest.FACTORY_TEST_HIGH_LEVEL && (app.info.flags&ApplicationInfo.FLAG_FACTORY_TEST) != 0) { uid = 0; } } int runtimeFlags = 0; if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { runtimeFlags |= Zygote.DEBUG_ENABLE_JDWP; Loading Loading @@ -3715,82 +3693,6 @@ public class ActivityManagerService extends IActivityManager.Stub } } Intent getHomeIntent() { Intent intent = new Intent(mTopAction, mTopData != null ? Uri.parse(mTopData) : null); intent.setComponent(mTopComponent); intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING); if (mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL) { intent.addCategory(Intent.CATEGORY_HOME); } return intent; } boolean startHomeActivityLocked(int userId, String reason) { return startHomeActivityLocked(userId, reason, DEFAULT_DISPLAY); } /** * This starts home activity on displays that can have system decorations and only if the * home activity can have multiple instances. */ boolean startHomeActivityLocked(int userId, String reason, int displayId) { if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopAction == null) { // We are running in factory test mode, but unable to find // the factory test app, so just sit around displaying the // error message and don't try to start anything. return false; } Intent intent = getHomeIntent(); ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, userId); if (aInfo != null) { intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name)); // Don't do this if the home app is currently being // instrumented. aInfo = new ActivityInfo(aInfo); aInfo.applicationInfo = getAppInfoForUser(aInfo.applicationInfo, userId); ProcessRecord app = getProcessRecordLocked(aInfo.processName, aInfo.applicationInfo.uid, true); if (app == null || app.getActiveInstrumentation() == null) { intent.setFlags(intent.getFlags() | FLAG_ACTIVITY_NEW_TASK); final int resolvedUserId = UserHandle.getUserId(aInfo.applicationInfo.uid); // For ANR debugging to verify if the user activity is the one that actually // launched. final String myReason = reason + ":" + userId + ":" + resolvedUserId; mActivityTaskManager.getActivityStartController().startHomeActivity(intent, aInfo, myReason, displayId); } } else { Slog.wtf(TAG, "No home screen found for " + intent, new Throwable()); } return true; } private ActivityInfo resolveActivityInfo(Intent intent, int flags, int userId) { ActivityInfo ai = null; ComponentName comp = intent.getComponent(); try { if (comp != null) { // Factory test. 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; } boolean getCheckedForSetup() { return mCheckedForSetup; } Loading Loading @@ -6722,7 +6624,7 @@ public class ActivityManagerService extends IActivityManager.Stub } } static int checkComponentPermission(String permission, int pid, int uid, public static int checkComponentPermission(String permission, int pid, int uid, int owningUid, boolean exported) { if (pid == MY_PID) { return PackageManager.PERMISSION_GRANTED; Loading Loading @@ -8804,7 +8706,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (mActivityTaskManager.mKeyguardController.isKeyguardLocked()) { // Showing launcher to avoid user entering credential twice. final int currentUserId = mUserController.getCurrentUserId(); startHomeActivityLocked(currentUserId, "notifyLockedProfile"); mAtmInternal.startHomeActivity(currentUserId, "notifyLockedProfile"); } mStackSupervisor.lockAllProfileTasks(userId); } Loading Loading @@ -9817,8 +9719,6 @@ public class ActivityManagerService extends IActivityManager.Stub return; } mHasHeavyWeightFeature = mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_CANT_SAVE_STATE); mLocalDeviceIdleController = LocalServices.getService(DeviceIdleController.LocalService.class); mActivityTaskManager.onSystemReady(); Loading Loading @@ -9863,44 +9763,9 @@ public class ActivityManagerService extends IActivityManager.Stub } Slog.i(TAG, "System now ready"); EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY, SystemClock.uptimeMillis()); EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY, SystemClock.uptimeMillis()); synchronized(this) { // Make sure we have no pre-ready processes sitting around. if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL) { ResolveInfo ri = mContext.getPackageManager() .resolveActivity(new Intent(Intent.ACTION_FACTORY_TEST), STOCK_PM_FLAGS); CharSequence errorMsg = null; if (ri != null) { ActivityInfo ai = ri.activityInfo; ApplicationInfo app = ai.applicationInfo; if ((app.flags&ApplicationInfo.FLAG_SYSTEM) != 0) { mTopAction = Intent.ACTION_FACTORY_TEST; mTopData = null; mTopComponent = new ComponentName(app.packageName, ai.name); } else { errorMsg = mContext.getResources().getText( com.android.internal.R.string.factorytest_not_system); } } else { errorMsg = mContext.getResources().getText( com.android.internal.R.string.factorytest_no_action); } if (errorMsg != null) { mTopAction = null; mTopData = null; mTopComponent = null; Message msg = Message.obtain(); msg.what = SHOW_FACTORY_ERROR_UI_MSG; msg.getData().putCharSequence("msg", errorMsg); mUiHandler.sendMessage(msg); } } } mAtmInternal.updateTopComponentForFactoryTest(); retrieveSettings(); final int currentUserId = mUserController.getCurrentUserId(); Loading Loading @@ -9946,7 +9811,7 @@ public class ActivityManagerService extends IActivityManager.Stub throw e.rethrowAsRuntimeException(); } } startHomeActivityLocked(currentUserId, "systemReady"); mAtmInternal.startHomeActivity(currentUserId, "systemReady"); mAtmInternal.showSystemReadyErrorDialogsIfNeeded(); Loading Loading @@ -20820,13 +20685,6 @@ public class ActivityManagerService extends IActivityManager.Stub mUserController.finishUserSwitch((UserState) uss); } @Override public Intent getHomeIntent() { synchronized (ActivityManagerService.this) { return ActivityManagerService.this.getHomeIntent(); } } @Override public void scheduleAppGcs() { synchronized (ActivityManagerService.this) { services/core/java/com/android/server/am/ActivityStackSupervisor.java +7 −6 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import static android.app.WindowConfiguration.activityTypeToString; import static android.app.WindowConfiguration.windowingModeToString; import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE; import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_TASK; import static android.content.pm.PackageManager.NOTIFY_PACKAGE_USE_ACTIVITY; import static android.content.pm.PackageManager.PERMISSION_DENIED; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.graphics.Rect.copyOrNull; Loading Loading @@ -824,7 +825,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D moveFocusableActivityToTop(r, myReason); return resumeFocusedStacksTopActivitiesLocked(r.getStack(), prev, null); } return mService.mAm.startHomeActivityLocked(mCurrentUser, myReason, displayId); return mService.startHomeActivityLocked(mCurrentUser, myReason, displayId); } boolean canStartHomeOnDisplay(ActivityInfo homeActivity, int displayId) { Loading Loading @@ -1522,8 +1523,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D // Home process is the root process of the task. mService.mHomeProcess = task.mActivities.get(0).app; } mService.mAm.notifyPackageUse(r.intent.getComponent().getPackageName(), PackageManager.NOTIFY_PACKAGE_USE_ACTIVITY); mService.getPackageManagerInternalLocked().notifyPackageUse( r.intent.getComponent().getPackageName(), NOTIFY_PACKAGE_USE_ACTIVITY); r.sleeping = false; r.forceNewConfig = false; mService.getAppWarningsLocked().onStartActivity(r); Loading Loading @@ -1588,7 +1589,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D mService.getLifecycleManager().scheduleTransaction(clientTransaction); if ((app.info.privateFlags & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0 && mService.mAm.mHasHeavyWeightFeature) { && mService.mHasHeavyWeightFeature) { // This may be a heavy-weight process! Note that the package manager will ensure // that only activity can run in the main process of the .apk, which is the only // thing that will be considered heavy-weight. Loading Loading @@ -1957,7 +1958,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D private int getComponentRestrictionForCallingPackage(ActivityInfo activityInfo, String callingPackage, int callingPid, int callingUid, boolean ignoreTargetSecurity) { if (!ignoreTargetSecurity && mService.mAm.checkComponentPermission(activityInfo.permission, if (!ignoreTargetSecurity && mService.checkComponentPermission(activityInfo.permission, callingPid, callingUid, activityInfo.applicationInfo.uid, activityInfo.exported) == PERMISSION_DENIED) { return ACTIVITY_RESTRICTION_PERMISSION; Loading Loading @@ -4280,7 +4281,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D private void handleDisplayAdded(int displayId) { synchronized (mService.mGlobalLock) { getActivityDisplayOrCreateLocked(displayId); mService.mAm.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId); mService.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId); } } Loading services/core/java/com/android/server/am/ActivityStartController.java +3 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; Loading Loading @@ -200,9 +201,8 @@ public class ActivityStartController { // version than the last one shown, and we are not running in // low-level factory test mode. final ContentResolver resolver = mService.mContext.getContentResolver(); if (mService.mAm.mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL && Settings.Global.getInt(resolver, Settings.Global.DEVICE_PROVISIONED, 0) != 0) { if (mService.mFactoryTest != FACTORY_TEST_LOW_LEVEL && Settings.Global.getInt(resolver, Settings.Global.DEVICE_PROVISIONED, 0) != 0) { mService.mAm.setCheckedForSetup(true); // See if we should be showing the platform update setup UI. Loading Loading
core/java/android/app/ActivityManagerInternal.java +0 −5 Original line number Diff line number Diff line Loading @@ -212,11 +212,6 @@ public abstract class ActivityManagerInternal { */ public abstract boolean shouldConfirmCredentials(int userId); /** * @return The intent used to launch the home activity. */ public abstract Intent getHomeIntent(); public abstract int[] getCurrentProfileIds(); public abstract UserInfo getCurrentUser(); public abstract void ensureNotSpecialUser(int userId); Loading
services/core/java/com/android/server/PinnerService.java +4 −1 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import com.android.internal.os.BackgroundThread; import com.android.internal.util.DumpUtils; import com.android.internal.util.function.pooled.PooledLambda; import com.android.server.wm.ActivityTaskManagerInternal; import dalvik.system.DexFile; import dalvik.system.VMRuntime; Loading Loading @@ -103,6 +104,7 @@ public final class PinnerService extends SystemService { public @interface AppKey {} private final Context mContext; private final ActivityTaskManagerInternal mAtmInternal; private final ActivityManagerInternal mAmInternal; private final IActivityManager mAm; private final UserManager mUserManager; Loading Loading @@ -164,6 +166,7 @@ public final class PinnerService extends SystemService { } mPinnerHandler = new PinnerHandler(BackgroundThread.get().getLooper()); mAtmInternal = LocalServices.getService(ActivityTaskManagerInternal.class); mAmInternal = LocalServices.getService(ActivityManagerInternal.class); mAm = ActivityManager.getService(); Loading Loading @@ -380,7 +383,7 @@ public final class PinnerService extends SystemService { } private ApplicationInfo getHomeInfo(int userHandle) { Intent intent = mAmInternal.getHomeIntent(); Intent intent = mAtmInternal.getHomeIntent(); return getApplicationInfoForIntent(intent, userHandle, false); } Loading
services/core/java/com/android/server/am/ActivityManagerService.java +10 −152 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.net.NetworkPolicyManager.isProcStateAllowedWhileIdleOrPowerSaveMode; import static android.net.NetworkPolicyManager.isProcStateAllowedWhileOnRestrictBackground; import static android.os.FactoryTest.FACTORY_TEST_OFF; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_HIGH; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL; Loading Loading @@ -1068,17 +1069,10 @@ public class ActivityManagerService extends IActivityManager.Stub */ final StringBuilder mStringBuilder = new StringBuilder(256); /** * Used to control how we initialize the service. */ ComponentName mTopComponent; String mTopAction = Intent.ACTION_MAIN; String mTopData; volatile boolean mProcessesReady = false; volatile boolean mSystemReady = false; volatile boolean mOnBattery = false; volatile int mFactoryTest; final int mFactoryTest; volatile boolean mBooting = false; @GuardedBy("this") boolean mCallFinishBooting = false; Loading Loading @@ -1411,7 +1405,6 @@ public class ActivityManagerService extends IActivityManager.Stub static final int SHOW_ERROR_UI_MSG = 1; static final int SHOW_NOT_RESPONDING_UI_MSG = 2; static final int SHOW_FACTORY_ERROR_UI_MSG = 3; static final int UPDATE_CONFIGURATION_MSG = 4; static final int GC_BACKGROUND_PROCESSES_MSG = 5; static final int WAIT_FOR_DEBUGGER_UI_MSG = 6; Loading Loading @@ -1472,8 +1465,6 @@ public class ActivityManagerService extends IActivityManager.Stub PackageManagerInternal mPackageManagerInt; boolean mHasHeavyWeightFeature; /** * Whether to force background check on all apps (for battery saver) or not. */ Loading Loading @@ -1555,12 +1546,6 @@ public class ActivityManagerService extends IActivityManager.Stub } ensureBootCompleted(); } break; case SHOW_FACTORY_ERROR_UI_MSG: { Dialog d = new FactoryErrorDialog( mUiContext, msg.getData().getCharSequence("msg")); d.show(); ensureBootCompleted(); } break; case WAIT_FOR_DEBUGGER_UI_MSG: { synchronized (ActivityManagerService.this) { ProcessRecord app = (ProcessRecord)msg.obj; Loading Loading @@ -2331,6 +2316,7 @@ public class ActivityManagerService extends IActivityManager.Stub mProcStartHandlerThread = null; mProcStartHandler = null; mHiddenApiBlacklist = null; mFactoryTest = FACTORY_TEST_OFF; } // Note: This method is invoked on the main thread but may need to attach various Loading Loading @@ -3345,17 +3331,9 @@ public class ActivityManagerService extends IActivityManager.Stub if (gids[1] == UserHandle.ERR_GID) gids[1] = gids[2]; } checkTime(startTime, "startProcess: building args"); if (mFactoryTest != FactoryTest.FACTORY_TEST_OFF) { if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopComponent != null && app.processName.equals(mTopComponent.getPackageName())) { if (mAtmInternal.isFactoryTestProcess(app.getWindowProcessController())) { uid = 0; } if (mFactoryTest == FactoryTest.FACTORY_TEST_HIGH_LEVEL && (app.info.flags&ApplicationInfo.FLAG_FACTORY_TEST) != 0) { uid = 0; } } int runtimeFlags = 0; if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { runtimeFlags |= Zygote.DEBUG_ENABLE_JDWP; Loading Loading @@ -3715,82 +3693,6 @@ public class ActivityManagerService extends IActivityManager.Stub } } Intent getHomeIntent() { Intent intent = new Intent(mTopAction, mTopData != null ? Uri.parse(mTopData) : null); intent.setComponent(mTopComponent); intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING); if (mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL) { intent.addCategory(Intent.CATEGORY_HOME); } return intent; } boolean startHomeActivityLocked(int userId, String reason) { return startHomeActivityLocked(userId, reason, DEFAULT_DISPLAY); } /** * This starts home activity on displays that can have system decorations and only if the * home activity can have multiple instances. */ boolean startHomeActivityLocked(int userId, String reason, int displayId) { if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopAction == null) { // We are running in factory test mode, but unable to find // the factory test app, so just sit around displaying the // error message and don't try to start anything. return false; } Intent intent = getHomeIntent(); ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, userId); if (aInfo != null) { intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name)); // Don't do this if the home app is currently being // instrumented. aInfo = new ActivityInfo(aInfo); aInfo.applicationInfo = getAppInfoForUser(aInfo.applicationInfo, userId); ProcessRecord app = getProcessRecordLocked(aInfo.processName, aInfo.applicationInfo.uid, true); if (app == null || app.getActiveInstrumentation() == null) { intent.setFlags(intent.getFlags() | FLAG_ACTIVITY_NEW_TASK); final int resolvedUserId = UserHandle.getUserId(aInfo.applicationInfo.uid); // For ANR debugging to verify if the user activity is the one that actually // launched. final String myReason = reason + ":" + userId + ":" + resolvedUserId; mActivityTaskManager.getActivityStartController().startHomeActivity(intent, aInfo, myReason, displayId); } } else { Slog.wtf(TAG, "No home screen found for " + intent, new Throwable()); } return true; } private ActivityInfo resolveActivityInfo(Intent intent, int flags, int userId) { ActivityInfo ai = null; ComponentName comp = intent.getComponent(); try { if (comp != null) { // Factory test. 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; } boolean getCheckedForSetup() { return mCheckedForSetup; } Loading Loading @@ -6722,7 +6624,7 @@ public class ActivityManagerService extends IActivityManager.Stub } } static int checkComponentPermission(String permission, int pid, int uid, public static int checkComponentPermission(String permission, int pid, int uid, int owningUid, boolean exported) { if (pid == MY_PID) { return PackageManager.PERMISSION_GRANTED; Loading Loading @@ -8804,7 +8706,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (mActivityTaskManager.mKeyguardController.isKeyguardLocked()) { // Showing launcher to avoid user entering credential twice. final int currentUserId = mUserController.getCurrentUserId(); startHomeActivityLocked(currentUserId, "notifyLockedProfile"); mAtmInternal.startHomeActivity(currentUserId, "notifyLockedProfile"); } mStackSupervisor.lockAllProfileTasks(userId); } Loading Loading @@ -9817,8 +9719,6 @@ public class ActivityManagerService extends IActivityManager.Stub return; } mHasHeavyWeightFeature = mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_CANT_SAVE_STATE); mLocalDeviceIdleController = LocalServices.getService(DeviceIdleController.LocalService.class); mActivityTaskManager.onSystemReady(); Loading Loading @@ -9863,44 +9763,9 @@ public class ActivityManagerService extends IActivityManager.Stub } Slog.i(TAG, "System now ready"); EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY, SystemClock.uptimeMillis()); EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY, SystemClock.uptimeMillis()); synchronized(this) { // Make sure we have no pre-ready processes sitting around. if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL) { ResolveInfo ri = mContext.getPackageManager() .resolveActivity(new Intent(Intent.ACTION_FACTORY_TEST), STOCK_PM_FLAGS); CharSequence errorMsg = null; if (ri != null) { ActivityInfo ai = ri.activityInfo; ApplicationInfo app = ai.applicationInfo; if ((app.flags&ApplicationInfo.FLAG_SYSTEM) != 0) { mTopAction = Intent.ACTION_FACTORY_TEST; mTopData = null; mTopComponent = new ComponentName(app.packageName, ai.name); } else { errorMsg = mContext.getResources().getText( com.android.internal.R.string.factorytest_not_system); } } else { errorMsg = mContext.getResources().getText( com.android.internal.R.string.factorytest_no_action); } if (errorMsg != null) { mTopAction = null; mTopData = null; mTopComponent = null; Message msg = Message.obtain(); msg.what = SHOW_FACTORY_ERROR_UI_MSG; msg.getData().putCharSequence("msg", errorMsg); mUiHandler.sendMessage(msg); } } } mAtmInternal.updateTopComponentForFactoryTest(); retrieveSettings(); final int currentUserId = mUserController.getCurrentUserId(); Loading Loading @@ -9946,7 +9811,7 @@ public class ActivityManagerService extends IActivityManager.Stub throw e.rethrowAsRuntimeException(); } } startHomeActivityLocked(currentUserId, "systemReady"); mAtmInternal.startHomeActivity(currentUserId, "systemReady"); mAtmInternal.showSystemReadyErrorDialogsIfNeeded(); Loading Loading @@ -20820,13 +20685,6 @@ public class ActivityManagerService extends IActivityManager.Stub mUserController.finishUserSwitch((UserState) uss); } @Override public Intent getHomeIntent() { synchronized (ActivityManagerService.this) { return ActivityManagerService.this.getHomeIntent(); } } @Override public void scheduleAppGcs() { synchronized (ActivityManagerService.this) {
services/core/java/com/android/server/am/ActivityStackSupervisor.java +7 −6 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import static android.app.WindowConfiguration.activityTypeToString; import static android.app.WindowConfiguration.windowingModeToString; import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE; import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_TASK; import static android.content.pm.PackageManager.NOTIFY_PACKAGE_USE_ACTIVITY; import static android.content.pm.PackageManager.PERMISSION_DENIED; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.graphics.Rect.copyOrNull; Loading Loading @@ -824,7 +825,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D moveFocusableActivityToTop(r, myReason); return resumeFocusedStacksTopActivitiesLocked(r.getStack(), prev, null); } return mService.mAm.startHomeActivityLocked(mCurrentUser, myReason, displayId); return mService.startHomeActivityLocked(mCurrentUser, myReason, displayId); } boolean canStartHomeOnDisplay(ActivityInfo homeActivity, int displayId) { Loading Loading @@ -1522,8 +1523,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D // Home process is the root process of the task. mService.mHomeProcess = task.mActivities.get(0).app; } mService.mAm.notifyPackageUse(r.intent.getComponent().getPackageName(), PackageManager.NOTIFY_PACKAGE_USE_ACTIVITY); mService.getPackageManagerInternalLocked().notifyPackageUse( r.intent.getComponent().getPackageName(), NOTIFY_PACKAGE_USE_ACTIVITY); r.sleeping = false; r.forceNewConfig = false; mService.getAppWarningsLocked().onStartActivity(r); Loading Loading @@ -1588,7 +1589,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D mService.getLifecycleManager().scheduleTransaction(clientTransaction); if ((app.info.privateFlags & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0 && mService.mAm.mHasHeavyWeightFeature) { && mService.mHasHeavyWeightFeature) { // This may be a heavy-weight process! Note that the package manager will ensure // that only activity can run in the main process of the .apk, which is the only // thing that will be considered heavy-weight. Loading Loading @@ -1957,7 +1958,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D private int getComponentRestrictionForCallingPackage(ActivityInfo activityInfo, String callingPackage, int callingPid, int callingUid, boolean ignoreTargetSecurity) { if (!ignoreTargetSecurity && mService.mAm.checkComponentPermission(activityInfo.permission, if (!ignoreTargetSecurity && mService.checkComponentPermission(activityInfo.permission, callingPid, callingUid, activityInfo.applicationInfo.uid, activityInfo.exported) == PERMISSION_DENIED) { return ACTIVITY_RESTRICTION_PERMISSION; Loading Loading @@ -4280,7 +4281,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D private void handleDisplayAdded(int displayId) { synchronized (mService.mGlobalLock) { getActivityDisplayOrCreateLocked(displayId); mService.mAm.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId); mService.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId); } } Loading
services/core/java/com/android/server/am/ActivityStartController.java +3 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; Loading Loading @@ -200,9 +201,8 @@ public class ActivityStartController { // version than the last one shown, and we are not running in // low-level factory test mode. final ContentResolver resolver = mService.mContext.getContentResolver(); if (mService.mAm.mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL && Settings.Global.getInt(resolver, Settings.Global.DEVICE_PROVISIONED, 0) != 0) { if (mService.mFactoryTest != FACTORY_TEST_LOW_LEVEL && Settings.Global.getInt(resolver, Settings.Global.DEVICE_PROVISIONED, 0) != 0) { mService.mAm.setCheckedForSetup(true); // See if we should be showing the platform update setup UI. Loading