[Camera] [Mod] Armani + power button focusing + video recording

Search This thread

aleadam

Senior Member
Feb 8, 2008
422
54
Albany, NY
Time for a big update to this post.

The andromeda roms have now a camera that not only uses the power button for taking stills, but also for video recording.

More interestingly, the power button in still images function now as the grey button on the display, i.e., one quick press takes a still as is, while a long press focuses until the key is released, and then takes the still.


The second mod required a change in android.policy.jar to prevent the power button long press to bring the power menu up. Thus, it will only work in the andromeda rom unless other rom developers decide to implement the change also.


You can find the diffs between the original armani camera app and this one attached here. For the actual app, please take a look at the andromeda page for the reason stated above.

I will explain the changes in posts below (20-23) so I don't clutter this one too much.
GlobalActions.smali is part of android.policy.jar, while the other three belong to the camera app.

BTW: This does not belong any more to Q&A. Dear Mods, would you please move the thread to a more suitable forum (apps or dev)?
 

Attachments

  • GlobalActions.smali.diff.txt
    3.8 KB · Views: 690
  • Camcorder.smali.diff.txt
    7.3 KB · Views: 214
  • CamcorderRecordingMenu.smali.txt
    4.2 KB · Views: 155
  • Camera.smali.diff.txt
    12.5 KB · Views: 240
Last edited:

PhilipPeake

Member
Jan 1, 2011
41
4
If this helps in the search:

I installed dropbox, and noticed that dropbox now shows as one of the upload options. This suggests (to me) that there is a configuration file or database entry somewhere where this was added.

If we can find out where, there is a possibility of just removing the lockbox entry.

I doubt that its built into the app, they would want to sell this to different providers, and each will have (or not) its own version of the AT&T lockbox.

I did spend an hour or so this morning perusing databases, but didn't find anything.
 

aleadam

Senior Member
Feb 8, 2008
422
54
Albany, NY
If this helps in the search:

I installed dropbox, and noticed that dropbox now shows as one of the upload options. This suggests (to me) that there is a configuration file or database entry somewhere where this was added.

If we can find out where, there is a possibility of just removing the lockbox entry.

I doubt that its built into the app, they would want to sell this to different providers, and each will have (or not) its own version of the AT&T lockbox.

I did spend an hour or so this morning perusing databases, but didn't find anything.

Lol! I almost forgot about this thread already! So many roms now and I always saw that button that I learned to be careful :)

I just decompiled it and this is what I found:
Code:
$:~/android/apk_manager/out$ grep -i -r -n 'locker' *
res/values/strings.xml:271:    <string name="menu_qsend">Send to Online Locker</string>
smali/com/sec/android/app/camera/ReviewImage.smali:2346:.method public onSendToOnlineLocker()V
smali/com/sec/android/app/camera/ReviewImage$9.smali:57:    invoke-virtual {v0}, Lcom/sec/android/app/camera/ReviewImage;->onSendToOnlineLocker()V
$:~/android/apk_manager/out$ grep -i -r -n 'menu_qsend' *
res/values-it/strings.xml:261:    <string name="menu_qsend">Invia a Armadietto online</string>
res/values-de/strings.xml:261:    <string name="menu_qsend">Senden an Online-Schließfach</string>
res/values/public.xml:1563:    <public type="string" name="menu_qsend" id="0x7f07010c" />
res/values/strings.xml:271:    <string name="menu_qsend">Send to Online Locker</string>
res/values-fr/strings.xml:261:    <string name="menu_qsend">Envoyer à Casier en ligne</string>
res/values-es/strings.xml:261:    <string name="menu_qsend">Enviar a Bloqueo en línea</string>
res/values-ko/strings.xml:261:    <string name="menu_qsend">온라인 보관함으로 전송</string>
smali/com/sec/android/app/camera/R$string.smali:506:.field public static final menu_qsend:I = 0x7f07010c

I'll dig a little more into it
 

aleadam

Senior Member
Feb 8, 2008
422
54
Albany, NY
If this helps in the search:

I installed dropbox, and noticed that dropbox now shows as one of the upload options. This suggests (to me) that there is a configuration file or database entry somewhere where this was added.

If we can find out where, there is a possibility of just removing the lockbox entry.

I doubt that its built into the app, they would want to sell this to different providers, and each will have (or not) its own version of the AT&T lockbox.

I did spend an hour or so this morning perusing databases, but didn't find anything.

You made me look again into this :)

Check the first post :)
 

aleadam

Senior Member
Feb 8, 2008
422
54
Albany, NY
So what makes this different from the other modded camera.apk?

I thought it was quite clear from the title :p

When reviewing the images, you don't have to click on more->delete to delete a picture. It's just there. More important, you don't have the option for at&t online locker above delete. Too many times I clicked on that (fat thumbs, maybe?) instead of the delete button.

It is just a minimal mod, for the few of us that hate the online locker. Nothing more.
 

MikeyMike01

Inactive Recognized Developer
Jul 23, 2010
6,489
2,450
The Camera app in JPY is (in some stupid way) reliant on the Email.apk, which I had removed.

Got that squared away, and now it's working.
 

vaiol123

Senior Member
Dec 1, 2010
150
2
I'm getting FC's on the stock I-9000 froyo rom with Setiron's kernel after installing through cwm
 

vaiol123

Senior Member
Dec 1, 2010
150
2
Oh yeah what I meant was I am using an i9000 rom on a cappy and wanted to get rid of ffc references but it would just fc haha. I can live with it though
 

aleadam

Senior Member
Feb 8, 2008
422
54
Albany, NY
I'm getting FC's on the stock I-9000 froyo rom with Setiron's kernel after installing through cwm

Sorry I didn't check this thread in a while. With a stock i9000 rom I would try an i9000 camera.apk, like the one in the original thread from fr4gg0r

I can't say much without a logcat to know where is the error.
 

aleadam

Senior Member
Feb 8, 2008
422
54
Albany, NY
New Camera.apk that does respond to the home button after pressing the power button. It's a dirty trick so haptic feedback won't work on it.

EDIT: Now video recording should also keep working with a low battery.
 

Attachments

  • Camera.apk
    2.9 MB · Views: 87
  • home_key_fix_camera.zip
    2.1 MB · Views: 63
Last edited:

aleadam

Senior Member
Feb 8, 2008
422
54
Albany, NY
Diff explanations

Let's start with the camera:

Code:
diff -ru armani_Camera/Camera/smali/com/sec/android/app/camera/Camera.smali new_Camera/Camera/smali/com/sec/android/app/camera/Camera.smali
--- armani_Camera/Camera/smali/com/sec/android/app/camera/Camera.smali	2011-02-09 23:53:00.459447001 -0500
+++ new_Camera/Camera/smali/com/sec/android/app/camera/Camera.smali	2011-02-09 23:52:27.407447002 -0500

Nothing new in this part, just to make it keep working when the battery is very low
Code:
@@ -588,9 +588,6 @@
 
     if-eq v3, v8, :cond_0
 
-    .line 1665
-    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->handleLowBattery()V
-
     .line 1668
     :cond_0
     if-eq v1, v8, :cond_1

This is at the very beginning of the onKeyDown method and is the hack to fix the issue with the home button not responding after pressing the power button. As I said in the other thread, I don't think this is the real solution but it works well enough for now.
Code:
@@ -7641,6 +7638,42 @@
     .prologue
     const/4 v4, 0x1
 
+    const/16 v1, 0x3
+
+    if-ne p1, v1, :cond_0
+
+    new-instance v0, Landroid/content/Intent;
+
+    const-string v1, "android.intent.action.MAIN"
+
+    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
+
+    .local v0, startMain:Landroid/content/Intent;
+    const-string v1, "android.intent.category.HOME"
+
+    invoke-virtual {v0, v1}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;
+
+    const/high16 v1, 0x1000
+
+    invoke-virtual {v0, v1}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
+
+    invoke-virtual {p0, v0}, Lcom/sec/android/app/camera/Camera;->startActivity(Landroid/content/Intent;)V
+

Now we're talking! This little piece here adds a new global setting, named "camera_in_use" that I made it be either 0 (not in use) or 1 (in use). As soon as the power key is pressed, this setting becomes 1. This is the int that will be read by android.policy.jar. We could use this idea to prevent android.policy.jar to respond to the power key altogether to solve the issue above, but I did not look into it yet.
Code:
+    .line 593
+    :cond_0
+    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getApplicationContext()Landroid/content/Context;
+
+    move-result-object v0
+
+    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
+
+    move-result-object v0
+
+    .line 594
+    const-string v2, "camera_in_use"
+
+    invoke-static {v0, v2, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
+
     const-string v3, "Camera"
 
     .line 595

I removed all the garbage here, to focus on the switch part. By making it jump to :sswitch_2 instead of _sswitch_0 i force it to evaluate it as a camera button.
Code:
@@ -7930,32 +7963,34 @@
      :sswitch_data_0
     .sparse-switch
         0x4 -> :sswitch_0
         0x17 -> :sswitch_2
         0x18 -> :sswitch_3
         0x19 -> :sswitch_3
-        0x1a -> :sswitch_0
+        0x1a -> :sswitch_2
         0x1b -> :sswitch_2
         0x42 -> :sswitch_2
         0x50 -> :sswitch_1

Beginning of onKeyUp method. Now the power menu cannot longer be called by the power button, so I changed camera_in_use back to 0. I thought it was the safest location to allow android.policy.jar to respond to the button in any other circumstance.
Code:
@@ -7971,6 +8057,20 @@
     .prologue
     const/4 v4, 0x0
 
+    .line 687
+    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getApplicationContext()Landroid/content/Context;
+
+    move-result-object v0
+
+    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
+
+    move-result-object v0
+
+    .line 688
+    const-string v2, "camera_in_use"
+
+    invoke-static {v0, v2, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
+
     const/4 v2, 0x1
 
     const-string v3, "Camera"

Actual code to make the power button to take the shot. To be honest, I don't really know how much of all this is required. I will trim it if I have the time.
Code:
@@ -8030,72 +8130,92 @@
     :cond_0
     const/16 v0, 0x1a
 
-    if-ne p1, v0, :cond_1
+    if-ne p1, v0, :cond_2
 
     .line 700
-    invoke-direct {p0}, Lcom/sec/android/app/camera/Camera;->resetFocusDueToZoom()V
+    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
 
-    .line 701
-    iget-object v0, p0, Lcom/sec/android/app/camera/Camera;->mCameraBaseIndicators:Lcom/sec/android/app/camera/CameraBaseIndicators;
+    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->isTouchAutoFocusing()Z
 
-    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraBaseIndicators;->showFocusIndicator()V
+    move-result v1
 
-    .line 702
-    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
+    if-eqz v1, :cond_1
 
-    move-result-object v0
+    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
 
-    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
+    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->stopTouchAutoFocus()V
 
-    move-result v0
+    :cond_1
+    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
 
-    if-eqz v0, :cond_2
+    const/16 v3, 0x190
 
-    .line 703
-    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
+    const/16 v4, 0xf0
 
-    move-result-object v0
+    const/16 v0, 0x320
 
-    invoke-virtual {v0, v4}, Lcom/sec/android/app/camera/CameraSettings;->setLock(Z)V
+    const/16 v2, 0x1e0
 
-    .line 712
-    :cond_1
-    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
+    invoke-virtual {v1, v3, v4}, Lcom/sec/android/app/camera/CameraEngine;->setTouchFocusPosition(II)V
 
-    move-result-object v0
+    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
 
-    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
+    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->startTouchAutoFocus()V
 
-    move-result v0
+    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraBaseIndicators:Lcom/sec/android/app/camera/CameraBaseIndicators;
 
-    if-eqz v0, :cond_3
+    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraBaseIndicators;->hideFocusIndicator()V
 
-    move v0, v2
+    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraBaseIndicators:Lcom/sec/android/app/camera/CameraBaseIndicators;
+
+    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraBaseIndicators;->resetTouchFocusRectView()V
+
+    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraBaseIndicators:Lcom/sec/android/app/camera/CameraBaseIndicators;
+
+    invoke-virtual {v1, v3, v4, v0, v2}, Lcom/sec/android/app/camera/CameraBaseIndicators;->setTouchFocusRectCenter(IIII)V
+
+    const/4 v1, 0x1
+
+    iput-boolean v1, p0, Lcom/sec/android/app/camera/Camera;->mChkAllowFocusTouch:Z
+
+    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
+
+    invoke-direct {p0}, Lcom/sec/android/app/camera/Camera;->handleShutterKey()Z
+
+    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->handleShutterEvent()V
+
+    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->scheduleAutoFocus()V
+
+    invoke-direct {p0}, Lcom/sec/android/app/camera/Camera;->handleShutterKeyReleased()Z
+
+    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->handleShutterReleaseEvent()V
+
+    const/4 v0, 0x1
 
-    .line 713
     goto :goto_0
 
-    .line 705
+    .line 702
+    .line 703
+    .line 712
     :cond_2
     invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
 
     move-result-object v0
 
-    invoke-virtual {v0, v2}, Lcom/sec/android/app/camera/CameraSettings;->setLock(Z)V
-
-    .line 706
-    :goto_1
-    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->isCaptureEnabled()Z
+    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
 
     move-result v0
 
-    if-nez v0, :cond_1
+    if-eqz v0, :cond_3
 
-    .line 707
-    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->processBack()V
+    move v0, v2
 
-    goto :goto_1
+    .line 713
+    goto :goto_0
 
+    .line 705
+    .line 706
+    .line 707
     .line 716
     :cond_3
     const-string v0, "Camera"
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    Diff explanations

    Let's start with the camera:

    Code:
    diff -ru armani_Camera/Camera/smali/com/sec/android/app/camera/Camera.smali new_Camera/Camera/smali/com/sec/android/app/camera/Camera.smali
    --- armani_Camera/Camera/smali/com/sec/android/app/camera/Camera.smali	2011-02-09 23:53:00.459447001 -0500
    +++ new_Camera/Camera/smali/com/sec/android/app/camera/Camera.smali	2011-02-09 23:52:27.407447002 -0500

    Nothing new in this part, just to make it keep working when the battery is very low
    Code:
    @@ -588,9 +588,6 @@
     
         if-eq v3, v8, :cond_0
     
    -    .line 1665
    -    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->handleLowBattery()V
    -
         .line 1668
         :cond_0
         if-eq v1, v8, :cond_1

    This is at the very beginning of the onKeyDown method and is the hack to fix the issue with the home button not responding after pressing the power button. As I said in the other thread, I don't think this is the real solution but it works well enough for now.
    Code:
    @@ -7641,6 +7638,42 @@
         .prologue
         const/4 v4, 0x1
     
    +    const/16 v1, 0x3
    +
    +    if-ne p1, v1, :cond_0
    +
    +    new-instance v0, Landroid/content/Intent;
    +
    +    const-string v1, "android.intent.action.MAIN"
    +
    +    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
    +
    +    .local v0, startMain:Landroid/content/Intent;
    +    const-string v1, "android.intent.category.HOME"
    +
    +    invoke-virtual {v0, v1}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;
    +
    +    const/high16 v1, 0x1000
    +
    +    invoke-virtual {v0, v1}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
    +
    +    invoke-virtual {p0, v0}, Lcom/sec/android/app/camera/Camera;->startActivity(Landroid/content/Intent;)V
    +

    Now we're talking! This little piece here adds a new global setting, named "camera_in_use" that I made it be either 0 (not in use) or 1 (in use). As soon as the power key is pressed, this setting becomes 1. This is the int that will be read by android.policy.jar. We could use this idea to prevent android.policy.jar to respond to the power key altogether to solve the issue above, but I did not look into it yet.
    Code:
    +    .line 593
    +    :cond_0
    +    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getApplicationContext()Landroid/content/Context;
    +
    +    move-result-object v0
    +
    +    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
    +
    +    move-result-object v0
    +
    +    .line 594
    +    const-string v2, "camera_in_use"
    +
    +    invoke-static {v0, v2, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
    +
         const-string v3, "Camera"
     
         .line 595

    I removed all the garbage here, to focus on the switch part. By making it jump to :sswitch_2 instead of _sswitch_0 i force it to evaluate it as a camera button.
    Code:
    @@ -7930,32 +7963,34 @@
          :sswitch_data_0
         .sparse-switch
             0x4 -> :sswitch_0
             0x17 -> :sswitch_2
             0x18 -> :sswitch_3
             0x19 -> :sswitch_3
    -        0x1a -> :sswitch_0
    +        0x1a -> :sswitch_2
             0x1b -> :sswitch_2
             0x42 -> :sswitch_2
             0x50 -> :sswitch_1

    Beginning of onKeyUp method. Now the power menu cannot longer be called by the power button, so I changed camera_in_use back to 0. I thought it was the safest location to allow android.policy.jar to respond to the button in any other circumstance.
    Code:
    @@ -7971,6 +8057,20 @@
         .prologue
         const/4 v4, 0x0
     
    +    .line 687
    +    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getApplicationContext()Landroid/content/Context;
    +
    +    move-result-object v0
    +
    +    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
    +
    +    move-result-object v0
    +
    +    .line 688
    +    const-string v2, "camera_in_use"
    +
    +    invoke-static {v0, v2, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
    +
         const/4 v2, 0x1
     
         const-string v3, "Camera"

    Actual code to make the power button to take the shot. To be honest, I don't really know how much of all this is required. I will trim it if I have the time.
    Code:
    @@ -8030,72 +8130,92 @@
         :cond_0
         const/16 v0, 0x1a
     
    -    if-ne p1, v0, :cond_1
    +    if-ne p1, v0, :cond_2
     
         .line 700
    -    invoke-direct {p0}, Lcom/sec/android/app/camera/Camera;->resetFocusDueToZoom()V
    +    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
     
    -    .line 701
    -    iget-object v0, p0, Lcom/sec/android/app/camera/Camera;->mCameraBaseIndicators:Lcom/sec/android/app/camera/CameraBaseIndicators;
    +    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->isTouchAutoFocusing()Z
     
    -    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraBaseIndicators;->showFocusIndicator()V
    +    move-result v1
     
    -    .line 702
    -    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
    +    if-eqz v1, :cond_1
     
    -    move-result-object v0
    +    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
     
    -    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
    +    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->stopTouchAutoFocus()V
     
    -    move-result v0
    +    :cond_1
    +    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
     
    -    if-eqz v0, :cond_2
    +    const/16 v3, 0x190
     
    -    .line 703
    -    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
    +    const/16 v4, 0xf0
     
    -    move-result-object v0
    +    const/16 v0, 0x320
     
    -    invoke-virtual {v0, v4}, Lcom/sec/android/app/camera/CameraSettings;->setLock(Z)V
    +    const/16 v2, 0x1e0
     
    -    .line 712
    -    :cond_1
    -    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
    +    invoke-virtual {v1, v3, v4}, Lcom/sec/android/app/camera/CameraEngine;->setTouchFocusPosition(II)V
     
    -    move-result-object v0
    +    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
     
    -    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
    +    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->startTouchAutoFocus()V
     
    -    move-result v0
    +    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraBaseIndicators:Lcom/sec/android/app/camera/CameraBaseIndicators;
     
    -    if-eqz v0, :cond_3
    +    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraBaseIndicators;->hideFocusIndicator()V
     
    -    move v0, v2
    +    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraBaseIndicators:Lcom/sec/android/app/camera/CameraBaseIndicators;
    +
    +    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraBaseIndicators;->resetTouchFocusRectView()V
    +
    +    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraBaseIndicators:Lcom/sec/android/app/camera/CameraBaseIndicators;
    +
    +    invoke-virtual {v1, v3, v4, v0, v2}, Lcom/sec/android/app/camera/CameraBaseIndicators;->setTouchFocusRectCenter(IIII)V
    +
    +    const/4 v1, 0x1
    +
    +    iput-boolean v1, p0, Lcom/sec/android/app/camera/Camera;->mChkAllowFocusTouch:Z
    +
    +    iget-object v1, p0, Lcom/sec/android/app/camera/Camera;->mCameraEngine:Lcom/sec/android/app/camera/CameraEngine;
    +
    +    invoke-direct {p0}, Lcom/sec/android/app/camera/Camera;->handleShutterKey()Z
    +
    +    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->handleShutterEvent()V
    +
    +    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->scheduleAutoFocus()V
    +
    +    invoke-direct {p0}, Lcom/sec/android/app/camera/Camera;->handleShutterKeyReleased()Z
    +
    +    invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraEngine;->handleShutterReleaseEvent()V
    +
    +    const/4 v0, 0x1
     
    -    .line 713
         goto :goto_0
     
    -    .line 705
    +    .line 702
    +    .line 703
    +    .line 712
         :cond_2
         invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
     
         move-result-object v0
     
    -    invoke-virtual {v0, v2}, Lcom/sec/android/app/camera/CameraSettings;->setLock(Z)V
    -
    -    .line 706
    -    :goto_1
    -    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->isCaptureEnabled()Z
    +    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
     
         move-result v0
     
    -    if-nez v0, :cond_1
    +    if-eqz v0, :cond_3
     
    -    .line 707
    -    invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->processBack()V
    +    move v0, v2
     
    -    goto :goto_1
    +    .line 713
    +    goto :goto_0
     
    +    .line 705
    +    .line 706
    +    .line 707
         .line 716
         :cond_3
         const-string v0, "Camera"
    2
    Time for a big update to this post.

    The andromeda roms have now a camera that not only uses the power button for taking stills, but also for video recording.

    More interestingly, the power button in still images function now as the grey button on the display, i.e., one quick press takes a still as is, while a long press focuses until the key is released, and then takes the still.


    The second mod required a change in android.policy.jar to prevent the power button long press to bring the power menu up. Thus, it will only work in the andromeda rom unless other rom developers decide to implement the change also.


    You can find the diffs between the original armani camera app and this one attached here. For the actual app, please take a look at the andromeda page for the reason stated above.

    I will explain the changes in posts below (20-23) so I don't clutter this one too much.
    GlobalActions.smali is part of android.policy.jar, while the other three belong to the camera app.

    BTW: This does not belong any more to Q&A. Dear Mods, would you please move the thread to a more suitable forum (apps or dev)?
    1
    Diff explanations

    and the last one of the camera app

    Code:
    diff -ru armani_Camera/Camera/smali/com/sec/android/app/camera/CamcorderRecordingMenu.smali new_Camera/Camera/smali/com/sec/android/app/camera/CamcorderRecordingMenu.smali
    --- armani_Camera/Camera/smali/com/sec/android/app/camera/CamcorderRecordingMenu.smali	2011-02-09 23:53:00.391447001 -0500
    +++ new_Camera/Camera/smali/com/sec/android/app/camera/CamcorderRecordingMenu.smali	2011-02-09 23:52:27.435447002 -0500

    We will need one more variable here
    Code:
    @@ -1513,7 +1513,7 @@
     .end method
     
     .method public onKeyUp(ILandroid/view/KeyEvent;)Z
    -    .locals 4
    +    .locals 5
         .parameter "keyCode"
         .parameter "event"

    And remove a lot of code that refers to locking the screen with the power button. Basically, I replaced a lot of junk with a single call to a doStop() method
    Code:
    @@ -1527,51 +1527,18 @@
         .line 477
         const/16 v0, 0x1a
     
    -    if-ne p1, v0, :cond_1
    -
    -    .line 478
    -    iget-object v0, p0, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->mActivityContext:Lcom/sec/android/app/camera/AbstractCameraActivity;
    -
    -    invoke-virtual {v0}, Lcom/sec/android/app/camera/AbstractCameraActivity;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
    -
    -    move-result-object v0
    -
    -    invoke-virtual {v0}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
    -
    -    move-result v0
    -
    -    if-eqz v0, :cond_0
    -
    -    .line 479
    -    iget-object v0, p0, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->mActivityContext:Lcom/sec/android/app/camera/AbstractCameraActivity;
    -
    -    invoke-virtual {v0}, Lcom/sec/android/app/camera/AbstractCameraActivity;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
    -
    -    move-result-object v0
    +    if-ne p1, v0, :cond_0
     
    -    invoke-virtual {v0, v2}, Lcom/sec/android/app/camera/CameraSettings;->setLock(Z)V
    +    invoke-direct {p0}, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->doStop()V
     
    -    :goto_0
         move v0, v1
     
         .line 509
    -    :goto_1
    +    :goto_0
         return v0
     
    -    .line 481
    -    :cond_0
    -    iget-object v0, p0, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->mActivityContext:Lcom/sec/android/app/camera/AbstractCameraActivity;
    -
    -    invoke-virtual {v0}, Lcom/sec/android/app/camera/AbstractCameraActivity;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
    -
    -    move-result-object v0
    -
    -    invoke-virtual {v0, v1}, Lcom/sec/android/app/camera/CameraSettings;->setLock(Z)V
    -
    -    goto :goto_0
    -
         .line 486
    -    :cond_1
    +    :cond_0
         iget-object v0, p0, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->mActivityContext:Lcom/sec/android/app/camera/AbstractCameraActivity;
     
         invoke-virtual {v0}, Lcom/sec/android/app/camera/AbstractCameraActivity;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;

    doStop is a private function, so I needed a public one to be used by Camcorder.smali. It only calls doStop()
    Code:
    @@ -1863,6 +1830,14 @@
         return-void
     .end method
     
    +.method public stopRecording()V
    +    .locals 0
    +
    +    invoke-direct {p0}, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->doStop()V
    +
    +    return-void
    +.end method
    +
     .method public stopTimer()V
         .locals 2
    1
    And lastly, the cool hack ;)
    Code:
    --- armani/out/com/android/internal/policy/impl/GlobalActions.smali	2011-02-10 00:17:14.515447002 -0500
    +++ latest/out/com/android/internal/policy/impl/GlobalActions.smali	2011-02-04 00:27:42.231980001 -0500

    As I said in the Camera.smali post, when the power button is pressed, the camera changes the value of a system setting called camera_in_use from 0 to 1, and reverts it to 0 when the power button is released.
    We can read this setting here to decide whether or not to show the power menu dialog (show when zero, do not show when one).
    I purposely left the new code at the bottom of the constructor. At first I coded very early in an attempt to make the code a little more efficient, but it would have nasty consequences if the camera was used before the power button was pressed at least once outside the camera app. Something relative to the initialisation of the variables. The code is very straightforward: get the context of the app, get the ContentResolver using that Context, and using
    Code:
    invoke-static {v0, v2, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
    to retrieve the value stored.
    You can find more info about this here:
    http://developer.android.com/reference/android/provider/Settings.System.html
    Code:
    @@ -841,14 +877,49 @@
         :cond_1a
         invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->prepareDialog()V
     
    +    const/4 v1, 0x1
    +
         .line 115
         iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mStatusBar:Landroid/app/StatusBarManager;
     
    -    const/4 v1, 0x1
    -
         invoke-virtual {v0, v1}, Landroid/app/StatusBarManager;->disable(I)V
     
    +    const/4 v1, 0x0
    +
    +    const/4 v4, 0x1
    +
    +    const-string v2, "****>> GlobalActions <<****"
    +
    +    const-string v3, "****>> onCreate() <<****"
    +
    +    .line 105
    +    invoke-static {v2, v3}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
    +
    +    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    +
    +    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
    +
    +    move-result-object v0
    +
    +    .line 106
    +    const-string v2, "camera_in_use"
    +
    +    invoke-static {v0, v2, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
    +
    +    move-result v0
    +
    +    if-ne v0, v4, :cond_42
    +
    +    const-string v2, "****>> GlobalActions <<****"
    +
    +    const-string v3, "****>> Skipping power menu dialog. Camera in use! <<****"
    +
    +    invoke-static {v2, v3}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
    +
    +    return-void
    +
         .line 116
    +    :cond_42
         iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mDialog:Landroid/app/AlertDialog;
     
         invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V