<application>
<meta-data android:name="org.sigrok.androidutils.jni_libs_resource_id" android:resource="@array/sigrok_androidutils_jni_libs"/>
+ <meta-data android:name="org.sigrok.androidutils.device_filter_resource_id" android:resource="@xml/sigrok_androidutils_device_filter"/>
</application>
</manifest>
private static final String JNI_LIBS_RESOURCE_ID_META =
"org.sigrok.androidutils.jni_libs_resource_id";
+ private static final String DEVICE_FILTER_RESOURCE_ID_META =
+ "org.sigrok.androidutils.device_filter_resource_id";
public SigrokApplication()
{
}
}
+ public static UsbSupplicant createUsbSupplicant(Context context)
+ {
+ ApplicationInfo appInfo = context.getApplicationInfo();
+ try {
+ appInfo = context.getPackageManager().
+ getApplicationInfo(context.getPackageName(),
+ PackageManager.GET_META_DATA);
+ } catch (PackageManager.NameNotFoundException exc) {
+ }
+ if (appInfo.metaData != null &&
+ appInfo.metaData.containsKey(DEVICE_FILTER_RESOURCE_ID_META)) {
+ int resId = appInfo.metaData.getInt(DEVICE_FILTER_RESOURCE_ID_META);
+ return new UsbSupplicant(context, resId);
+ }
+ Log.e("SigrokApplication", "Can't create UsbSupplicant (resource ID missing)");
+ return null;
+ }
+
@Override
public void onCreate()
{