aboutsummaryrefslogtreecommitdiffstats
path: root/wpadebug
diff options
context:
space:
mode:
authorAnurag Das <anurdas@codeaurora.org>2018-02-23 10:14:02 (GMT)
committerJouni Malinen <j@w1.fi>2018-02-23 13:37:49 (GMT)
commitbe97da671cd5d0332d317d5c098ccc37a6fb25b1 (patch)
tree23e68d252204ee6619a4d95b5043e32e4c2b6287 /wpadebug
parentc7d89a87d813253596bded4543a6ed11b33ffa5f (diff)
downloadhostap-be97da671cd5d0332d317d5c098ccc37a6fb25b1.zip
hostap-be97da671cd5d0332d317d5c098ccc37a6fb25b1.tar.gz
hostap-be97da671cd5d0332d317d5c098ccc37a6fb25b1.tar.bz2
wpadebug: Add activity to select method for QR Code scanning
Add QrCodeReadActivity that makes a decision to select between InputUri and QrCodeScannerActivity depending on the availability of the camera in the device. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Diffstat (limited to 'wpadebug')
-rw-r--r--wpadebug/AndroidManifest.xml5
-rw-r--r--wpadebug/src/w1/fi/wpadebug/QrCodeReadActivity.java40
2 files changed, 45 insertions, 0 deletions
diff --git a/wpadebug/AndroidManifest.xml b/wpadebug/AndroidManifest.xml
index 6c7157a..3c8b9b9 100644
--- a/wpadebug/AndroidManifest.xml
+++ b/wpadebug/AndroidManifest.xml
@@ -59,6 +59,11 @@
android:label="Input URI"
android:parentActivityName="w1.fi.wpadebug.MainActivity">
</activity>
+ <activity
+ android:name="w1.fi.wpadebug.QrCodeReadActivity"
+ android:label="Start Scan"
+ android:parentActivityName="w1.fi.wpadebug.MainActivity">
+ </activity>
<activity android:name="w1.fi.wpadebug.WpaWebViewActivity"
android:label="WebView"
android:launchMode="singleTop"
diff --git a/wpadebug/src/w1/fi/wpadebug/QrCodeReadActivity.java b/wpadebug/src/w1/fi/wpadebug/QrCodeReadActivity.java
new file mode 100644
index 0000000..f21eccb
--- /dev/null
+++ b/wpadebug/src/w1/fi/wpadebug/QrCodeReadActivity.java
@@ -0,0 +1,40 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2018, The Linux Foundation
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+package w1.fi.wpadebug;
+
+import android.app.Activity;
+import android.util.Log;
+import android.content.Intent;
+import android.hardware.Camera;
+import android.os.Bundle;
+
+public class QrCodeReadActivity extends Activity {
+
+ private static final String TAG = "wpadebug";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ int numberOfCameras = Camera.getNumberOfCameras();
+
+ if (numberOfCameras > 0) {
+ Log.e(TAG, "Number of cameras found: " + numberOfCameras);
+ Intent QrCodeScanIntent = new Intent(QrCodeReadActivity.this,
+ QrCodeScannerActivity.class);
+ QrCodeReadActivity.this.startActivity(QrCodeScanIntent);
+ finish();
+ } else {
+ Log.e(TAG, "No cameras found, input the QR Code");
+ Intent QrCodeInputIntent = new Intent(QrCodeReadActivity.this,
+ InputUri.class);
+ QrCodeReadActivity.this.startActivity(QrCodeInputIntent);
+ finish();
+ }
+ }
+}