diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-01-10 00:20:33 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-01-10 00:20:33 +0000 |
commit | 9ba8ed9c3a124723e5782d7585f8b4276bf0dba8 (patch) | |
tree | 0fdf70f3fa848332d0677ee80acf42509c346614 | |
parent | 21224e4606cd07502e05246566d6b17ad2771200 (diff) | |
parent | 136496079aaf1fac10d2b499dad06009518aa6ab (diff) | |
download | services-android13-qpr3-s5-release.tar.gz |
Snap for 9470583 from 136496079aaf1fac10d2b499dad06009518aa6ab to tm-qpr3-releaseandroid-13.0.0_r83android-13.0.0_r79android-13.0.0_r78android-13.0.0_r77android-13.0.0_r76android-13.0.0_r75android-13.0.0_r71android-13.0.0_r70android-13.0.0_r69android-13.0.0_r68android-13.0.0_r67android-13.0.0_r63android-13.0.0_r62android-13.0.0_r61android-13.0.0_r56android-13.0.0_r54android-13.0.0_r53android-13.0.0_r52android-13.0.0_r51android-13.0.0_r50android13-qpr3-s9-releaseandroid13-qpr3-s8-releaseandroid13-qpr3-s7-releaseandroid13-qpr3-s6-releaseandroid13-qpr3-s5-releaseandroid13-qpr3-s4-releaseandroid13-qpr3-s3-releaseandroid13-qpr3-s2-releaseandroid13-qpr3-s14-releaseandroid13-qpr3-s13-releaseandroid13-qpr3-s12-releaseandroid13-qpr3-s11-releaseandroid13-qpr3-s10-releaseandroid13-qpr3-s1-releaseandroid13-qpr3-release
Change-Id: I58e2c3da00cec11548606bd60843ae415af2366f
20 files changed, 203 insertions, 100 deletions
diff --git a/builtInServices/src/com/android/annotation/AddedIn.java b/builtInServices/src/com/android/annotation/AddedIn.java new file mode 100644 index 0000000..6cfceb4 --- /dev/null +++ b/builtInServices/src/com/android/annotation/AddedIn.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.annotation; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import android.car.builtin.annotation.PlatformVersion; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Defines in which version of platform this method / type / field was added. + * + * <p>Annotation should be used for APIs exposed to CarService module by {@code android.car.builtin} + * + * @hide + */ +@Retention(RUNTIME) +@Target({ANNOTATION_TYPE, FIELD, TYPE, METHOD}) +public @interface AddedIn { + PlatformVersion value(); +} diff --git a/builtInServices/src/com/android/internal/car/CarServiceHelperInterface.java b/builtInServices/src/com/android/internal/car/CarServiceHelperInterface.java index 4a139f6..e9a58a9 100644 --- a/builtInServices/src/com/android/internal/car/CarServiceHelperInterface.java +++ b/builtInServices/src/com/android/internal/car/CarServiceHelperInterface.java @@ -18,9 +18,11 @@ package com.android.internal.car; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.os.UserHandle; +import com.android.annotation.AddedIn; + import java.io.File; /** @@ -33,14 +35,14 @@ public interface CarServiceHelperInterface { /** * Sets safety mode */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void setSafetyMode(boolean safe); /** * Creates user even when disallowed */ @Nullable - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) UserHandle createUserEvenWhenDisallowed(@Nullable String name, @NonNull String userType, int flags); @@ -48,6 +50,6 @@ public interface CarServiceHelperInterface { * Dumps service stacks */ @Nullable - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) File dumpServiceStacks(); } diff --git a/builtInServices/src/com/android/internal/car/CarServiceHelperService.java b/builtInServices/src/com/android/internal/car/CarServiceHelperService.java index 52e6861..3d9301b 100644 --- a/builtInServices/src/com/android/internal/car/CarServiceHelperService.java +++ b/builtInServices/src/com/android/internal/car/CarServiceHelperService.java @@ -15,6 +15,7 @@ */ package com.android.internal.car; +import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_CREATED; import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_POST_UNLOCKED; import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_STARTING; import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_STOPPED; @@ -205,7 +206,11 @@ public class CarServiceHelperService extends SystemService @Override public void onUserCreated(UserInfo user, Object token) { if (DBG) Slogf.d(TAG, "onUserCreated(): %s", user.toFullString()); + mCarServiceHelperServiceUpdatable.sendUserLifecycleEvent( + USER_LIFECYCLE_EVENT_TYPE_CREATED, /* userFrom= */ null, + user.getUserHandle()); } + @Override public void onUserRemoved(UserInfo user) { if (DBG) Slogf.d(TAG, "onUserRemoved(): $s", user.toFullString()); diff --git a/builtInServices/src/com/android/internal/car/CarServiceHelperServiceUpdatable.java b/builtInServices/src/com/android/internal/car/CarServiceHelperServiceUpdatable.java index 61a9892..3409c15 100644 --- a/builtInServices/src/com/android/internal/car/CarServiceHelperServiceUpdatable.java +++ b/builtInServices/src/com/android/internal/car/CarServiceHelperServiceUpdatable.java @@ -18,10 +18,11 @@ package com.android.internal.car; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.os.Bundle; import android.os.UserHandle; +import com.android.annotation.AddedIn; import com.android.server.wm.CarLaunchParamsModifierUpdatable; import java.io.PrintWriter; @@ -36,25 +37,25 @@ import java.util.function.BiConsumer; @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) public interface CarServiceHelperServiceUpdatable { - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void onUserRemoved(@NonNull UserHandle userHandle); - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void onStart(); - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void dump(@NonNull PrintWriter pw, @Nullable String[] args); - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void sendUserLifecycleEvent(int eventType, @Nullable UserHandle userFrom, @NonNull UserHandle userTo); - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void onFactoryReset(@NonNull BiConsumer<Integer, Bundle> processFactoryReset); - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void initBootUser(); - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) CarLaunchParamsModifierUpdatable getCarLaunchParamsModifierUpdatable(); } diff --git a/builtInServices/src/com/android/server/wm/ActivityOptionsWrapper.java b/builtInServices/src/com/android/server/wm/ActivityOptionsWrapper.java index 71ceabb..b67e190 100644 --- a/builtInServices/src/com/android/server/wm/ActivityOptionsWrapper.java +++ b/builtInServices/src/com/android/server/wm/ActivityOptionsWrapper.java @@ -18,9 +18,11 @@ package com.android.server.wm; import android.annotation.SystemApi; import android.app.ActivityOptions; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.window.WindowContainerToken; +import com.android.annotation.AddedIn; + /** * Wrapper of {@link ActivityOptions}. * @hide @@ -34,7 +36,7 @@ public final class ActivityOptionsWrapper { } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static ActivityOptionsWrapper create(ActivityOptions options) { if (options == null) return null; return new ActivityOptionsWrapper(options); @@ -44,7 +46,7 @@ public final class ActivityOptionsWrapper { * Gets the underlying {@link ActivityOptions} that is wrapped by this instance. */ // Exposed the original object in order to allow to use the public accessors. - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public ActivityOptions getOptions() { return mOptions; } @@ -52,7 +54,7 @@ public final class ActivityOptionsWrapper { /** * Gets {@link TaskDisplayAreaWrapper} to launch the Activity into */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public TaskDisplayAreaWrapper getLaunchTaskDisplayArea() { WindowContainerToken daToken = mOptions.getLaunchTaskDisplayArea(); if (daToken == null) return null; @@ -61,7 +63,7 @@ public final class ActivityOptionsWrapper { } @Override - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public String toString() { return mOptions.toString(); } diff --git a/builtInServices/src/com/android/server/wm/ActivityRecordWrapper.java b/builtInServices/src/com/android/server/wm/ActivityRecordWrapper.java index da91220..210995f 100644 --- a/builtInServices/src/com/android/server/wm/ActivityRecordWrapper.java +++ b/builtInServices/src/com/android/server/wm/ActivityRecordWrapper.java @@ -18,10 +18,12 @@ package com.android.server.wm; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.content.ComponentName; import android.content.pm.ActivityInfo; +import com.android.annotation.AddedIn; + /** * Wrapper of {@link ActivityRecord}. * @hide @@ -35,14 +37,14 @@ public final class ActivityRecordWrapper { } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static ActivityRecordWrapper create(@Nullable ActivityRecord activityRecord) { if (activityRecord == null) return null; return new ActivityRecordWrapper(activityRecord); } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public ActivityRecord getActivityRecord() { return mActivityRecord; } @@ -50,7 +52,7 @@ public final class ActivityRecordWrapper { /** * Gets which user this Activity is running for. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public int getUserId() { return mActivityRecord.mUserId; } @@ -58,7 +60,7 @@ public final class ActivityRecordWrapper { /** * Gets the actual {@link ComponentName} of this Activity. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public ComponentName getComponentName() { if (mActivityRecord.info == null) return null; return mActivityRecord.info.getComponentName(); @@ -67,7 +69,7 @@ public final class ActivityRecordWrapper { /** * Gets the {@link TaskDisplayAreaWrapper} where this is located. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public TaskDisplayAreaWrapper getDisplayArea() { return TaskDisplayAreaWrapper.create(mActivityRecord.getDisplayArea()); } @@ -75,7 +77,7 @@ public final class ActivityRecordWrapper { /** * Returns whether this Activity is not displayed. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public boolean isNoDisplay() { return mActivityRecord.noDisplay; } @@ -83,7 +85,7 @@ public final class ActivityRecordWrapper { /** * Gets {@link TaskDisplayAreaWrapper} where the handover Activity is supposed to launch */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public TaskDisplayAreaWrapper getHandoverTaskDisplayArea() { return TaskDisplayAreaWrapper.create(mActivityRecord.mHandoverTaskDisplayArea); } @@ -91,7 +93,7 @@ public final class ActivityRecordWrapper { /** * Gets {@code displayId} where the handover Activity is supposed to launch */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public int getHandoverLaunchDisplayId() { return mActivityRecord.mHandoverLaunchDisplayId; } @@ -99,7 +101,7 @@ public final class ActivityRecordWrapper { /** * Returns whether this Activity allows to be embedded in the other Activity. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public boolean allowingEmbedded() { if (mActivityRecord.info == null) return false; return (mActivityRecord.info.flags & ActivityInfo.FLAG_ALLOW_EMBEDDED) != 0; @@ -108,13 +110,13 @@ public final class ActivityRecordWrapper { /** * Returns whether the display where this Activity is located is trusted. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public boolean isDisplayTrusted() { return mActivityRecord.getDisplayContent().isTrusted(); } @Override - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public String toString() { return mActivityRecord.toString(); } diff --git a/builtInServices/src/com/android/server/wm/CalculateParams.java b/builtInServices/src/com/android/server/wm/CalculateParams.java index 6e0ddd5..0973882 100644 --- a/builtInServices/src/com/android/server/wm/CalculateParams.java +++ b/builtInServices/src/com/android/server/wm/CalculateParams.java @@ -18,10 +18,12 @@ package com.android.server.wm; import android.annotation.SystemApi; import android.app.ActivityOptions; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.content.pm.ActivityInfo; import android.view.WindowLayout; +import com.android.annotation.AddedIn; + /** * Wrapper of the parameters of {@code LaunchParamsController.LaunchParamsModifier.onCalculate()} * @hide @@ -42,7 +44,7 @@ public final class CalculateParams { private CalculateParams() {} /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static CalculateParams create(Task task, ActivityInfo.WindowLayout layout, ActivityRecord actvity, ActivityRecord source, ActivityOptions options, ActivityStarter.Request request, int phase, @@ -66,7 +68,7 @@ public final class CalculateParams { /** * Gets the {@link TaskWrapper} currently being positioned. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public TaskWrapper getTask() { return mTask; } @@ -74,7 +76,7 @@ public final class CalculateParams { /** * Gets the specified {@link WindowLayoutWrapper}. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public WindowLayoutWrapper getWindowLayout() { return mLayout; } @@ -82,7 +84,7 @@ public final class CalculateParams { /** * Gets the {@link ActivityRecordWrapper} currently being positioned. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public ActivityRecordWrapper getActivity() { return mActivity; } @@ -90,7 +92,7 @@ public final class CalculateParams { /** * Gets the {@link ActivityRecordWrapper} from which activity was started from. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public ActivityRecordWrapper getSource() { return mSource; } @@ -98,7 +100,7 @@ public final class CalculateParams { /** * Gets the {@link ActivityOptionsWrapper} specified for the activity. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public ActivityOptionsWrapper getOptions() { return mOptions; } @@ -106,7 +108,7 @@ public final class CalculateParams { /** * Gets the optional {@link RequestWrapper} from the activity starter. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public RequestWrapper getRequest() { return mRequest; } @@ -115,7 +117,7 @@ public final class CalculateParams { * Gets the {@link LaunchParamsController.LaunchParamsModifier.Phase} that the resolution should * finish. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public int getPhase() { return mPhase; } @@ -123,7 +125,7 @@ public final class CalculateParams { /** * Gets the current {@link LaunchParamsWrapper}. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public LaunchParamsWrapper getCurrentParams() { return mCurrentParams; } @@ -131,7 +133,7 @@ public final class CalculateParams { /** * Gets the resulting {@link LaunchParamsWrapper}. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public LaunchParamsWrapper getOutParams() { return mOutParams; } @@ -139,7 +141,7 @@ public final class CalculateParams { /** * Returns whether the current system supports the multiple display. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public boolean supportsMultiDisplay() { return mSupportsMultiDisplay; } diff --git a/builtInServices/src/com/android/server/wm/CarDisplayAreaPolicyProvider.java b/builtInServices/src/com/android/server/wm/CarDisplayAreaPolicyProvider.java index ea4a4bf..96a90bc 100644 --- a/builtInServices/src/com/android/server/wm/CarDisplayAreaPolicyProvider.java +++ b/builtInServices/src/com/android/server/wm/CarDisplayAreaPolicyProvider.java @@ -16,6 +16,7 @@ package com.android.server.wm; +import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; @@ -83,14 +84,17 @@ public class CarDisplayAreaPolicyProvider implements DisplayAreaPolicy.Provider TaskDisplayArea backgroundTaskDisplayArea = new TaskDisplayArea(content, wmService, "BackgroundTaskDisplayArea", BACKGROUND_TASK_CONTAINER, /* createdByOrganizer= */ false, /* canHostHomeTask= */ false); + backgroundTaskDisplayArea.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); TaskDisplayArea controlBarDisplayArea = new TaskDisplayArea(content, wmService, "ControlBarTaskDisplayArea", CONTROL_BAR_DISPLAY_AREA, /* createdByOrganizer= */ false, /* canHostHomeTask= */ false); + controlBarDisplayArea.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); TaskDisplayArea voicePlateTaskDisplayArea = new TaskDisplayArea(content, wmService, "VoicePlateTaskDisplayArea", FEATURE_VOICE_PLATE, /* createdByOrganizer= */ false, /* canHostHomeTask= */ false); + // voicePlatTaskDisplayArea needs to be in full screen windowing mode. List<TaskDisplayArea> backgroundTdaList = new ArrayList<>(); backgroundTdaList.add(voicePlateTaskDisplayArea); @@ -115,6 +119,8 @@ public class CarDisplayAreaPolicyProvider implements DisplayAreaPolicy.Provider // Default application launches here RootDisplayArea defaultAppsRoot = new DisplayAreaGroup(wmService, "FeatureForegroundApplication", FOREGROUND_DISPLAY_AREA_ROOT); + defaultAppsRoot.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); + TaskDisplayArea defaultAppTaskDisplayArea = new TaskDisplayArea(content, wmService, "DefaultApplicationTaskDisplayArea", DEFAULT_APP_TASK_CONTAINER); List<TaskDisplayArea> firstTdaList = new ArrayList<>(); diff --git a/builtInServices/src/com/android/server/wm/CarLaunchParamsModifier.java b/builtInServices/src/com/android/server/wm/CarLaunchParamsModifier.java index 6472ffb..a7bdb4c 100644 --- a/builtInServices/src/com/android/server/wm/CarLaunchParamsModifier.java +++ b/builtInServices/src/com/android/server/wm/CarLaunchParamsModifier.java @@ -188,7 +188,7 @@ public final class CarLaunchParamsModifier implements LaunchParamsController.Lau @Nullable private TaskDisplayAreaWrapper findTaskDisplayArea(int displayId, int featureId) { - DisplayContent display = mAtm.mRootWindowContainer.getDisplayContentOrCreate(displayId); + DisplayContent display = mAtm.mRootWindowContainer.getDisplayContent(displayId); if (display == null) { return null; } diff --git a/builtInServices/src/com/android/server/wm/CarLaunchParamsModifierInterface.java b/builtInServices/src/com/android/server/wm/CarLaunchParamsModifierInterface.java index 80abda8..2627c74 100644 --- a/builtInServices/src/com/android/server/wm/CarLaunchParamsModifierInterface.java +++ b/builtInServices/src/com/android/server/wm/CarLaunchParamsModifierInterface.java @@ -19,10 +19,12 @@ package com.android.server.wm; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.graphics.Rect; import android.view.Display; +import com.android.annotation.AddedIn; + import java.util.List; /** @@ -40,19 +42,19 @@ public interface CarLaunchParamsModifierInterface { * Returns {@link TaskDisplayAreaWrapper} of the given {@code featureId} in the given * {@code displayId}. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) @Nullable TaskDisplayAreaWrapper findTaskDisplayArea(int displayId, int featureId); /** * Returns the default {@link TaskDisplayAreaWrapper} of the given {@code displayId}. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) @Nullable TaskDisplayAreaWrapper getDefaultTaskDisplayAreaOnDisplay(int displayId); /** * Returns the list of fallback {@link TaskDisplayAreaWrapper} from the source of the request. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) @NonNull List<TaskDisplayAreaWrapper> getFallbackDisplayAreasForActivity( @NonNull ActivityRecordWrapper activityRecord, @Nullable RequestWrapper request); diff --git a/builtInServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatable.java b/builtInServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatable.java index a8bbe5a..6ea45e2 100644 --- a/builtInServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatable.java +++ b/builtInServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatable.java @@ -20,8 +20,8 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.UserIdInt; -import android.car.annotation.AddedIn; import android.car.app.CarActivityManager; +import android.car.builtin.annotation.PlatformVersion; import android.content.ComponentName; import android.hardware.display.DisplayManager; import android.os.ServiceSpecificException; @@ -32,6 +32,7 @@ import android.util.SparseIntArray; import android.view.Display; import android.window.DisplayAreaOrganizer; +import com.android.annotation.AddedIn; import com.android.internal.annotations.GuardedBy; import java.util.ArrayList; @@ -47,25 +48,25 @@ import java.util.List; public interface CarLaunchParamsModifierUpdatable { /** Returns {@link DisplayManager.DisplayListener} of CarLaunchParamsModifierUpdatable. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) DisplayManager.DisplayListener getDisplayListener(); /** Notifies user switching. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void handleCurrentUserSwitching(@UserIdInt int newUserId); /** Notifies user starting. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void handleUserStarting(@UserIdInt int startingUser); /** Notifies user stopped. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) void handleUserStopped(@UserIdInt int stoppedUser); /** * Calculates {@code outParams} based on the given arguments. * See {@code LaunchParamsController.LaunchParamsModifier.onCalculate()} for the detail. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) int calculate(CalculateParams params); } diff --git a/builtInServices/src/com/android/server/wm/LaunchParamsWrapper.java b/builtInServices/src/com/android/server/wm/LaunchParamsWrapper.java index 45112c4..8d36a5b 100644 --- a/builtInServices/src/com/android/server/wm/LaunchParamsWrapper.java +++ b/builtInServices/src/com/android/server/wm/LaunchParamsWrapper.java @@ -18,9 +18,11 @@ package com.android.server.wm; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.graphics.Rect; +import com.android.annotation.AddedIn; + /** * Wrapper of {@link com.android.server.wm.LaunchParamsController.LaunchParams}. * @hide @@ -28,19 +30,19 @@ import android.graphics.Rect; @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) public final class LaunchParamsWrapper { /** Returned when the modifier does not want to influence the bounds calculation */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static int RESULT_SKIP = LaunchParamsController.LaunchParamsModifier.RESULT_SKIP; /** * Returned when the modifier has changed the bounds and would like its results to be the * final bounds applied. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static int RESULT_DONE = LaunchParamsController.LaunchParamsModifier.RESULT_DONE; /** * Returned when the modifier has changed the bounds but is okay with other modifiers * influencing the bounds. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static int RESULT_CONTINUE = LaunchParamsController.LaunchParamsModifier.RESULT_CONTINUE; private final LaunchParamsController.LaunchParams mLaunchParams; @@ -50,7 +52,7 @@ public final class LaunchParamsWrapper { } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static LaunchParamsWrapper create( @Nullable LaunchParamsController.LaunchParams launchParams) { if (launchParams == null) return null; @@ -60,7 +62,7 @@ public final class LaunchParamsWrapper { /** * Gets the {@link TaskDisplayAreaWrapper} the {@link Task} would prefer to be on. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public TaskDisplayAreaWrapper getPreferredTaskDisplayArea() { return TaskDisplayAreaWrapper.create(mLaunchParams.mPreferredTaskDisplayArea); } @@ -68,7 +70,7 @@ public final class LaunchParamsWrapper { /** * Sets the {@link TaskDisplayAreaWrapper} the {@link Task} would prefer to be on. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public void setPreferredTaskDisplayArea(TaskDisplayAreaWrapper tda) { mLaunchParams.mPreferredTaskDisplayArea = tda.getTaskDisplayArea(); } @@ -76,7 +78,7 @@ public final class LaunchParamsWrapper { /** * Gets the windowing mode to be in. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public int getWindowingMode() { return mLaunchParams.mWindowingMode; } @@ -84,7 +86,7 @@ public final class LaunchParamsWrapper { /** * Sets the windowing mode to be in. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public void setWindowingMode(int windowingMode) { mLaunchParams.mWindowingMode = windowingMode; } @@ -92,7 +94,7 @@ public final class LaunchParamsWrapper { /** * Gets the bounds within the parent container. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public Rect getBounds() { return mLaunchParams.mBounds; } @@ -100,13 +102,13 @@ public final class LaunchParamsWrapper { /** * Sets the bounds within the parent container. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public void setBounds(Rect bounds) { mLaunchParams.mBounds.set(bounds); } @Override - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public String toString() { return "LaunchParams{" + "mPreferredTaskDisplayArea=" + mLaunchParams.mPreferredTaskDisplayArea + diff --git a/builtInServices/src/com/android/server/wm/RequestWrapper.java b/builtInServices/src/com/android/server/wm/RequestWrapper.java index 826b648..2bda2f1 100644 --- a/builtInServices/src/com/android/server/wm/RequestWrapper.java +++ b/builtInServices/src/com/android/server/wm/RequestWrapper.java @@ -18,7 +18,9 @@ package com.android.server.wm; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; + +import com.android.annotation.AddedIn; /** * Wrapper of {@link com.android.server.wm.ActivityStarter.Request}. @@ -33,20 +35,20 @@ public final class RequestWrapper { } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static RequestWrapper create(@Nullable ActivityStarter.Request request) { if (request == null) return null; return new RequestWrapper(request); } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public ActivityStarter.Request getRequest() { return mRequest; } @Override - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public String toString() { return mRequest.toString(); } diff --git a/builtInServices/src/com/android/server/wm/TaskDisplayAreaWrapper.java b/builtInServices/src/com/android/server/wm/TaskDisplayAreaWrapper.java index 1f51243..d703246 100644 --- a/builtInServices/src/com/android/server/wm/TaskDisplayAreaWrapper.java +++ b/builtInServices/src/com/android/server/wm/TaskDisplayAreaWrapper.java @@ -18,9 +18,11 @@ package com.android.server.wm; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.view.Display; +import com.android.annotation.AddedIn; + /** * Wrapper of {@link TaskDisplayArea}. * @hide @@ -34,14 +36,14 @@ public final class TaskDisplayAreaWrapper { } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static TaskDisplayAreaWrapper create(@Nullable TaskDisplayArea taskDisplayArea) { if (taskDisplayArea == null) return null; return new TaskDisplayAreaWrapper(taskDisplayArea); } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public TaskDisplayArea getTaskDisplayArea() { return mTaskDisplayArea; } @@ -49,13 +51,13 @@ public final class TaskDisplayAreaWrapper { /** * Gets the display this {@link TaskDisplayAreaWrapper} is on. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public Display getDisplay() { return mTaskDisplayArea.getDisplayContent().getDisplay(); } @Override - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public String toString() { return mTaskDisplayArea.toString(); } diff --git a/builtInServices/src/com/android/server/wm/TaskWrapper.java b/builtInServices/src/com/android/server/wm/TaskWrapper.java index 275d141..3759f91 100644 --- a/builtInServices/src/com/android/server/wm/TaskWrapper.java +++ b/builtInServices/src/com/android/server/wm/TaskWrapper.java @@ -18,7 +18,9 @@ package com.android.server.wm; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; + +import com.android.annotation.AddedIn; /** * Wrapper of {@link Task}. @@ -33,7 +35,7 @@ public final class TaskWrapper { } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static TaskWrapper create(@Nullable Task task) { if (task == null) return null; return new TaskWrapper(task); @@ -42,7 +44,7 @@ public final class TaskWrapper { /** * Gets the {@code userId} of this {@link Task} is created for */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public int getUserId() { return mTask.mUserId; } @@ -50,7 +52,7 @@ public final class TaskWrapper { /** * Gets the root {@link TaskWrapper} of the this. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public TaskWrapper getRootTask() { return create(mTask.getRootTask()); } @@ -58,13 +60,13 @@ public final class TaskWrapper { /** * Gets the {@link TaskDisplayAreaWrapper} this {@link Task} is on. */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public TaskDisplayAreaWrapper getTaskDisplayArea() { return TaskDisplayAreaWrapper.create(mTask.getTaskDisplayArea()); } @Override - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public String toString() { return mTask.toString(); } diff --git a/builtInServices/src/com/android/server/wm/WindowLayoutWrapper.java b/builtInServices/src/com/android/server/wm/WindowLayoutWrapper.java index ba2cee6..f55ce99 100644 --- a/builtInServices/src/com/android/server/wm/WindowLayoutWrapper.java +++ b/builtInServices/src/com/android/server/wm/WindowLayoutWrapper.java @@ -18,9 +18,11 @@ package com.android.server.wm; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.car.annotation.AddedIn; +import android.car.builtin.annotation.PlatformVersion; import android.content.pm.ActivityInfo; +import com.android.annotation.AddedIn; + /** * Wrapper of {@link android.content.pm.ActivityInfo.WindowLayout}. * @hide @@ -34,14 +36,14 @@ public final class WindowLayoutWrapper { } /** @hide */ - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public static WindowLayoutWrapper create(@Nullable ActivityInfo.WindowLayout layout) { if (layout == null) return null; return new WindowLayoutWrapper(layout); } @Override - @AddedIn(majorVersion = 33) + @AddedIn(PlatformVersion.TIRAMISU_0) public String toString() { return mLayout.toString(); } diff --git a/builtInServices/tests/src/com/android/server/wm/AnnotationTest.java b/builtInServices/tests/src/com/android/server/wm/AnnotationTest.java index 20239fa..8360985 100644 --- a/builtInServices/tests/src/com/android/server/wm/AnnotationTest.java +++ b/builtInServices/tests/src/com/android/server/wm/AnnotationTest.java @@ -18,7 +18,7 @@ package com.android.server.wm; import static com.google.common.truth.Truth.assertWithMessage; -import android.car.annotation.AddedIn; +import com.android.annotation.AddedIn; import static android.car.test.util.AnnotationHelper.checkForAnnotation; diff --git a/updatableServices/src/com/android/internal/car/updatable/CarServiceProxy.java b/updatableServices/src/com/android/internal/car/updatable/CarServiceProxy.java index 0824755..da3db22 100644 --- a/updatableServices/src/com/android/internal/car/updatable/CarServiceProxy.java +++ b/updatableServices/src/com/android/internal/car/updatable/CarServiceProxy.java @@ -16,6 +16,8 @@ package com.android.internal.car.updatable; +import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_CREATED; +import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_REMOVED; import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_STARTING; import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_STOPPED; import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_STOPPING; @@ -197,7 +199,7 @@ final class CarServiceProxy { boolean user0IsCurrent = lastSwitchedUser == USER_SYSTEM; // If user0Lifecycle is 0, then no life-cycle event received yet. if (user0Lifecycle != 0) { - sendAllLifecyleToUser(USER_SYSTEM, user0Lifecycle, + sendAllLifecycleToUser(USER_SYSTEM, user0Lifecycle, user0IsCurrent); } lastUserLifecycle.delete(USER_SYSTEM); @@ -207,7 +209,7 @@ final class CarServiceProxy { int currentUserLifecycle = lastUserLifecycle.get(lastSwitchedUser); // If currentUserLifecycle is 0, then no life-cycle event received yet. if (currentUserLifecycle != 0) { - sendAllLifecyleToUser(lastSwitchedUser, currentUserLifecycle, + sendAllLifecycleToUser(lastSwitchedUser, currentUserLifecycle, /* isCurrentUser= */ true); } } @@ -218,15 +220,34 @@ final class CarServiceProxy { for (int i = 0; i < lastUserLifecycle.size(); i++) { int userId = lastUserLifecycle.keyAt(i); int lifecycle = lastUserLifecycle.valueAt(i); - sendAllLifecyleToUser(userId, lifecycle, /* isCurrentUser= */ false); + sendAllLifecycleToUser(userId, lifecycle, /* isCurrentUser= */ false); } } - private void sendAllLifecyleToUser(@UserIdInt int userId, int lifecycle, + private void sendAllLifecycleToUser(@UserIdInt int userId, int lifecycle, boolean isCurrentUser) { if (DBG) { - Slogf.d(TAG, "sendAllLifecyleToUser, user:" + userId + " lifecycle:" + lifecycle); + Slogf.d(TAG, "sendAllLifecycleToUser, user:" + userId + " lifecycle:" + lifecycle); } + + // User created and user removed are unrelated to the user switching/unlocking flow. + // Return early to prevent them from going into the following logic + // that makes assumptions about the sequence of lifecycle event types + // following numerical order. + if (lifecycle == USER_LIFECYCLE_EVENT_TYPE_CREATED) { + sendUserLifecycleEventInternal(USER_LIFECYCLE_EVENT_TYPE_CREATED, + UserManagerHelper.USER_NULL, userId); + return; + } + + if (lifecycle == USER_LIFECYCLE_EVENT_TYPE_REMOVED) { + sendUserLifecycleEventInternal(USER_LIFECYCLE_EVENT_TYPE_REMOVED, + UserManagerHelper.USER_NULL, userId); + return; + } + + // The following logic makes assumptions about the sequence of lifecycle event types + // following numerical order. if (lifecycle >= USER_LIFECYCLE_EVENT_TYPE_STARTING) { sendUserLifecycleEventInternal(USER_LIFECYCLE_EVENT_TYPE_STARTING, UserManagerHelper.USER_NULL, userId); @@ -401,8 +422,11 @@ final class CarServiceProxy { Preconditions.checkArgument((value instanceof UserHandle), "Invalid value for ON_USER_REMOVED: %s", value); UserHandle user = (UserHandle) value; + // TODO(235524989): Consolidating logging with other lifecycle events, + // including user metrics. if (DBG) Slogf.d(TAG, "Sending onUserRemoved(): " + user); - mCarService.onUserRemoved(user); + mCarService.onUserLifecycleEvent(USER_LIFECYCLE_EVENT_TYPE_REMOVED, + UserManagerHelper.USER_NULL, user.getIdentifier()); } /** diff --git a/updatableServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatableImpl.java b/updatableServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatableImpl.java index d836c03..03933b4 100644 --- a/updatableServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatableImpl.java +++ b/updatableServices/src/com/android/server/wm/CarLaunchParamsModifierUpdatableImpl.java @@ -272,11 +272,11 @@ public final class CarLaunchParamsModifierUpdatableImpl TaskDisplayAreaWrapper originalDisplayArea = currentParams.getPreferredTaskDisplayArea(); // DisplayArea where CarLaunchParamsModifier targets to launch the Activity. TaskDisplayAreaWrapper targetDisplayArea = null; + ComponentName activityName = activity.getComponentName(); if (DBG) { - Slogf.d(TAG, "onCalculate, userId:%d original displayArea:%s ActivityOptions:%s", - userId, originalDisplayArea, options); + Slogf.d(TAG, "onCalculate, userId:%d original displayArea:%s actvity:%s options:%s", + userId, originalDisplayArea, activityName, options); } - ComponentName activityName = activity.getComponentName(); decision: synchronized (mLock) { // If originalDisplayArea is set, respect that before ActivityOptions check. @@ -350,7 +350,7 @@ public final class CarLaunchParamsModifierUpdatableImpl } if (targetDisplayArea != null && originalDisplayArea != targetDisplayArea) { Slogf.i(TAG, "Changed launching display, user:%d requested display area:%s" - + " target display area:", userId, originalDisplayArea, targetDisplayArea); + + " target display area:%s", userId, originalDisplayArea, targetDisplayArea); outParams.setPreferredTaskDisplayArea(targetDisplayArea); return LaunchParamsWrapper.RESULT_DONE; } else { diff --git a/updatableServices/tests/src/com/android/internal/car/updatable/CarServiceProxyTest.java b/updatableServices/tests/src/com/android/internal/car/updatable/CarServiceProxyTest.java index 714cf55..39781c5 100644 --- a/updatableServices/tests/src/com/android/internal/car/updatable/CarServiceProxyTest.java +++ b/updatableServices/tests/src/com/android/internal/car/updatable/CarServiceProxyTest.java @@ -15,6 +15,7 @@ */ package com.android.internal.car.updatable; +import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_REMOVED; import static com.android.car.internal.common.CommonConstants.USER_LIFECYCLE_EVENT_TYPE_SWITCHING; import static org.mockito.Mockito.any; @@ -27,6 +28,7 @@ import android.car.test.mocks.AbstractExtendedMockitoTestCase; import android.car.test.util.UserTestingHelper.UserInfoBuilder; import android.content.pm.UserInfo; import android.os.RemoteException; +import android.os.UserHandle; import com.android.car.internal.ICarSystemServerClient; import com.android.server.SystemService.TargetUser; @@ -115,7 +117,7 @@ public class CarServiceProxyTest extends AbstractExtendedMockitoTestCase { verifyInitBootUserCalled(); verifySendLifecycleEventCalled(USER_LIFECYCLE_EVENT_TYPE_SWITCHING); - verifyOnUserRemovedCalled(); + verifyLifecycleEventCalledForUserRemoval(); } @Test @@ -124,14 +126,14 @@ public class CarServiceProxyTest extends AbstractExtendedMockitoTestCase { callOnUserRemoved(); - verifyOnUserRemovedCalled(); + verifyLifecycleEventCalledForUserRemoval(); } @Test public void testOnUserRemoved_CarServiceNull() throws RemoteException { callOnUserRemoved(); - verifyOnUserRemovedNeverCalled(); + verifySendLifecycleEventNeverCalled(); } @Test @@ -203,10 +205,13 @@ public class CarServiceProxyTest extends AbstractExtendedMockitoTestCase { verify(mCarService, never()).onUserLifecycleEvent(anyInt(), anyInt(), anyInt()); } - private void verifyOnUserRemovedCalled() throws RemoteException { - verify(mCarService).onUserRemoved(mRemovedUser1.getUserHandle()); - verify(mCarService).onUserRemoved(mRemovedUser2.getUserHandle()); - verify(mCarService).onUserRemoved(mRemovedUser3.getUserHandle()); + private void verifyLifecycleEventCalledForUserRemoval() throws RemoteException { + verify(mCarService).onUserLifecycleEvent(USER_LIFECYCLE_EVENT_TYPE_REMOVED, + UserHandle.USER_NULL, mRemovedUser1.getUserHandle().getIdentifier()); + verify(mCarService).onUserLifecycleEvent(USER_LIFECYCLE_EVENT_TYPE_REMOVED, + UserHandle.USER_NULL, mRemovedUser2.getUserHandle().getIdentifier()); + verify(mCarService).onUserLifecycleEvent(USER_LIFECYCLE_EVENT_TYPE_REMOVED, + UserHandle.USER_NULL, mRemovedUser3.getUserHandle().getIdentifier()); } private void verifyOnUserRemovedNeverCalled() throws RemoteException { |