ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/.gitignore b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/.gitignore
new file mode 100644
index 0000000..baf2c78
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/.gitignore
@@ -0,0 +1,4 @@
+bin
+gen
+local.properties
+proguard-project.txt
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/AndroidManifest.xml b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/AndroidManifest.xml
new file mode 100644
index 0000000..0d8dec3
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/AndroidManifest.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="w1.fi.wpadebug"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
+ <uses-permission android:name="android.permission.NFC" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <application android:label="wpadebug" android:usesCleartextTraffic="true">
+ <activity android:name="w1.fi.wpadebug.MainActivity"
+ android:label="wpadebug">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="w1.fi.wpadebug.DisplayMessageActivity"
+ android:label="Operation result"
+ android:parentActivityName="w1.fi.wpadebug.MainActivity">
+ </activity>
+ <activity android:name="w1.fi.wpadebug.WpaNfcActivity"
+ android:label="wpa_supplicant NFC operation"
+ android:parentActivityName="w1.fi.wpadebug.MainActivity">
+ <intent-filter>
+ <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ <data android:mimeType="application/vnd.wfa.wsc" />
+ </intent-filter>
+ </activity>
+ <activity android:name="w1.fi.wpadebug.CommandListActivity"
+ android:label="Command list"
+ android:parentActivityName="w1.fi.wpadebug.MainActivity">
+ </activity>
+ <activity android:name="w1.fi.wpadebug.WpaCommandListActivity"
+ android:label="WPA command list"
+ android:parentActivityName="w1.fi.wpadebug.MainActivity">
+ </activity>
+ <activity android:name="w1.fi.wpadebug.WpaCredActivity"
+ android:label="Credentials"
+ android:parentActivityName="w1.fi.wpadebug.MainActivity">
+ </activity>
+ <activity android:name="w1.fi.wpadebug.WpaCredEditActivity"
+ android:label="Credential"
+ android:parentActivityName="w1.fi.wpadebug.WpaCredActivity">
+ </activity>
+ <activity android:name="w1.fi.wpadebug.QrCodeScannerActivity"
+ android:label="QR Code Reader"
+ android:parentActivityName="w1.fi.wpadebug.MainActivity">
+ </activity>
+ <activity android:name="w1.fi.wpadebug.QrCodeDisplayActivity"
+ android:label="QR Code Display"
+ android:parentActivityName="w1.fi.wpadebug.MainActivity">
+ </activity>
+ <activity
+ android:name="w1.fi.wpadebug.InputUri"
+ 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"
+ android:noHistory="true">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ </intent-filter>
+ </activity>
+ <receiver android:name="w1.fi.wpadebug.WifiReceiver">
+ <intent-filter>
+ <action android:name="android.net.wifi.STATE_CHANGE" />
+ <action android:name="android.net.wifi.RSSI_CHANGED" />
+ <action android:name="android.net.wifi.SCAN_RESULTS" />
+ <action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE" />
+ <action android:name="android.net.wifi.supplicant.STATE_CHANGE" />
+ <action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
+ </intent-filter>
+ </receiver>
+ </application>
+</manifest>
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/README b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/README
new file mode 100644
index 0000000..f66f0c2
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/README
@@ -0,0 +1,78 @@
+wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+Copyright (c) 2013, Jouni Malinen <j@w1.fi> and contributors
+All Rights Reserved.
+
+This program is licensed under the BSD license (the one with
+advertisement clause removed). See the top level README for detailed
+license text.
+
+If you are submitting changes to the project, please see CONTRIBUTIONS
+file for more instructions.
+
+
+NOTE! This Android app is for debugging and testing purposes only. It is
+not supposed to be installed on a production use device and doing so may
+result in complete loss of security protections on the device.
+
+
+
+Build
+-----
+
+- Install Android SDK and build tools
+
+wpadebug depends on zxing core to launch QR code display/scanning.
+To build zxing core:
+
+- mkdir hostap/wpadebug/libs # target for the jar file
+- Install maven tool
+- clone latest zxing code [git clone https://github.com/zxing/zxing.git]
+- cd zxing/core
+- run: mvn install -DskipTests
+- copy target/core-*.*.*-SNAPSHOT.jar to hostap/wpadebug/libs
+
+To build wpadebug application:
+
+- update project target if desired; for example:
+ android list targets
+ android update project --target 1 --path $PWD
+- run: ant debug
+
+
+Installation (with adb over USB)
+------------
+
+adb install bin/wpadebug-debug.apk
+
+NOTE: Following steps enable any app on the system to get root access!
+This is not suitable for any production use. This is needed for direct
+wpa_supplicant access and some networking operating in general. You can
+still use rest of the wpadebug app without doing this, but those
+functions will not work unless this step part of installation is
+done. It should be obvious that these steps require a rooted device. In
+addition, if you do not understand what the following commands do,
+please do not run them.
+
+adb root
+adb remount
+adb shell cp /system/bin/mksh /system/bin/mksh-su
+adb shell chmod 6755 /system/bin/mksh-su
+
+Optionally, a text file with a set of command can be installed to allow
+arbitrary shell commands to be executed. This text file need to be in
+/data/local/wpadebug.cmds and use title@command format per line. For
+example:
+version@cat /proc/version
+
+Similarly, /data/local/wpadebug.wpacmds can be used to define additional
+wpa_supplicant control interface commands.
+
+
+Uninstallation
+--------------
+
+adb root
+adb remount
+adb shell rm /system/bin/mksh-su
+
+adb uninstall w1.fi.wpadebug
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/build.xml b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/build.xml
new file mode 100644
index 0000000..5301e69
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/build.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="wpadebug" default="help">
+ <property file="local.properties" />
+ <property file="ant.properties" />
+ <property environment="env" />
+ <condition property="sdk.dir" value="${env.ANDROID_HOME}">
+ <isset property="env.ANDROID_HOME" />
+ </condition>
+ <loadproperties srcFile="project.properties" />
+ <fail
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
+ unless="sdk.dir"
+ />
+ <import file="custom_rules.xml" optional="true" />
+ <!-- version-tag: 1 -->
+ <import file="${sdk.dir}/tools/ant/build.xml" />
+</project>
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/project.properties b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/project.properties
new file mode 100644
index 0000000..36cc0ce
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/project.properties
@@ -0,0 +1,2 @@
+# Project target.
+target=android-22
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/cred_edit.xml b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/cred_edit.xml
new file mode 100644
index 0000000..292b30a
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/cred_edit.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ >
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Username"
+ />
+ <EditText android:id="@+id/cred_edit_username"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:lines="1"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Realm"
+ />
+ <EditText android:id="@+id/cred_edit_realm"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:lines="1"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Password"
+ />
+ <EditText android:id="@+id/cred_edit_password"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:lines="1"
+ android:inputType="textPassword"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Domain"
+ />
+ <EditText android:id="@+id/cred_edit_domain"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:lines="1"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="IMSI"
+ />
+ <EditText android:id="@+id/cred_edit_imsi"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:lines="1"
+ android:hint="Used only with SIM/USIM testing"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Save"
+ android:onClick="credSave"
+ />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Cancel"
+ android:onClick="credCancel"
+ />
+ </LinearLayout>
+</LinearLayout>
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/input_uri.xml b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/input_uri.xml
new file mode 100644
index 0000000..ab391fb
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/input_uri.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="w1.fi.wpadebug.InputUri">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:layout_margin="30dp"
+ android:layout_height="wrap_content">
+
+ <EditText
+ android:id="@+id/edit_uri"
+ android:layout_width="match_parent"
+ android:layout_height="130dp" />
+
+ <Button
+ android:id="@+id/submit_uri"
+ android:layout_width="wrap_content"
+ android:text="Submit"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/main.xml b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/main.xml
new file mode 100644
index 0000000..cbdbfb9
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/main.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Framework commands"
+ />
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="WifiManager"
+ android:onClick="wifiManagerInfo"
+ />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="WifiInfo"
+ android:onClick="wifiInfo"
+ />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Networks"
+ android:onClick="wifiConfiguredNetworks"
+ />
+ </LinearLayout>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="wpa_supplicant commands"
+ />
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="wpa_supplicant commands"
+ android:onClick="runWpaCommands"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Credentials"
+ android:onClick="runWpaCredentials"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="log:info"
+ android:onClick="wpaLogLevelInfo"
+ />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="log:debug"
+ android:onClick="wpaLogLevelDebug"
+ />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="log:excessive"
+ android:onClick="wpaLogLevelExcessive"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <EditText android:id="@+id/edit_cmd"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:hint="wpa_cli command"
+ />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Run"
+ android:onClick="runWpaCliCmd"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Shell commands"
+ android:onClick="runCommands"
+ />
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="QR Scan"
+ android:onClick="runQrScan"
+ />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="QR Input"
+ android:onClick="runQrInput"
+ />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="QR Display"
+ android:onClick="runQrDisplay"
+ />
+ </LinearLayout>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="NFC commands"
+ />
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="WPS handover request"
+ android:onClick="nfcWpsHandoverRequest"
+ />
+ </LinearLayout>
+</LinearLayout>
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/qrcode.xml b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/qrcode.xml
new file mode 100644
index 0000000..8cf50de
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/layout/qrcode.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal">
+ <ImageView
+ android:id="@+id/qrCode"
+ android:layout_width="350dp"
+ android:layout_height="350dp"
+ android:layout_marginTop="20dp"
+ />
+</LinearLayout>
\ No newline at end of file
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/raw/shell_commands.txt b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/raw/shell_commands.txt
new file mode 100644
index 0000000..9b45d65
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/raw/shell_commands.txt
@@ -0,0 +1,2 @@
+id@id
+version@cat /proc/version
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/raw/wpa_commands.txt b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/raw/wpa_commands.txt
new file mode 100644
index 0000000..3baa01c
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/res/raw/wpa_commands.txt
@@ -0,0 +1,9 @@
+Status@STATUS
+PMKSA cache@PMKSA
+Networks@LIST_NETWORKS
+Interworking connect@INTERWORKING_SELECT auto
+Creds@LIST_CREDS
+Scan results@SCAN_RESULTS
+Flush@FLUSH
+Disconnect@DISCONNECT
+Reassociate@REASSOCIATE
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/CommandListActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/CommandListActivity.java
new file mode 100644
index 0000000..6d7ad4d
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/CommandListActivity.java
@@ -0,0 +1,130 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+package w1.fi.wpadebug;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.InputStream;
+import java.io.IOException;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.ArrayAdapter;
+import android.widget.Toast;
+import android.text.method.ScrollingMovementMethod;
+import android.util.Log;
+
+class CmdList
+{
+ String title;
+ String command;
+
+ public CmdList(String _title, String _command)
+ {
+ title = _title;
+ command = _command;
+ }
+
+ @Override
+ public String toString()
+ {
+ return title;
+ }
+}
+
+public class CommandListActivity extends ListActivity
+{
+ private static final String TAG = "wpadebug";
+ private static final String cmdfile = "/data/local/wpadebug.cmds";
+
+ private void read_commands(ArrayList<CmdList> list, Scanner in)
+ {
+ in.useDelimiter("@");
+ while (in.hasNext()) {
+ String title = in.next();
+ String cmd = in.nextLine().substring(1);
+ list.add(new CmdList(title, cmd));
+ }
+ in.close();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ ArrayList<CmdList> list = new ArrayList<CmdList>();
+
+ FileReader in;
+ try {
+ in = new FileReader(cmdfile);
+ read_commands(list, new Scanner(in));
+ } catch (IOException e) {
+ Toast.makeText(this, "Could not read " + cmdfile,
+ Toast.LENGTH_SHORT).show();
+ }
+
+ InputStream inres;
+ try {
+ inres = getResources().openRawResource(R.raw.shell_commands);
+ read_commands(list, new Scanner(inres));
+ } catch (android.content.res.Resources.NotFoundException e) {
+ Toast.makeText(this, "Could not read internal resource",
+ Toast.LENGTH_SHORT).show();
+ }
+
+ ArrayAdapter<CmdList> listAdapter;
+ listAdapter = new ArrayAdapter<CmdList>(this, android.R.layout.simple_list_item_1, list);
+
+ setListAdapter(listAdapter);
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id)
+ {
+ CmdList item = (CmdList) getListAdapter().getItem(position);
+ Toast.makeText(this, "Running: " + item.command,
+ Toast.LENGTH_SHORT).show();
+ String message = run(item.command);
+ if (message == null)
+ return;
+ Intent intent = new Intent(this, DisplayMessageActivity.class);
+ intent.putExtra(MainActivity.EXTRA_MESSAGE, message);
+ startActivity(intent);
+ }
+
+ private String run(String cmd)
+ {
+ try {
+ Process proc = Runtime.getRuntime().exec(new String[]{"/system/bin/mksh-su", "-c", cmd});
+ BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ StringBuffer output = new StringBuffer();
+ int read;
+ char[] buffer = new char[1024];
+ while ((read = reader.read(buffer)) > 0)
+ output.append(buffer, 0, read);
+ reader.close();
+ proc.waitFor();
+ return output.toString();
+ } catch (IOException e) {
+ Toast.makeText(this, "Could not run command",
+ Toast.LENGTH_LONG).show();
+ return null;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/DisplayMessageActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/DisplayMessageActivity.java
new file mode 100644
index 0000000..28ef85f
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/DisplayMessageActivity.java
@@ -0,0 +1,49 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * 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.os.Bundle;
+import android.os.Parcelable;
+import android.view.MenuItem;
+import android.content.Intent;
+import android.widget.TextView;
+import android.text.method.ScrollingMovementMethod;
+import android.util.Log;
+
+public class DisplayMessageActivity extends Activity
+{
+ private static final String TAG = "wpadebug";
+
+ String byteArrayHex(byte[] a) {
+ StringBuilder sb = new StringBuilder();
+ for (byte b: a)
+ sb.append(String.format("%02x", b));
+ return sb.toString();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ Log.d(TAG, "onCreate");
+ super.onCreate(savedInstanceState);
+
+ // Get the message from the intent
+ Intent intent = getIntent();
+ String action = intent.getAction();
+ Log.d(TAG, "onCreate: action=" + action);
+
+ String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
+
+ TextView textView = new TextView(this);
+ textView.setText(message);
+ textView.setMovementMethod(new ScrollingMovementMethod());
+ setContentView(textView);
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/InputUri.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/InputUri.java
new file mode 100644
index 0000000..ea1fa99
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/InputUri.java
@@ -0,0 +1,108 @@
+/*
+ * 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.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.util.Log;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+
+public class InputUri extends Activity {
+
+ private EditText mEditText;
+ private Button mSubmitButton;
+ private String mUriText;
+ private static final String FILE_NAME = "wpadebug_qrdata.txt";
+ private static final String TAG = "wpadebug";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.input_uri);
+ mEditText = (EditText)findViewById(R.id.edit_uri);
+ mSubmitButton = (Button)findViewById(R.id.submit_uri);
+
+ mEditText.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before,
+ int count) {
+ mUriText = mEditText.getText().toString();
+ if (mUriText.startsWith("DPP:") &&
+ mUriText.endsWith(";;")) {
+ writeToFile(mUriText);
+ finish();
+ }
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start,
+ int count, int after) {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ }
+ });
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ mSubmitButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mUriText = mEditText.getText().toString();
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ writeToFile(mUriText);
+
+ InputUri.this.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ finish();
+ }
+ });
+ }
+ }).start();
+
+ }
+
+ });
+ }
+
+ public void writeToFile(String data)
+ {
+ File file = new File("/sdcard", FILE_NAME);
+ try
+ {
+ file.createNewFile();
+ FileOutputStream fOut = new FileOutputStream(file);
+ OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
+ myOutWriter.append(mUriText);
+ myOutWriter.close();
+
+ fOut.flush();
+ fOut.close();
+ }
+ catch (IOException e)
+ {
+ Log.e(TAG, "File write failed: " + e.toString());
+ }
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/MainActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/MainActivity.java
new file mode 100644
index 0000000..4c37b48
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/MainActivity.java
@@ -0,0 +1,209 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+package w1.fi.wpadebug;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.os.Bundle;
+import android.view.View;
+import android.content.Intent;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.widget.EditText;
+import android.widget.Toast;
+import android.util.Log;
+import android.net.wifi.WifiManager;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiConfiguration;
+import android.nfc.NdefMessage;
+import android.nfc.NdefRecord;
+import android.nfc.NfcAdapter;
+
+public class MainActivity extends Activity
+{
+ public final static String EXTRA_MESSAGE = "w1.fi.wpadebug.MESSAGE";
+ private static final String TAG = "wpadebug";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+ }
+
+ public void runCommands(View view)
+ {
+ Intent intent = new Intent(this, CommandListActivity.class);
+ startActivity(intent);
+ }
+
+ public void runQrScan(View view)
+ {
+ Intent intent = new Intent(this, QrCodeScannerActivity.class);
+ startActivity(intent);
+ }
+
+ public void runQrInput(View view)
+ {
+ Intent intent = new Intent(this, InputUri.class);
+ startActivity(intent);
+ }
+
+ public void runQrDisplay(View view)
+ {
+ Intent intent = new Intent(this, QrCodeDisplayActivity.class);
+ startActivity(intent);
+ }
+
+ public void runWpaCommands(View view)
+ {
+ Intent intent = new Intent(this, WpaCommandListActivity.class);
+ startActivity(intent);
+ }
+
+ public void runWpaCredentials(View view)
+ {
+ Intent intent = new Intent(this, WpaCredActivity.class);
+ startActivity(intent);
+ }
+
+ public void runWpaCliCmd(View view)
+ {
+ Intent intent = new Intent(this, DisplayMessageActivity.class);
+ EditText editText = (EditText) findViewById(R.id.edit_cmd);
+ String cmd = editText.getText().toString();
+ if (cmd.trim().length() == 0) {
+ show_alert("wpa_cli command", "Invalid command");
+ return;
+ }
+ wpaCmd(view, cmd);
+ }
+
+ public void wpaLogLevelInfo(View view)
+ {
+ wpaCmd(view, "LOG_LEVEL INFO 1");
+ }
+
+ public void wpaLogLevelDebug(View view)
+ {
+ wpaCmd(view, "LOG_LEVEL DEBUG 1");
+ }
+
+ public void wpaLogLevelExcessive(View view)
+ {
+ wpaCmd(view, "LOG_LEVEL EXCESSIVE 1");
+ }
+
+ private void wpaCmd(View view, String cmd)
+ {
+ Intent intent = new Intent(this, DisplayMessageActivity.class);
+ String message = run("wpa_cli " + cmd);
+ if (message == null)
+ return;
+ intent.putExtra(EXTRA_MESSAGE, message);
+ startActivity(intent);
+ }
+
+ private String run(String cmd)
+ {
+ try {
+ Log.d(TAG, "Running external process: " + cmd);
+ Process proc = Runtime.getRuntime().exec(new String[]{"/system/bin/mksh-su", "-c", cmd});
+ BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ StringBuffer output = new StringBuffer();
+ int read;
+ char[] buffer = new char[1024];
+ while ((read = reader.read(buffer)) > 0)
+ output.append(buffer, 0, read);
+ reader.close();
+ proc.waitFor();
+ Log.d(TAG, "External process completed - exitValue " +
+ proc.exitValue());
+ return output.toString();
+ } catch (IOException e) {
+ show_alert("Could not run external program",
+ "Execution of an external program failed. " +
+ "Maybe mksh-su was not installed.");
+ return null;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void show_alert(String title, String message)
+ {
+ AlertDialog.Builder alert = new AlertDialog.Builder(this);
+ alert.setTitle(title);
+ alert.setMessage(message);
+ alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id)
+ {
+ }
+ });
+ alert.create().show();
+ }
+
+ public void wifiManagerInfo(View view)
+ {
+ Intent intent = new Intent(this, DisplayMessageActivity.class);
+ WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
+ String message = "WifiState: " + manager.getWifiState() + "\n" +
+ "WifiEnabled: " + manager.isWifiEnabled() + "\n" +
+ "pingSupplicant: " + manager.pingSupplicant() + "\n" +
+ "DhcpInfo: " + manager.getDhcpInfo().toString() + "\n";
+ intent.putExtra(EXTRA_MESSAGE, message);
+ startActivity(intent);
+ }
+
+ public void wifiInfo(View view)
+ {
+ Intent intent = new Intent(this, DisplayMessageActivity.class);
+ WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
+ WifiInfo wifi = manager.getConnectionInfo();
+ String message = wifi.toString() + "\n" + wifi.getSupplicantState();
+ intent.putExtra(EXTRA_MESSAGE, message);
+ startActivity(intent);
+ }
+
+ public void wifiConfiguredNetworks(View view)
+ {
+ Intent intent = new Intent(this, DisplayMessageActivity.class);
+ WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
+ StringBuilder sb = new StringBuilder();
+ for (WifiConfiguration n: manager.getConfiguredNetworks())
+ sb.append(n.toString() + "\n");
+ intent.putExtra(EXTRA_MESSAGE, sb.toString());
+ startActivity(intent);
+ }
+
+ public void nfcWpsHandoverRequest(View view)
+ {
+ NfcAdapter nfc;
+ nfc = NfcAdapter.getDefaultAdapter(this);
+ if (nfc == null) {
+ Toast.makeText(this, "NFC is not available",
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+
+ NdefMessage msg;
+ msg = new NdefMessage(new NdefRecord[] {
+ NdefRecord.createMime("application/vnd.wfa.wsc",
+ new byte[0])
+ });
+
+ nfc.setNdefPushMessage(msg, this);
+ Toast.makeText(this, "NFC push message (WSC) configured",
+ Toast.LENGTH_LONG).show();
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/QrCodeDisplayActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/QrCodeDisplayActivity.java
new file mode 100644
index 0000000..10c9c01
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/QrCodeDisplayActivity.java
@@ -0,0 +1,109 @@
+/*
+ * 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.graphics.Bitmap;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+import android.widget.ImageView;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.WriterException;
+import com.google.zxing.common.BitMatrix;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public class QrCodeDisplayActivity extends Activity {
+
+ private static final String TAG = "wpadebug";
+ private static final String FILE_NAME = "wpadebug_qrdata.txt";
+ private ImageView imageView;
+
+ // Below set of configs are used for QR code display window
+ private final static int WHITE = 0xFFFFFFFF;
+ private final static int BLACK = 0xFF000000;
+ private final static int WIDTH = 400;
+ private final static int HEIGHT = 400;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // create imageview for this and attach to this activity.
+ setContentView(R.layout.qrcode);
+ imageView = (ImageView) findViewById(R.id.qrCode);
+ String str = readFromFile(FILE_NAME);
+
+ //Encode and launch qrcode now
+ try {
+ Bitmap bitmap = (TextUtils.isEmpty(str)) ? null : encodeAsBitmap(str);
+ if (bitmap != null) {
+ imageView.setImageBitmap(bitmap);
+ } else {
+ Log.e(TAG, "Failed to generate bitmap for uri=" + str);
+ finish();
+ }
+ } catch (WriterException e) {
+ e.printStackTrace();
+ finish();
+ }
+ }
+
+ private Bitmap encodeAsBitmap(String str) throws WriterException {
+ BitMatrix result;
+ try {
+ result = new MultiFormatWriter().encode(str, BarcodeFormat.QR_CODE, WIDTH, HEIGHT, null);
+ } catch (IllegalArgumentException iae) {
+ // Unsupported format
+ return null;
+ }
+
+ int width = result.getWidth();
+ int height = result.getHeight();
+ int[] pixels = new int[width * height];
+ for (int y = 0; y < height; y++) {
+ int offset = y * width;
+ for (int x = 0; x < width; x++) {
+ pixels[offset + x] = result.get(x, y) ? BLACK : WHITE;
+ }
+ }
+
+ Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
+ return bitmap;
+ }
+
+ private String readFromFile(String filePath) {
+ try {
+ FileInputStream fis = new FileInputStream(new File("/sdcard", filePath));
+ BufferedReader br = new BufferedReader(new InputStreamReader(fis, "UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ String line;
+ while(( line = br.readLine()) != null ) {
+ sb.append( line );
+ sb.append( '\n' );
+ }
+ return sb.toString();
+ }
+ catch (FileNotFoundException e) {
+ Log.e(TAG, "File not found: " + e.toString());
+ } catch (IOException e) {
+ Log.e(TAG, "Can not read file: " + e.toString());
+ }
+
+ return null;
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/QrCodeReadActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/QrCodeReadActivity.java
new file mode 100644
index 0000000..f21eccb
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/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();
+ }
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/QrCodeScannerActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/QrCodeScannerActivity.java
new file mode 100644
index 0000000..4b3591c
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/QrCodeScannerActivity.java
@@ -0,0 +1,82 @@
+/*
+ * 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.content.ActivityNotFoundException;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.Toast;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+
+public class QrCodeScannerActivity extends Activity {
+
+ private static final String TAG = "wpadebug";
+ private static final String RESULT = "SCAN_RESULT";
+ private static final String FILE_NAME = "wpadebug_qrdata.txt";
+ private static final String ACTION = "com.google.zxing.client.android.SCAN";
+
+ private static final int QRCODE = 1;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = new Intent();
+ intent.setAction(ACTION);
+ intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
+ intent.putExtra("PROMPT_MESSAGE",
+ "Place a QR Code inside the viewfinder rectangle to scan it.");
+ try {
+ startActivityForResult(intent, QRCODE);
+ } catch (ActivityNotFoundException e) {
+ Log.e(TAG, "No QR code scanner found with name=" + ACTION);
+ Toast.makeText(QrCodeScannerActivity.this, "QR code scanner not found", Toast.LENGTH_SHORT).show();
+ finish();
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ Log.d(TAG, "onActivityResult: requestCode=" + requestCode + " resultCode=" + resultCode);
+ if (requestCode == QRCODE && resultCode == RESULT_OK) {
+ String contents = data.getStringExtra(RESULT);
+ writeToFile(contents);
+ Log.d(TAG, "onActivityResult: QRCODE RESULT_OK: " + contents);
+ finishActivity(requestCode);
+ finish();
+ }
+ }
+
+ public void writeToFile(String data)
+ {
+ File file = new File("/sdcard", FILE_NAME);
+ try
+ {
+ file.createNewFile();
+ FileOutputStream fOut = new FileOutputStream(file);
+ OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
+ myOutWriter.append(data);
+
+ myOutWriter.close();
+
+ fOut.flush();
+ fOut.close();
+ }
+ catch (IOException e)
+ {
+ Log.e(TAG, "File write failed: " + e.toString());
+ }
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WifiReceiver.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WifiReceiver.java
new file mode 100644
index 0000000..d69e05d
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WifiReceiver.java
@@ -0,0 +1,95 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+package w1.fi.wpadebug;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.NetworkInfo;
+import android.net.wifi.SupplicantState;
+import android.net.wifi.WifiInfo;
+import android.os.Bundle;
+import android.util.Log;
+
+public class WifiReceiver extends BroadcastReceiver
+{
+ private static final String TAG = "wpadebug";
+
+ @Override
+ public void onReceive(Context c, Intent intent)
+ {
+ String act = intent.getAction();
+ Log.d(TAG, "Received broadcast intent: action=" + act);
+
+ Bundle bundles = intent.getExtras();
+ if (bundles == null)
+ return;
+
+ if (bundles.containsKey("bssid")) {
+ String val;
+ val = intent.getStringExtra("bssid");
+ if (val != null)
+ Log.d(TAG, " bssid: " + val);
+ }
+
+ if (bundles.containsKey("networkInfo")) {
+ NetworkInfo info;
+ info = (NetworkInfo) intent.getParcelableExtra("networkInfo");
+ if (info != null)
+ Log.d(TAG, " networkInfo: " + info);
+ }
+
+ if (bundles.containsKey("newRssi")) {
+ int val;
+ val = intent.getIntExtra("newRssi", -1);
+ Log.d(TAG, " newRssi: " + val);
+ }
+
+ if (bundles.containsKey("newState")) {
+ SupplicantState state;
+ state = (SupplicantState) intent.getParcelableExtra("newState");
+ if (state != null)
+ Log.d(TAG, " newState: " + state);
+ }
+
+ if (bundles.containsKey("previous_wifi_state")) {
+ int wifi_state;
+ wifi_state = intent.getIntExtra("previous_wifi_state", -1);
+ if (wifi_state != -1)
+ Log.d(TAG, " previous_wifi_state: " + wifi_state);
+ }
+
+ if (bundles.containsKey("connected")) {
+ boolean connected;
+ connected = intent.getBooleanExtra("connected", false);
+ Log.d(TAG, " connected: " + connected);
+ }
+
+ if (bundles.containsKey("supplicantError")) {
+ int error;
+ error = intent.getIntExtra("supplicantError", -1);
+ if (error != -1)
+ Log.d(TAG, " supplicantError: " + error);
+ }
+
+ if (bundles.containsKey("wifiInfo")) {
+ WifiInfo info;
+ info = (WifiInfo) intent.getParcelableExtra("wifiInfo");
+ if (info != null)
+ Log.d(TAG, " wifiInfo: " + info);
+ }
+
+ if (bundles.containsKey("wifi_state")) {
+ int wifi_state;
+ wifi_state = intent.getIntExtra("wifi_state", -1);
+ if (wifi_state != -1)
+ Log.d(TAG, " wifi_state: " + wifi_state);
+ }
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java
new file mode 100644
index 0000000..e089179
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java
@@ -0,0 +1,112 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+package w1.fi.wpadebug;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.InputStream;
+import java.io.IOException;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.ArrayAdapter;
+import android.widget.Toast;
+import android.text.method.ScrollingMovementMethod;
+import android.util.Log;
+
+public class WpaCommandListActivity extends ListActivity
+{
+ private static final String TAG = "wpadebug";
+ private static final String cmdfile = "/data/local/wpadebug.wpacmds";
+
+ private void read_commands(ArrayList<CmdList> list, Scanner in)
+ {
+ in.useDelimiter("@");
+ while (in.hasNext()) {
+ String title = in.next();
+ String cmd = in.nextLine().substring(1);
+ list.add(new CmdList(title, cmd));
+ }
+ in.close();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ ArrayList<CmdList> list = new ArrayList<CmdList>();
+
+ FileReader in;
+ try {
+ in = new FileReader(cmdfile);
+ read_commands(list, new Scanner(in));
+ } catch (IOException e) {
+ Toast.makeText(this, "Could not read " + cmdfile,
+ Toast.LENGTH_SHORT).show();
+ }
+
+ InputStream inres;
+ try {
+ inres = getResources().openRawResource(R.raw.wpa_commands);
+ read_commands(list, new Scanner(inres));
+ } catch (android.content.res.Resources.NotFoundException e) {
+ Toast.makeText(this, "Could not read internal resource",
+ Toast.LENGTH_SHORT).show();
+ }
+
+ ArrayAdapter<CmdList> listAdapter;
+ listAdapter = new ArrayAdapter<CmdList>(this, android.R.layout.simple_list_item_1, list);
+
+ setListAdapter(listAdapter);
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id)
+ {
+ CmdList item = (CmdList) getListAdapter().getItem(position);
+ Toast.makeText(this, "Running: " + item.command,
+ Toast.LENGTH_SHORT).show();
+ String message = run(item.command);
+ if (message == null)
+ return;
+ Intent intent = new Intent(this, DisplayMessageActivity.class);
+ intent.putExtra(MainActivity.EXTRA_MESSAGE, message);
+ startActivity(intent);
+ }
+
+ private String run(String cmd)
+ {
+ try {
+ Process proc = Runtime.getRuntime().exec(new String[]{"/system/bin/mksh-su", "-c", "wpa_cli " + cmd});
+ BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ StringBuffer output = new StringBuffer();
+ int read;
+ char[] buffer = new char[1024];
+ while ((read = reader.read(buffer)) > 0)
+ output.append(buffer, 0, read);
+ reader.close();
+ proc.waitFor();
+ return output.toString();
+ } catch (IOException e) {
+ Toast.makeText(this, "Could not run command",
+ Toast.LENGTH_LONG).show();
+ return null;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCredActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCredActivity.java
new file mode 100644
index 0000000..3902f09
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCredActivity.java
@@ -0,0 +1,263 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+package w1.fi.wpadebug;
+
+import java.util.ArrayList;
+import java.util.ListIterator;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.InputStream;
+import java.io.IOException;
+
+import android.app.ListActivity;
+import android.app.ActionBar;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.ListView;
+import android.widget.ArrayAdapter;
+import android.widget.Toast;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+
+class Credential
+{
+ int id;
+ String realm;
+ String username;
+ String domain;
+ String imsi;
+
+ public Credential(String entry)
+ {
+ String fields[] = entry.split("\t");
+ id = Integer.parseInt(fields[0]);
+ if (fields.length > 1)
+ realm = fields[1];
+ else
+ realm = "";
+ if (fields.length > 2)
+ username = fields[2];
+ else
+ username = "";
+ if (fields.length > 3 && fields[3].length() > 0)
+ domain = fields[3];
+ else
+ domain = null;
+ if (fields.length > 4 && fields[4].length() > 0)
+ imsi = fields[4];
+ else
+ imsi = null;
+ }
+
+ public Credential(int _id, String _username, String _realm, String _domain,
+ String _imsi)
+ {
+ id = _id;
+ username = _username;
+ realm = _realm;
+ domain = _domain;
+ imsi = _imsi;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ String res = id + " - " + username + "@" + realm;
+ if (domain != null)
+ res += " (domain=" + domain + ")";
+ if (imsi != null)
+ res += " (imsi=" + imsi + ")";
+ return res;
+ }
+}
+
+public class WpaCredActivity extends ListActivity
+{
+ private static final String TAG = "wpadebug";
+ static final int CRED_EDIT_REQ = 0;
+ private ArrayList<Credential> mList;
+ private ArrayAdapter<Credential> mListAdapter;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ mList = new ArrayList<Credential>();
+
+ String res = run("LIST_CREDS");
+ if (res == null) {
+ Toast.makeText(this, "Could not get credential list",
+ Toast.LENGTH_LONG).show();
+ finish();
+ return;
+ }
+
+ String creds[] = res.split("\n");
+ for (String cred: creds) {
+ if (Character.isDigit(cred.charAt(0)))
+ mList.add(new Credential(cred));
+ }
+
+ mListAdapter = new ArrayAdapter<Credential>(this, android.R.layout.simple_list_item_1, mList);
+
+ setListAdapter(mListAdapter);
+ registerForContextMenu(getListView());
+
+ ActionBar abar = getActionBar();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu)
+ {
+ menu.add(0, 0, 0, "Add credential");
+ return true;
+ }
+
+ protected void onActivityResult(int requestCode, int resultCode,
+ Intent data)
+ {
+ if (requestCode == CRED_EDIT_REQ) {
+ if (resultCode != RESULT_OK)
+ return;
+
+ String username = data.getStringExtra("username");
+
+ String realm = data.getStringExtra("realm");
+
+ String domain = data.getStringExtra("domain");
+ if (domain != null && domain.length() == 0)
+ domain = null;
+
+ String imsi = data.getStringExtra("imsi");
+ if (imsi != null && imsi.length() == 0)
+ imsi = null;
+
+ String password = data.getStringExtra("password");
+ if (password != null && password.length() == 0)
+ password = null;
+
+ String res = run("ADD_CRED");
+ if (res == null || res.contains("FAIL")) {
+ Toast.makeText(this, "Failed to add credential",
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+
+ int id = -1;
+ String lines[] = res.split("\n");
+ for (String line: lines) {
+ if (Character.isDigit(line.charAt(0))) {
+ id = Integer.parseInt(line);
+ break;
+ }
+ }
+
+ if (id < 0) {
+ Toast.makeText(this, "Failed to add credential (invalid id)",
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+
+ if (!set_cred_quoted(id, "username", username) ||
+ !set_cred_quoted(id, "realm", realm) ||
+ (password != null &&
+ !set_cred_quoted(id, "password", password)) ||
+ (domain != null && !set_cred_quoted(id, "domain", domain)) ||
+ (imsi != null && !set_cred_quoted(id, "imsi", imsi))) {
+ run("REMOVE_CRED " + id);
+ Toast.makeText(this, "Failed to set credential field",
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+
+ mListAdapter.add(new Credential(id, username, realm, domain, imsi));
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ if (item.getTitle().equals("Add credential")) {
+ startActivityForResult(new Intent(this, WpaCredEditActivity.class),
+ CRED_EDIT_REQ);
+ return true;
+ }
+ return false;
+ }
+
+ public void onCreateContextMenu(android.view.ContextMenu menu, View v,
+ android.view.ContextMenu.ContextMenuInfo menuInfo)
+ {
+ menu.add(0, v.getId(), 0, "Delete");
+ }
+
+ @Override
+ public boolean onContextItemSelected(MenuItem item)
+ {
+ if (item.getTitle().equals("Delete")) {
+ AdapterContextMenuInfo info =
+ (AdapterContextMenuInfo) item.getMenuInfo();
+ Credential cred = (Credential) getListAdapter().getItem(info.position);
+ String res = run("REMOVE_CRED " + cred.id);
+ if (res == null || !res.contains("OK")) {
+ Toast.makeText(this, "Failed to delete credential",
+ Toast.LENGTH_LONG).show();
+ } else
+ mListAdapter.remove(cred);
+ return true;
+ }
+ return super.onContextItemSelected(item);
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id)
+ {
+ Credential item = (Credential) getListAdapter().getItem(position);
+ Toast.makeText(this, "Credential selected: " + item,
+ Toast.LENGTH_SHORT).show();
+ }
+
+ private String run(String cmd)
+ {
+ try {
+ Process proc = Runtime.getRuntime().exec(new String[]{"/system/bin/mksh-su", "-c", "wpa_cli " + cmd});
+ BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ StringBuffer output = new StringBuffer();
+ int read;
+ char[] buffer = new char[1024];
+ while ((read = reader.read(buffer)) > 0)
+ output.append(buffer, 0, read);
+ reader.close();
+ proc.waitFor();
+ return output.toString();
+ } catch (IOException e) {
+ Toast.makeText(this, "Could not run command",
+ Toast.LENGTH_LONG).show();
+ return null;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private boolean set_cred(int id, String field, String value)
+ {
+ String res = run("SET_CRED " + id + " " + field + " " + value);
+ return res != null && res.contains("OK");
+ }
+
+ private boolean set_cred_quoted(int id, String field, String value)
+ {
+ String value2 = "'\"" + value + "\"'";
+ return set_cred(id, field, value2);
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCredEditActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCredEditActivity.java
new file mode 100644
index 0000000..3f846c7
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaCredEditActivity.java
@@ -0,0 +1,55 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * 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.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+
+public class WpaCredEditActivity extends Activity
+{
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.cred_edit);
+ }
+
+ public void credSave(View view)
+ {
+ Intent data = new Intent();
+ EditText edit;
+
+ edit = (EditText) findViewById(R.id.cred_edit_username);
+ data.putExtra("username", edit.getText().toString());
+
+ edit = (EditText) findViewById(R.id.cred_edit_realm);
+ data.putExtra("realm", edit.getText().toString());
+
+ edit = (EditText) findViewById(R.id.cred_edit_password);
+ data.putExtra("password", edit.getText().toString());
+
+ edit = (EditText) findViewById(R.id.cred_edit_domain);
+ data.putExtra("domain", edit.getText().toString());
+
+ edit = (EditText) findViewById(R.id.cred_edit_imsi);
+ data.putExtra("imsi", edit.getText().toString());
+
+ setResult(Activity.RESULT_OK, data);
+ finish();
+ }
+
+ public void credCancel(View view)
+ {
+ setResult(Activity.RESULT_CANCELED);
+ finish();
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaNfcActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaNfcActivity.java
new file mode 100644
index 0000000..6a16017
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaNfcActivity.java
@@ -0,0 +1,131 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+package w1.fi.wpadebug;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.view.MenuItem;
+import android.content.Intent;
+import android.content.DialogInterface;
+import android.widget.TextView;
+import android.widget.Toast;
+import android.text.method.ScrollingMovementMethod;
+import android.util.Log;
+import android.nfc.NdefMessage;
+import android.nfc.NdefRecord;
+import android.nfc.NfcAdapter;
+
+public class WpaNfcActivity extends Activity
+{
+ private static final String TAG = "wpadebug";
+
+ String byteArrayHex(byte[] a) {
+ StringBuilder sb = new StringBuilder();
+ for (byte b: a)
+ sb.append(String.format("%02x", b));
+ return sb.toString();
+ }
+
+ private void show_alert(String title, String message)
+ {
+ AlertDialog.Builder alert = new AlertDialog.Builder(this);
+ alert.setTitle(title);
+ alert.setMessage(message);
+ alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id)
+ {
+ finish();
+ }
+ });
+ alert.create().show();
+ }
+
+ private String wpaCmd(String cmd)
+ {
+ try {
+ Log.d(TAG, "Executing wpaCmd: " + cmd);
+ Process proc = Runtime.getRuntime().exec(new String[]{"/system/bin/mksh-su", "-c", "wpa_cli " + cmd});
+ BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ StringBuffer output = new StringBuffer();
+ int read;
+ char[] buffer = new char[1024];
+ while ((read = reader.read(buffer)) > 0)
+ output.append(buffer, 0, read);
+ reader.close();
+ proc.waitFor();
+ Log.d(TAG, "External process completed - exitValue " +
+ proc.exitValue());
+ return output.toString();
+ } catch (IOException e) {
+ show_alert("Could not run external program",
+ "Execution of an external program failed. " +
+ "Maybe mksh-su was not installed.");
+ return null;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean report_tag_read(byte[] payload)
+ {
+ String res = wpaCmd("WPS_NFC_TAG_READ " + byteArrayHex(payload));
+ if (res == null)
+ return false;
+ if (!res.contains("OK")) {
+ Toast.makeText(this, "Failed to report WSC tag read to " +
+ "wpa_supplicant", Toast.LENGTH_LONG).show();
+ } else {
+ Toast.makeText(this, "Reported WSC tag read to wpa_supplicant",
+ Toast.LENGTH_LONG).show();
+ }
+ finish();
+ return true;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ String action = intent.getAction();
+ Log.d(TAG, "onCreate: action=" + action);
+
+ if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
+ Log.d(TAG, "NDEF discovered");
+ Parcelable[] raw = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
+ if (raw != null) {
+ Log.d(TAG, "NDEF message count: " + raw.length);
+ NdefMessage[] msgs = new NdefMessage[raw.length];
+ for (int i = 0; i < raw.length; i++) {
+ msgs[i] = (NdefMessage) raw[i];
+ NdefRecord rec = msgs[i].getRecords()[0];
+ Log.d(TAG, "MIME type: " + rec.toMimeType());
+ byte[] a = rec.getPayload();
+ Log.d(TAG, "NDEF record: " + byteArrayHex(a));
+ if (rec.getTnf() == NdefRecord.TNF_MIME_MEDIA &&
+ rec.toMimeType().equals("application/vnd/wfa.wsc")) {
+ Log.d(TAG, "WSC tag read");
+ }
+
+ if (!report_tag_read(a))
+ return;
+ }
+ }
+ }
+
+ finish();
+ }
+}
diff --git a/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaWebViewActivity.java b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaWebViewActivity.java
new file mode 100644
index 0000000..a7c54fc
--- /dev/null
+++ b/package/kernel/asr-wl/asr-hostapd/asr-hostapd-2023-06-22/wpadebug/src/w1/fi/wpadebug/WpaWebViewActivity.java
@@ -0,0 +1,146 @@
+/*
+ * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
+ * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+ *
+ * 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.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.net.http.SslError;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Window;
+import android.webkit.SslErrorHandler;
+import android.webkit.WebChromeClient;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.Toast;
+
+public class WpaWebViewActivity extends Activity
+{
+ private static final String TAG = "wpadebug";
+ private static final String EXTRA_MESSAGE = "w1.fi.wpadebug.URL";
+ private WebView mWebView;
+ final Activity activity = this;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ Log.d(TAG, "WpaWebViewActivity::onCreate");
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ String url = intent.getStringExtra(EXTRA_MESSAGE);
+ Log.d(TAG, "url=" + url);
+ if (url.equals("FINISH")) {
+ finish();
+ return;
+ }
+
+ mWebView = new WebView(this);
+ mWebView.getSettings().setJavaScriptEnabled(true);
+ mWebView.setWebViewClient(new WpaWebViewClient());
+
+ getWindow().requestFeature(Window.FEATURE_PROGRESS);
+
+ mWebView.setWebChromeClient(new WebChromeClient()
+ {
+ public void onProgressChanged(WebView view, int progress)
+ {
+ Log.d(TAG, "progress=" + progress);
+ activity.setProgress(progress * 1000);
+ }
+ });
+
+ setContentView(mWebView);
+
+ mWebView.loadUrl(url);
+ }
+
+ @Override
+ public void onResume()
+ {
+ Log.d(TAG, "WpaWebViewActivity::onResume");
+ super.onResume();
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent)
+ {
+ Log.d(TAG, "WpaWebViewActivity::onNewIntent");
+ super.onNewIntent(intent);
+ String url = intent.getStringExtra(EXTRA_MESSAGE);
+ Log.d(TAG, "url=" + url);
+ setIntent(intent);
+ if (url.equals("FINISH")) {
+ finish();
+ return;
+ }
+ mWebView.loadUrl(url);
+ }
+
+ private class WpaWebViewClient extends WebViewClient {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url)
+ {
+ Log.d(TAG, "shouldOverrideUrlLoading: url=" + url);
+ Intent intent = getIntent();
+ intent.putExtra(EXTRA_MESSAGE, url);
+
+ view.loadUrl(url);
+ return true;
+ }
+
+ @Override
+ public void onPageFinished(WebView view, String url)
+ {
+ Log.d(TAG, "onPageFinished: url=" + url);
+ }
+
+ public void onReceivedError(WebView view, int errorCode,
+ String description, String failingUrl)
+ {
+ Log.d(TAG, "Failed to load page: errorCode=" +
+ errorCode + " description=" + description +
+ " URL=" + failingUrl);
+ Toast.makeText(activity, "Failed to load page: " +
+ description + " (URL=" + failingUrl + ")",
+ Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onReceivedSslError(WebView view, SslErrorHandler handler,
+ SslError error)
+ {
+ Log.d(TAG, "SSL error: " + error);
+
+ final SslErrorHandler h = handler;
+ AlertDialog.Builder alert = new AlertDialog.Builder(activity);
+ alert.setTitle("SSL error - Continue?");
+ alert.setMessage(error.toString())
+ .setCancelable(false)
+ .setPositiveButton("Yes", new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int id)
+ {
+ h.proceed();
+ }
+ })
+ .setNegativeButton("No", new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int id)
+ {
+ h.cancel();
+ }
+ });
+ alert.show();
+ }
+ }
+}