All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robolectric.shadows.SystemFeatureListInitializer Maven / Gradle / Ivy

package org.robolectric.shadows;

import android.content.pm.PackageManager;
import android.os.Build.VERSION_CODES;
import com.google.common.collect.ImmutableMap;
import java.util.HashMap;
import java.util.Map;
import org.robolectric.RuntimeEnvironment;

final class SystemFeatureListInitializer {

  public static ImmutableMap getSystemFeatures() {
    int apiLevel = RuntimeEnvironment.getApiLevel();
    Map features = new HashMap<>();

    if (apiLevel >= VERSION_CODES.N_MR1) {
      features.put(PackageManager.FEATURE_WIFI, true);
    }

    if (apiLevel >= VERSION_CODES.O) {
      features.put(PackageManager.FEATURE_WIFI_AWARE, true);
      features.put(PackageManager.FEATURE_COMPANION_DEVICE_SETUP, true);
    }

    if (apiLevel >= VERSION_CODES.P) {
      features.put(PackageManager.FEATURE_WIFI_DIRECT, true);
      features.put(PackageManager.FEATURE_WIFI_RTT, true);
    }

    return ImmutableMap.copyOf(features);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy