forked from RikkaApps/Shizuku
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(service-auto-start): add auto-start support for rootless devices
This feature is tested working on GrapheneOS Android 14, Bluejay
- Loading branch information
1 parent
889734b
commit fdee9d0
Showing
14 changed files
with
340 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": 3, | ||
"artifactType": { | ||
"type": "APK", | ||
"kind": "Directory" | ||
}, | ||
"applicationId": "moe.shizuku.privileged.api", | ||
"variantName": "release", | ||
"elements": [ | ||
{ | ||
"type": "SINGLE", | ||
"filters": [], | ||
"attributes": [], | ||
"versionCode": 1053, | ||
"versionName": "13.5.4.r1053.5c86fcf", | ||
"outputFile": "shizuku-v13.5.4.r1053.5c86fcf-release.apk" | ||
} | ||
], | ||
"elementType": "File" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
manager/src/main/java/moe/shizuku/manager/adb/AdbWirelessHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package moe.shizuku.manager.adb | ||
|
||
import android.content.ContentResolver | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.net.ConnectivityManager | ||
import android.net.NetworkCapabilities | ||
import android.provider.Settings | ||
import android.util.Log | ||
import android.widget.Toast | ||
import moe.shizuku.manager.AppConstants | ||
import moe.shizuku.manager.starter.StarterActivity | ||
|
||
object WirelessADBHelper { | ||
|
||
fun validateThenEnableWirelessAdb(contentResolver: ContentResolver, context: Context): Boolean { | ||
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | ||
val networkCapabilities = connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork) | ||
if (networkCapabilities != null && networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { | ||
enableWirelessADB(contentResolver, context) | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
private fun enableWirelessADB(contentResolver: ContentResolver, context: Context) { | ||
// Enable wireless ADB | ||
Settings.Global.putInt( | ||
contentResolver, | ||
"adb_wifi_enabled", | ||
1 | ||
) | ||
|
||
Log.i(AppConstants.TAG, "Wireless Debugging enabled") | ||
Toast.makeText(context, "Wireless Debugging enabled", Toast.LENGTH_SHORT).show() | ||
} | ||
|
||
fun callStartAdb(context: Context, host: String, port: Int) { | ||
val intent = Intent(context, StarterActivity::class.java).apply { | ||
putExtra(StarterActivity.EXTRA_IS_ROOT, false) | ||
putExtra(StarterActivity.EXTRA_HOST, host) | ||
putExtra(StarterActivity.EXTRA_PORT, port) | ||
} | ||
context.startActivity(intent) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.