2013/10/08

LG G2 韓版 - 如何開啟相機無聲的選項 for Kitkat

首先必須要有編譯反編譯的基礎.
由於基本上原廠 rom 都是 odex 的, 所以也必須要 deodex.

如何 deodex 和 odex , 可以參考以下文章.
如何 deodex stock rom 的 apk 檔案.

以下是如何修改相機無聲選項.

搜尋以下字串 'isSupportShutterSoundOff'

以下為修改好的部份

.method public static isSupportShutterSoundOff()Z
    .locals 1

    .prologue
    .line 20
    #sget-boolean v0, Lcom/lge/camera/properties/ShutterSoundProperties;->mShutterSoundOff:Z
    const/4 v0, 0x1

    return v0
.end method

儲存, 這樣相機無聲的選項就開啟了. 接著上面連結所說的做就可以了.

但是即使是相機開無聲, 對焦時還是會有逼逼的聲音.
以下就是連逼逼都去掉.

com/lge/camera/controller/SoundController.smali

.method public playAFSound(Z)V
    .registers 6
    .param p1, "seccess"    # Z

    .prologue
    const/4 v3, 0x0

    .line 769
    const-string v0, "CameraApp"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;->()V

    const-string v2, "playAFSound : seccess="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/lge/camera/util/CamLog;->d(Ljava/lang/String;Ljava/lang/String;)V
    
# Add Begin
    invoke-static {}, Lcom/lge/camera/properties/ShutterSoundProperties;->isSupportShutterSoundOff()Z

    move-result v0

    if-eqz v0, :cond_2

    const-string v0, "off"

    iget-object v1, p0, Lcom/lge/camera/controller/Controller;->mGet:Lcom/lge/camera/ControllerFunction;

    const-string v2, "key_camera_shutter_sound"

    invoke-interface {v1, v2}, Lcom/lge/camera/ControllerFunction;->getSettingValue(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0
    
    if-nez v0, :cond_0

    :cond_2
# Add End

    .line 770
    if-eqz p1, :cond_29

    .line 771
    iget v0, p0, Lcom/lge/camera/controller/SoundController;->mSound_afSuccess:I

    invoke-direct {p0, v0, v3}, Lcom/lge/camera/controller/SoundController;->checkSoundLoaded(IZ)Z

    move-result v0

    if-eqz v0, :cond_28

    .line 772
    iget v0, p0, Lcom/lge/camera/controller/SoundController;->mSound_afSuccess:I

    invoke-virtual {p0, v0}, Lcom/lge/camera/controller/SoundController;->soundPlay(I)V

    .line 779
    :cond_28
    :goto_28
    return-void

    .line 775
    :cond_29
    iget v0, p0, Lcom/lge/camera/controller/SoundController;->mSound_afFail:I

    invoke-direct {p0, v0, v3}, Lcom/lge/camera/controller/SoundController;->checkSoundLoaded(IZ)Z

    move-result v0

    if-eqz v0, :cond_28

    .line 776
    iget v0, p0, Lcom/lge/camera/controller/SoundController;->mSound_afFail:I

    invoke-virtual {p0, v0}, Lcom/lge/camera/controller/SoundController;->soundPlay(I)V

    goto :goto_28
.end method

這樣就可以連對焦的聲音都關閉了.