use of android.content.pm.FeatureInfo in project android_frameworks_base by DirtyUnicorns.
the class PackageManagerShellCommand method runListFeatures.
private int runListFeatures() throws RemoteException {
final PrintWriter pw = getOutPrintWriter();
final List<FeatureInfo> list = mInterface.getSystemAvailableFeatures().getList();
// sort by name
Collections.sort(list, new Comparator<FeatureInfo>() {
public int compare(FeatureInfo o1, FeatureInfo o2) {
if (o1.name == o2.name)
return 0;
if (o1.name == null)
return -1;
if (o2.name == null)
return 1;
return o1.name.compareTo(o2.name);
}
});
final int count = (list != null) ? list.size() : 0;
for (int p = 0; p < count; p++) {
FeatureInfo fi = list.get(p);
pw.print("feature:");
if (fi.name != null) {
pw.print(fi.name);
if (fi.version > 0) {
pw.print("=");
pw.print(fi.version);
}
pw.println();
} else {
pw.println("reqGlEsVersion=0x" + Integer.toHexString(fi.reqGlEsVersion));
}
}
return 0;
}
use of android.content.pm.FeatureInfo in project acra by ACRA.
the class DeviceFeaturesCollector method collect.
/**
* collects device features
*
* @param reportField the ReportField to collect
* @param reportBuilder the current reportBuilder
* @return Element of all device feature names
*/
@NonNull
@Override
Element collect(ReportField reportField, ReportBuilder reportBuilder) {
final ComplexElement result = new ComplexElement();
try {
final PackageManager pm = context.getPackageManager();
final FeatureInfo[] features = pm.getSystemAvailableFeatures();
for (final FeatureInfo feature : features) {
final String featureName = feature.name;
if (featureName != null) {
result.put(featureName, true);
} else {
result.put("glEsVersion", feature.getGlEsVersion());
}
}
} catch (Throwable e) {
ACRA.log.w(LOG_TAG, "Couldn't retrieve DeviceFeatures for " + context.getPackageName(), e);
}
return result;
}
use of android.content.pm.FeatureInfo in project android_frameworks_base by DirtyUnicorns.
the class SystemConfig method addFeature.
private void addFeature(String name, int version) {
FeatureInfo fi = mAvailableFeatures.get(name);
if (fi == null) {
fi = new FeatureInfo();
fi.name = name;
fi.version = version;
mAvailableFeatures.put(name, fi);
} else {
fi.version = Math.max(fi.version, version);
}
}
use of android.content.pm.FeatureInfo in project android_frameworks_base by AOSPA.
the class SystemConfig method addFeature.
private void addFeature(String name, int version) {
FeatureInfo fi = mAvailableFeatures.get(name);
if (fi == null) {
fi = new FeatureInfo();
fi.name = name;
fi.version = version;
mAvailableFeatures.put(name, fi);
} else {
fi.version = Math.max(fi.version, version);
}
}
use of android.content.pm.FeatureInfo in project android_frameworks_base by AOSPA.
the class CameraBinderTestUtils method isFeatureAvailable.
public static final boolean isFeatureAvailable(Context context, String feature) {
final PackageManager packageManager = context.getPackageManager();
final FeatureInfo[] featuresList = packageManager.getSystemAvailableFeatures();
for (FeatureInfo f : featuresList) {
if (f.name != null && f.name.equals(feature)) {
return true;
}
}
return false;
}
Aggregations