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

Commit 8bc9186a authored by Yu Shan's avatar Yu Shan Committed by Android (Google) Code Review
Browse files

Merge "Correct REMOVE_USER change mode." into main

parents 29aea558 3c1cfbe4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1215,7 +1215,7 @@
            {
                "name": "REMOVE_USER",
                "value": 299896586,
                "description": "Called by the Android System after an Android user was removed.\nThe HAL can use this property to remove its equivalent user.\nThis is write-only call - the Android System is not expecting a reply from the HAL. Hence, this request should not fail - if the equivalent HAL user cannot be removed, then HAL should mark it as inactive or recover in some other way.\nThe request is made by setting the VehiclePropValue with the contents defined by RemoveUserRequest.\nFor example, if system had 3 users (0, 10, and 11) and user 11 was removed, the request would be:\nint32[0]: 42  \/\/ request id int32[1]: 11  \/\/ (Android user id of the removed user) int32[2]: 0   \/\/ (Android user flags of the removed user) int32[3]: 10  \/\/ current user int32[4]: 0   \/\/ current user flags (none) int32[5]: 2   \/\/ number of users int32[6]: 0   \/\/ 1st user (user 0) int32[7]: 0   \/\/ 1st user flags (none) int32[8]: 10  \/\/ 2nd user (user 10) int32[9]: 0   \/\/ 2nd user flags (none)"
                "description": "Called by the Android System after an Android user was removed.\nThe HAL can use this property to remove its equivalent user.\nThis is write-only call - the Android System is not expecting a reply from the HAL. Hence, this request should not fail - if the equivalent HAL user cannot be removed, then HAL should mark it as inactive or recover in some other way.\nThe request is made by setting the VehiclePropValue with the contents defined by RemoveUserRequest.\nFor example, if system had 3 users (0, 10, and 11) and user 11 was removed, the request would be:\nint32[0]: 42  \/\/ request id int32[1]: 11  \/\/ (Android user id of the removed user) int32[2]: 0   \/\/ (Android user flags of the removed user) int32[3]: 10  \/\/ current user int32[4]: 0   \/\/ current user flags (none) int32[5]: 2   \/\/ number of users int32[6]: 0   \/\/ 1st user (user 0) int32[7]: 0   \/\/ 1st user flags (none) int32[8]: 10  \/\/ 2nd user (user 10) int32[9]: 0   \/\/ 2nd user flags (none)\nBefore Android B, this property's change mode was defined as STATIC although the property value may be updated from Android side. For backward compatibility, we still allow STATIC as change mode, but for new implementations, ON_CHANGE should be used instead."
            },
            {
                "name": "USER_IDENTIFICATION_ASSOCIATION",
+1 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> ChangeModeForVehi
        {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyChangeMode::ON_CHANGE},
        {VehicleProperty::SWITCH_USER, VehiclePropertyChangeMode::ON_CHANGE},
        {VehicleProperty::CREATE_USER, VehiclePropertyChangeMode::ON_CHANGE},
        {VehicleProperty::REMOVE_USER, VehiclePropertyChangeMode::STATIC},
        {VehicleProperty::REMOVE_USER, VehiclePropertyChangeMode::ON_CHANGE},
        {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyChangeMode::ON_CHANGE},
        {VehicleProperty::EVS_SERVICE_REQUEST, VehiclePropertyChangeMode::ON_CHANGE},
        {VehicleProperty::POWER_POLICY_REQ, VehiclePropertyChangeMode::ON_CHANGE},
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public final class ChangeModeForVehicleProperty {
        Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyChangeMode.ON_CHANGE),
        Map.entry(VehicleProperty.SWITCH_USER, VehiclePropertyChangeMode.ON_CHANGE),
        Map.entry(VehicleProperty.CREATE_USER, VehiclePropertyChangeMode.ON_CHANGE),
        Map.entry(VehicleProperty.REMOVE_USER, VehiclePropertyChangeMode.STATIC),
        Map.entry(VehicleProperty.REMOVE_USER, VehiclePropertyChangeMode.ON_CHANGE),
        Map.entry(VehicleProperty.USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyChangeMode.ON_CHANGE),
        Map.entry(VehicleProperty.EVS_SERVICE_REQUEST, VehiclePropertyChangeMode.ON_CHANGE),
        Map.entry(VehicleProperty.POWER_POLICY_REQ, VehiclePropertyChangeMode.ON_CHANGE),
+5 −1
Original line number Diff line number Diff line
@@ -5716,7 +5716,11 @@ enum VehicleProperty {
     * int32[8]: 10  // 2nd user (user 10)
     * int32[9]: 0   // 2nd user flags (none)
     *
     * @change_mode VehiclePropertyChangeMode.STATIC
     * Before Android B, this property's change mode was defined as STATIC although the property
     * value may be updated from Android side. For backward compatibility, we still allow STATIC
     * as change mode, but for new implementations, ON_CHANGE should be used instead.
     *
     * @change_mode VehiclePropertyChangeMode.ON_CHANGE
     * @access VehiclePropertyAccess.WRITE
     * @version 2
     */
+15 −3
Original line number Diff line number Diff line
@@ -1248,9 +1248,21 @@ TEST_P(VtsHalAutomotivePropertyConfigTest, verifyPropertyConfig) {
        }
    }

    if (actualPropId != toInt(VehicleProperty::REMOVE_USER)) {
        EXPECT_EQ(actualChangeMode, expectedChangeMode)
                << StringPrintf("Expect to get VehiclePropertyChangeMode: %i, got %i",
                                expectedChangeMode, actualChangeMode);
    } else {
        // Special logic for REMOVE_USER property. We allow both STATIC and ON_CHANGE change mode
        // because historically we define the change mode to be STATIC which is incorrect, it should
        // be on_change. For backward compatibility, we have to allow both.
        EXPECT_THAT(actualChangeMode, ::testing::AnyOf(toInt(VehiclePropertyChangeMode::STATIC),
                                                       toInt(VehiclePropertyChangeMode::ON_CHANGE)))
                << StringPrintf(
                           "Expect to get VehiclePropertyChangeMode as one of: "
                           "[STATIC, ON_CHANGE], got %i",
                           actualChangeMode);
    }

    std::unordered_set<std::string> annotations;
    auto it = AnnotationsForVehicleProperty.find(param.propId);