๐Ÿ”— Redirect Bluesky links to your preferred client
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Even more cleanup

+22 -34
+22 -34
shared/src/main/java/dev/zwander/shared/shizuku/ShizukuService.kt
··· 1 1 package dev.zwander.shared.shizuku 2 2 3 - import android.annotation.SuppressLint 4 3 import android.content.Context 5 4 import android.os.Build 6 5 import androidx.annotation.Keep ··· 16 15 @Keep 17 16 constructor(@Suppress("UNUSED_PARAMETER") context: Context) : super() 18 17 19 - @SuppressLint("PrivateApi") 20 18 override fun verifyLinks(sdk: Int, packageName: String): List<VerifyResult> { 19 + return doLinkVerification(sdk, packageName, true) 20 + } 21 + 22 + override fun unverifyLinks(sdk: Int, packageName: String): List<VerifyResult> { 23 + return doLinkVerification(sdk, packageName, false) 24 + } 25 + 26 + override fun destroy() { 27 + exitProcess(0) 28 + } 29 + 30 + private fun doLinkVerification( 31 + sdk: Int, 32 + packageName: String, 33 + verify: Boolean, 34 + ): List<VerifyResult> { 21 35 try { 22 36 return if (sdk >= Build.VERSION_CODES.S) { 23 37 val setOutput = ArrayList<String>() ··· 36 50 val setResult = runCommand( 37 51 "cmd package set-app-links-user-selection" + 38 52 " --user -1" + // USER_ALL 39 - " --package $packageName true all", 40 - setOutput, 41 - ) 42 - 43 - listOf( 44 - VerifyResult(setOutput, setResult), 45 - ) 46 - } else { 47 - listOf() 48 - } 49 - } finally { 50 - PackageManager.setLinkVerificationState( 51 - packageName, 52 - PackageManager.VerificationStatus.ALWAYS, 53 - ) 54 - } 55 - } 56 - 57 - override fun unverifyLinks(sdk: Int, packageName: String): List<VerifyResult> { 58 - try { 59 - return if (sdk >= Build.VERSION_CODES.S) { 60 - val setOutput = ArrayList<String>() 61 - 62 - val setResult = runCommand( 63 - "cmd package set-app-links-user-selection" + 64 - " --user -1" + // USER_ALL 65 - " --package $packageName false all", 53 + " --package $packageName $verify all", 66 54 setOutput, 67 55 ) 68 56 ··· 75 63 } finally { 76 64 PackageManager.setLinkVerificationState( 77 65 packageName, 78 - PackageManager.VerificationStatus.ALWAYS_ASK, 66 + if (verify) { 67 + PackageManager.VerificationStatus.ALWAYS 68 + } else { 69 + PackageManager.VerificationStatus.ALWAYS_ASK 70 + }, 79 71 ) 80 72 } 81 - } 82 - 83 - override fun destroy() { 84 - exitProcess(0) 85 73 } 86 74 87 75 private fun runCommand(command: String, output: MutableList<String>): Int {