Skip to content

Commit

Permalink
Phone: Enable audio & call related logs
Browse files Browse the repository at this point in the history
Add logs when
-enabling/disabling MIC and Speaker
through AudioManager.
-for call related operations.
This would help in debugging call issues.

Change-Id: I48e09a8e68737444009a0deac3cb0550f8bd1ed8
CRs-Fixed: 359921
  • Loading branch information
Shruthi N.K authored and Gerrit Code Review committed Oct 21, 2012
1 parent 84b61d6 commit 645ec72
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
10 changes: 5 additions & 5 deletions src/com/android/phone/BluetoothHandsfree.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2374,13 +2374,13 @@ public AtCommandResult handleSetCommand(Object[] args) {
if (phoneType == Phone.PHONE_TYPE_CDMA) { if (phoneType == Phone.PHONE_TYPE_CDMA) {
if (ringingCall.isRinging()) { if (ringingCall.isRinging()) {
// Hangup the active call and then answer call waiting call. // Hangup the active call and then answer call waiting call.
if (VDBG) log("CHLD:1 Callwaiting Answer call"); log("CHLD:1 Callwaiting Answer call");
PhoneUtils.hangupRingingAndActive(phone); PhoneUtils.hangupRingingAndActive(phone);
} else { } else {
// If there is no Call waiting then just hangup // If there is no Call waiting then just hangup
// the active call. In CDMA this mean that the complete // the active call. In CDMA this mean that the complete
// call session would be ended // call session would be ended
if (VDBG) log("CHLD:1 Hangup Call"); log("CHLD:1 Hangup Call");
PhoneUtils.hangup(PhoneApp.getInstance().mCM); PhoneUtils.hangup(PhoneApp.getInstance().mCM);
} }
return new AtCommandResult(AtCommandResult.OK); return new AtCommandResult(AtCommandResult.OK);
Expand All @@ -2404,15 +2404,15 @@ public AtCommandResult handleSetCommand(Object[] args) {
// If the Phone state is already in CONF_CALL then we simply send // If the Phone state is already in CONF_CALL then we simply send
// a flash cmd by calling switchHoldingAndActive() // a flash cmd by calling switchHoldingAndActive()
if (ringingCall.isRinging()) { if (ringingCall.isRinging()) {
if (VDBG) log("CHLD:2 Callwaiting Answer call"); log("CHLD:2 Callwaiting Answer call");
PhoneUtils.answerCall(ringingCall); PhoneUtils.answerCall(ringingCall);
PhoneUtils.setMute(false); PhoneUtils.setMute(false);
// Setting the second callers state flag to TRUE (i.e. active) // Setting the second callers state flag to TRUE (i.e. active)
cdmaSetSecondCallState(true); cdmaSetSecondCallState(true);
} else if (PhoneApp.getInstance().cdmaPhoneCallState } else if (PhoneApp.getInstance().cdmaPhoneCallState
.getCurrentCallState() .getCurrentCallState()
== CdmaPhoneCallState.PhoneCallState.CONF_CALL) { == CdmaPhoneCallState.PhoneCallState.CONF_CALL) {
if (VDBG) log("CHLD:2 Swap Calls"); log("CHLD:2 Swap Calls");
PhoneUtils.switchHoldingAndActive(backgroundCall); PhoneUtils.switchHoldingAndActive(backgroundCall);
// Toggle the second callers active state flag // Toggle the second callers active state flag
cdmaSwapSecondCallState(); cdmaSwapSecondCallState();
Expand All @@ -2430,7 +2430,7 @@ public AtCommandResult handleSetCommand(Object[] args) {
PhoneApp.getInstance().cdmaPhoneCallState.getCurrentCallState(); PhoneApp.getInstance().cdmaPhoneCallState.getCurrentCallState();
// For CDMA, we need to check if the call is in THRWAY_ACTIVE state // For CDMA, we need to check if the call is in THRWAY_ACTIVE state
if (state == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) { if (state == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) {
if (VDBG) log("CHLD:3 Merge Calls"); log("CHLD:3 Merge Calls");
PhoneUtils.mergeCalls(); PhoneUtils.mergeCalls();
} else if (state == CdmaPhoneCallState.PhoneCallState.CONF_CALL) { } else if (state == CdmaPhoneCallState.PhoneCallState.CONF_CALL) {
// State is CONF_CALL already and we are getting a merge call // State is CONF_CALL already and we are getting a merge call
Expand Down
4 changes: 2 additions & 2 deletions src/com/android/phone/CallCard.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ private void updateNoCall(CallManager cm) {
* (ie. the stuff in the primaryCallInfo block) based on the specified Call. * (ie. the stuff in the primaryCallInfo block) based on the specified Call.
*/ */
private void displayMainCallStatus(CallManager cm, Call call) { private void displayMainCallStatus(CallManager cm, Call call) {
if (DBG) log("displayMainCallStatus(call " + call + ")..."); log("displayMainCallStatus(call " + call + ")...");


if (call == null) { if (call == null) {
// There's no call to display, presumably because the phone is idle. // There's no call to display, presumably because the phone is idle.
Expand All @@ -460,7 +460,7 @@ private void displayMainCallStatus(CallManager cm, Call call) {
mPrimaryCallInfo.setVisibility(View.VISIBLE); mPrimaryCallInfo.setVisibility(View.VISIBLE);


Call.State state = call.getState(); Call.State state = call.getState();
if (DBG) log(" - call.state: " + call.getState()); log(" - call.state: " + call.getState());


switch (state) { switch (state) {
case ACTIVE: case ACTIVE:
Expand Down
2 changes: 1 addition & 1 deletion src/com/android/phone/InCallControlState.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void update() {
canHold = false; canHold = false;
} }


if (DBG) dumpState(); dumpState();
} }


public void dumpState() { public void dumpState() {
Expand Down
10 changes: 5 additions & 5 deletions src/com/android/phone/InCallScreen.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ private void internalResolveIntent(Intent intent) {
return; return;
} }
String action = intent.getAction(); String action = intent.getAction();
if (DBG) log("internalResolveIntent: action=" + action); log("internalResolveIntent: action=" + action);


// In gingerbread and earlier releases, the InCallScreen used to // In gingerbread and earlier releases, the InCallScreen used to
// directly handle certain intent actions that could initiate phone // directly handle certain intent actions that could initiate phone
Expand Down Expand Up @@ -1730,8 +1730,8 @@ private void onPhoneStateChanged(AsyncResult r) {
private void onDisconnect(AsyncResult r) { private void onDisconnect(AsyncResult r) {
Connection c = (Connection) r.result; Connection c = (Connection) r.result;
Connection.DisconnectCause cause = c.getDisconnectCause(); Connection.DisconnectCause cause = c.getDisconnectCause();
if (DBG) log("onDisconnect: connection '" + c + "', cause = " + cause log("onDisconnect: connection '" + c + "', cause = " + cause
+ ", showing screen: " + mApp.isShowingCallScreen()); + ", showing screen: " + mApp.isShowingCallScreen());


boolean currentlyIdle = !phoneIsInUse(); boolean currentlyIdle = !phoneIsInUse();
int autoretrySetting = AUTO_RETRY_OFF; int autoretrySetting = AUTO_RETRY_OFF;
Expand Down Expand Up @@ -3009,7 +3009,7 @@ private void closeDialpadInternal(boolean animate) {
* Handles button clicks from the InCallTouchUi widget. * Handles button clicks from the InCallTouchUi widget.
*/ */
/* package */ void handleOnscreenButtonClick(int id) { /* package */ void handleOnscreenButtonClick(int id) {
if (DBG) log("handleOnscreenButtonClick(id " + id + ")..."); log("handleOnscreenButtonClick(id " + id + ")...");


switch (id) { switch (id) {
// Actions while an incoming call is ringing: // Actions while an incoming call is ringing:
Expand Down Expand Up @@ -3745,7 +3745,7 @@ private void internalSwapCalls() {
* necessary. * necessary.
*/ */
private void setInCallScreenMode(InCallScreenMode newMode) { private void setInCallScreenMode(InCallScreenMode newMode) {
if (DBG) log("setInCallScreenMode: " + newMode); log("setInCallScreenMode: " + newMode);
mApp.inCallUiState.inCallScreenMode = newMode; mApp.inCallUiState.inCallScreenMode = newMode;


switch (newMode) { switch (newMode) {
Expand Down
26 changes: 12 additions & 14 deletions src/com/android/phone/PhoneUtils.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ static boolean isConferenceCall(Call call) {
* @param store True when the settings should be stored in the device. * @param store True when the settings should be stored in the device.
*/ */
/* package */ static void turnOnSpeaker(Context context, boolean flag, boolean store) { /* package */ static void turnOnSpeaker(Context context, boolean flag, boolean store) {
if (DBG) log("turnOnSpeaker(flag=" + flag + ", store=" + store + ")..."); log("turnOnSpeaker(flag=" + flag + ", store=" + store + ")...");
final PhoneApp app = PhoneApp.getInstance(); final PhoneApp app = PhoneApp.getInstance();


AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
Expand Down Expand Up @@ -1990,19 +1990,17 @@ static void setMute(boolean muted) {
*/ */
private static void setMuteInternal(Phone phone, boolean muted) { private static void setMuteInternal(Phone phone, boolean muted) {
final PhoneApp app = PhoneApp.getInstance(); final PhoneApp app = PhoneApp.getInstance();
if (phone != null) { Context context = phone.getContext();
Context context = phone.getContext(); boolean routeToAudioManager =
boolean routeToAudioManager = context.getResources().getBoolean(R.bool.send_mic_mute_to_AudioManager);
context.getResources().getBoolean(R.bool.send_mic_mute_to_AudioManager); if (routeToAudioManager) {
if (routeToAudioManager) { AudioManager audioManager =
AudioManager audioManager = (AudioManager) phone.getContext().getSystemService(Context.AUDIO_SERVICE);
(AudioManager) phone.getContext().getSystemService(Context.AUDIO_SERVICE); log("setMuteInternal: using setMicrophoneMute(" + muted + ")...");
if (DBG) log("setMuteInternal: using setMicrophoneMute(" + muted + ")..."); audioManager.setMicrophoneMute(muted);
audioManager.setMicrophoneMute(muted); } else {
} else { log("setMuteInternal: using phone.setMute(" + muted + ")...");
if (DBG) log("setMuteInternal: using phone.setMute(" + muted + ")..."); phone.setMute(muted);
phone.setMute(muted);
}
} }
app.notificationMgr.updateMuteNotification(); app.notificationMgr.updateMuteNotification();
} }
Expand Down

0 comments on commit 645ec72

Please sign in to comment.