Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dad90cb3 authored by Achim Thesmann's avatar Achim Thesmann
Browse files

Use constant for no process

The value -1 is passed in as UID by non-PendingIntent call flows to indicate
that there is no actual process in the role of the real caller. This
just improves readability to replace those -1 values that are compared
to the passed in UID (and where we pass in a -1 UID to other methods).

Test: atest com.android.server.wm.ActivityStarterTests android.server.wm.BackgroundActivityLaunchTest
Bug: 306059525
Change-Id: Iafa0b45bb9b382115a581f5a90419177e352767a
parent 094616cb
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class BackgroundActivityStartController {

    private static final long ASM_GRACEPERIOD_TIMEOUT_MS = TIMEOUT_MS;
    private static final int ASM_GRACEPERIOD_MAX_REPEATS = 5;
    private static final int NO_PROCESS_UID = -1;
    public static final ActivityOptions ACTIVITY_OPTIONS_SYSTEM_DEFINED =
            ActivityOptions.makeBasic()
                    .setPendingIntentBackgroundActivityStartMode(
@@ -649,7 +650,7 @@ public class BackgroundActivityStartController {
        if (PendingIntentRecord.isPendingIntentBalAllowedByPermission(checkedOptions)
                && ActivityManager.checkComponentPermission(
                android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND,
                state.mRealCallingUid, -1, true) == PackageManager.PERMISSION_GRANTED) {
                state.mRealCallingUid, NO_PROCESS_UID, true) == PackageManager.PERMISSION_GRANTED) {
            return new BalVerdict(BAL_ALLOW_PENDING_INTENT,
                    /*background*/ false,
                    "realCallingUid has BAL permission.");
@@ -834,7 +835,7 @@ public class BackgroundActivityStartController {
                /* caller_activity_class_name */
                sourceRecord != null ? sourceRecord.info.name : null,
                /* target_task_top_activity_uid */
                targetTopActivity != null ? targetTopActivity.getUid() : -1,
                targetTopActivity != null ? targetTopActivity.getUid() : NO_PROCESS_UID,
                /* target_task_top_activity_class_name */
                targetTopActivity != null ? targetTopActivity.info.name : null,
                /* target_task_is_different */
@@ -988,13 +989,13 @@ public class BackgroundActivityStartController {
                /* caller_activity_class_name */
                callerActivityClassName,
                /* target_task_top_activity_uid */
                topActivity == null ? -1 : topActivity.getUid(),
                topActivity == null ? NO_PROCESS_UID : topActivity.getUid(),
                /* target_task_top_activity_class_name */
                topActivity == null ? null : topActivity.info.name,
                /* target_task_is_different */
                false,
                /* target_activity_uid */
                -1,
                NO_PROCESS_UID,
                /* target_activity_class_name */
                null,
                /* target_intent_action */