Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 1 | // This file is auto-generated. DO NOT MODIFY. |
| 2 | // Args: com.android.systemfeatures.RwFeatures \ |
| 3 | // --readonly=false \ |
| 4 | // --feature=WATCH:1 \ |
| 5 | // --feature=WIFI:0 \ |
Jared Duke | 90e4363 | 2024-09-20 17:05:02 +0000 | [diff] [blame] | 6 | // --feature=VULKAN:UNAVAILABLE \ |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 7 | // --feature=AUTO: |
| 8 | package com.android.systemfeatures; |
| 9 | |
Jared Duke | 568adec | 2024-09-20 21:11:17 +0000 | [diff] [blame^] | 10 | import android.annotation.NonNull; |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 11 | import android.annotation.Nullable; |
| 12 | import android.content.Context; |
Jared Duke | 568adec | 2024-09-20 21:11:17 +0000 | [diff] [blame^] | 13 | import android.content.pm.FeatureInfo; |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 14 | import android.content.pm.PackageManager; |
Jared Duke | 568adec | 2024-09-20 21:11:17 +0000 | [diff] [blame^] | 15 | import java.util.HashMap; |
| 16 | import java.util.Map; |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 17 | |
| 18 | /** |
| 19 | * @hide |
| 20 | */ |
| 21 | public final class RwFeatures { |
| 22 | /** |
| 23 | * Check for FEATURE_WATCH. |
| 24 | * |
| 25 | * @hide |
| 26 | */ |
| 27 | public static boolean hasFeatureWatch(Context context) { |
| 28 | return hasFeatureFallback(context, PackageManager.FEATURE_WATCH); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Check for FEATURE_WIFI. |
| 33 | * |
| 34 | * @hide |
| 35 | */ |
| 36 | public static boolean hasFeatureWifi(Context context) { |
| 37 | return hasFeatureFallback(context, PackageManager.FEATURE_WIFI); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Check for FEATURE_VULKAN. |
| 42 | * |
| 43 | * @hide |
| 44 | */ |
| 45 | public static boolean hasFeatureVulkan(Context context) { |
| 46 | return hasFeatureFallback(context, PackageManager.FEATURE_VULKAN); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Check for FEATURE_AUTO. |
| 51 | * |
| 52 | * @hide |
| 53 | */ |
| 54 | public static boolean hasFeatureAuto(Context context) { |
| 55 | return hasFeatureFallback(context, PackageManager.FEATURE_AUTO); |
| 56 | } |
| 57 | |
| 58 | private static boolean hasFeatureFallback(Context context, String featureName) { |
| 59 | return context.getPackageManager().hasSystemFeature(featureName, 0); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @hide |
| 64 | */ |
| 65 | @Nullable |
| 66 | public static Boolean maybeHasFeature(String featureName, int version) { |
| 67 | return null; |
| 68 | } |
Jared Duke | 568adec | 2024-09-20 21:11:17 +0000 | [diff] [blame^] | 69 | |
| 70 | /** |
| 71 | * Gets features marked as available at compile-time, keyed by name. |
| 72 | * |
| 73 | * @hide |
| 74 | */ |
| 75 | @NonNull |
| 76 | public static Map<String, FeatureInfo> getCompileTimeAvailableFeatures() { |
| 77 | Map<String, FeatureInfo> features = new HashMap<>(0); |
| 78 | return features; |
| 79 | } |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 80 | } |