Search -mainline- from anywhere in kernel release
The string -mainline- can appear anywhere in the kernel release. One
such example is:
5.10.0-rc1-mainline-14939-g67d3ed57657b-ab6938779
Modify the predicate the make IsMainline more tolerant.
Fixes: 172294228
Test: boot cuttlefish with mainline kernel
Change-Id: I5f91908f5a5a676ebbd115f2cf08cee79be1f58e
diff --git a/RuntimeInfo-target.cpp b/RuntimeInfo-target.cpp
index 659cdec..c6aa8f6 100644
--- a/RuntimeInfo-target.cpp
+++ b/RuntimeInfo-target.cpp
@@ -147,9 +147,7 @@
if (!parse(mRuntimeInfo->mOsRelease.substr(0, pos), &mRuntimeInfo->mKernel.mVersion)) {
return UNKNOWN_ERROR;
}
- mRuntimeInfo->mIsMainline =
- pos != std::string::npos &&
- android::base::StartsWith(mRuntimeInfo->mOsRelease.substr(pos), kMainline);
+ mRuntimeInfo->mIsMainline = mRuntimeInfo->mOsRelease.find(kMainline) != std::string::npos;
return OK;
}