Menu

Can the power button be used to take a picture?

2021-01-13
2021-07-15
  • Smokey JoJo

    Smokey JoJo - 2021-01-13

    Is there any way to make the power button take pictures?

    That way you could use the volume buttons for zooming.

    Taken together that arangement would be a very useful.

     

    Last edit: Smokey JoJo 2021-01-13
  • Smokey JoJo

    Smokey JoJo - 2021-02-08

    Bump! Anyone have any feedback on how to do this or shoud it be a feature request for Mark to conisder? Thanks for any info.

     
  • Mark

    Mark - 2021-02-08

    Sorry for the delay - I don't think overriding the power button like this is possible as far as I know.

     

    Last edit: Mark 2021-02-08
  • Anonymous

    Anonymous - 2021-02-16

    You would need the highest level of access in the Android OS, to block the default programming of the button. The best you can do is find a phone with a programmable button or dedicated camera button. Unfortunately, those are rare designs these days, as the Galaxy/iPhone design has become the industry template for smartphones. Kyocera and some other lesser known companies still offer it on their devices, but you can't really get them unless you go looking. .

     
  • Anonymous

    Anonymous - 2021-07-15

    On LineageOS, there's lineage.permission.PREVENT_POWER_KEY permission. Would it be possible to make a signed release at least for it? I think patch shall be as simple as:

    diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
    index 0864837d..a0d293e2 100644
    --- a/app/src/main/AndroidManifest.xml
    +++ b/app/src/main/AndroidManifest.xml
    @@ -18,6 +18,7 @@
         <uses-permission android:name="android.permission.CAMERA" />
         <uses-permission android:name="android.permission.RECORD_AUDIO" />
         <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    +    <uses-permission android:name="lineage.permission.PREVENT_POWER_KEY" />
    
         <uses-feature android:name="android.hardware.camera" />
         <uses-feature android:name="android.hardware.microphone" />
    diff --git a/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java b/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java
    index a7901e5c..3234b779 100644
    --- a/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java
    +++ b/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java
    @@ -2548,6 +2548,7 @@ public class MainUI {
                     return true;
                 }
                 case KeyEvent.KEYCODE_CAMERA:
    +            case KeyEvent.KEYCODE_POWER:
                 {
                     if( event.getRepeatCount() == 0 ) {
                         main_activity.takePicture(false);
    
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.