Initial system feature codegen prototype
Add a simple codegen utility for system features that:
* Exports a `hasFeatureX` method for each defined system feature
* Hardcodes the result if readonly system features are enabled
* Falls back to a runtime query otherwise
Note that this tool is not yet used, referenced, or enabled in any
production code. Follow-up changes will route build flags into
inputs for the codegen, and the outputs will be wired into the
framework.
Test: atest systemfeatures-gen-tests --host
Bug: 203143243
Change-Id: I059a38b11305c759662ea6c74c11d3cfdb058c40
diff --git a/tools/systemfeatures/tests/PackageManager.java b/tools/systemfeatures/tests/PackageManager.java
new file mode 100644
index 0000000..645d500
--- /dev/null
+++ b/tools/systemfeatures/tests/PackageManager.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2024 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 android.content.pm;
+
+/** Stub for testing */
+public class PackageManager {
+ public static final String FEATURE_AUTO = "automotive";
+ public static final String FEATURE_VULKAN = "vulkan";
+ public static final String FEATURE_WATCH = "watch";
+ public static final String FEATURE_WIFI = "wifi";
+
+ /** @hide */
+ public boolean hasSystemFeature(String featureName, int version) {
+ return false;
+ }
+}