[Fascinate Android Development] GizmoDroid:
Current Functionality over stock Camera.apk:

Optional Geotagging (thanks to Adrynalyne or whoever he got it from)

Power Button in Camera mode becomes functionally the same as the touchscreen Shutter Key

Power Button in Camcorder mode becomes functionally the same as the touchscreen Shutter Key for starting recording

Removed Low Battery restriction

Removed In-Call restriction

This camera has been included with Super Clean since v2.2 until v2.9, and is included in some other ROMs as well. If you installed any of these roms, then you do not need to install this camera.

[Size=+1]Froyo Camera Mod v2.1 - APK version[/Size]

Camera.apk - Download @ MediaFire.com

Installation: Since this is a system app, it cannot be installed using the Package Installer. Camera.apk must replace /system/app/Camera.apk. You can accomplish this many different ways. Two common methods are: 1) use ADB to push it ("adb push Camera.apk /system/app/Camera.apk"); or 2) copy Camera.apk to your SD card, then use a program like Root Explorer to move it to "/system/app/". If you are running a Stock Froyo rom, you will want to delete any camera.odex files in /system/app/, clear dalvik cache and reboot. For most deodexed roms, a reboot is only necessary if the camera is not working correctly after installation.
​

Thanks to s44, there is now a CWM flashable upgrade version:

[Size=+1]Froyo Camera Mod v2.1 - ClockworkMod ZIP version[/Size]

cameramodv2.1-install.zip - Download @ xdaDevelopers.com

Installation: Copy zip file to sdcard. Boot into CWM, and select "Install zip from sd card". Select the file, then confirm the flash. When finished, reboot.
​

Disclaimer: This should work on any of the Froyo roms/kernels, but maybe not your's. Be sure to make a backup of your current Camera.apk for easily switching it back if you have problems.

Feedback: If it doesn't work right, let me know your setup, and what the problem is. If you see an error in my description, or if you know of a better way to do something, let me know. It's my goal to both be as unobtrusive to the original code as possible, while increasing functionality/efficiency. I am *slightly* open to suggestions on future features (I can't promise much since I'm in school and don't have too much time).

Future Features/Fixes:

In camcorder mode, Power Button second press->Pause Key

Optimize PNG's

User Requested Features/Reported Bugs:

On long press of the Power Button, Enable Auto Focus before taking picture (i.e. disable the Power Menu from popping up).

Home Key short press does not follow OS setting after using the Power Button to take a picture (happens after every odd # of Power Button presses)

Previous Versions

[Size=-1]Camera Mod v1

Camera.apk - Download @ MediaFire.com

[/size]

Changelog

v2.1

-Added "Unable to start camera while in a call" Alert Disable

-Added Remap Power Button to Shutter Key for Camcorder (start only)

v2

-Corrupted Upload... Sorry!

v1

-Initial Release

Thanks:

-Adrynalyne for providing the deodexed, froyo Camera.apk with optional geotagging added.

-The author of that forum post I read that pointed me to the "camera.smali" file. I'm sorry, I have no idea who you are.

-Whoever wrote this Dalvik VM cheatsheet

-S44 for putting together the CWM flash file

[SIZE=+1]

Process - How I Made It

[/SIZE]

I extracted the Camera.apk from SuperClean 2.0. From there, I extracted "classes.dex" using 7-zip. Then, I decompiled "classes.dex" using baksmali. I edited the Dalvik bytecode in the Camera.smali and AbstractCameraActivity.smali files using Notepad++. I recompiled "classses.dex" using smali. I overwrote the "classes.dex" in the Camera.apk using 7-zip. Finally, I zipaligned the resulting APK.

I did not mod the camcorder files (v2.1 - I have half of the camcorder part done), but the process would be similar. Also, if you understand the general rules of bytecode, you could adapt this to other versions of the APK fairly quickly.

The commands I used for decompiling and recompiling are as follows:

java -jar baksmali-1.2.1.jar -x classes.dex

java -Xmx512m -jar smali-1.2.1.jar -o classes.dex c:\out

Remap Power Button to Shutter Key for Camera

In com\sec\android\app\camera\Camera.smali, the red lines are the ones I modified:

.line 728
:cond_45
const/16 v1, 0x1a

[COLOR="red"]goto :cond_52[/COLOR]

.line 729
invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->isCaptureEnabled()Z

.line 736
:sswitch_data_fc
.sparse-switch
0x4 -> :sswitch_61
0x17 -> :sswitch_69
0x18 -> :sswitch_b7
0x19 -> :sswitch_b7
[COLOR="red"] 0x1a -> :sswitch_69[/COLOR]
0x1b -> :sswitch_69
0x42 -> :sswitch_69
0x50 -> :sswitch_63
0x52 -> :sswitch_61
0x54 -> :sswitch_61
.end sparse-switch
.end method

.line 828
:cond_3a
const/16 v0, 0x1a

[COLOR="red"]goto :cond_57[/COLOR]

.line 830
invoke-direct {p0}, Lcom/sec/android/app/camera/Camera;->resetFocusDueToZoom()V

.line 848
nop

:sswitch_data_e8
.sparse-switch
0x4 -> :sswitch_83
0x17 -> :sswitch_b5
0x18 -> :sswitch_e4
0x19 -> :sswitch_e4
[COLOR="red"]0x1a -> :sswitch_b5[/COLOR]
0x1b -> :sswitch_b5
0x42 -> :sswitch_b5
0x52 -> :sswitch_b2
0x54 -> :sswitch_e4
.end sparse-switch
.end method

There you have it. You only have to modify 4 lines, and now your power button should perfectly emulate the shutter key on the screen.

Low Battery Alert Disable

In com\sec\android\app\camera\AbstractCameraActivity.smali, add the red line:

.line 855
:cond_14
invoke-virtual {p0}, Lcom/sec/android/app/camera/AbstractCameraActivity;->hideAllDlg()V

[COLOR="Red"]goto :goto_13[/COLOR]

.line 857
new-instance v0, Landroid/app/AlertDialog$Builder;

"Unable to start camera while in a call" Alert Disable - Added in v2.1

In com\sec\android\app\camera\AbstractCameraActivity.smali, add the red line:

.line 613
const/4 v2, 0x0

[COLOR="Red"]goto :goto_1a[/COLOR]

iput-boolean v2, p0, Lcom/sec/android/app/camera/AbstractCameraActivity;->mCheckCalling:Z