Created
March 9, 2012 19:32
-
-
Save daohoangson/2008244 to your computer and use it in GitHub Desktop.
com/android/phone/CallNotifier.java diff to enable on-call-state-changed vibration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java | |
index 2e82543..0131c13 100755 | |
--- a/src/com/android/phone/CallNotifier.java | |
+++ b/src/com/android/phone/CallNotifier.java | |
@@ -160,6 +160,7 @@ public class CallNotifier extends Handler | |
private static final int TONE_RELATIVE_VOLUME_SIGNALINFO = 80; | |
private Call.State mPreviousCdmaCallState; | |
+ private Call.State mPreviousGsmCallState; | |
private boolean mVoicePrivacyState = false; | |
private boolean mIsCdmaRedialCall = false; | |
@@ -877,6 +878,25 @@ public class CallNotifier extends Handler | |
if ((fgPhone.getPhoneType() == Phone.PHONE_TYPE_GSM) | |
|| (fgPhone.getPhoneType() == Phone.PHONE_TYPE_SIP)) { | |
Call.State callState = mCM.getActiveFgCallState(); | |
+ | |
+ if (callState == Call.State.ACTIVE | |
+ && (mPreviousGsmCallState == Call.State.DIALING | |
+ || mPreviousGsmCallState == Call.State.ALERTING | |
+ )) { | |
+ Log.i("sondh", "Vibrate on out going call connect"); | |
+ | |
+ Vibrator v = (Vibrator) mApplication.getSystemService(Context.VIBRATOR_SERVICE); | |
+ v.vibrate(300); | |
+ } | |
+ | |
+ if (callState == Call.State.DISCONNECTED | |
+ && mPreviousGsmCallState == Call.State.ACTIVE) { | |
+ Log.i("sondh", "Vibrate on out call disconnect (both out going and incoming)"); | |
+ | |
+ Vibrator v = (Vibrator) mApplication.getSystemService(Context.VIBRATOR_SERVICE); | |
+ v.vibrate(150); | |
+ } | |
+ | |
if (!callState.isDialing()) { | |
// If call get activated or disconnected before the ringback | |
// tone stops, we have to stop it to prevent disturbing. | |
@@ -885,6 +905,8 @@ public class CallNotifier extends Handler | |
mInCallRingbackTonePlayer = null; | |
} | |
} | |
+ | |
+ mPreviousGsmCallState = callState; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment