diff --git a/.idea/deviceManager.xml b/.idea/deviceManager.xml
new file mode 100644
index 0000000..eebfe8e
--- /dev/null
+++ b/.idea/deviceManager.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/other.xml b/.idea/other.xml
new file mode 100644
index 0000000..0d3a1fb
--- /dev/null
+++ b/.idea/other.xml
@@ -0,0 +1,263 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 90baefb..3eb76bf 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,13 +7,12 @@
+
-
-
-
+
+
+
+
+
+
+
+
-
-
+
-
+
@@ -92,8 +94,7 @@
-
@@ -106,8 +107,7 @@
-
-
-
-
diff --git a/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/OnBootCompletedReceiver.kt b/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/OnBootCompletedReceiver.kt
new file mode 100644
index 0000000..35982e3
--- /dev/null
+++ b/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/OnBootCompletedReceiver.kt
@@ -0,0 +1,91 @@
+package com.smoothie.wirelessDebuggingSwitch
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import android.net.Network
+import android.net.NetworkCapabilities
+import android.net.NetworkRequest
+import android.util.Log
+import androidx.preference.PreferenceManager
+import java.util.concurrent.Executors
+import java.util.concurrent.TimeUnit
+
+class OnBootCompletedReceiver : BroadcastReceiver() {
+
+ private val tag = "OnBootCompletedReceiver"
+ private val defaultWaitingTime = 30f // in seconds
+
+ private var actionReceived = false
+
+ override fun onReceive(context: Context?, intent: Intent?) {
+ if (intent?.action != Intent.ACTION_BOOT_COMPLETED) {
+ Log.w(tag, "onReceive: Action does not match boot completed")
+ return
+ }
+
+ if (context == null) {
+ Log.e(tag, "onReceive: Context is null")
+ return
+ }
+
+ if (actionReceived) {
+ Log.d(tag, "onReceive: Action already ran")
+ return
+ }
+
+ Log.d(tag, "onReceive: Proceeding")
+ actionReceived = true
+
+ val preferences = PreferenceManager.getDefaultSharedPreferences(context)
+
+ val keyEnableOnBoot = context.getString(R.string.key_enable_on_boot)
+ if (!preferences.getBoolean(keyEnableOnBoot, false)) {
+ Log.d(tag, "onReceive: Enable on but is disabled")
+ return
+ }
+
+ val waitingTimeKey = context.getString(R.string.key_after_boot_wait_time)
+ val waitingTime = preferences.getFloat(waitingTimeKey, defaultWaitingTime)
+
+ val connectivityManager =
+ context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
+
+ val request = NetworkRequest.Builder()
+ .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
+ .build()
+
+ val callback = object : ConnectivityManager.NetworkCallback() {
+ override fun onAvailable(network: Network) {
+ super.onAvailable(network)
+ Log.d(tag, "Callback: network became available")
+
+ val capabilities = connectivityManager.getNetworkCapabilities(network)
+ if (capabilities?.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) != true) {
+ Log.d(tag, "Callback: WiFi transport type is unavailable")
+ return
+ }
+
+ Log.d(tag, "Callback enabling wireless debugging")
+ WirelessDebugging.setEnabled(context, true)
+ WirelessDebugging.syncConnectionData(context)
+ Log.d(tag, "Callback: done")
+
+ connectivityManager.unregisterNetworkCallback(this)
+ Log.d(tag, "Callback: unregistered the callback: done")
+ }
+ }
+
+ connectivityManager.registerNetworkCallback(request, callback)
+ Log.d(tag, "onReceive: Assigned the network callback")
+
+ val scheduler = Executors.newSingleThreadScheduledExecutor()
+ scheduler.schedule({
+ connectivityManager.unregisterNetworkCallback(callback)
+ Log.d(tag, "Scheduler: callback unregistered: timeout")
+ }, waitingTime.toLong(), TimeUnit.SECONDS)
+ Log.d(tag, "onReceive: Scheduled to unregister the callback in $waitingTime seconds")
+ }
+
+}
diff --git a/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/SettingsActivity.kt b/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/SettingsActivity.kt
index e62579c..072535a 100644
--- a/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/SettingsActivity.kt
+++ b/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/SettingsActivity.kt
@@ -126,19 +126,11 @@ class SettingsActivity : ApplicationPreferenceActivity(
preferenceKey = getString(R.string.key_prefix_connection_data)
preferencePrefixData = preferenceFragment.findPreference(preferenceKey)!!
preferencePrefixData.summaryProvider = prefixConnectionDataSummaryProvider
- preferencePrefixData.setOnPreferenceClickListener {
- startActivity(Intent(baseContext, ActivityPreferencePrefix::class.java))
- false
- }
preferenceKey = getString(R.string.key_enable_kde_connect)
preferenceKdeConnect = preferenceFragment.findPreference(preferenceKey)!!
preferenceKdeConnect.isEnabled = kdeConnectInstalled && hasRoot
preferenceKdeConnect.summaryProvider = kdeConnectSummaryProvider
- preferenceKdeConnect.onPreferenceClickListener = OnPreferenceClickListener {
- startActivity(Intent(baseContext, ActivityPreferenceKdeConnect::class.java))
- false
- }
preferenceKey = getString(R.string.key_app_version)
val preferenceAppVersion = preferenceFragment.findPreference(preferenceKey)!!
diff --git a/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/preference/ActivityPreferenceEnableOnBoot.kt b/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/preference/ActivityPreferenceEnableOnBoot.kt
new file mode 100644
index 0000000..6d72a99
--- /dev/null
+++ b/app/src/main/java/com/smoothie/wirelessDebuggingSwitch/preference/ActivityPreferenceEnableOnBoot.kt
@@ -0,0 +1,9 @@
+package com.smoothie.wirelessDebuggingSwitch.preference
+
+import com.smoothie.widgetFactory.preference.PreferenceActivity
+import com.smoothie.wirelessDebuggingSwitch.R
+
+class ActivityPreferenceEnableOnBoot : PreferenceActivity(
+ R.xml.preferences_enable_on_boot,
+ R.string.preference_name_enable_on_boot
+)
diff --git a/app/src/main/res/drawable/round_av_timer_24.xml b/app/src/main/res/drawable/round_av_timer_24.xml
new file mode 100644
index 0000000..9c70cf6
--- /dev/null
+++ b/app/src/main/res/drawable/round_av_timer_24.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/round_info_outline_24.xml b/app/src/main/res/drawable/round_info_outline_24.xml
new file mode 100644
index 0000000..7288626
--- /dev/null
+++ b/app/src/main/res/drawable/round_info_outline_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/round_power_settings_new_24.xml b/app/src/main/res/drawable/round_power_settings_new_24.xml
new file mode 100644
index 0000000..bd6d325
--- /dev/null
+++ b/app/src/main/res/drawable/round_power_settings_new_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 49d33fe..d81e2af 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -71,7 +71,7 @@
Использование светлого текста может помочь выделить его на темных обоях при использовании полупрозрачного фона.
Прочее
GitHub
- Посетите страницу этого проекта на GitHub
+ Посетите страницу проекта на GitHub
Оставить отзыв
Сообщите о проблеме или предложите новый функционал
Версия приложения
@@ -89,6 +89,11 @@
Прочтите инструкцию в приложении.
Детали подключения
Доступно по адресу
+ Включать после загрузки
+ Включать отладку сразу после загрузки системы
+ Ваше устройство обычно не подключено к сети WiFi сразу после загрузки. WADBS подождет, пока подключение появится, включит беспроводную отладку и проведет синхронизацию (если включено). Если ваше устройство не было подключено к WiFi в течение указанного времени, WADBS остановит мониторинг. Вы всегда можете включить беспроводную отладку самостоятельно.
+ Время ожидания
+ Количество времени на протяжении которого WADBS будет ожидать WiFi соединения после загрузки системы
Копировать информацию
Копировать информацию о соединениии при включении беспроводной отладки
Для интеграции с KDE Connect необходим root-доступ
@@ -97,4 +102,5 @@
Этому виджету нужны пер. обновления
Б/п отладка
Обновить
+ Беспроводная отладка
diff --git a/app/src/main/res/values/constants.xml b/app/src/main/res/values/constants.xml
index a5338cf..6ac65b6 100644
--- a/app/src/main/res/values/constants.xml
+++ b/app/src/main/res/values/constants.xml
@@ -2,6 +2,8 @@
debugging_enabled
connection_details
+ enable_on_boot
+ after_boot_wait_time
skip_permissions_activity
settings_preference_group
copy_connection_data
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a4c7dbe..0a8b627 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -71,6 +71,14 @@
Connection details
Available at
+ Wireless debugging
+ Enable on boot
+ Enable wireless debugging right after system has booted up
+ When your phone boots, you are not connected to a WiFi network immediately. WADBS will wait for a connection, enable wireless debugging and perform the sync (if enabled). If after the specified time your device has still not connected to any network, WADBS will stop the monitoring process. You can always enable wireless debugging manually.
+
+ Waiting time
+ Amount of time WADBS should wait for a WiFi connection after the boot is completed
+
Copy connection data
Put connection data into the clipboard after enabling wireless debugging
diff --git a/app/src/main/res/xml/preferences_app.xml b/app/src/main/res/xml/preferences_app.xml
index 37fc000..b8806cd 100644
--- a/app/src/main/res/xml/preferences_app.xml
+++ b/app/src/main/res/xml/preferences_app.xml
@@ -16,6 +16,17 @@
tools:summary="Available at 192.168.0.1:8080"
android:icon="@drawable/round_content_copy_24" />
+
+
+
+
@@ -52,7 +63,11 @@
android:title="@string/preference_name_prefix_connection_data"
android:summary="@string/default_connection_data_prefix"
android:icon="@drawable/round_settings_ethernet_24"
- android:dependency="@string/key_copy_connection_data" />
+ android:dependency="@string/key_copy_connection_data">
+
+
+ android:dependency="@string/key_copy_connection_data">
+
+
diff --git a/app/src/main/res/xml/preferences_enable_on_boot.xml b/app/src/main/res/xml/preferences_enable_on_boot.xml
new file mode 100644
index 0000000..3dc3e2d
--- /dev/null
+++ b/app/src/main/res/xml/preferences_enable_on_boot.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/widget-factory/src/main/AndroidManifest.xml b/widget-factory/src/main/AndroidManifest.xml
index d2c5258..6e22031 100644
--- a/widget-factory/src/main/AndroidManifest.xml
+++ b/widget-factory/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">
+