mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
fix(shortcuts): move the accessibility service into an optional companion so Play Protect stops blocking the install (#2654)
* fix(shortcuts): move the accessibility service into an optional companion so Play Protect stops blocking the install * fix(shortcuts): bind only same-signer relays, recheck enablement per call, drop timed-out keys
This commit is contained in:
1 parent
5dd973587f
commit
de5f0fe6df
52 files changed
+750
-296
No files matched your search
@@ -90,10 +90,11 @@ object SelfInstaller {
|
||||
}
|
||||
}
|
||||
|
||||
fun install(context: Context, apk: File, onSession: (Int) -> Unit = {}) {
|
||||
fun install(context: Context, apk: File, packageName: String = context.packageName, action: String = ACTION_STATUS,
|
||||
onSession: (Int) -> Unit = {}) {
|
||||
val installer = context.packageManager.packageInstaller
|
||||
val params = PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL).apply {
|
||||
setAppPackageName(context.packageName)
|
||||
setAppPackageName(packageName)
|
||||
setSize(apk.length())
|
||||
if (Build.VERSION.SDK_INT >= 31) setRequireUserAction(PackageInstaller.SessionParams.USER_ACTION_NOT_REQUIRED)
|
||||
}
|
||||
@@ -105,7 +106,7 @@ object SelfInstaller {
|
||||
session.fsync(out)
|
||||
}
|
||||
}
|
||||
val status = Intent(ACTION_STATUS).setPackage(context.packageName)
|
||||
val status = Intent(action).setPackage(context.packageName)
|
||||
val flags = PendingIntent.FLAG_UPDATE_CURRENT or (if (Build.VERSION.SDK_INT >= 31) PendingIntent.FLAG_MUTABLE else 0)
|
||||
onSession(id)
|
||||
session.commit(PendingIntent.getBroadcast(context, id, status, flags).intentSender)
|
||||
|
||||
Reference in new issue
Block a user