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

Commit 4d832d75 authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "ActivityManagerService: Rather than throw an exception, return...

Merge "ActivityManagerService: Rather than throw an exception, return INVALID_STACK_ID from getWorkspaceId when there is no associated workspace. This leaves the caller free to default."
parents 0b578f90 49cbf6ba
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.ActivityManager.FIRST_DYNAMIC_STACK_ID;
import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.HOME_STACK_ID;
import static android.app.ActivityManager.INVALID_STACK_ID;
import static android.view.View.MeasureSpec.AT_MOST;
import static android.view.View.MeasureSpec.EXACTLY;
import static android.view.View.MeasureSpec.getMode;
@@ -5250,7 +5251,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
     * @return Returns the workspace stack id which contains this window.
     **/
    private int getWorkspaceId() {
        int workspaceId = FULLSCREEN_WORKSPACE_STACK_ID;
        int workspaceId = INVALID_STACK_ID;
        WindowControllerCallback callback = getWindowControllerCallback();
        if (callback != null) {
            try {
@@ -5259,6 +5260,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                Log.e(TAG, "Failed to get the workspace ID of a PhoneWindow.");
            }
        }
        if (workspaceId == INVALID_STACK_ID) {
            return FULLSCREEN_WORKSPACE_STACK_ID;
        }
        return workspaceId;
    }

+2 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.app.ActivityManager.DOCKED_STACK_ID;
import static android.app.ActivityManager.HOME_STACK_ID;
import static android.app.ActivityManager.INVALID_STACK_ID;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static com.android.internal.util.XmlUtils.readBooleanAttribute;
import static com.android.internal.util.XmlUtils.readIntAttribute;
@@ -9005,8 +9006,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        synchronized (this) {
            ActivityStack stack = ActivityRecord.getStackLocked(token);
            if (stack == null) {
                throw new IllegalArgumentException(
                        "getActivityStackId: No stack for token=" + token);
                return INVALID_STACK_ID;
            }
            return stack.mStackId;
        }