Skip to content
Merged
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## [4.7.2](https://github.com/sds100/KeyMapper/releases/tag/v4.7.2)

#### 25 November 2026

## Fixed

- Crash when showing a pinch action in Chinese or Turkish.
- Crash when returning to the home screen after leaving a screen while it was returning a result.
- Crash when a cycle rotations action has no orientations selected.
- Crash when launching the device assistant, settings app, or an app that can not be opened.

## [4.7.1](https://github.com/sds100/KeyMapper/releases/tag/v4.7.1)

#### 19 November 2026
Expand Down
4 changes: 2 additions & 2 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION_NAME=4.7.1
VERSION_CODE=295
VERSION_NAME=4.7.2
VERSION_CODE=297
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,10 @@ object ActionDataEntityMapper {
.then { extraValue ->
extraValue
.split(",")
.map { ConstantTypeConverters.ORIENTATION_MAP.getKey(it)!! }
.mapNotNull { ConstantTypeConverters.ORIENTATION_MAP.getKey(it) }
.success()
}.valueOrNull() ?: return null
}.valueOrNull()
?.takeIf { it.isNotEmpty() } ?: return null

ActionData.Rotation.CycleRotations(orientations)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,8 @@ class CreateActionDelegate(
}

val orientations =
showDialog("pick_orientations", DialogModel.MultiChoice(items)) ?: return null
showDialog("pick_orientations", DialogModel.MultiChoice(items))
?.takeIf { it.isNotEmpty() } ?: return null

return ActionData.Rotation.CycleRotations(orientations)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,21 @@ suspend inline fun <reified R> NavigationProvider.navigate(
onNavigate.drop(1).filterNotNull().dropWhile { it.key != key }.map { null },
onNavResult.filterNotNull()
.dropWhile { it.key != key }
.map { result -> result.data?.let { Json.decodeFromString<R>(it) } },
.map { result ->
result.data?.let {
// A stray result from another screen can end up here if the back stack
// changed before the result was delivered. Treat it as no result.
try {
Json.decodeFromString<R>(it)
} catch (e: IllegalArgumentException) {
Timber.e(
e,
"Navigation: Ignoring result for $key that could not be decoded",
)
null
}
}
},
).first()
}

Expand Down
4 changes: 2 additions & 2 deletions base/src/main/res/values-tr-rTR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
<string name="description_tap_coordinate_with_description">Ekrana dokun (%s)</string>
<string name="description_swipe_coordinate_default">%d parmakla (%d,%d) noktasından (%d,%d) noktasına %d ms\'de kaydır</string>
<string name="description_swipe_coordinate_with_description">%d parmakla (%d,%d) noktasından (%d,%d) noktasına %d ms\'de kaydır (%s)</string>
<string name="description_pinch_coordinate_default">%d parmakla (%d,%d) noktasında %d px mesafeyle %d ms\'de %s yap</string>
<string name="description_pinch_coordinate_with_description">%d parmakla (%d,%d) noktasında %d px mesafeyle %d ms\'de %s yap (%s)</string>
<string name="description_pinch_coordinate_default">%2$d parmakla (%3$d,%4$d) noktasında %5$d px mesafeyle %6$d ms\'de %1$s yap</string>
<string name="description_pinch_coordinate_with_description">%2$d parmakla (%3$d,%4$d) noktasında %5$d px mesafeyle %6$d ms\'de %1$s yap (%7$s)</string>
<string name="description_phone_call">%s numarayı ara</string>
<string name="description_sound">Ses çal: %s</string>
<string name="description_sound_unknown">Bilinmeyen sesi oynat</string>
Expand Down
4 changes: 2 additions & 2 deletions base/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Kaydedilmiş ses dosyalarını ayarlardan silebilirsiniz.</string>
<string name="description_tap_coordinate_with_description">Ekrana dokun (%s)</string>
<string name="description_swipe_coordinate_default">%d parmakla (%d,%d) konumundan (%d,%d) konumuna %dms içinde kaydır</string>
<string name="description_swipe_coordinate_with_description">%d parmakla (%d,%d) konumundan (%d,%d) konumuna %dms içinde kaydır (%s)</string>
<string name="description_pinch_coordinate_default">%d parmakla (%d,%d) üzerinde %dpx sıkıştırma mesafesiyle %dms içinde %s</string>
<string name="description_pinch_coordinate_with_description">%d parmakla (%d,%d) üzerinde %dpx sıkıştırma mesafesiyle %dms içinde %s (%s)</string>
<string name="description_pinch_coordinate_default">%2$d parmakla (%3$d,%4$d) üzerinde %5$dpx sıkıştırma mesafesiyle %6$dms içinde %1$s</string>
<string name="description_pinch_coordinate_with_description">%2$d parmakla (%3$d,%4$d) üzerinde %5$dpx sıkıştırma mesafesiyle %6$dms içinde %1$s (%7$s)</string>
<string name="description_phone_call">%s numarayı ara</string>
<string name="description_sound">Ses çal: %s</string>
<string name="description_sound_unknown">Bilinmeyen sesi oynat</string>
Expand Down
4 changes: 2 additions & 2 deletions base/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
<string name="description_tap_coordinate_with_description">点击屏幕 (%s)</string>
<string name="description_swipe_coordinate_default">用 %d 根手指从 (%d,%d) 划至 (%d,%d),动作耗时 %d 毫秒</string>
<string name="description_swipe_coordinate_with_description">以 %d 根手指从 (%d,%d) 划至 (%d,%d),动作耗时 %d 毫秒 (%s)</string>
<string name="description_pinch_coordinate_default">用 %d 根手指在 (%d,%d) 处进行 %s操作,缩放 %d 像素,动作耗时 %d 毫秒</string>
<string name="description_pinch_coordinate_with_description">用 %d 根手指在 (%d,%d) 处进行 %s操作,缩放 %d 像素,耗时 %d 毫秒 (%s)</string>
<string name="description_pinch_coordinate_default">用 %2$d 根手指在 (%3$d,%4$d) 处进行 %1$s操作,缩放 %5$d 像素,动作耗时 %6$d 毫秒</string>
<string name="description_pinch_coordinate_with_description">用 %2$d 根手指在 (%3$d,%4$d) 处进行 %1$s操作,缩放 %5$d 像素,耗时 %6$d 毫秒 (%7$s)</string>
<string name="description_phone_call">呼叫 %s</string>
<string name="description_sound">播放音效:%s</string>
<string name="description_sound_unknown">播放未知声音</string>
Expand Down
4 changes: 2 additions & 2 deletions base/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@
<string name="description_tap_coordinate_with_description">Tap screen (%s)</string>
<string name="description_swipe_coordinate_default">Swipe with %d finger(s) from (%d,%d) to (%d,%d) in %dms</string>
<string name="description_swipe_coordinate_with_description">Swipe with %d finger(s) from (%d,%d) to (%d,%d) in %dms (%s)</string>
<string name="description_pinch_coordinate_default">%s with %d finger(s) on (%d,%d) with a pinch distance of %dpx in %dms</string>
<string name="description_pinch_coordinate_with_description">%s with %d finger(s) on (%d,%d) to with a pinch distance of %dpx %dms (%s)</string>
<string name="description_pinch_coordinate_default">%1$s with %2$d finger(s) on (%3$d,%4$d) with a pinch distance of %5$dpx in %6$dms</string>
<string name="description_pinch_coordinate_with_description">%1$s with %2$d finger(s) on (%3$d,%4$d) with a pinch distance of %5$dpx in %6$dms (%7$s)</string>
<string name="description_phone_call">Call %s</string>
<string name="description_sound">Play sound: %s</string>
<string name="description_sound_unknown">Play unknown sound</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ class AndroidPackageManagerAdapter @Inject constructor(
return KMError.AppNotFound(packageName)
}
} else {
startActivityWithTrampoline(packageIntent)
try {
startActivityWithTrampoline(packageIntent)
} catch (e: ActivityNotFoundException) {
return KMError.AppNotFound(packageName)
}

return Success(Unit)
}
Expand All @@ -321,16 +325,22 @@ class AndroidPackageManagerAdapter @Inject constructor(
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT,
)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
val bundle = ActivityOptions.makeBasic()
.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED,
)
.toBundle()

pendingIntent.send(bundle)
} else {
pendingIntent.send()
// PendingIntent.send throws CanceledException rather than ActivityNotFoundException
// if no activity can handle the intent.
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
val bundle = ActivityOptions.makeBasic()
.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED,
)
.toBundle()

pendingIntent.send(bundle)
} else {
pendingIntent.send()
}
} catch (e: PendingIntent.CanceledException) {
throw ActivityNotFoundException(e.message)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.os.Build
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.core.os.BundleCompat
import timber.log.Timber

/**
* Use an activity trampoline so that the keyguard is dismissed when launching activities from
Expand Down Expand Up @@ -36,16 +37,20 @@ class TrampolineActivity : ComponentActivity() {
val pendingIntent =
PendingIntent.getActivity(this, 0, activityIntent, PendingIntent.FLAG_IMMUTABLE)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
val bundle = ActivityOptions.makeBasic()
.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED,
)
.toBundle()

pendingIntent.send(bundle)
} else {
pendingIntent.send()
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
val bundle = ActivityOptions.makeBasic()
.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED,
)
.toBundle()

pendingIntent.send(bundle)
} else {
pendingIntent.send()
}
} catch (e: PendingIntent.CanceledException) {
Timber.e(e, "Failed to start activity from trampoline")
}
}

Expand Down
Loading