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

Commit ac5da892 authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Fix minor version bump reflected in lshal --init-vintf am: e86f70b4

am: cab805aa

Change-Id: Idf92e510713e438f8a649e411eecbb4e61715eee
parents a2d9c1e4 cab805aa
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -244,6 +244,16 @@ void ListCommand::printLine(
    mOut << std::endl;
}

static inline bool findAndBumpVersion(vintf::ManifestHal* hal, const vintf::Version& version) {
    for (vintf::Version& v : hal->versions) {
        if (v.majorVer == version.majorVer) {
            v.minorVer = std::max(v.minorVer, version.minorVer);
            return true;
        }
    }
    return false;
}

void ListCommand::dumpVintf() const {
    using vintf::operator|=;
    mOut << "<!-- " << std::endl
@@ -253,7 +263,9 @@ void ListCommand::dumpVintf() const {
         << "       only hwbinder is shown." << std::endl
         << "    3. It is likely that HALs in passthrough transport does not have" << std::endl
         << "       <interface> declared; users will have to write them by hand." << std::endl
         << "    4. sepolicy version is set to 0.0. It is recommended that the entry" << std::endl
         << "    4. A HAL with lower minor version can be overridden by a HAL with" << std::endl
         << "       higher minor version if they have the same name and major version." << std::endl
         << "    5. sepolicy version is set to 0.0. It is recommended that the entry" << std::endl
         << "       is removed from the manifest file and written by assemble_vintf" << std::endl
         << "       at build time." << std::endl
         << "-->" << std::endl;
@@ -324,7 +336,7 @@ void ListCommand::dumpVintf() const {
                    done = true;
                    break;
                }
                if (hal->hasVersion(version)) {
                if (findAndBumpVersion(hal, version)) {
                    if (&table != &mImplementationsTable) {
                        hal->interfaces[interfaceName].name = interfaceName;
                        hal->interfaces[interfaceName].instances.insert(instanceName);