[Captivate Q&A, Help & Troubleshooting] aleadam:
Diff explanations

and continue with the camcorder

diff -ru armani_Camera/Camera/smali/com/sec/android/app/camera/Camcorder.smali new_Camera/Camera/smali/com/sec/android/app/camera/Camcorder.smali
--- armani_Camera/Camera/smali/com/sec/android/app/camera/Camcorder.smali	2011-02-09 23:53:00.307447001 -0500
+++ new_Camera/Camera/smali/com/sec/android/app/camera/Camcorder.smali	2011-02-09 23:52:27.451447002 -0500

First, remove unwanted references to the power button

@@ -2931,30 +2931,17 @@
goto :goto_0

.line 472
- :cond_1
- const/16 v2, 0x1a
-
- if-ne p1, v2, :cond_2
-
.line 473
- invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->isCaptureEnabled()Z
-
- move-result v2
-
- if-nez v2, :cond_2
-
.line 474
- invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->processBack()V
-
.line 478
- :cond_2
+ :cond_1
iget-object v2, p0, Lcom/sec/android/app/camera/Camcorder;->mCamcorderEngine:Lcom/sec/android/app/camera/CamcorderEngine;

invoke-virtual {v2}, Lcom/sec/android/app/camera/CamcorderEngine;->isPrepareRecording()Z

move-result v2

- if-eqz v2, :cond_3
+ if-eqz v2, :cond_2

.line 479
const-string v2, "Camcorder"

The actual code to process the power button. One caveat here. The first press works with no issues. It starts the video recording. The second press, though, it's handled by another file, CamcorderRecordingMenu.smali (diff following). But there is still a need for a way to stop the video recording here also: it's only required when the zoom buttons are used while recording. For some reason, that event restores this class as the one responding to the key event. Without the second part of the code, there is a bug in which you need to press the power button twice. The decision of whether start or stop recording is handled by

invoke-virtual {v1}, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->getRecordingState()I

@@ -3173,70 +3162,91 @@
:cond_0
const/16 v1, 0x1a

- if-ne p1, v1, :cond_1
+ if-ne p1, v1, :cond_2

- .line 595
- invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
+ iget-object v2, p0, Lcom/sec/android/app/camera/Camcorder;->mMenuResourceData:Lcom/sec/android/app/camera/MenuResourceData;
+
+ const v1, 0x7f03003b
+
+ iget-object v4, p0, Lcom/sec/android/app/camera/Camcorder;->mBaseLayout:Landroid/view/ViewGroup;
+
+ invoke-virtual {v2, v1, v4}, Lcom/sec/android/app/camera/MenuResourceData;->getMenuByLayoutId(ILandroid/view/ViewGroup;)Lcom/sec/android/app/camera/MenuBase;

move-result-object v1

- invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
+ check-cast v1, Lcom/sec/android/app/camera/CamcorderRecordingMenu;

- move-result v1
+ .line 498
+ .local v1, recordingMenu:Lcom/sec/android/app/camera/CamcorderRecordingMenu;
+ invoke-virtual {v1}, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->getRecordingState()I

- if-eqz v1, :cond_2
+ move-result v2

- .line 596
- invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
+ const-string v0, "****>> Camcorder <<**** "

- move-result-object v1
+ new-instance v0, Ljava/lang/StringBuilder;

- invoke-virtual {v1, v3}, Lcom/sec/android/app/camera/CameraSettings;->setLock(Z)V
+ invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

- .line 605
- :cond_1
- invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;
+ const-string v3, "getRecordingState():"

- move-result-object v1
+ invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

- invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z
+ move-result-object v0

- move-result v1
+ invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

- if-eqz v1, :cond_3
+ move-result-object v0

- move v1, v4
+ invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
+
+ move-result-object v0
+
+ invoke-static {v5, v0}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
+
+ const v4, 0x3
+
+ if-ne v2, v4, :cond_1
+
+ invoke-virtual {v1}, Lcom/sec/android/app/camera/CamcorderRecordingMenu;->stopRecording()V
+
+ const v1, 0x1

- .line 606
goto :goto_0

- .line 598
+ :cond_1
+ invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->handleShutter()V
+
+ const v1, 0x1
+
+ goto :goto_0
+
+ .line 605
:cond_2
invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->getCameraSettings()Lcom/sec/android/app/camera/CameraSettings;

move-result-object v1

- invoke-virtual {v1, v4}, Lcom/sec/android/app/camera/CameraSettings;->setLock(Z)V
-
- .line 599
- :goto_1
- invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->isCaptureEnabled()Z
+ invoke-virtual {v1}, Lcom/sec/android/app/camera/CameraSettings;->getLock()Z

move-result v1

- if-nez v1, :cond_1
+ if-eqz v1, :cond_3

- .line 600
- invoke-virtual {p0}, Lcom/sec/android/app/camera/Camcorder;->processBack()V
+ move v1, v4

- goto :goto_1
+ .line 606
+ goto :goto_0

+ .line 598
+ .line 599
+ .line 600
.line 609
:cond_3
sparse-switch p1, :sswitch_data_0

.line 653
- :goto_2
+ :goto_1
invoke-super {p0, p1, p2}, Lcom/sec/android/app/camera/AbstractCameraActivity;->onKeyUp(ILandroid/view/KeyEvent;)Z

move-result v1

As with Camera.smali, te switch governs what is done with each keycode. Here I just added 0x1a to the list

@@ -3387,12 +3397,15 @@
.line 609
nop

+ nop
+
:sswitch_data_0
.sparse-switch
0x4 -> :sswitch_2
0x17 -> :sswitch_1
0x18 -> :sswitch_3
0x19 -> :sswitch_3
+ 0x1a -> :sswitch_1
0x1b -> :sswitch_1
0x52 -> :sswitch_0
.end sparse-switch