Skip to content

Commit

Permalink
Add delay test to settings, edit service config
Browse files Browse the repository at this point in the history
  • Loading branch information
romanvht committed Oct 24, 2024
1 parent 84b401b commit 377426f
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdk = 21
targetSdk = 34
versionCode = 10
versionName = "1.3.8-beta"
versionName = "1.3.8-beta2"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:name="android.accessibility_service"
android:resource="@xml/accessibility_service_config" />
</service>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/assets/proxytest_cmds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
-n www.google.com -q 1+s -O 1 -s 29+s -t 5
-n www.google.com -q 2+s -O 1 -s 25+s -t 5
-n www.google.com -q 2+s -O 1 -s 29+s -t 5
-s1 -q1 -Y -At -T5 -b1000 -S -f-1 -r1+s -As
--split 2 --disoob 3+sni --fake 517 --ttl 5
--split 1 --disorder 3+sni --fake -1 --ttl 5
--split 2 --disorder 3+sni --fake -1 --ttl 5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package io.github.dovecoteescapee.byedpi.activities

import android.annotation.SuppressLint
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.content.pm.ActivityInfo
import android.content.res.Configuration
import android.os.Bundle
import android.text.SpannableString
import android.text.Spanned
Expand All @@ -13,6 +16,7 @@ import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.WindowManager
import android.widget.Button
import android.widget.ScrollView
import android.widget.TextView
Expand Down Expand Up @@ -95,6 +99,14 @@ class TestActivity : AppCompatActivity() {
}
})

@SuppressLint("SwitchIntDef", "SourceLockedOrientationActivity")
when (resources.configuration.orientation) {
Configuration.ORIENTATION_LANDSCAPE -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
Configuration.ORIENTATION_PORTRAIT -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}

window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

Expand Down Expand Up @@ -180,6 +192,7 @@ class TestActivity : AppCompatActivity() {
clearLog()

val successfulCmds = mutableListOf<Pair<String, Int>>()
val delay = getPreferences().getString("byedpi_proxytest_delay", "1")?.toIntOrNull() ?: 1
val gdomain = getPreferences().getBoolean("byedpi_proxytest_gdomain", true)
val fullLog = getPreferences().getBoolean("byedpi_proxytest_fulllog", false)
val logClickable = getPreferences().getBoolean("byedpi_proxytest_logclickable", false)
Expand Down Expand Up @@ -227,6 +240,7 @@ class TestActivity : AppCompatActivity() {

appendTextToResults("$successfulCount/${sites.size} ($successPercentage%)\n\n")

delay(delay * 1000L)
stopProxyService()
waitForProxyToStop()
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@
<string name="test_settings_domains">Domain list</string>
<string name="test_settings_usercommands">Use custom command lists</string>
<string name="test_settings_commands">Command list</string>

<string name="test_delay">Delay between commands\nin seconds</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@
<string name="test_settings_domains">Список доменов</string>
<string name="test_settings_usercommands">Использовать свой список команд</string>
<string name="test_settings_commands">Список команд</string>
<string name="test_delay">Ожидание между командами\nв секундах</string>
</resources>
7 changes: 2 additions & 5 deletions app/src/main/res/xml/accessibility_service_config.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/accessibility_service_description"
android:packageNames="io.github.dovecoteescapee.byedpi"
android:accessibilityEventTypes="typeWindowStateChanged|typeViewScrolled"
android:accessibilityFlags="flagRequestFilterKeyEvents|flagIncludeNotImportantViews"
android:accessibilityEventTypes="typeNotificationStateChanged"
android:accessibilityFeedbackType="feedbackHaptic"
android:notificationTimeout="100"
android:canRetrieveWindowContent="false"
android:settingsActivity="io.github.dovecoteescapee.byedpi.SettingsActivity" />
android:notificationTimeout="0" />

7 changes: 7 additions & 0 deletions app/src/main/res/xml/proxy_test_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<com.takisoft.preferencex.EditTextPreference
android:key="byedpi_proxytest_delay"
android:title="@string/test_delay"
android:inputType="number"
android:defaultValue="1"
app:useSimpleSummaryProvider="true" />

<SwitchPreference
android:key="byedpi_proxytest_gdomain"
android:title="@string/test_settings_gdomain"
Expand Down

0 comments on commit 377426f

Please sign in to comment.