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

Commit 9ba443f0 authored by Yu Shan's avatar Yu Shan
Browse files

Deprecate DefaultConfig.h.

We migrated DefaultConfig.h to config JSON files.

Test: Presubmit
Bug: 238685398
Change-Id: Ia3d2e5b34b0cdbfb5078129aabfe4b080e2e67a8
parent 31b0fd2f
Loading
Loading
Loading
Loading
+0 −37
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2021 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 {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

cc_library_headers {
    name: "VehicleHalDefaultConfig",
    vendor: true,
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
    defaults: ["VehicleHalDefaults"],
    static_libs: ["VehicleHalUtils"],
    header_libs: [
        "VehicleHalJsonConfigLoaderHeaders",
        "VehicleHalTestUtilHeaders",
    ],
    export_static_lib_headers: ["VehicleHalUtils"],
    export_header_lib_headers: [
        "VehicleHalTestUtilHeaders",
        "VehicleHalJsonConfigLoaderHeaders",
    ],
}
+0 −6
Original line number Original line Diff line number Diff line
@@ -30,8 +30,6 @@ cc_test {
        "libgtest",
        "libgtest",
    ],
    ],
    header_libs: [
    header_libs: [
        // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h
        "VehicleHalDefaultConfig",
        "IVehicleGeneratedHeaders",
        "IVehicleGeneratedHeaders",
    ],
    ],
    shared_libs: [
    shared_libs: [
@@ -55,13 +53,9 @@ cc_test {
        "libgtest",
        "libgtest",
    ],
    ],
    cflags: [
    cflags: [
        // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h
        "-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING",
        "-DENABLE_VEHICLE_HAL_TEST_PROPERTIES",
        "-DENABLE_VEHICLE_HAL_TEST_PROPERTIES",
    ],
    ],
    header_libs: [
    header_libs: [
        // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h
        "VehicleHalDefaultConfig",
        "IVehicleGeneratedHeaders",
        "IVehicleGeneratedHeaders",
    ],
    ],
    shared_libs: [
    shared_libs: [
+0 −21
Original line number Original line Diff line number Diff line
@@ -14,7 +14,6 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


#include <DefaultConfig.h>
#include <JsonConfigLoader.h>
#include <JsonConfigLoader.h>
#include <VehicleUtils.h>
#include <VehicleUtils.h>
#include <android-base/file.h>
#include <android-base/file.h>
@@ -80,26 +79,6 @@ TEST(DefaultConfigTest, TestloadVendorClusterTestProperties) {
    ASSERT_TRUE(result.ok()) << result.error().message();
    ASSERT_TRUE(result.ok()) << result.error().message();
}
}


// TODO(b/238685398): Remove this test after we deprecate DefaultConfig.h
TEST(DefaultConfigTest, TestCompatibleWithDefaultConfigHeader) {
    auto configsFromHeaderFile = defaultconfig::getDefaultConfigs();

    std::vector<ConfigDeclaration> configsFromJson;
    JsonConfigLoader loader;
    for (const char* file :
         std::vector<const char*>({kDefaultPropertiesConfigFile, kTestPropertiesConfigFile,
                                   kVendorClusterTestPropertiesConfigFile})) {
        auto result = loadConfig(loader, file);
        ASSERT_TRUE(result.ok()) << result.error().message();
        for (auto& [propId, configDeclaration] : result.value()) {
            configsFromJson.push_back(configDeclaration);
        }
    }

    ASSERT_EQ(configsFromHeaderFile.size(), configsFromJson.size());
    ASSERT_THAT(configsFromHeaderFile, UnorderedElementsAreArray(configsFromJson));
}

#endif  // ENABLE_VEHICLE_HAL_TEST_PROPERTIES
#endif  // ENABLE_VEHICLE_HAL_TEST_PROPERTIES


}  // namespace test
}  // namespace test
+0 −1
Original line number Original line Diff line number Diff line
@@ -61,6 +61,5 @@ cc_test {
    data: [
    data: [
        ":VehicleHalDefaultProperties_JSON",
        ":VehicleHalDefaultProperties_JSON",
    ],
    ],
    header_libs: ["VehicleHalDefaultConfig"],
    test_suites: ["device-tests"],
    test_suites: ["device-tests"],
}
}