Merge branch 'master' into s

This commit is contained in:
Mygod
2021-07-10 19:26:22 -04:00
10 changed files with 41 additions and 31 deletions

View File

@@ -9,9 +9,9 @@ buildscript {
} }
dependencies { dependencies {
classpath(kotlin("gradle-plugin", "1.5.10")) classpath(kotlin("gradle-plugin", "1.5.20"))
classpath("com.android.tools.build:gradle:7.0.0-beta03") classpath("com.android.tools.build:gradle:7.0.0-beta05")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.0") classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.1")
classpath("com.google.android.gms:oss-licenses-plugin:0.10.4") classpath("com.google.android.gms:oss-licenses-plugin:0.10.4")
classpath("com.google.gms:google-services:4.3.8") classpath("com.google.gms:google-services:4.3.8")
} }

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

2
gradlew vendored
View File

@@ -72,7 +72,7 @@ case "`uname`" in
Darwin* ) Darwin* )
darwin=true darwin=true
;; ;;
MINGW* ) MSYS* | MINGW* )
msys=true msys=true
;; ;;
NONSTOP* ) NONSTOP* )

View File

@@ -72,9 +72,9 @@ dependencies {
implementation(kotlin("stdlib-jdk8")) implementation(kotlin("stdlib-jdk8"))
implementation("androidx.appcompat:appcompat:1.3.0") // https://issuetracker.google.com/issues/151603528 implementation("androidx.appcompat:appcompat:1.3.0") // https://issuetracker.google.com/issues/151603528
implementation("androidx.browser:browser:1.3.0") implementation("androidx.browser:browser:1.3.0")
implementation("androidx.core:core-ktx:1.6.0-beta02") implementation("androidx.core:core-ktx:1.6.0")
implementation("androidx.emoji:emoji:1.1.0") implementation("androidx.emoji:emoji:1.1.0")
implementation("androidx.fragment:fragment-ktx:1.3.4") implementation("androidx.fragment:fragment-ktx:1.3.5")
implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion") implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion") implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion") implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
@@ -83,18 +83,18 @@ dependencies {
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("com.android.billingclient:billing-ktx:4.0.0") implementation("com.android.billingclient:billing-ktx:4.0.0")
implementation("com.google.android.gms:play-services-oss-licenses:17.0.0") implementation("com.google.android.gms:play-services-oss-licenses:17.0.0")
implementation("com.google.android.material:material:1.4.0-rc01") implementation("com.google.android.material:material:1.4.0")
implementation("com.google.firebase:firebase-analytics-ktx:19.0.0") implementation("com.google.firebase:firebase-analytics-ktx:19.0.0")
implementation("com.google.firebase:firebase-crashlytics:18.0.1") implementation("com.google.firebase:firebase-crashlytics:18.1.0")
implementation("com.google.zxing:core:3.4.1") implementation("com.google.zxing:core:3.4.1")
implementation("com.jakewharton.timber:timber:4.7.1") implementation("com.jakewharton.timber:timber:4.7.1")
implementation("com.linkedin.dexmaker:dexmaker:2.28.1") implementation("com.linkedin.dexmaker:dexmaker:2.28.1")
implementation("com.takisoft.preferencex:preferencex-simplemenu:1.1.0") implementation("com.takisoft.preferencex:preferencex-simplemenu:1.1.0")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.4") implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.4")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1")
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.room:room-testing:$roomVersion") androidTestImplementation("androidx.room:room-testing:$roomVersion")
androidTestImplementation("androidx.test:runner:1.3.0") androidTestImplementation("androidx.test:runner:1.4.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0") androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
androidTestImplementation("androidx.test.ext:junit-ktx:1.1.2") androidTestImplementation("androidx.test.ext:junit-ktx:1.1.3")
} }

View File

@@ -479,17 +479,19 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene
private fun showNotification(group: WifiP2pGroup? = null) = ServiceNotification.startForeground(this, private fun showNotification(group: WifiP2pGroup? = null) = ServiceNotification.startForeground(this,
if (group == null) emptyMap() else mapOf(Pair(group.`interface`, group.clientList?.size ?: 0))) if (group == null) emptyMap() else mapOf(Pair(group.`interface`, group.clientList?.size ?: 0)))
private fun removeGroup() = p2pManager.removeGroup(channel, object : WifiP2pManager.ActionListener { private fun removeGroup() {
override fun onSuccess() { p2pManager.removeGroup(channel ?: return, object : WifiP2pManager.ActionListener {
launch { cleanLocked() } override fun onSuccess() {
} launch { cleanLocked() }
override fun onFailure(reason: Int) { }
if (reason != WifiP2pManager.BUSY) { override fun onFailure(reason: Int) {
SmartSnackbar.make(formatReason(R.string.repeater_remove_group_failure, reason)).show() if (reason != WifiP2pManager.BUSY) {
} // else assuming it's already gone SmartSnackbar.make(formatReason(R.string.repeater_remove_group_failure, reason)).show()
onSuccess() } // else assuming it's already gone
} onSuccess()
}) }
})
}
private fun cleanLocked() { private fun cleanLocked() {
if (receiverRegistered) { if (receiverRegistered) {
ensureReceiverUnregistered(receiver) ensureReceiverUnregistered(receiver)

View File

@@ -389,7 +389,7 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
} }
} }
true true
} catch (e: IllegalArgumentException) { } catch (e: RuntimeException) {
SmartSnackbar.make(e).show() SmartSnackbar.make(e).show()
false false
} }

View File

@@ -326,6 +326,10 @@ object WifiApManager {
private val cancelLocalOnlyHotspotRequest by lazy { private val cancelLocalOnlyHotspotRequest by lazy {
WifiManager::class.java.getDeclaredMethod("cancelLocalOnlyHotspotRequest") WifiManager::class.java.getDeclaredMethod("cancelLocalOnlyHotspotRequest")
} }
/**
* This is the only way to unregister requests besides app exiting.
* Therefore, we are happy with crashing the app if reflection fails.
*/
@RequiresApi(26) @RequiresApi(26)
fun cancelLocalOnlyHotspotRequest() = cancelLocalOnlyHotspotRequest(Services.wifi) fun cancelLocalOnlyHotspotRequest() = cancelLocalOnlyHotspotRequest(Services.wifi)

View File

@@ -213,8 +213,8 @@ data class SettingsGlobalPut(val name: String, val value: String) : RootCommandN
override suspend fun execute() = withContext(Dispatchers.IO) { override suspend fun execute() = withContext(Dispatchers.IO) {
val process = ProcessBuilder("settings", "put", "global", name, value).fixPath(true).start() val process = ProcessBuilder("settings", "put", "global", name, value).fixPath(true).start()
val error = process.inputStream.bufferedReader().readText() val error = process.inputStream.bufferedReader().readText()
check(process.waitFor() == 0) val exit = process.waitFor()
if (error.isNotEmpty()) throw RemoteException(error) if (exit != 0 || error.isNotEmpty()) throw RemoteException("Process exited with $exit: $error")
null null
} }
} }

View File

@@ -213,10 +213,14 @@ private val newLookup by lazy @TargetApi(26) {
* See also: https://stackoverflow.com/a/49532463/2245107 * See also: https://stackoverflow.com/a/49532463/2245107
*/ */
fun InvocationHandler.callSuper(interfaceClass: Class<*>, proxy: Any, method: Method, args: Array<out Any?>?) = when { fun InvocationHandler.callSuper(interfaceClass: Class<*>, proxy: Any, method: Method, args: Array<out Any?>?) = when {
Build.VERSION.SDK_INT >= 26 && method.isDefault -> newLookup.newInstance(interfaceClass, 0xf) // ALL_MODES Build.VERSION.SDK_INT >= 26 && method.isDefault -> try {
.`in`(interfaceClass).unreflectSpecial(method, interfaceClass).bindTo(proxy).run { newLookup.newInstance(interfaceClass, 0xf) // ALL_MODES
if (args == null) invokeWithArguments() else invokeWithArguments(*args) } catch (e: ReflectiveOperationException) {
} Timber.w(e)
MethodHandles.lookup().`in`(interfaceClass)
}.unreflectSpecial(method, interfaceClass).bindTo(proxy).run {
if (args == null) invokeWithArguments() else invokeWithArguments(*args)
}
// otherwise, we just redispatch it to InvocationHandler // otherwise, we just redispatch it to InvocationHandler
method.declaringClass.isAssignableFrom(javaClass) -> when { method.declaringClass.isAssignableFrom(javaClass) -> when {
method.declaringClass == Object::class.java -> when (method.name) { method.declaringClass == Object::class.java -> when (method.name) {