AOKP接聽震動PHONE.APK修改方法


1.準備工做,前提電腦需配置JAVA環境,須要apktool notepad++  ,解壓。  工具下載見附件。java

2、提取ROMsystem\appPHONE.apk   框架文件system\framework framework-res.apk ,把這兩個文件放到apktool目錄下.android

3.運行CMD.bat ,cmd下輸入命令 apktool if framework-res.apk  ,加載系統框架 ,而後反編PHONE.apk ,  CMD命令apktool d phone.apk abc   web

CMD

4進入abc\smali\com\android\phone  找到 CallNotifier.smali  notepad++  打開CallNotifier.smali  最後另起一行添加如下代碼:app

 

.method private callVibrate(Z)V
    .locals 11

    const/4 v10, 0x0

    const/4 v9, 0x1

    :try_start_0
    iget-object v7, p0, Lcom/android/phone/CallNotifier;->mApplication:Lcom/android/phone/PhoneApp;

    iget-object v7, v7, Lcom/android/phone/PhoneApp;->phone:Lcom/android/internal/telephony/Phone;

    invoke-interface {v7}, Lcom/android/internal/telephony/Phone;->getForegroundCall()Lcom/android/internal/telephony/Call;

    move-result-object v0

    invoke-virtual {v0}, Lcom/android/internal/telephony/Call;->getLatestConnection()Lcom/android/internal/telephony/Connection;

    move-result-object v1

    iget-object v7, p0, Lcom/android/phone/CallNotifier;->mApplication:Lcom/android/phone/PhoneApp;

    invoke-virtual {v7}, Lcom/android/phone/PhoneApp;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v4

    const/4 v6, 0x0

    invoke-virtual {v1}, Lcom/android/internal/telephony/Connection;->getDurationMillis()J

    move-result-wide v2

    if-eqz p1, :cond_2

    const-wide/16 v7, 0x0

    cmp-long v7, v2, v7

    if-lez v7, :cond_1

    const-string v7, "hungup_vibrator"

    const/4 v8, 0x1

    invoke-static {v4, v7, v8}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v7

    if-ne v7, v9, :cond_1

    move v6, v9

    :goto_0
    if-eqz v6, :cond_0

    iget-object v7, p0, Lcom/android/phone/CallNotifier;->mApplication:Lcom/android/phone/PhoneApp;

    const-string v8, "vibrator"

    invoke-virtual {v7, v8}, Lcom/android/phone/PhoneApp;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Landroid/os/Vibrator;

    const-wide/16 v7, 0x64

    invoke-virtual {v5, v7, v8}, Landroid/os/Vibrator;->vibrate(J)V

    :cond_0
    :goto_1
    return-void

    :cond_1
    move v6, v10

    goto :goto_0

    :cond_2
    invoke-virtual {v1}, Lcom/android/internal/telephony/Connection;->isIncoming()Z

    move-result v7

    if-nez v7, :cond_3

    const-wide/16 v7, 0xc8

    cmp-long v7, v2, v7

    if-gez v7, :cond_3

    invoke-virtual {v0}, Lcom/android/internal/telephony/Call;->getState()Lcom/android/internal/telephony/Call$State;

    move-result-object v7

    sget-object v8, Lcom/android/internal/telephony/Call$State;->ACTIVE:Lcom/android/internal/telephony/Call$State;

    if-ne v7, v8, :cond_3

    const-string v7, "outgoing_vibrator"

    const/4 v8, 0x1

    invoke-static {v4, v7, v8}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v7

    if-ne v7, v9, :cond_3

    move v6, v9

    goto :goto_0

    :cond_3
    move v6, v10

    goto :goto_0

    :catch_0
    move-exception v7

    goto :goto_1
.end method

.method private callVibrateHungup()V
    .locals 1

    const/4 v0, 0x1

    invoke-direct {p0, v0}, Lcom/android/phone/CallNotifier;->callVibrate(Z)V

    return-void
.end method

.method private callVibrateOutgoing()V
    .locals 1

    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lcom/android/phone/CallNotifier;->callVibrate(Z)V

    return-void
.end method

五、用ctrl+F查找 .method private onDisconnect(Landroid/os/AsyncResult;)V    空一行加入下邊代碼框架

invoke-direct/range {p0 .. p0}, Lcom/android/phone/CallNotifier;->callVibrateHungup()V

繼續ctrl+F查找.method private onPhoneStateChanged(Landroid/os/AsyncResult;)V  空一行加入如下代碼ide

invoke-direct {p0}, Lcom/android/phone/CallNotifier;->callVibrateOutgoing()V

六、保存,回編譯,CMD下命令 :    apktool b abc         成功後找到abc\build\apk\classes.dex     用壓縮軟件RAR打開PHONE.apk ,把反編的classes.dex託進去替換舊的classes.dex ,而後用RE替換新的PHONE.apk 就能夠了,注意改權限 ,第一排豎的三個勾上,豎的第二排的第一個勾上。重啓,大功告成!
相關文章
相關標籤/搜索