File tree Expand file tree Collapse file tree
app/src/main/java/io/github/sds100/keymapper/system/apps Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ## [ 3.0 Beta 5] ( https://github.com/sds100/KeyMapper/releases/tag/v3.0.0-beta.5 )
2+
3+ #### TO BE RELEASED
4+
5+ ## Bug fixes
6+
7+ - #1627 open camera app action does not work when device is locked
8+
19## [ 3.0 Beta 4] ( https://github.com/sds100/KeyMapper/releases/tag/v3.0.0-beta.4 )
210
311#### 2 April 2025
Original file line number Diff line number Diff line change @@ -281,14 +281,31 @@ class AndroidPackageManagerAdapter(
281281
282282 override fun launchCameraApp (): Result <* > {
283283 try {
284- Intent (MediaStore .INTENT_ACTION_STILL_IMAGE_CAMERA ).apply {
284+ /* *
285+ * See this guide on how the camera is launched with double press power button in
286+ * SystemUI. https://cs.android.com/android/platform/superproject/+/master:frameworks/base/packages/SystemUI/docs/camera.md
287+ *
288+ * First launch the SECURE camera intent so the camera opens when the device
289+ * is locked.
290+ */
291+ Intent (MediaStore .INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE ).apply {
285292 flags = Intent .FLAG_ACTIVITY_NEW_TASK
286293 ctx.startActivity(this )
287294 }
288295
289296 return Success (Unit )
290297 } catch (e: ActivityNotFoundException ) {
291- return Error .NoCameraApp
298+ // Just in case the camera app didn't implement the secure intent, try the normal one.
299+ try {
300+ Intent (MediaStore .INTENT_ACTION_STILL_IMAGE_CAMERA ).apply {
301+ flags = Intent .FLAG_ACTIVITY_NEW_TASK
302+ ctx.startActivity(this )
303+ }
304+
305+ return Success (Unit )
306+ } catch (e: ActivityNotFoundException ) {
307+ return Error .NoCameraApp
308+ }
292309 }
293310 }
294311
You can’t perform that action at this time.
0 commit comments