本文整理匯總了Java中android.content.pm.FeatureInfo類的典型用法代碼示例。如果您正苦於以下問題:Java FeatureInfo類的具體用法?Java FeatureInfo怎麽用?Java FeatureInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FeatureInfo類屬於android.content.pm包,在下文中一共展示了FeatureInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getOpenGL
import android.content.pm.FeatureInfo; //導入依賴的package包/類
/**
* 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";
}
示例2: isSupportCameraLedFlash
import android.content.pm.FeatureInfo; //導入依賴的package包/類
/**
* 判斷是否支持閃光燈
*
* @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;
}
示例3: isHTCSenseDevice
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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;
}
示例4: parseUsesFeature
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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;
}
示例5: getVersionFromPackageManager
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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;
}
示例6: _isHTC
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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;
}
示例7: initialize
import android.content.pm.FeatureInfo; //導入依賴的package包/類
/**
* 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;
}
示例8: getVersionFromPackageManager
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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;
}
示例9: setUpSystemFeatures
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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;
}
示例10: isSPenSupported
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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;
}
示例11: getVersionFromPackageManager
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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;
}
示例12: EclairChecker
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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());
}
示例13: getOpenGLVersion
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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";
}
示例14: EclairChecker
import android.content.pm.FeatureInfo; //導入依賴的package包/類
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());
}
示例15: isSupportCameraLedFlash
import android.content.pm.FeatureInfo; //導入依賴的package包/類
/** 判斷是否支持閃光燈 */
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;
}