Support <system-sdk> in fwk manifest and dev matrix.
<system-sdk> is a tag in framework manifest and
device matrix. It states a list of System SDK levels
that the framework supports for vendor apps / vendor
apps requires.
Format:
<system-sdk>
<version>14</version>
<version>15</version>
</system-sdk>
Versions must not be duplicated.
It is compatible when the set specified in framework
manifest is a superset of the set specified in the
device compatibility matrix.
Test: libvintf_test
Test: vintf_object_tests
Bug: 69088799
Change-Id: I802f055ea60666995202438a770d1e440517ec5c
diff --git a/SystemSdk.cpp b/SystemSdk.cpp
new file mode 100644
index 0000000..d2ee123
--- /dev/null
+++ b/SystemSdk.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#include "SystemSdk.h"
+
+#include <algorithm>
+
+namespace android {
+namespace vintf {
+
+SystemSdk SystemSdk::removeVersions(const SystemSdk& other) const {
+ SystemSdk ret;
+ std::set_difference(versions().begin(), versions().end(), other.versions().begin(),
+ other.versions().end(), std::inserter(ret.mVersions, ret.mVersions.end()));
+ return ret;
+}
+
+bool SystemSdk::operator==(const SystemSdk& other) const {
+ return versions() == other.versions();
+}
+
+} // namespace vintf
+} // namespace android