[APP] Hacked Camera.apk

Search This thread

Fr4gg0r

Inactive Recognized Developer
Aug 4, 2010
698
679
Hi,
--JPU version--

i modded the Camera.apk a bit. ;)
Changes:
-take Pictures with pressing power button.
-Take pictures even if your battery is at 2% :)

You can apply it with my SGS Tools app or push it manually to /system or with Muspelheim (http://softdevs.wordpress.com/muspelheim/)

If you are not on JPU or newer, choose Camera_old.apk !

See the code changes here

Changelog:
Version 4:
-based on jpu
-exif data correct again
Version 3:
-focus before taking picture when using power key (not sure about it)
Version 2.
-use the power key instead of volume keys
Version 1
-initial release
 

Attachments

  • Camera.apk
    3 MB · Views: 13,098
  • Camera_old.apk
    2.9 MB · Views: 5,523
Last edited:

oswade

Senior Member
Jun 18, 2010
1,057
119
omg, i needed this last night... went to U2 concert and phone batt was too low (stupid me!!! lol).

Thanks anyway buddy, top stuff! Will give it a test run soon :)
 

ickyboo

Senior Member
Oct 26, 2007
849
46
Syd
Hey thanks. Didn't relize that pinch zoom worked in camera. Nice work!

Sent from my GT-I9000 using Tapatalk
 

Fr4gg0r

Inactive Recognized Developer
Aug 4, 2010
698
679
Update:
-Vol down/up reassigned to zooming.
-press power button for taking picture. :D
-batt hack still included (still untested though^^)
 

mr_at_sgs

Senior Member
Sep 27, 2010
552
25
I tried upgrade Stock Apps from SGS Tools, but nothing happens. No Change.
No point in Upgrade Stock Apps is changing my System.
Edit: Stupid. I forgot the checkbox. :)
 
Last edited:

Fr4gg0r

Inactive Recognized Developer
Aug 4, 2010
698
679
You have root and busybox is installed?
Next version of the app will show if there appears errors while applying..

Edit: :p
 
Last edited:

mr_at_sgs

Senior Member
Sep 27, 2010
552
25
Some suggestion for hacked gallery3d: enable autorotation at start and disable on exit.
 

Weasley85

Member
Jul 7, 2008
10
1
Great work! Was searching earlier this week for an hack/app that would use the power button als capture button but could only find a very old thread about this on XDA.
Wondering why someone didn't attempted this before, it seems so natural. Samsung should have made this the default behavior in the first place, locking the camera with the power button caused pain when I accidentally pressed it the first time I got my SGS and it wouldn't respond..
 

Top Liked Posts

  • There are no posts matching your filters.
  • 33
    Hi,
    --JPU version--

    i modded the Camera.apk a bit. ;)
    Changes:
    -take Pictures with pressing power button.
    -Take pictures even if your battery is at 2% :)

    You can apply it with my SGS Tools app or push it manually to /system or with Muspelheim (http://softdevs.wordpress.com/muspelheim/)

    If you are not on JPU or newer, choose Camera_old.apk !

    See the code changes here

    Changelog:
    Version 4:
    -based on jpu
    -exif data correct again
    Version 3:
    -focus before taking picture when using power key (not sure about it)
    Version 2.
    -use the power key instead of volume keys
    Version 1
    -initial release
    20
    Hello,
    I have read all the posts and there absolutely no info on HOW to Increasing Sampling rate of camera app from 16000 to 22050

    any help?

    thanks

    No concrete info at all anywhere I guess

    Here I show how I do it, but you should know after modifications, audi and video are out-of-sync

    Firstly get a copy of you 'camera.apk', obviously (system/ folder)
    Now, decompile
    A nice tool I use is dex2jar: http://code.google.com/p/dex2jar/
    With it you get .class files
    You can open them with JD-GUI: http://java.decompiler.free.fr/?q=jdgui
    "MediaRecorderProfile.class" has the power
    smile.gif


    **************************************
    package com.sec.android.app.camera;

    public class MediaRecorderProfile
    {
    private static final int PROFILE_1280_720 = 0;
    private static final int PROFILE_176_144 = 4;
    private static final int PROFILE_320_240 = 3;
    private static final int PROFILE_640_480 = 2;
    private static final int PROFILE_720_480 = 1;
    private static final int PROFILE_MMS = 5;
    private static final int PROPERTY_AUDIO_BITRATE = 7;
    private static final int PROPERTY_AUDIO_ENCORDER = 6;
    private static final int PROPERTY_AUDIO_NUM_CHANNELS = 8;
    private static final int PROPERTY_AUDIO_SAMPLINGRATE = 9;
    private static final int PROPERTY_VIDEO_BITRATE_FINE = 2;
    private static final int PROPERTY_VIDEO_BITRATE_NORMAL = 3;
    private static final int PROPERTY_VIDEO_BITRATE_SUPERFINE = 1;
    private static final int PROPERTY_VIDEO_ENCORDER = 0;
    private static final int PROPERTY_VIDEO_FRAME_RATE = 4;
    private static final int PROPERTY_VIDEO_OUTPUT_FORMAT = 5;
    private static final String TAG = "MediaRecorderProfile";
    public final int mAudioBitrate;
    public final int mAudioChannels;
    public final int mAudioEncoder;
    public final int mAudioSamplingRate;
    public final int mOutputFormat;
    private int[][] mProfileTable;
    public final int mVideoBitrate;
    public final int mVideoEncoder;
    public final int mVideoFps;
    public final int mVideoHeight;
    public final int mVideoWidth;

    public MediaRecorderProfile(AbstractCameraActivity paramAbstractCameraActivity, int paramInt)
    {
    int[] arrayOfInt1 = new int[6];
    int[] arrayOfInt2 = { 2, 12000000, 10000000, 8000000, 30, 2, 3, 62900, 1, 16000 };
    arrayOfInt1[0] = arrayOfInt2;
    int[] arrayOfInt3 = { 2, 3449000, 2834000, 2298000, 30, 2, 3, 62900, 1, 16000 };
    arrayOfInt1[1] = arrayOfInt3;
    int[] arrayOfInt4 = { 2, 3078000, 2553000, 2019000, 30, 2, 3, 62900, 1, 16000 };
    arrayOfInt1[2] = arrayOfInt4;
    int[] arrayOfInt5 = { 2, 767000, 641000, 518000, 30, 2, 3, 62900, 1, 16000 };
    arrayOfInt1[3] = arrayOfInt5;
    int[] arrayOfInt6 = { 2, 161000, 154000, 134000, 30, 2, 3, 62900, 1, 16000 };
    arrayOfInt1[4] = arrayOfInt6;
    int[] arrayOfInt7 = { 1, 96100, 96100, 96100, 15, 1, 1, 12200, 1, 8000 };
    arrayOfInt1[5] = arrayOfInt7;
    this.mProfileTable = arrayOfInt1;
    int i = 1;
    int j = paramAbstractCameraActivity.getCameraSettings().ge tCamcorderResolution();
    int k = 3;
    switch (j)
    {
    case 8:
    case 11:
    default:
    if (paramAbstractCameraActivity.getCameraSettings().g etRecordingMode() == 1)
    {
    i = 5;
    j = 13;
    }
    switch (paramInt)
    {
    default:
    case 0:
    case 1:
    case 2:
    }
    case 9:
    case 10:
    case 7:
    case 12:
    case 13:
    }
    while (true)
    {
    int m = this.mProfileTable[0];
    this.mVideoEncoder = m;
    int n = this.mProfileTable[k];
    this.mVideoBitrate = n;
    int i1 = this.mProfileTable[4];
    this.mVideoFps = i1;
    int i2 = this.mProfileTable[5];
    this.mOutputFormat = i2;
    int i3 = CameraResolution.getIntWidth(j);
    this.mVideoWidth = i3;
    int i4 = CameraResolution.getIntHeight(j);
    this.mVideoHeight = i4;
    int i5 = this.mProfileTable[6];
    this.mAudioEncoder = i5;
    int i6 = this.mProfileTable[7];
    this.mAudioBitrate = i6;
    int i7 = this.mProfileTable[8];
    this.mAudioChannels = i7;
    int i8 = this.mProfileTable[9];
    this.mAudioSamplingRate = i8;
    return;
    i = 0;
    break;
    i = 1;
    break;
    i = 2;
    break;
    i = 3;
    break;
    i = 4;
    break;
    k = 1;
    continue;
    k = 2;
    continue;
    k = 3;
    }
    }
    }
    ********************************************
    16000Hz Samplerate
    62900bps Bitrate

    But, I'm not able to directly edit those .class files
    So, I get .smali files decompiling with apk manager, and then I edit there

    .smali files are less understandable than .class
    On 'MediaRecorderProfile.smali', at the end you will find these tables:

    .array-data 0x4
    0x2t 0x0t 0x0t 0x0t //VIDEO_ENCORDER
    0x0t 0x1bt 0xb7t 0x0t //BITRATE_SUPERFINE
    0x80t 0x96t 0x98t 0x0t //BITRATE_FINE
    0x0t 0x12t 0x7at 0x0t //BITRATE_NORMAL
    0x1et 0x0t 0x0t 0x0t //VIDEO_FRAME_RATE
    0x2t 0x0t 0x0t 0x0t //VIDEO_OUTPUT_FORMAT
    0x3t 0x0t 0x0t 0x0t //AUDIO_ENCORDER
    0xb4t 0xf5t 0x0t 0x0t //AUDIO_BITRATE
    0x1t 0x0t 0x0t 0x0t //AUDIO_NUM_CHANNELS
    0x80t 0x3et 0x0t 0x0t //AUDIO_SAMPLINGRATE
    .end array-data

    This one is equivalent to this one on 'MediaRecorderProfile.class':

    arrayOfInt2 = { 2, 12000000, 10000000, 8000000, 30, 2, 3, 62900, 1, 16000 };

    Blue: Sample rate [Hz]
    Green: Bitrate [bps]

    This first table is profile for 1280x720, recording at 16000Hz 62900Kbps

    So, if you want to record at , lets say, 32000Hz 128000bps, now we work on hexadecimal, but in little-endian format (http://en.wiktionary.org/wiki/little-endian)

    before: 16000 -> 00003E80h -> 0x00 0x00 0x3E 0x80 -> 0x80t 0x3Et 0x0t 0x0t
    Now: 32000 -> 00007D00h -> 0x00 0x00 0x7D 0x00 -> 0x0t 0x7Dt 0x0t 0x0t

    before: 62900 -> 0000F5B4 -> 0x00 0x00 0xF5 0xB4 -> 0xB4t 0xF5t 0x0t 0x0t
    Now: 128000 -> 0001F400 -> 0x00 0x01 0xF4 0x00 -> 0x0t 0xF4t 0x1t 0x0t

    Final result:

    .array-data 0x4
    0x2t 0x0t 0x0t 0x0t
    0x0t 0x1bt 0xb7t 0x0t
    0x80t 0x96t 0x98t 0x0t
    0x0t 0x12t 0x7at 0x0t
    0x1et 0x0t 0x0t 0x0t
    0x2t 0x0t 0x0t 0x0t
    0x3t 0x0t 0x0t 0x0t
    0x0t 0xF4t 0x1t 0x0t
    0x1t 0x0t 0x0t 0x0t
    0x0t 0x7Dt 0x0t 0x0t
    .end array-data

    Recompile and test

    Voilà! ;)
    4
    i9000 Camera.apk apk modded, from JS5 deodexed rom

    Able to record and take pictures with power button and on low battery
    Does not handle power menu yet ( no automatic focus). Working on it
    Will update when ready

    http://www.multiupload.com/TIC8HWFA8F
    2
    For those having audio/video sync issues due to the hacked bitrate/sample rate, simply re-encode the audio as a mono MP3 using avidemux. This fixes the syncing problems.

    Excellent, just what we needed!

    I couldn't find any higher quality hacks, so I just did my own deodexed stock JS5 camera and improved the audio (no other hacks included):

    1280x720 - Bitrate: 192kbps (original: 63kbps), Samplerate: 44100Hz (original: 16000Hz). Video quality slightly higher for Superfine setting.
    720x480 - Bitrate: 192kbps (original: 63kbps), Samplerate: 44100Hz (original: 16000Hz). Video quality slightly higher for Superfine setting.
    640x480 - Unchanged (Bitrate: 63kbps, Samplerate: 16000Hz).
    320x240 - Unchanged (Bitrate: 63kbps, Samplerate: 16000Hz).
    176x144 - Unchanged (Bitrate: 12kbps, Samplerate: 8000Hz).


    After you run it through avidemux, it's back in sync.