Java Code Examples for android.content.pm.FeatureInfo

The following are top voted examples for showing how to use android.content.pm.FeatureInfo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: CrashDetails.java   View source code 6 votes vote down vote up
/**
 * Returns the current device openGL version.
 */
static String getOpenGL(Context context) {
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return Integer.toString((featureInfo.reqGlEsVersion & 0xffff0000) >> 16);
                } else {
                    return "1"; // Lack of property means OpenGL ES version 1
                }
            }
        }
    }
    return "1";
}
 
Example 2
Project: utilsLibrary   File: DeviceInfo.java   View source code 6 votes vote down vote up
/**
 * 判断是否支持闪光灯
 *
 * @return true 支持,false 不支持
 */
public static boolean isSupportCameraLedFlash() {
    PackageManager pm = UtilManager.getContext().getPackageManager();
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                //判断设备是否支持闪光灯
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example 3
Project: movento-webview   File: TiUIWebView.java   View source code 6 votes vote down vote up
private boolean isHTCSenseDevice()
{
	boolean isHTC = false;
	
	FeatureInfo[] features = TiApplication.getInstance().getApplicationContext().getPackageManager().getSystemAvailableFeatures();
	if(features == null) { 
		return isHTC;
	}
	for (FeatureInfo f : features) {
		String fName = f.name;
		if (fName != null) {
			isHTC = fName.contains("com.htc.software.Sense");
			if (isHTC) {
				Log.i(TAG, "Detected com.htc.software.Sense feature "+fName);
				break;
			}
		}
	}
	
	return isHTC;
}
 
Example 4
Project: Android-plugin-support   File: DynamicApkParser.java   View source code 6 votes vote down vote up
private FeatureInfo parseUsesFeature(Resources res, AttributeSet attrs)
        throws XmlPullParserException, IOException {
    FeatureInfo fi = new FeatureInfo();
    TypedArray sa = res.obtainAttributes(attrs,
            Hooks.getStyleableArray("AndroidManifestUsesFeature"));
    // Note: don't allow this value to be a reference to a resource
    // that may change.
    fi.name = sa.getNonResourceString(
            Hooks.getStyleable("AndroidManifestUsesFeature_name"));
    if (fi.name == null) {
        fi.reqGlEsVersion = sa.getInt(
                Hooks.getStyleable("AndroidManifestUsesFeature_glEsVersion"),
                FeatureInfo.GL_ES_VERSION_UNDEFINED);
    }
    if (sa.getBoolean(
            Hooks.getStyleable("AndroidManifestUsesFeature_required"), true)) {
        fi.flags |= FeatureInfo.FLAG_REQUIRED;
    }
    sa.recycle();
    return fi;
}
 
Example 5
Project: geopin   File: AbstractMapActivity.java   View source code 6 votes vote down vote up
private static int getVersionFromPackageManager(Context context) {
    PackageManager packageManager=context.getPackageManager();
    FeatureInfo[] featureInfos=
            packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open
            // gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return getMajorVersion(featureInfo.reqGlEsVersion);
                }
                else {
                    return 1; // Lack of property means OpenGL ES
                    // version 1
                }
            }
        }
    }
    return 1;
}
 
Example 6
Project: countly-sdk-appcelerator-titanium-android   File: CrashDetails.java   View source code 6 votes vote down vote up
/**
 * Returns the current device openGL version.
 */
static String getOpenGL(Context context) {
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return Integer.toString((featureInfo.reqGlEsVersion & 0xffff0000) >> 16);
                } else {
                    return "1"; // Lack of property means OpenGL ES version 1
                }
            }
        }
    }
    return "1";
}
 
Example 7
Project: Noyze   File: AudioHelper.java   View source code 6 votes vote down vote up
private static boolean _isHTC(Context context) {
    // CHECK: Build prop to see if HTC is there.
    if (Build.MANUFACTURER.contains("HTC")) return true;
    // CHECK: available features, like HTC sense.
    FeatureInfo[] features = context.getPackageManager().getSystemAvailableFeatures();
    for (FeatureInfo feature : features) {
        if (!TextUtils.isEmpty(feature.name) &&
            feature.name.startsWith("com.htc")) {
            return true;
        }
    }
    // CHECK: the HTC Sense launcher package.
    PackageManager pm = context.getPackageManager();
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    List<ResolveInfo> list = pm.queryIntentActivities(
            intent, PackageManager.MATCH_DEFAULT_ONLY);
    for (ResolveInfo info : list) {
        if (info.activityInfo != null) {
            if ("com.htc.launcher.Launcher".equals(info.activityInfo.name)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 8
Project: 365browser   File: SPenSupport.java   View source code 6 votes vote down vote up
/**
 * Initialize SPen support. This is done lazily at the first invocation of
 * {@link #convertSPenEventAction(int)}.
 */
private static void initialize() {
    if (sIsSPenSupported != null) return;

    if (!"SAMSUNG".equalsIgnoreCase(Build.MANUFACTURER)) {
        sIsSPenSupported = false;
        return;
    }

    Context context = ContextUtils.getApplicationContext();
    final FeatureInfo[] infos = context.getPackageManager().getSystemAvailableFeatures();
    for (FeatureInfo info : infos) {
        if ("com.sec.feature.spen_usp".equalsIgnoreCase(info.name)) {
            sIsSPenSupported = true;
            return;
        }
    }
    sIsSPenSupported = false;
}
 
Example 9
Project: downtown   File: AbstractMapActivity.java   View source code 6 votes vote down vote up
private static int getVersionFromPackageManager(Context context) {
  PackageManager packageManager=context.getPackageManager();
  FeatureInfo[] featureInfos=
      packageManager.getSystemAvailableFeatures();
  if (featureInfos != null && featureInfos.length > 0) {
    for (FeatureInfo featureInfo : featureInfos) {
      // Null feature name means this feature is the open
      // gl es version feature.
      if (featureInfo.name == null) {
        if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
          return getMajorVersion(featureInfo.reqGlEsVersion);
        }
        else {
          return 1; // Lack of property means OpenGL ES
                    // version 1
        }
      }
    }
  }
  return 1;
}
 
Example 10
Project: java-android-developertools   File: SystemFeaturesFragment.java   View source code 6 votes vote down vote up
private void setUpSystemFeatures(TextView systemFeaturesTextView) {
    FeatureInfo[] featureInfoArray = getActivity().getPackageManager().getSystemAvailableFeatures();
    List<String> features = new ArrayList<>();
    for (FeatureInfo featureInfo : featureInfoArray) {
        final String name = featureInfo.name;
        if (name != null) {
            features.add(name);
        }
    }
    Collections.sort(features, new Comparator<String>() {
        @Override
        public int compare(String lhs, String rhs) {
            return lhs.compareTo(rhs);
        }
    });
    StringBuilder systemFeatures = new StringBuilder();
    for (String feature : features) {
        systemFeatures.append(feature);
        systemFeatures.append("\n");
    }
    this.systemFeatures = systemFeatures.toString();
    systemFeaturesTextView.setText(this.systemFeatures);
    this.systemFeatures = "Device: " + Utils.getDeviceSummary() + "\n" + this.systemFeatures;
}
 
Example 11
Project: slide-android   File: SettingsActivity.java   View source code 6 votes vote down vote up
private boolean isSPenSupported()
{
    final FeatureInfo[] featureInfo = getPackageManager().getSystemAvailableFeatures();
    for (FeatureInfo info : featureInfo)
    {
        if (SPEN_FEATURE.equalsIgnoreCase(info.name))
        {
            return true;
        }
    }
    if (SAMSUNG.equalsIgnoreCase(Build.MANUFACTURER))
    {
        if (Build.MODEL.toUpperCase(Locale.ENGLISH).startsWith(NOTE))
        {
            return true;
        }
    }
    return false;
}
 
Example 12
Project: Noyze   File: AudioHelper.java   View source code 6 votes vote down vote up
private static boolean _isHTC(Context context) {
    // CHECK: Build prop to see if HTC is there.
    if (Build.MANUFACTURER.contains("HTC")) return true;
    // CHECK: available features, like HTC sense.
    FeatureInfo[] features = context.getPackageManager().getSystemAvailableFeatures();
    for (FeatureInfo feature : features) {
        if (!TextUtils.isEmpty(feature.name) &&
            feature.name.startsWith("com.htc")) {
            return true;
        }
    }
    // CHECK: the HTC Sense launcher package.
    PackageManager pm = context.getPackageManager();
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    List<ResolveInfo> list = pm.queryIntentActivities(
            intent, PackageManager.MATCH_DEFAULT_ONLY);
    for (ResolveInfo info : list) {
        if (info.activityInfo != null) {
            if ("com.htc.launcher.Launcher".equals(info.activityInfo.name)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 13
Project: ClusteredMarkers   File: AbstractMapActivity.java   View source code 6 votes vote down vote up
private static int getVersionFromPackageManager(Context context) {
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos  = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open
            // gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return getMajorVersion(featureInfo.reqGlEsVersion);
                }
                else {
                    return 1; // Lack of property means OpenGL ES
                    // version 1
                }
            }
        }
    }
    return 1;
}
 
Example 14
Project: aakash-fdroid-client   File: DB.java   View source code 6 votes vote down vote up
public EclairChecker(Context ctx) {

                SharedPreferences prefs = PreferenceManager
                        .getDefaultSharedPreferences(ctx);
                ignoreTouchscreen = prefs
                        .getBoolean("ignoreTouchscreen", false);

                PackageManager pm = ctx.getPackageManager();
                StringBuilder logMsg = new StringBuilder();
                logMsg.append("Available device features:");
                features = new HashSet<String>();
                for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
                    features.add(fi.name);
                    logMsg.append('\n');
                    logMsg.append(fi.name);
                }
                Log.d("FDroid", logMsg.toString());
            }
 
Example 15
Project: COCOFramework   File: DeviceInfo.java   View source code 6 votes vote down vote up
private String getOpenGLVersion() {
    Context context = getActivity();
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return String.valueOf((featureInfo.reqGlEsVersion & 0xFFFF0000) >> 16) + "." + String.valueOf((featureInfo.reqGlEsVersion & 0x0000FFFF));
                } else {
                    return "1.0"; // Lack of property means OpenGL ES version 1
                }
            }
        }
    }
    return "1.0";
}
 
Example 16
Project: countly-sdk-js   File: CrashDetails.java   View source code 6 votes vote down vote up
/**
 * Returns the current device openGL version.
 */
static String getOpenGL(Context context) {
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return Integer.toString((featureInfo.reqGlEsVersion & 0xffff0000) >> 16);
                } else {
                    return "1"; // Lack of property means OpenGL ES version 1
                }
            }
        }
    }
    return "1";
}
 
Example 17
Project: aakash_bazaar_client   File: DB.java   View source code 6 votes vote down vote up
public EclairChecker(Context ctx) {

				SharedPreferences prefs = PreferenceManager
						.getDefaultSharedPreferences(ctx);
				ignoreTouchscreen = prefs
						.getBoolean("ignoreTouchscreen", false);

				PackageManager pm = ctx.getPackageManager();
				StringBuilder logMsg = new StringBuilder();
				logMsg.append("Available device features:");
				features = new HashSet<String>();
				for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
					features.add(fi.name);
					logMsg.append('\n');
					logMsg.append(fi.name);
				}
				Log.d("FDroid", logMsg.toString());
			}
 
Example 18
Project: WeiXinRecordedDemo   File: DeviceUtils.java   View source code 5 votes vote down vote up
/** 判断是否支持闪光灯 */
public static boolean isSupportCameraLedFlash(PackageManager pm) {
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) //判断设备是否支持闪光灯
                    return true;
            }
        }
    }
    return false;
}
 
Example 19
Project: WeiXinRecordedDemo   File: DeviceUtils.java   View source code 5 votes vote down vote up
/** 判断是否支持闪光灯 */
public static boolean isSupportCameraLedFlash(PackageManager pm) {
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) //判断设备是否支持闪光灯
                    return true;
            }
        }
    }
    return false;
}
 
Example 20
Project: AliZhiBoHao   File: CommonUtils.java   View source code 5 votes vote down vote up
public static boolean isSupportCameraLedFlash(PackageManager pm) {
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name))
                    return true;
            }
        }
    }
    return false;
}
 
Example 21
Project: PlayAndroid   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void initView() {
    ShortCutUtil.addShortcut(getApplicationContext());

    new RevealEffectUtil().createEnterRevealEffect(this);

    mToolbar.setLogo(R.drawable.vector_user_default_logo);
    mToolbar.setTitleMarginStart(30);
    setToolbarTitle(getString(R.string.nav_home_page));

    mDrawerLayout = findView(R.id.drawer_layout);

    mToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, 0, 0);

    NavigationView navigationView = findView(R.id.navigation_view);
    navigationView.setNavigationItemSelectedListener(this);
    ImageView userLogo = (ImageView) navigationView.findViewById(R.id.nav_user_logo);


    mToggle.syncState();
    mDrawerLayout.addDrawerListener(mToggle);

    PackageManager pm = getPackageManager();

    FeatureInfo[] features = pm.getSystemAvailableFeatures(); //得到所有支援的硬件种类
    Log.d(TAG, "initView: feature:size:" + (features == null));
    for (FeatureInfo feature : features) {
        if (feature != null) {
            String name = feature.name;
            if (TextUtils.isEmpty(name)) {
                Log.v(TAG, "name2: " + feature.reqGlEsVersion);
            } else {
                Log.v(TAG, "name1: " + feature.name);
            }
        } else {
            Log.d(TAG, "空!");
        }
    }

}
 
Example 22
Project: meipai-Android   File: DeviceUtils.java   View source code 5 votes vote down vote up
/** 判断是否支持闪光灯 */
public static boolean isSupportCameraLedFlash(PackageManager pm) {
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) //判断设备是否支持闪光灯
                    return true;
            }
        }
    }
    return false;
}
 
Example 23
Project: YalpStore   File: NativeDeviceInfoProvider.java   View source code 5 votes vote down vote up
static public List<String> getFeatures(Context context) {
    List<String> featureStringList = new ArrayList<>();
    for (FeatureInfo feature: context.getPackageManager().getSystemAvailableFeatures()) {
        if (!TextUtils.isEmpty(feature.name)) {
            featureStringList.add(feature.name);
        }
    }
    Collections.sort(featureStringList);
    return featureStringList;
}
 
Example 24
Project: apkupdater   File: NativeDeviceInfoProvider.java   View source code 5 votes vote down vote up
static public List<String> getFeatures(Context context) {
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featuresList = packageManager.getSystemAvailableFeatures();
    List<String> featureStringList = new ArrayList<>();
    for (FeatureInfo feature: featuresList) {
        if (!TextUtils.isEmpty(feature.name)) {
            featureStringList.add(feature.name);
        }
    }
    return featureStringList;
}
 
Example 25
Project: XposedLePro3Infrared   File: MethodHooks.java   View source code 5 votes vote down vote up
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
    Object resultObj = param.getResult();
    if (resultObj == null || !(resultObj instanceof FeatureInfo[])) {
        Log.w(TAG, "getSystemAvailableFeaturesHook: return value is null or wrong type: " + resultObj);
        log(TAG + ": ERROR: getSystemAvailableFeaturesHook: return value is null or wrong type: " + resultObj);
        if (resultObj != null) {
            log(TAG + ": getSystemAvailableFeaturesHook: " + resultObj.getClass().getCanonicalName());
            Log.w(TAG, "ERROR: getSystemAvailableFeaturesHook type: " + resultObj.getClass().getCanonicalName());
        }
        return;
    }
    FeatureInfo[] featuresArray = (FeatureInfo[]) resultObj;
    boolean containsIr = false;
    for (FeatureInfo f : featuresArray) {
        if (PackageManager.FEATURE_CONSUMER_IR.equals(f.name)) {
            containsIr = true;
            break;
        }
    }
    if (!containsIr) {
        Log.v(TAG, "getSystemAvailableFeaturesHook: return value doesn't contain consumerIR, so we will add it");
        FeatureInfo consumerIrFeature = new FeatureInfo();
        consumerIrFeature.name = PackageManager.FEATURE_CONSUMER_IR;
        consumerIrFeature.flags = 0;
        consumerIrFeature.reqGlEsVersion = 0;
        // add feature to feature list array
        FeatureInfo[] newFeaturesArray = new FeatureInfo[featuresArray.length + 1];
        System.arraycopy(featuresArray, 0, newFeaturesArray, 0, featuresArray.length);
        newFeaturesArray[newFeaturesArray.length - 1] = consumerIrFeature;
        // and set new array as result
        param.setResult(newFeaturesArray);
    } else {
        Log.v(TAG, "getSystemAvailableFeaturesHook: return value already contains IR, will do nothing");
    }
}
 
Example 26
Project: BLE-Mesh   File: LocalPeer.java   View source code 5 votes vote down vote up
private static boolean doesDeviceSupportWifiDirect(Context ctx) {
    PackageManager pm = ctx.getPackageManager();
    FeatureInfo[] features = pm.getSystemAvailableFeatures();
    for (FeatureInfo info : features) {
        if (info != null && info.name != null && info.name.equalsIgnoreCase("android.hardware.wifi.direct")) {
            return true;
        }
    }
    return false;
}
 
Example 27
Project: under-the-hood   File: PackageInfoAssembler.java   View source code 5 votes vote down vote up
/**
 * Creates entries for all declared system features (see Manifest &lt;uses-feature> tags)
 * Uses {@link DefaultProperties#createSystemFeatureInfo(Context, Map)} call.
 *
 * @param context     must not be null
 * @param packageInfo from {@link PackageManager#getPackageInfo(String, int)} requiring {@link PackageManager#GET_CONFIGURATIONS} flag
 * @return list of all declared uses-feature tags in AndroidManifest as page entries
 */
public static List<PageEntry<?>> createPmDeclaredSystemFeatureInfo(@NonNull Context context, @NonNull PackageInfo packageInfo) {
    try {
        Map<CharSequence, String> featureMap = new TreeMap<>();
        if (packageInfo.reqFeatures != null && packageInfo.reqFeatures.length > 0) {
            for (FeatureInfo reqFeature : packageInfo.reqFeatures) {
                boolean required = reqFeature.flags == FeatureInfo.FLAG_REQUIRED;
                String fullLabel;
                String id;
                if ((reqFeature.name == null || reqFeature.name.trim().isEmpty())
                        && reqFeature.getGlEsVersion() != null && !reqFeature.getGlEsVersion().isEmpty()) {
                    fullLabel = "glEsVersion " + reqFeature.getGlEsVersion();
                    id = String.valueOf(reqFeature.reqGlEsVersion);
                } else {
                    fullLabel = reqFeature.name;
                    id = reqFeature.name;
                }

                fullLabel += (required ? " (req)" : "");
                featureMap.put(Hood.ext().createFullLabel(fullLabel.replace("android.hardware.", ""), fullLabel), id);
            }
        }

        return DefaultProperties.createSystemFeatureInfo(context, featureMap);
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
 
Example 28
Project: FMTech   File: PhoneDeviceConfigurationHelper.java   View source code 5 votes vote down vote up
private static void customizeDeviceConfiguration(Context paramContext, DeviceConfiguration.DeviceConfigurationProto paramDeviceConfigurationProto)
{
  FeatureInfo[] arrayOfFeatureInfo = paramContext.getPackageManager().getSystemAvailableFeatures();
  if (arrayOfFeatureInfo != null)
  {
    ArrayList localArrayList = new ArrayList();
    int i = arrayOfFeatureInfo.length;
    for (int j = 0; j < i; j++)
    {
      FeatureInfo localFeatureInfo = arrayOfFeatureInfo[j];
      if (localFeatureInfo.name != null) {
        localArrayList.add(localFeatureInfo.name);
      }
    }
    paramDeviceConfigurationProto.systemAvailableFeature = ((String[])localArrayList.toArray(new String[localArrayList.size()]));
  }
  if (Build.VERSION.SDK_INT >= 21)
  {
    paramDeviceConfigurationProto.nativePlatform = Build.SUPPORTED_ABIS;
    return;
  }
  if (Build.CPU_ABI2.equals("unknown"))
  {
    String[] arrayOfString2 = new String[1];
    arrayOfString2[0] = Build.CPU_ABI;
    paramDeviceConfigurationProto.nativePlatform = arrayOfString2;
    return;
  }
  String[] arrayOfString1 = new String[2];
  arrayOfString1[0] = Build.CPU_ABI;
  arrayOfString1[1] = Build.CPU_ABI2;
  paramDeviceConfigurationProto.nativePlatform = arrayOfString1;
}
 
Example 29
Project: Android-Applications-Info   File: DetailFragment.java   View source code 5 votes vote down vote up
/**
 * Boring view inflation / creation
 */
private View getFeaturesView(ViewGroup viewGroup, View convertView, int index) {
    ViewHolder viewHolder;
    if (!checkIfConvertViewMatch(convertView, FEATURES)) {
        convertView = mLayoutInflater.inflate(R.layout.detail_features, viewGroup, false);

        viewHolder = new ViewHolder();
        viewHolder.currentViewType = FEATURES;
        viewHolder.textView1 = (TextView) convertView.findViewById(R.id.name);
        viewHolder.textView2 = (TextView) convertView.findViewById(R.id.flags);
        viewHolder.textView3 = (TextView) convertView.findViewById(R.id.gles_ver);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }

    final FeatureInfo featureInfo = mPackageInfo.reqFeatures[index];
    convertView.setBackgroundColor(index % 2 == 0 ? mColorGrey1 : mColorGrey2);

    //Name
    viewHolder.textView1.setText(featureInfo.name);

    //Falgs
    viewHolder.textView2.setText(getString(R.string.flags) + ": " + Utils.getFeatureFlagsString(featureInfo.flags));

    //GLES ver
    viewHolder.textView3.setText(getString(R.string.gles_ver) + ": " + featureInfo.reqGlEsVersion);

    return convertView;
}
 
Example 30
Project: Cordova-Flashlight   File: Flashlight.java   View source code 5 votes vote down vote up
private final boolean isSupported() throws Exception {
	request();

	final PackageManager packageManager = this.cordova.getActivity().getPackageManager();
	for (final FeatureInfo feature : packageManager.getSystemAvailableFeatures()) {
		if (PackageManager.FEATURE_CAMERA_FLASH.equalsIgnoreCase(feature.name)) {
			return true;
		}
	}
	camera = null;
	return false;
}
 
Example 31
Project: HTCAuthorizer   File: X_Mod.java   View source code 5 votes vote down vote up
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
    if (mSettings.getCachedPref_use_themes()) {
        replaceSystemWideThemes();
    } else {
        Logger.v("Themes are turned off in module settings.");
    }

    Logger.v("Loading hook to add HTC features to system feature list...");

    XposedHelpers.findAndHookMethod(CLASS_PACKAGEMANAGER, null, "getSystemAvailableFeatures",
            new XC_MethodHook() {
                @Override
                protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                    FeatureInfo[] sys = (FeatureInfo[]) param.getResult();
                    FeatureInfo[] fs = new FeatureInfo[sys.length + HTC_FEATURES.length];
                    System.arraycopy(sys, 0, fs, 0, sys.length);
                    for (int i = sys.length; i < sys.length + HTC_FEATURES.length; i++) {
                        fs[i] = new FeatureInfo();
                        fs[i].name = HTC_FEATURES[i - sys.length];
                    }
                    param.setResult(fs);
                    Logger.logHookAfter(param);
                }
            });

    Logger.v("System feature list hook loaded.");
}
 
Example 32
Project: DIYRepo   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	//ȥ��title   
      this.requestWindowFeature(Window.FEATURE_NO_TITLE);  
	         
       //ȥ��Activity�����״̬��   
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  
       WindowManager.LayoutParams.FLAG_FULLSCREEN); 

	setContentView(R.layout.activity_main);
	
	surfaceView = (SurfaceView) this.findViewById(R.id.surfaceview);      
	surfaceHolder = surfaceView.getHolder();      
	surfaceHolder.addCallback(this);      
	surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);     
	
	if(isAutoBrightness(getContentResolver()))
	{
		AutoBrightnessOpen = true;
	}
	
	normal = Settings.System.getInt(getContentResolver(),  
	        Settings.System.SCREEN_BRIGHTNESS, 255); 
	
	PackageManager pm= this.getPackageManager();
	 FeatureInfo[]  features=pm.getSystemAvailableFeatures();
	 for(FeatureInfo f : features)
	 {
	   if(PackageManager.FEATURE_CAMERA_FLASH.equals(f.name))   //�ж��豸�Ƿ�֧�������
	   {
		   Log.d("huahua","֧�������");
	   }
	 }
	 
}
 
Example 33
Project: AndroidCommunicationBenchmark   File: WifiServer.java   View source code 5 votes vote down vote up
@Override
public boolean isSupported() {
    // see http://stackoverflow.com/questions/23828487/how-can-i-check-my-android-device-support-wifi-direct
    PackageManager pm = this.getContext().getPackageManager();
    FeatureInfo[] features = pm.getSystemAvailableFeatures();
    for (FeatureInfo info : features) {
        if (info != null && info.name != null && info.name.equalsIgnoreCase("android.hardware.wifi.direct")) {
            return true;
        }
    }
    return false;
}
 
Example 34
Project: AndroidCommunicationBenchmark   File: WifiClient.java   View source code 5 votes vote down vote up
@Override
public boolean isSupported() {
    // see http://stackoverflow.com/questions/23828487/how-can-i-check-my-android-device-support-wifi-direct
    PackageManager pm = this.getContext().getPackageManager();
    FeatureInfo[] features = pm.getSystemAvailableFeatures();
    for (FeatureInfo info : features) {
        if (info != null && info.name != null && info.name.equalsIgnoreCase("android.hardware.wifi.direct")) {
            return true;
        }
    }
    return false;
}
 
Example 35
Project: f-droid   File: CompatibilityChecker.java   View source code 5 votes vote down vote up
public CompatibilityChecker(Context ctx) {

        context = ctx.getApplicationContext();

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
        ignoreTouchscreen = prefs.getBoolean(Preferences.PREF_IGN_TOUCH, false);

        PackageManager pm = ctx.getPackageManager();
        StringBuilder logMsg = new StringBuilder();
        logMsg.append("Available device features:");
        features = new HashSet<String>();
        if (pm != null) {
            final FeatureInfo[] featureArray = pm.getSystemAvailableFeatures();
            if (featureArray != null)
                for (FeatureInfo fi : pm.getSystemAvailableFeatures()) {
                    features.add(fi.name);
                    logMsg.append('\n');
                    logMsg.append(fi.name);
                }
        }

        cpuAbis = SupportedArchitectures.getAbis();

        StringBuilder builder = new StringBuilder();
        boolean first = true;
        for (String abi : cpuAbis) {
            if (first) first = false;
            else builder.append(", ");
            builder.append(abi);
        }
        cpuAbisDesc = builder.toString();

        Log.d("FDroid", logMsg.toString());
    }
 
Example 36
Project: glEsCapsViewer   File: GLESInfo.java   View source code 5 votes vote down vote up
public void getDeviceInfo(Display display, Context context) {
       // Device
       mDeviceName = android.os.Build.MODEL;
       mDeviceOS = android.os.Build.VERSION.RELEASE;
       mScreenWidth = display.getWidth();
       mScreenHeight = display.getHeight();
       mDeviceCPUCores = Runtime.getRuntime().availableProcessors();
       mDeviceCPUSpeed = getMaxCPUFreqMHz();
       mDeviceCPUArch = System.getProperty("os.arch");
       //mDeviceTotalRAM = getTotalRAM();
       
       // Available features
       PackageManager packageManager = context.getPackageManager();
       FeatureInfo[] featuresList = packageManager.getSystemAvailableFeatures();
       for (FeatureInfo f : featuresList) {
           mDeviceFeatures.add(f.name);
       }       
       
       // Available sensors
       SensorManager mSensorManager;
       mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
       List<Sensor> deviceSensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);

       for (int i=0; i < deviceSensors.size(); i++) {
       	SensorInfo sensorInfo = new SensorInfo();
       	sensorInfo.mName = deviceSensors.get(i).getName();
       	sensorInfo.mMaxRange = deviceSensors.get(i).getMaximumRange();
       	sensorInfo.mResolution = deviceSensors.get(i).getResolution();       	
       	
           mDeviceSensors.add(sensorInfo);
       }
	
}
 
Example 37
Project: android-gif-drawable-sample   File: GifTexImage2DFragment.java   View source code 5 votes vote down vote up
private boolean isOpenGLES2Supported() {
	FeatureInfo[] featureInfos = getContext().getPackageManager().getSystemAvailableFeatures();
	if (featureInfos != null) {
		for (FeatureInfo featureInfo : featureInfos) {
			if (featureInfo.name == null) {
				return ((featureInfo.reqGlEsVersion & 0xffff0000) >> 16) >= 2;
			}
		}
	}
	return false;
}
 
Example 38
Project: androiddevice.info   File: FeaturesProperty.java   View source code 5 votes vote down vote up
@Override
public Object getProperty() {
    JSONArray jsonArray = new JSONArray();

    PackageManager pm = Application.getContext().getPackageManager();
    FeatureInfo[] features = pm != null ? pm.getSystemAvailableFeatures() : new FeatureInfo[0];
    for(FeatureInfo feature: features) {
        jsonArray.put(feature.name);
    }
    return jsonArray;
}
 
Example 39
Project: censustaker   File: PackageManagerCensus.java   View source code 5 votes vote down vote up
private static void pollFeatures(PackageManager pm, Map<String, JsonElement> results) {
  List<String> features = new ArrayList<>();
  for(FeatureInfo feature : pm.getSystemAvailableFeatures()) {
    if (feature.name != null) {
      features.add(feature.name);
    }
  }
  results.put("features", gson.toJsonTree(features, features.getClass()));
}
 
Example 40
Project: glEsCapsViewer   File: GLESInfo.java   View source code 5 votes vote down vote up
public void getDeviceInfo(Display display, Context context) {
       // Device
       mDeviceName = android.os.Build.MODEL;
       mDeviceOS = android.os.Build.VERSION.RELEASE;
       mScreenWidth = display.getWidth();
       mScreenHeight = display.getHeight();
       mDeviceCPUCores = Runtime.getRuntime().availableProcessors();
       mDeviceCPUSpeed = getMaxCPUFreqMHz();
       mDeviceCPUArch = System.getProperty("os.arch");
       //mDeviceTotalRAM = getTotalRAM();
       
       // Available features
       PackageManager packageManager = context.getPackageManager();
       FeatureInfo[] featuresList = packageManager.getSystemAvailableFeatures();
       for (FeatureInfo f : featuresList) {
           mDeviceFeatures.add(f.name);
       }       
       
       // Available sensors
       SensorManager mSensorManager;
       mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
       List<Sensor> deviceSensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);

       for (int i=0; i < deviceSensors.size(); i++) {
       	SensorInfo sensorInfo = new SensorInfo();
       	sensorInfo.mName = deviceSensors.get(i).getName();
       	sensorInfo.mMaxRange = deviceSensors.get(i).getMaximumRange();
       	sensorInfo.mResolution = deviceSensors.get(i).getResolution();       	
       	
           mDeviceSensors.add(sensorInfo);
       }
	
}