Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ class WaitAppAction : Action {
delay(1000)

val targetApp = "com.android.chrome"
act.startActivity(act.packageManager.getLaunchIntentForPackage(targetApp))
val launchIntent = act.packageManager.getLaunchIntentForPackage(targetApp)
if (launchIntent == null) {
toast("未找到应用: $targetApp")
return
}
act.startActivity(launchIntent)

if (
waitForApp(targetApp, 5000).also {
Expand Down Expand Up @@ -271,4 +276,4 @@ class TraverseAllAction : Action {
// assert = [ Bottom, SubView ]

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ class ForegroundService : Service() {
setContentText("输出布局 on logcat")
val printIntent = Intent(this@ForegroundService, ForegroundService::class.java)
printIntent.action = ACTION_PRINT_LAYOUT
val pi = PendingIntent.getService(this@ForegroundService, 0, printIntent, 0)
val pendingFlags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
} else {
PendingIntent.FLAG_UPDATE_CURRENT
}
val pi = PendingIntent.getService(this@ForegroundService, 0, printIntent, pendingFlags)

setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
setSmallIcon(R.mipmap.ic_launcher_round)
Expand Down Expand Up @@ -86,4 +91,4 @@ class ForegroundService : Service() {
companion object {
const val ACTION_PRINT_LAYOUT = "print_layout"
}
}
}