Skip to content

Commit

Permalink
Fix first time of pairing always fail since recent versions
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkaW committed Oct 9, 2022
1 parent 11fb338 commit e88de6a
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions manager/src/main/java/moe/shizuku/manager/adb/AdbPairingService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,10 @@ class AdbPairingService : Service() {
.build()
}

private val searchingNotification by unsafeLazy {
Notification.Builder(this, notificationChannel)
.setColor(getColor(R.color.notification))
.setSmallIcon(R.drawable.ic_system_icon)
.setContentTitle(getString(R.string.notification_adb_pairing_searching_for_service_title))
.addAction(stopNotificationAction)
.build()
}
private fun replyNotificationAction(port: Int): Notification.Action {
// Ensure pending intent is created
val action = replyNotificationAction

private fun createInputNotification(port: Int): Notification {
PendingIntent.getForegroundService(
this,
replyRequestId,
Expand All @@ -313,11 +307,24 @@ class AdbPairingService : Service() {
PendingIntent.FLAG_UPDATE_CURRENT
)

return action
}

private val searchingNotification by unsafeLazy {
Notification.Builder(this, notificationChannel)
.setColor(getColor(R.color.notification))
.setSmallIcon(R.drawable.ic_system_icon)
.setContentTitle(getString(R.string.notification_adb_pairing_searching_for_service_title))
.addAction(stopNotificationAction)
.build()
}

private fun createInputNotification(port: Int): Notification {
return Notification.Builder(this, notificationChannel)
.setColor(getColor(R.color.notification))
.setContentTitle(getString(R.string.notification_adb_pairing_service_found_title))
.setSmallIcon(R.drawable.ic_system_icon)
.addAction(replyNotificationAction)
.addAction(replyNotificationAction(port))
.build()
}

Expand Down

0 comments on commit e88de6a

Please sign in to comment.