[MOD] Hacked Gingerbread Camera.apk - updated 5/14/12

Search This thread

substanceD

Member
Aug 24, 2009
48
50
This is the Droid Charge Gingerbread Camera.apk with the following modifications:
* Sharpness set to +2 by default--use Camera-5-14-12.apk or Camera-with-2-sharpness.zip. dwitherell had a better idea for how to do this so that doesn't leave the sharpness stuck at +2, so I've updated the attachment to use his instead (thanks!) (added 5/14/12)
* Does not show in call warning--use Camera.apk or Camera-with-normal-sharpness.apk (added 12/20/11)
* Does not show battery warning on <= 15% battery (added 11/6/11)
* Shutter can be activated with either the power button or the search button (although you need to press pause or stop manually in the camcorder) (added 11/6/11)

Requirements:
* You must be running a deodexed Gingerbread Droid Charge ROM. If you have a /system/app/Camera.odex file, you are not running a deodexed ROM, and will need to flash a different one or deodex your ROM before using this mod.

Installation instructions:
1. Back up your Camera.apk by moving it to /system/app/Camera.apk.bak
2. Push one of the attached Camera files to /system/app/Camera.apk with adb or download and copy it there with RootExplorer or ROM Toolbox

Alternatively, flash one of the attached CWM ZIP files from recovery. Thanks to dwitherell for the empty flashable ZIP file, since I could never get them to work correctly when I created them myself.

To use a different version of this mod or revert to the original, download the desired file, rename it to Camera.apk, and then follow the installation instructions above

Known to work on:
Pretty much every Gingerbread (Android 2.3.6) ROM. It is included in Tweaked/TweakStock and InfinityROM.

Feel free to click the "Thanks" button if you like my work :)
 

Attachments

  • Camera.apk
    2.1 MB · Views: 14,206
  • Camera-11-6-11.apk
    2.1 MB · Views: 4,007
  • Camera-original.apk
    2.1 MB · Views: 6,860
  • Camera-original.zip
    1.7 MB · Views: 3,688
  • Camera-with-normal-sharpness.zip
    1.7 MB · Views: 1,904
  • Camera-5-14-12.apk
    1.9 MB · Views: 5,515
  • Camera-with-2-sharpness.zip
    1.8 MB · Views: 3,049
Last edited:

Haloman800

Senior Member
Dec 16, 2010
294
19
THANK. YOU. I was trying to get the old one for froyo build's working today & I couldn't, this is exactly what I was looking for.

If you could also add Search Button for shutter, that would be perfect, since it's easier to press & more conveniently located than the power button.

One other request, sort of weird, but when I'm in the camera app, & I press the power button, make it so it actually puts the phone to sleep, not just locks it so you can't do anything but it's still running down your battery.
 

maurogg84

Senior Member
Feb 6, 2011
482
45
THANK. YOU. I was trying to get the old one for froyo build's working today & I couldn't, this is exactly what I was looking for.

If you could also add Search Button for shutter, that would be perfect, since it's easier to press & more conveniently located than the power button.

One other request, sort of weird, but when I'm in the camera app, & I press the power button, make it so it actually puts the phone to sleep, not just locks it so you can't do anything but it's still running down your battery.

I counter that, I would like to use the power button for shutter. It's easier to use when you take a picture of others and of yourself

Sent from my SCH-I510 using xda premium
 

substanceD

Member
Aug 24, 2009
48
50
Thanks for the feedback! Once I figure out how to change the behavior of keys in the app I could maybe create a couple different versions--one with search for shutter and another for power. I haven't figured out how that code works yet (I'm reading smali code for the most part) but I'll keep you posted.
 

ForeverSupra

Senior Member
Aug 3, 2011
1,026
1,622
Thank you! This is very useful. I was taking off from Puerto Rico to fly back to Florida and I wanted to record the take off. But guess what? My battery was to low!
 

substanceD

Member
Aug 24, 2009
48
50
Doesn't work-humble 4.5. A working version would be sweet... Thanks for the effort.

Sent from my HUMBLE 4.5 using XDA App

When you replace the Camera.apk in /system/app/, what happens? Does it not show in the app drawer or are you not able to run it? If you PM me the Humble APK I will make the same modification to it as I did to the other one, which should make it work for you.
 

Haloman800

Senior Member
Dec 16, 2010
294
19
When you replace the Camera.apk in /system/app/, what happens? Does it not show in the app drawer or are you not able to run it? If you PM me the Humble APK I will make the same modification to it as I did to the other one, which should make it work for you.

I'm running Humble 4.5 as well, it works perfectly for me. He probably tried to install it like a normal app.

p.s. , here's the thread for the guy that hacked the froyo camera, if you want to ask him how he changed the button mappings: http://xdaforums.com/showthread.php?t=1144885


Thanks again, this has already saved me once!
 
  • Like
Reactions: vijovame

Chitala383

Senior Member
Oct 21, 2011
88
3
It works for me running stock 2.3.5. If it doesn't work try rebooting.

Sent from my SCH-I510 using XDA App
 

haza12d

Senior Member
Nov 14, 2007
616
86
Gotham
Works for me. I'm running Humble 4.5. App disappeared when I copied it over to system/app using Root Explorer. Rebooted and now everything is just fine. Thanks!
 

substanceD

Member
Aug 24, 2009
48
50
Works for me. I'm running Humble 4.5. App disappeared when I copied it over to system/app using Root Explorer. Rebooted and now everything is just fine. Thanks!

In general, if you replace a system app it will disappear from your home screen, but will reappear in the app drawer and soon as you put it back in /system/app/. That has been my experience, anyway.
 

tezjet

Member
Jul 15, 2011
31
7
SoCal
Thanks Substance!!! Been waiting on this for a while! Would love to see a write-up on how you did it. What Smali code you edited etc. I spent some time learning how to turn stuff into smali, but was never able to make the necessary changes. Would love to see your thought process.

Thanks again!!!
 

substanceD

Member
Aug 24, 2009
48
50
Thanks Substance!!! Been waiting on this for a while! Would love to see a write-up on how you did it. What Smali code you edited etc. I spent some time learning how to turn stuff into smali, but was never able to make the necessary changes. Would love to see your thought process.

Thanks again!!!

I'm glad you found this useful :)

Smali is kind of like a cross between x86 assembly and Java, although it definitely beats the former in terms of being able to understand and code in it easily. I actually just found this thread where someone did essentially the same thing for a different phone, and the author explains the process he used (which looks about the same as mine).

What I did is I pulled out the classes.dex file from Camera.apk and used a tool called dex2jar to generate a .jar file with the "classes" embodied by the .dex file (I say "classes" because most of the generated classes are not actually valid code). I then used jd-gui to examine the classes, which provides a better high-level overview of what is happening than .smali files do. After identifying which methods contained the logic I wanted to modify, I used baksmali to decompile the .dex file into .smali files. Editing the smali files was generally straightforward, since I knew which methods I wanted to edit and I was mostly just removing code or adding a couple lines here and there. The low battery check is in AbstractCameraActivity.smali:handleLowBattery() and the key press logic is in Camera/Camcorder.smali: onKeyDown() and Camera/Camcorder.smali: onKeyUp(). After making the changes I packaged up the .smali files into classes.dex with smali and replaced the classes.dex in Camera.apk.

I'm far from an expert, but if you have any specific questions about smali, send me a PM and I'll try to help.
 
  • Like
Reactions: dwitherell

Chitala383

Senior Member
Oct 21, 2011
88
3
The remapped buttons don't seem to work on stock 2.3.5 :-(

Sent from my SCH-I510 using XDA App
 

Chitala383

Senior Member
Oct 21, 2011
88
3
Yeah, pressing power locks the camera and pressing search does nothing. I've tried downloading and pushing it over 3 times, rebooting, and the remapped buttons won't work.

Sent from my SCH-I510 using XDA App
 

substanceD

Member
Aug 24, 2009
48
50
Yeah, pressing power locks the camera and pressing search does nothing. I've tried downloading and pushing it over 3 times, rebooting, and the remapped buttons won't work.

Sent from my SCH-I510 using XDA App

Since you're still seeing that the power button "locks" the camera, you're definitely on the first version that I posted. With the edits that I made, there isn't any logic in the app that can cause it to lock, so somehow the versions are mixed up for you. I just downloaded the APK attached in the first post and it behaves correctly for me. Can you please try this?

1. Rename Camera.apk in /system/app/ to Camera.bak2 or something
2. Confirm that the camera app is now missing from your home screen and app drawer
3. Copy the Camera.apk from the original post to /system/app/
4. Confirm that the size of Camera.apk is 2.07MB (the initial version shows as 2.06MB for me)
5. Confirm that the modification time on Camera.apk is sometime in the last xx minutes

Let me know how that works for you, thanks!
 

Chitala383

Senior Member
Oct 21, 2011
88
3
Yup, this is now the fourth time I've done all of that with still the same results. weird.
a6f80189-31ad-a0c5.jpg


Sent from my SCH-I510 using XDA App
 

Top Liked Posts

  • There are no posts matching your filters.
  • 38
    This is the Droid Charge Gingerbread Camera.apk with the following modifications:
    * Sharpness set to +2 by default--use Camera-5-14-12.apk or Camera-with-2-sharpness.zip. dwitherell had a better idea for how to do this so that doesn't leave the sharpness stuck at +2, so I've updated the attachment to use his instead (thanks!) (added 5/14/12)
    * Does not show in call warning--use Camera.apk or Camera-with-normal-sharpness.apk (added 12/20/11)
    * Does not show battery warning on <= 15% battery (added 11/6/11)
    * Shutter can be activated with either the power button or the search button (although you need to press pause or stop manually in the camcorder) (added 11/6/11)

    Requirements:
    * You must be running a deodexed Gingerbread Droid Charge ROM. If you have a /system/app/Camera.odex file, you are not running a deodexed ROM, and will need to flash a different one or deodex your ROM before using this mod.

    Installation instructions:
    1. Back up your Camera.apk by moving it to /system/app/Camera.apk.bak
    2. Push one of the attached Camera files to /system/app/Camera.apk with adb or download and copy it there with RootExplorer or ROM Toolbox

    Alternatively, flash one of the attached CWM ZIP files from recovery. Thanks to dwitherell for the empty flashable ZIP file, since I could never get them to work correctly when I created them myself.

    To use a different version of this mod or revert to the original, download the desired file, rename it to Camera.apk, and then follow the installation instructions above

    Known to work on:
    Pretty much every Gingerbread (Android 2.3.6) ROM. It is included in Tweaked/TweakStock and InfinityROM.

    Feel free to click the "Thanks" button if you like my work :)
    3
    Yeah, but here is a more permanent location for the file.
    Camera APK Patch.zip (FTP Link)

    MD5: BCCAA3766ED2944B7102B79D6935BEAB

    It makes a copy of the original APK file to the same file name with ".bak" at the end for you. It's completely automatic. Run the ZIP package and you're done.

    Update: I've uploaded a new version of the ZIP file that contains a mounting command for the /system partition. It should work with RFS-based file systems but I'm not sure about EXT4-based file systems.
    1
    When you replace the Camera.apk in /system/app/, what happens? Does it not show in the app drawer or are you not able to run it? If you PM me the Humble APK I will make the same modification to it as I did to the other one, which should make it work for you.

    I'm running Humble 4.5 as well, it works perfectly for me. He probably tried to install it like a normal app.

    p.s. , here's the thread for the guy that hacked the froyo camera, if you want to ask him how he changed the button mappings: http://xdaforums.com/showthread.php?t=1144885


    Thanks again, this has already saved me once!
    1
    Thanks Substance!!! Been waiting on this for a while! Would love to see a write-up on how you did it. What Smali code you edited etc. I spent some time learning how to turn stuff into smali, but was never able to make the necessary changes. Would love to see your thought process.

    Thanks again!!!

    I'm glad you found this useful :)

    Smali is kind of like a cross between x86 assembly and Java, although it definitely beats the former in terms of being able to understand and code in it easily. I actually just found this thread where someone did essentially the same thing for a different phone, and the author explains the process he used (which looks about the same as mine).

    What I did is I pulled out the classes.dex file from Camera.apk and used a tool called dex2jar to generate a .jar file with the "classes" embodied by the .dex file (I say "classes" because most of the generated classes are not actually valid code). I then used jd-gui to examine the classes, which provides a better high-level overview of what is happening than .smali files do. After identifying which methods contained the logic I wanted to modify, I used baksmali to decompile the .dex file into .smali files. Editing the smali files was generally straightforward, since I knew which methods I wanted to edit and I was mostly just removing code or adding a couple lines here and there. The low battery check is in AbstractCameraActivity.smali:handleLowBattery() and the key press logic is in Camera/Camcorder.smali: onKeyDown() and Camera/Camcorder.smali: onKeyUp(). After making the changes I packaged up the .smali files into classes.dex with smali and replaced the classes.dex in Camera.apk.

    I'm far from an expert, but if you have any specific questions about smali, send me a PM and I'll try to help.
    1
    Do you mean the one by moblynx?

    Sent from my SCH-I510 using XDA

    Yes.

    Sent from my handheld Linux computer using electromagnetic radiation.