Java Code Examples for android.content.pm.ConfigurationInfo#INPUT_FEATURE_FIVE_WAY_NAV

The following examples show how to use android.content.pm.ConfigurationInfo#INPUT_FEATURE_FIVE_WAY_NAV . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utils.java    From Android-Applications-Info with Apache License 2.0 5 votes vote down vote up
public static String getInputFeaturesString(int flag) {
    String string = "";
    if ((flag & ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV) != 0)
        string += "Five way nav";
    if ((flag & ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD) != 0)
        string += (string.length() == 0 ? "" : "|") + "Hard keyboard";
    return string.length() == 0 ? "null" : string;
}
 
Example 2
Source File: DeviceConfiguration.java    From android_packages_apps_GmsCore with Apache License 2.0 4 votes vote down vote up
public DeviceConfiguration(Context context) {
    ConfigurationInfo configurationInfo = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getDeviceConfigurationInfo();
    touchScreen = configurationInfo.reqTouchScreen;
    keyboardType = configurationInfo.reqKeyboardType;
    navigation = configurationInfo.reqNavigation;
    Configuration configuration = context.getResources().getConfiguration();
    screenLayout = configuration.screenLayout;
    hasHardKeyboard = (configurationInfo.reqInputFeatures & ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD) > 0;
    hasFiveWayNavigation = (configurationInfo.reqInputFeatures & ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV) > 0;
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    densityDpi = displayMetrics.densityDpi;
    glEsVersion = configurationInfo.reqGlEsVersion;
    PackageManager packageManager = context.getPackageManager();
    String[] systemSharedLibraryNames = packageManager.getSystemSharedLibraryNames();
    sharedLibraries = new ArrayList<String>();
    if (systemSharedLibraryNames != null) sharedLibraries.addAll(Arrays.asList(systemSharedLibraryNames));
    for (String s : new String[]{"com.google.android.maps", "com.google.android.media.effects", "com.google.widevine.software.drm"}) {
        if (!sharedLibraries.contains(s)) {
            sharedLibraries.add(s);
        }
    }
    Collections.sort(sharedLibraries);
    availableFeatures = new ArrayList<String>();
    if (packageManager.getSystemAvailableFeatures() != null) {
        for (FeatureInfo featureInfo : packageManager.getSystemAvailableFeatures()) {
            if (featureInfo != null && featureInfo.name != null) availableFeatures.add(featureInfo.name);
        }
    }
    Collections.sort(availableFeatures);
    this.nativePlatforms = getNativePlatforms();
    widthPixels = displayMetrics.widthPixels;
    heightPixels = displayMetrics.heightPixels;
    locales = new ArrayList<String>(Arrays.asList(context.getAssets().getLocales()));
    for (int i = 0; i < locales.size(); i++) {
        locales.set(i, locales.get(i).replace("-", "_"));
    }
    Collections.sort(locales);
    Set<String> glExtensions = new HashSet<String>();
    addEglExtensions(glExtensions);
    this.glExtensions = new ArrayList<String>(glExtensions);
    Collections.sort(this.glExtensions);
}