[MOD][Camera][JB v8 / ICS v6][27/02] Power and Volume buttons as a shutter and more..

jobnik

Senior Member
Mar 4, 2010
127
528
133
Tel-Aviv
www.jobnik.net
Hi,

This is my first MOD ;)

Latest update 27/02/2013
  • Based on Latest Official Note JB 4.1.2 XXLSZ firmware.
  • Volume and Power keys as a shutter (no burst shot with power key).
  • Volume keys as shutter in Camcorder as follows: Volume Up start recording, Volume Down stop recording.
  • Power key as shutter in Camcorder will just start recording.
  • Shutter sound will be off/on in all cases using Camera according to menu selection.
Notes:
  • Please test it and let me know if it works well and in which ROMs, I have nowhere to test it myself ;)
  • It's only for Samsung Stock / Custom JB/ICS ROMs ;)
  • To make it run on ODEXED JB ROMs, backup and remove the SamsungCamera.odex file from system/app (the script should do it automatically).
  • To make it run on ODEXED ICS ROMs, backup and remove the Camera.odex file from system/app (the script should do it automatically).
  • DO NOT install JB mod on ICS ROM and vice-versa! it simply won't work ;)
JB SamsungCamera app
Download CWM recovery file and install:
http://www.jobnik.org/files/apk/note/jobnik_Camera_Note_JB_MOD_v8_cwm.zip

Or

Download SamsungCamera.apk and push it to system/app, then change permissions to 644
http://www.jobnik.org/files/apk/note/SamsungCamera.apk

Having problems recording in 1080p format? Use this one, that uses the default MediaRecorderProfile.smali
http://www.jobnik.org/files/apk/note/jobnik_Camera_Note_JB_MOD_v8_default_media_cwm.zip

For those who want to restore to original version, that comes with ROM:
http://www.jobnik.org/files/apk/note/restore_Camera_Note_JB_cwm.zip
ICS Camera app
Download CWM recovery file and install:
http://www.jobnik.org/files/apk/note/jobnik_Camera_Note_ICS_MOD_v6_cwm.zip

Or

Download Camera.apk and push it to system/app, then change permissions to 644
http://www.jobnik.org/files/apk/note/Camera.apk

Having problems recording in 1080p format? Use this one, that uses the default MediaRecorderProfile.smali
http://www.jobnik.org/files/apk/note/jobnik_Camera_Note_ICS_MOD_v6_default_media_cwm.zip

For those who want to restore to original version, that comes with ROM:
http://www.jobnik.org/files/apk/note/restore_Camera_Note_cwm.zip
I've also modified Camera app for Galaxy S2, Galaxy S3 and Galaxy Note 2:
Galaxy S2 mod: http://forum.xda-developers.com/showthread.php?t=1841988
Galaxy S3 mod: http://forum.xda-developers.com/showthread.php?t=1883192
Galaxy Note 2 mod: http://forum.xda-developers.com/showthread.php?t=1965801

What's inside?:
  1. "Unable to start camera while in a call" Alert Disabled
  2. Camera "Low Battery" Alert Disabled
  3. Camera Volume Up/Down as a shutter
  4. Camera "Can't use flash on low battery" Alert Disabled
  5. Camera focus sound Disabled
  6. Camcorder "Can't use flash on low battery" Alert Disabled
  7. Camcorder "Low Battery" Alert Disabled
  8. Camcorder Better audio quality/video bitrate
    • Video Quality:
      1080p: Normal - 17MBit / Fine - 24MBit / Superfine - 30MBit
      720p: Normal - 9MBit / Fine - 13MBit / Superfine - 17MBit
    • Sound Quality:
      192 kbit/s
      48000 KHz
  9. Camera Power button as a shutter (The Power menu will popup as well, but it will take a picture, just wait until it vibrates.)
  10. Camera Self-shot Volume buttons as a shutter
  11. Camera "Action shot" shooting mode Volume buttons as a shutter
  12. Camera "Panorama" shooting mode Volume buttons as a shutter
  13. Camera Enabled "Shutter Sound On/Off" item in Menu

Changes I've made in smali files are:
Code:
Camera MOD v6 by jobnik (Arthur):
---------------------------------
Files to be changed:
	com\sec\android\app\camera\AbstractCameraActivity.smali
	com\sec\android\app\camera\Camcorder.smali
	com\sec\android\app\camera\Camera.smali
	com\sec\android\app\camera\MediaRecorderProfile.smali
	com\sec\android\app\camera\SelfShotView.smali
	com\sec\android\app\camera\glwidget\TwGLActionMenu.smali
	com\sec\android\app\camera\glwidget\TwGLPanoramaMenu.smali
	com\sec\android\app\camera\resourcedata\CameraSettingsMenuResourceData.smali

   
1. "Unable to start camera while in a call" Alert Disabled
	* FILE:
		com\sec\android\app\camera\AbstractCameraActivity.smali
	* METHOD:
		.method public checkCameraStartCondition_Call()Z
	* ADDED new line:
		goto :goto_1b
	* WHERE?:
		const/4 v2, 0x0

		goto :goto_1b

		.line 1228
		iput-boolean v2, p0, Lcom/sec/android/app/camera/AbstractCameraActivity;->mCheckCalling:Z
	* EXPLANATION:
		We are telling this method to return "false" where it jumps to :goto_1b
		There you will see:
			:goto_1b
			return v2
		As "v2" variable already set to "false" i.e: const/4 v2, 0x0

2. Camera "Low Battery" Alert Disabled
	* FILE:
		com\sec\android\app\camera\AbstractCameraActivity.smali
	* METHOD:
		.method protected handleLowBattery()V
	* ADDED new line:
		return-void
	* WHERE?:
		.prologue
		.line 1569
		return-void
		const-string v1, "AbstractCameraActivity"
	* EXPLANATION:
		We are telling this method to return, exit, as it's just a "void" method
	----------
	* FILE:
		com\sec\android\app\camera\Camera.smali
	* METHOD:
		.method private handleBatteryChanged(Landroid/content/Intent;)V
	* REMOVED these lines:
		invoke-virtual {p0}, Lcom/sec/android/app/camera/Camera;->handleLowBattery()V
		invoke-direct {p0, v6}, Lcom/sec/android/app/camera/Camera;->handlePluggedLowBattery(Z)V
	* WHERE?:
		Just search and remove :)
	* EXPLANATION:
		To be sure not to call these methods.

3. Camera Volume Up/Down as a shutter
	* FILE:
		com\sec\android\app\camera\Camera.smali
	* METHOD:
		.method public onKeyDown(ILandroid/view/KeyEvent;)Z
	* MODIFIED switch case:
		.line 1487
		:sswitch_data_204
		.sparse-switch
			0x4 -> :sswitch_38
			0x17 -> :sswitch_90
			0x18 -> :sswitch_90
			0x19 -> :sswitch_90
			0x1a -> :sswitch_38
			0x1b -> :sswitch_90
			0x42 -> :sswitch_90
			0x50 -> :sswitch_3a
			0x52 -> :sswitch_36
			0x55 -> :sswitch_38
			0x59 -> :sswitch_38
			0x5a -> :sswitch_38
		.end sparse-switch
	* EXPLANATION:
		0x18 is volume up, 0x19 is volume down
		We are telling these switch cases to link to sswitch_90 and act the same as touch shutter button.
	----------
	* METHOD:
		.method public onKeyUp(ILandroid/view/KeyEvent;)Z
	* MODIFIED switch case:
		.line 1690
		nop

		:sswitch_data_184
		.sparse-switch
			0x4 -> :sswitch_3d
			0x17 -> :sswitch_cd
			0x18 -> :sswitch_cd
			0x19 -> :sswitch_cd
			0x1a -> :sswitch_3d
			0x1b -> :sswitch_cd
			0x42 -> :sswitch_cd
			0x50 -> :sswitch_146
			0x52 -> :sswitch_96
		.end sparse-switch
	* EXPLANATION:
		0x18 is volume up, 0x19 is volume down
		We are telling these switch cases to link to sswitch_90 and act the same as touch shutter button.

4. Camera "Can't use flash on low battery" Alert Disabled
	* FILE:
		com\sec\android\app\camera\Camera.smali
	* METHOD:
		.method private handlePluggedLowBattery(Z)V
	* ADDED new line:
		return-void
	* WHERE?:
		.prologue
		const/4 v3, 0x0

		.line 4629
		return-void
		const-string v1, "Camera"
	* EXPLANATION:
		We are telling this method to return, exit, as it's just a "void" method
      
5. Camera focus sound Disabled
	* FILE:
		com\sec\android\app\camera\Camera.smali
	* METHOD:
		.method public playCameraSound(II)V
	* ADDED new line:
		return-void
	* WHERE?:
		.prologue
		.line 3405
		return-void
		iget-object v0, p0, Lcom/sec/android/app/camera/Camera;->mSoundPool:Landroid/media/SoundPool;
	* EXPLANATION:
		We are telling this method to return, exit, as it's just a "void" method

6. Camcorder "Can't use flash on low battery" Alert Disabled
	* FILE:
		com\sec\android\app\camera\Camcorder.smali
	* METHOD:
		.method private handlePluggedLowBattery(Z)V
	* ADDED new line:
		return-void
	* WHERE?:
		.prologue
		const/4 v4, 0x1
		const/4 v3, 0x0

		.line 2897
		return-void
		const-string v1, "Camcorder"
	* EXPLANATION:
		We are telling this method to return, exit, as it's just a "void" method

7. Camcorder "Low Battery" Alert Disabled
	* FILE:
		com\sec\android\app\camera\Camcorder.smali
	* METHOD:
		.method protected handleLowBattery()V
	* ADDED new line:
		return-void
	* WHERE?:
		.prologue
		.line 2166
		return-void
		const-string v0, "Camcorder"
	* EXPLANATION:
		We are telling this method to return, exit, as it's just a "void" method
	----------
	* FILE:
		com\sec\android\app\camera\Camcorder.smali
	* METHOD:
		.method private handleBatteryChanged(Landroid/content/Intent;)V
	* REMOVED these lines:
		invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->handleLowBattery()V
		invoke-direct {p0, v7}, Lcom/sec/android/app/camera/Camcorder;->handlePluggedLowBattery(Z)V
	* WHERE?:
		Just search and remove :)
	* EXPLANATION:
		To be sure not to call these methods.

8. Camcorder Better audio quality/video bitrate
	FILE:
		com\sec\android\app\camera\MediaRecorderProfile.smali
	INFO FROM:
		http://forum.xda-developers.com/showthread.php?t=1832472
	VIDEO QUALITY:
		1080p: Normal - 17MBit / Fine - 24MBit / Superfine - 30MBit
		720p: Normal - 9MBit / Fine - 13MBit / Superfine - 17MBit
	SOUND QUALITY:
		192kbit/s
		48000 khz
	MODIFIED Arrays:
		.line 66
		:array_c4
		.array-data 0x4
			0x2t 0x0t 0x0t 0x0t
			0x80t 0xc3t 0xc9t 0x1t
			0x0t 0x36t 0x6et 0x1t
			0x40t 0x66t 0x3t 0x1t
			0x1et 0x0t 0x0t 0x0t
			0x2t 0x0t 0x0t 0x0t
			0x3t 0x0t 0x0t 0x0t
			0x0t 0xeet 0x2t 0x0t
			0x2t 0x0t 0x0t 0x0t
			0x80t 0xbbt 0x0t 0x0t
		.end array-data

		:array_dc
		.array-data 0x4
			0x2t 0x0t 0x0t 0x0t
			0x40t 0x66t 0x3t 0x1t
			0x40t 0x5dt 0xc6t 0x0t
			0x40t 0x54t 0x89t 0x0t
			0x1et 0x0t 0x0t 0x0t
			0x2t 0x0t 0x0t 0x0t
			0x3t 0x0t 0x0t 0x0t
			0x0t 0xeet 0x2t 0x0t
			0x2t 0x0t 0x0t 0x0t
			0x80t 0xbbt 0x0t 0x0t
		.end array-data

		:array_f4
		.array-data 0x4
			0x2t 0x0t 0x0t 0x0t
			0xa8t 0xa0t 0x34t 0x0t
			0x50t 0x3et 0x2bt 0x0t
			0x90t 0x10t 0x23t 0x0t
			0x1et 0x0t 0x0t 0x0t
			0x2t 0x0t 0x0t 0x0t
			0x3t 0x0t 0x0t 0x0t
			0x0t 0xeet 0x2t 0x0t
			0x2t 0x0t 0x0t 0x0t
			0x80t 0xbbt 0x0t 0x0t
		.end array-data

		:array_10c
		.array-data 0x4
			0x2t 0x0t 0x0t 0x0t
			0x70t 0xf7t 0x2et 0x0t
			0xa8t 0xf4t 0x26t 0x0t
			0xb8t 0xcet 0x1et 0x0t
			0x1et 0x0t 0x0t 0x0t
			0x2t 0x0t 0x0t 0x0t
			0x3t 0x0t 0x0t 0x0t
			0x0t 0xeet 0x2t 0x0t
			0x2t 0x0t 0x0t 0x0t
			0x80t 0xbbt 0x0t 0x0t
		.end array-data

9. Camera Power button as a shutter
	* FILE:
		com\sec\android\app\camera\Camera.smali
	* METHOD:
		.method public onKeyUp(ILandroid/view/KeyEvent;)Z
	* ADDED new line:
		goto :cond_d2
	* WHERE?:
		.line 1727
		:sswitch_cd
		goto :cond_d2
		if-eqz p2, :cond_d2
	* EXPLANATION:
		We are telling this switch case "_cd" to jump to "if" condition and start taking a picture.
	----------
	* MODIFIED switch case:
		.line 1690
		nop

		:sswitch_data_184
		.sparse-switch
			0x4 -> :sswitch_3d
			0x17 -> :sswitch_cd
			0x18 -> :sswitch_cd
			0x19 -> :sswitch_cd
			0x1a -> :sswitch_cd
			0x1b -> :sswitch_cd
			0x42 -> :sswitch_cd
			0x50 -> :sswitch_146
			0x52 -> :sswitch_96
		.end sparse-switch
	* EXPLANATION:
		0x1a is a power button.
		We are telling this switch cases to link to sswitch_cd and act the same as touch shutter button.

10. Camera "Self-shot" Volume Up/Down as a shutter
	* FILE:
		com\sec\android\app\camera\SelfShotView.smali
	* METHOD:
		.method public onKeyDown(ILandroid/view/KeyEvent;)Z
	* REMOVED these lines:
		const/16 v0, 0x18
		if-eq p1, v0, :cond_c

		const/16 v0, 0x19
		if-eq p1, v0, :cond_c
	* WHERE?:
		.prologue
		.line 43
		const/16 v0, 0x18
		if-eq p1, v0, :cond_c

		const/16 v0, 0x19
		if-eq p1, v0, :cond_c

		const/16 v0, 0x50
		if-ne p1, v0, :cond_e
	* EXPLANATION:
		These are "if" conditions to check if volume keys up/down are pressed
	----------
	* FILE:
		com\sec\android\app\camera\SelfShotView.smali
	* METHOD:
		.method public onKeyUp(ILandroid/view/KeyEvent;)Z
	* REMOVED these lines:
		const/16 v0, 0x18
		if-eq p1, v0, :cond_c

		const/16 v0, 0x19
		if-eq p1, v0, :cond_c
	* WHERE?:
		.prologue
		.line 53
		const/16 v0, 0x18
		if-eq p1, v0, :cond_c

		const/16 v0, 0x19
		if-eq p1, v0, :cond_c

		const/16 v0, 0x50
		if-ne p1, v0, :cond_e
	* EXPLANATION:
		These are "if" conditions to check if volume keys up/down are pressed

11. Camera "Action shot" shooting mode Volume Up/Down as a shutter
	* FILE:
		com\sec\android\app\camera\glwidget\TwGLActionMenu.smali
	* METHOD:
		.method public onKeyDown(ILandroid/view/KeyEvent;)Z
	* ADDED new line:
		goto :cond_c
	* WHERE?:
		.prologue
		const/16 v2, 0x1b
		const/4 v0, 0x1

		.line 271
		goto :cond_c

		const/16 v1, 0x18
		if-eq p1, v1, :cond_b

		const/16 v1, 0x19
		if-ne p1, v1, :cond_c
	* EXPLANATION:
		Jump below "if" conditions that check if volume keys up/down are pressed
	----------
	* FILE:
		com\sec\android\app\camera\glwidget\TwGLActionMenu.smali
	* METHOD:
		.method public onKeyUp(ILandroid/view/KeyEvent;)Z
	* ADDED new line:
		goto :cond_c
	* WHERE?:
		.prologue
		const/16 v2, 0x1b
		const/4 v0, 0x1

		.line 293
		goto :cond_c

		const/16 v1, 0x18
		if-eq p1, v1, :cond_b

		const/16 v1, 0x19
		if-ne p1, v1, :cond_c
	* EXPLANATION:
		Jump below "if" conditions that check if volume keys up/down are pressed

12. Camera "Panorama" shooting mode Volume Up/Down as a shutter
	* FILE:
		com\sec\android\app\camera\glwidget\TwGLPanoramaMenu.smali
	* METHOD:
		.method public onKeyDown(ILandroid/view/KeyEvent;)Z
	* ADDED new line:
		goto :cond_c
	* WHERE?:
		.prologue
		const/16 v2, 0x1b
		const/4 v0, 0x1

		.line 337
		goto :cond_c

		const/16 v1, 0x18
		if-eq p1, v1, :cond_b

		const/16 v1, 0x19
		if-ne p1, v1, :cond_c
	* EXPLANATION:
		Jump below "if" conditions that check if volume keys up/down are pressed
	----------
	* FILE:
		com\sec\android\app\camera\glwidget\TwGLPanoramaMenu.smali
	* METHOD:
		.method public onKeyUp(ILandroid/view/KeyEvent;)Z
	* ADDED new line:
		goto :cond_c
	* WHERE?:
		.prologue
		const/16 v2, 0x1b
		const/4 v0, 0x1

		.line 361
		goto :cond_c

		const/16 v1, 0x18
		if-eq p1, v1, :cond_b

		const/16 v1, 0x19
		if-ne p1, v1, :cond_c
	* EXPLANATION:
		Jump below "if" conditions that check if volume keys up/down are pressed

13. Camera Enabled "Shutter Sound On/Off" item in Menu
	JB
	--
	* FILE:
		com\sec\android\app\camera\resourcedata\CameraSettingsMenuResourceData.smali
	* METHOD:
		.method private initCommandIdList(Lcom/sec/android/app/camera/AbstractCameraActivity;)V
	* REMOVED these lines:
		invoke-static {}, Lcom/sec/android/app/CscFeature;->getInstance()Lcom/sec/android/app/CscFeature;

		move-result-object v2

		const-string v3, "CscFeature_Camera_ShutterSoundMenu"

		invoke-virtual {v2, v3}, Lcom/sec/android/app/CscFeature;->getEnableStatus(Ljava/lang/String;)Z

		move-result v2

		if-eqz v2, :cond_f8
	* WHERE?:
		.line 80
		iget-object v2, p0, Lcom/sec/android/app/camera/resourcedata/CameraSettingsMenuResourceData;->mCommandIdList:Ljava/util/ArrayList;

		const/16 v3, 0x14

		invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

		move-result-object v3

		invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

		.line 82
		:cond_e1
	* EXPLANATION:
		Remove "if" condition, below ":cond_e1", that check if "CscFeature_Camera_ShutterSoundMenu" is enabled in "system/csc/others.xml" or "system/csc/features.xml"
		That way we permanently enable "Shutter Sound On/Off" menu item in menu array.

	ICS
	---
	* FILE:
		com\sec\android\app\camera\resourcedata\CameraSettingsMenuResourceData.smali
	* METHOD:
		.method private initCommandIdList(Lcom/sec/android/app/camera/AbstractCameraActivity;)V
	* ADDED these lines:
		iget-object v0, p0, Lcom/sec/android/app/camera/resourcedata/CameraSettingsMenuResourceData;->mCommandIdList:Ljava/util/ArrayList;

		const/16 v1, 0x15

		invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

		move-result-object v1

		invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
	* WHERE?:
		.line 67
		iget-object v0, p0, Lcom/sec/android/app/camera/resourcedata/CameraSettingsMenuResourceData;->mCommandIdList:Ljava/util/ArrayList;

		const/16 v1, 0x14

		invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

		move-result-object v1

		invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
	* EXPLANATION:
		0x15 item is a "Shutter sound On/Off" and it's missing in ICS app.
		That way we permanently enable "Shutter Sound On/Off" menu item in menu array.
Credits:
nguyenxuanhoa - Camera Volume Up/Down as a shutter
GizmoDroid - "Unable to start camera while in a call" Alert Disabled
zxz0O0 - Camcorder Better audio quality/video bitrate
xavierjohn22 - AutoAPKTool2.0.4a
Tungstwenty - Backup/Restore CWM script

*** Don't forget to give me Credit and link to this XDA thread if you're using my modifications or Camera.apk in your ROM ***

This mod found working fine on ROMs based for JB: LSZ/A , for ICS:LRT/Q/G/K/5:
LRK KingDroid ICS NoteMania v7.3/4
LRK RocketROM v10 ICS 4.0.4

* You're using this mod on your own risk. I'm not responsible for any damage of use or misuse of this fixed application Camera.apk

Liked it? Please make a donation :)


* Don't want to donate? Then at least hit Thanks button! (from hundred of downloads, only a few dozens say thanks).

Thank you!

Have fun! ;)
 
Last edited:

shivg86

Senior Member
Jul 21, 2012
498
90
0
delhi
Cant we just push the files in the root system if we dont want to flash thru cwm????tell me the procedure

Sent from my GT-N7000 using xda app-developers app
 

shivg86

Senior Member
Jul 21, 2012
498
90
0
delhi
Thanks...mm on stock 4.0.4 and wd speedmpd kernel......so cn i go in recovery mode nd flash it.????

Sent from my GT-N7000 using xda app-developers app
 

bigfau

Inactive Recognized Developer
Oct 9, 2010
5,084
10,681
0
Zanesville, Ohio
Volume button is working for capture but not power button can you fix it:confused::confused:
The Power button work for capture. You just have to hold it longer. Your power menu will pop up but it will still take the picture. #9

What's inside?:
1. "Unable to start camera while in a call" Alert Disabled
2. Camera "Low Battery" Alert Disabled
3. Camera Volume Up/Down as a shutter
4. Camera "Can't use flash on low battery" Alert Disabled
5. Camera focus sound Disabled
6. Camcorder "Can't use flash on low battery" Alert Disabled
7. Camcorder "Low Battery" Alert Disabled
8. Camcorder Better audio quality/video bitrate
9. Camera Power button as a shutter (The Power menu will popup as well, but it will take a picture, just wait until it vibrates.)
10. Camera Self-shot Volume buttons as a shutter
11. Camera "Action shot" shooting mode Volume buttons as a shutter
12. Camera "Panorama" shooting mode Volume buttons as a shutter
13. Camera icon taken from VK 5.1.2


Sent from my SAMSUNG-SGH-I717 using Tapatalk 2
 
Last edited: