Skip to content

Commit

Permalink
Remove Android 14 warning, since we now have working ADB setup for this
Browse files Browse the repository at this point in the history
Fixed in server v1.14.2
  • Loading branch information
pimterry committed Sep 14, 2023
1 parent 6da0ddc commit 7151531
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ private const val VPN_START_TIME_PREF = "vpn-start-time"
private const val LAST_UPDATE_CHECK_TIME_PREF = "update-check-time"
private const val APP_CRASHED_PREF = "app-crashed"
private const val FIRST_RUN_PREF = "is-first-run"
private const val SEEN_ANDROID_14_WARNING_PREF = "seen-android-14-warning"

private val isProbablyEmulator =
Build.FINGERPRINT.startsWith("generic")
Expand Down Expand Up @@ -97,17 +96,6 @@ class HttpToolkitApplication : Application() {
}
}

/**
* Check if the Android 14 warning has already been seen. This returns the value,
* and sets it to true if it was not already, so this will only return 'false'
* the first time it is ever called.
*/
fun popAndroid14WarningState(): Boolean {
val hasSeenWarning = prefs.getBoolean(SEEN_ANDROID_14_WARNING_PREF, false)
prefs.edit().putBoolean(SEEN_ANDROID_14_WARNING_PREF, true).apply()
return hasSeenWarning
}

/**
* Grab any first run params, drop them for future usage, and return them.
* This will return first-run params at most once (per install).
Expand Down
29 changes: 0 additions & 29 deletions app/src/main/java/tech/httptoolkit/android/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,6 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {

Log.i(TAG, "Main activity created")

if (
// Should be the real value later on
Build.VERSION.RELEASE == "14" ||
Build.VERSION.RELEASE == "15" || // Reasonable guess for the future
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R &&
// Or, while it's still in beta:
Build.VERSION.RELEASE_OR_CODENAME == "UpsideDownCake"
)
) {
val hasSeenWarningAlready = app.popAndroid14WarningState()
if (!hasSeenWarningAlready) showAndroid14Alert()
}

// Are we being opened by an intent? I.e. a barcode scan/URL elsewhere on the device
if (intent != null) {
onNewIntent(intent)
Expand Down Expand Up @@ -950,22 +937,6 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
.show()
}

private fun showAndroid14Alert() {
MaterialAlertDialogBuilder(this)
.setTitle("System interception is not available on Android 14+")
.setIcon(R.drawable.ic_exclamation_triangle)
.setMessage(
"Android 14 includes some changes which make system interception impossible." +
"\n\n" +
"This is a general issue that blocks system interception by HTTP Toolkit and all " +
"similar tools." +
"\n\n" +
"To use system interception, you will need to use Android 13 or older."
)
.setNeutralButton("Ok") { _, _ -> }
.show()
}

private fun tryStartActivity(intent: Intent): Boolean {
return try {
startActivity(intent)
Expand Down

0 comments on commit 7151531

Please sign in to comment.