am 21b732ff: am 2159a502: Merge "Re-add some CallNotifier implementations." into lmp-dev
* commit '21b732ff0687f0bdaa2a9707b93333f7da77bb47':
Re-add some CallNotifier implementations.
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 0edf62f..1a64166 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -56,20 +56,15 @@
/**
* Phone app module that listens for phone state changes and various other
* events from the telephony layer, and triggers any resulting UI behavior
- * (like starting the Ringer and Incoming Call UI, playing in-call tones,
+ * (like starting the Incoming Call UI, playing in-call tones,
* updating notifications, writing call log entries, etc.)
*/
-public class CallNotifier extends Handler
- implements CallerInfoAsyncQuery.OnQueryCompleteListener {
+public class CallNotifier extends Handler {
private static final String LOG_TAG = "CallNotifier";
private static final boolean DBG =
(PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
private static final boolean VDBG = (PhoneGlobals.DBG_LEVEL >= 2);
- // Maximum time we allow the CallerInfo query to run,
- // before giving up and falling back to the default ringtone.
- private static final int RINGTONE_QUERY_WAIT_TIME = 500; // msec
-
// Time to display the DisplayInfo Record sent by CDMA network
private static final int DISPLAYINFO_NOTIFICATION_TIME = 2000; // msec
@@ -91,9 +86,6 @@
// object used to synchronize access to mCallerInfoQueryState
private Object mCallerInfoQueryStateGuard = new Object();
- // Event used to indicate a query timeout.
- private static final int RINGER_CUSTOM_RINGTONE_QUERY_TIMEOUT = 100;
-
// Events generated internally:
private static final int PHONE_MWI_CHANGED = 21;
private static final int DISPLAYINFO_NOTIFICATION_DONE = 24;
@@ -106,10 +98,8 @@
private PhoneGlobals mApplication;
private CallManager mCM;
- private Ringer mRinger;
private BluetoothHeadset mBluetoothHeadset;
private CallLogger mCallLogger;
- private boolean mSilentRingerRequested;
// ToneGenerator instance for playing SignalInfo tones
private ToneGenerator mSignalInfoToneGenerator;
@@ -138,12 +128,12 @@
* Initialize the singleton CallNotifier instance.
* This is only done once, at startup, from PhoneApp.onCreate().
*/
- /* package */ static CallNotifier init(PhoneGlobals app, Phone phone, Ringer ringer,
+ /* package */ static CallNotifier init(PhoneGlobals app, Phone phone,
CallLogger callLogger, CallStateMonitor callStateMonitor,
BluetoothManager bluetoothManager) {
synchronized (CallNotifier.class) {
if (sInstance == null) {
- sInstance = new CallNotifier(app, phone, ringer, callLogger, callStateMonitor,
+ sInstance = new CallNotifier(app, phone, callLogger, callStateMonitor,
bluetoothManager);
} else {
Log.wtf(LOG_TAG, "init() called multiple times! sInstance = " + sInstance);
@@ -153,7 +143,7 @@
}
/** Private constructor; @see init() */
- private CallNotifier(PhoneGlobals app, Phone phone, Ringer ringer, CallLogger callLogger,
+ private CallNotifier(PhoneGlobals app, Phone phone, CallLogger callLogger,
CallStateMonitor callStateMonitor, BluetoothManager bluetoothManager) {
mApplication = app;
mCM = app.mCM;
@@ -166,7 +156,6 @@
createSignalInfoToneGenerator();
- mRinger = ringer;
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if (adapter != null) {
adapter.getProfileProxy(mApplication.getApplicationContext(),
@@ -207,23 +196,6 @@
case CallStateMonitor.PHONE_NEW_RINGING_CONNECTION:
log("RINGING... (new)");
onNewRingingConnection((AsyncResult) msg.obj);
- mSilentRingerRequested = false;
- break;
-
- case CallStateMonitor.PHONE_INCOMING_RING:
- // repeat the ring when requested by the RIL, and when the user has NOT
- // specifically requested silence.
- if (msg.obj != null && ((AsyncResult) msg.obj).result != null) {
- PhoneBase pb = (PhoneBase)((AsyncResult)msg.obj).result;
-
- if ((pb.getState() == PhoneConstants.State.RINGING)
- && (mSilentRingerRequested == false)) {
- if (DBG) log("RINGING... (PHONE_INCOMING_RING event)");
- mRinger.ring();
- } else {
- if (DBG) log("RING before NEW_RING, skipping");
- }
- }
break;
case CallStateMonitor.PHONE_STATE_CHANGED:
@@ -239,10 +211,6 @@
onUnknownConnectionAppeared((AsyncResult) msg.obj);
break;
- case RINGER_CUSTOM_RINGTONE_QUERY_TIMEOUT:
- onCustomRingtoneQueryTimeout((Connection) msg.obj);
- break;
-
case PHONE_MWI_CHANGED:
onMwiChanged(mApplication.phone.getMessageWaitingIndicator());
break;
@@ -373,12 +341,6 @@
if (VDBG) log("Holding wake lock on new incoming connection.");
mApplication.requestWakeState(PhoneGlobals.WakeState.PARTIAL);
- // - don't ring for call waiting connections
- // - do this before showing the incoming call panel
- startIncomingCallQuery(c);
-
-
-
// Note we *don't* post a status bar notification here, since
// we're not necessarily ready to actually show the incoming call
// to the user. (For calls in the INCOMING state, at least, we
@@ -460,112 +422,6 @@
return false;
}
- /**
- * Helper method to manage the start of incoming call queries
- */
- private void startIncomingCallQuery(Connection c) {
- // TODO: cache the custom ringer object so that subsequent
- // calls will not need to do this query work. We can keep
- // the MRU ringtones in memory. We'll still need to hit
- // the database to get the callerinfo to act as a key,
- // but at least we can save the time required for the
- // Media player setup. The only issue with this is that
- // we may need to keep an eye on the resources the Media
- // player uses to keep these ringtones around.
-
- // make sure we're in a state where we can be ready to
- // query a ringtone uri.
- boolean shouldStartQuery = false;
- synchronized (mCallerInfoQueryStateGuard) {
- if (mCallerInfoQueryState == CALLERINFO_QUERY_READY) {
- mCallerInfoQueryState = CALLERINFO_QUERYING;
- shouldStartQuery = true;
- }
- }
- if (shouldStartQuery) {
- // Reset the ringtone to the default first.
- mRinger.setCustomRingtoneUri(Settings.System.DEFAULT_RINGTONE_URI);
-
- // query the callerinfo to try to get the ringer.
- PhoneUtils.CallerInfoToken cit = PhoneUtils.startGetCallerInfo(
- mApplication, c, this, c);
-
- // if this has already been queried then just ring, otherwise
- // we wait for the alloted time before ringing.
- if (cit.isFinal) {
- if (VDBG) log("- CallerInfo already up to date, using available data");
- onQueryComplete(0, c, cit.currentInfo);
- } else {
- if (VDBG) log("- Starting query, posting timeout message.");
-
- // Phone number (via getAddress()) is stored in the message to remember which
- // number is actually used for the look up.
- sendMessageDelayed(
- Message.obtain(this, RINGER_CUSTOM_RINGTONE_QUERY_TIMEOUT, c),
- RINGTONE_QUERY_WAIT_TIME);
- }
- // The call to showIncomingCall() will happen after the
- // queries are complete (or time out).
- } else {
- // This should never happen; its the case where an incoming call
- // arrives at the same time that the query is still being run,
- // and before the timeout window has closed.
- EventLog.writeEvent(EventLogTags.PHONE_UI_MULTIPLE_QUERY);
- }
- }
-
- /**
- * Performs the final steps of the onNewRingingConnection sequence:
- * starts the ringer, and brings up the "incoming call" UI.
- *
- * Normally, this is called when the CallerInfo query completes (see
- * onQueryComplete()). In this case, onQueryComplete() has already
- * configured the Ringer object to use the custom ringtone (if there
- * is one) for this caller. So we just tell the Ringer to start, and
- * proceed to the InCallScreen.
- *
- * But this method can *also* be called if the
- * RINGTONE_QUERY_WAIT_TIME timeout expires, which means that the
- * CallerInfo query is taking too long. In that case, we log a
- * warning but otherwise we behave the same as in the normal case.
- * (We still tell the Ringer to start, but it's going to use the
- * default ringtone.)
- */
- private void onCustomRingQueryComplete(Connection c) {
- boolean isQueryExecutionTimeExpired = false;
- synchronized (mCallerInfoQueryStateGuard) {
- if (mCallerInfoQueryState == CALLERINFO_QUERYING) {
- mCallerInfoQueryState = CALLERINFO_QUERY_READY;
- isQueryExecutionTimeExpired = true;
- }
- }
- if (isQueryExecutionTimeExpired) {
- // There may be a problem with the query here, since the
- // default ringtone is playing instead of the custom one.
- Log.w(LOG_TAG, "CallerInfo query took too long; falling back to default ringtone");
- EventLog.writeEvent(EventLogTags.PHONE_UI_RINGER_QUERY_ELAPSED);
- }
-
- // Make sure we still have an incoming call!
- //
- // (It's possible for the incoming call to have been disconnected
- // while we were running the query. In that case we better not
- // start the ringer here, since there won't be any future
- // DISCONNECT event to stop it!)
- //
- // Note we don't have to worry about the incoming call going away
- // *after* this check but before we call mRinger.ring() below,
- // since in that case we *will* still get a DISCONNECT message sent
- // to our handler. (And we will correctly stop the ringer when we
- // process that event.)
- if (mCM.getState() != PhoneConstants.State.RINGING) {
- Log.i(LOG_TAG, "onCustomRingQueryComplete: No incoming call! Bailing out...");
- // Don't start the ringer *or* bring up the "incoming call" UI.
- // Just bail out.
- return;
- }
- }
-
private void onUnknownConnectionAppeared(AsyncResult r) {
PhoneConstants.State state = mCM.getState();
@@ -624,15 +480,6 @@
if (VDBG) log("onPhoneStateChanged: OFF HOOK");
// make sure audio is in in-call mode now
PhoneUtils.setAudioMode(mCM);
-
- // Since we're now in-call, the Ringer should definitely *not*
- // be ringing any more. (This is just a sanity-check; we
- // already stopped the ringer explicitly back in
- // PhoneUtils.answerCall(), before the call to phone.acceptCall().)
- // TODO: Confirm that this call really *is* unnecessary, and if so,
- // remove it!
- if (DBG) log("stopRing()... (OFFHOOK state)");
- mRinger.stopRing();
}
if (fgPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
@@ -691,104 +538,6 @@
createSignalInfoToneGenerator();
}
- /**
- * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface.
- * refreshes the CallCard data when it called. If called with this
- * class itself, it is assumed that we have been waiting for the ringtone
- * and direct to voicemail settings to update.
- */
- @Override
- public void onQueryComplete(int token, Object cookie, CallerInfo ci) {
- if (cookie instanceof Long) {
- } else if (cookie instanceof Connection) {
- final Connection c = (Connection) cookie;
- if (VDBG) log("CallerInfo query complete (for CallNotifier), "
- + "updating state for incoming call..");
-
- // get rid of the timeout messages
- removeMessages(RINGER_CUSTOM_RINGTONE_QUERY_TIMEOUT);
-
- boolean isQueryExecutionTimeOK = false;
- synchronized (mCallerInfoQueryStateGuard) {
- if (mCallerInfoQueryState == CALLERINFO_QUERYING) {
- mCallerInfoQueryState = CALLERINFO_QUERY_READY;
- isQueryExecutionTimeOK = true;
- }
- }
- //if we're in the right state
- if (isQueryExecutionTimeOK) {
-
- // send directly to voicemail.
- if (ci.shouldSendToVoicemail) {
- if (DBG) log("send to voicemail flag detected. hanging up.");
- final Call ringingCall = mCM.getFirstActiveRingingCall();
- if (ringingCall != null && ringingCall.getLatestConnection() == c) {
- PhoneUtils.hangupRingingCall(ringingCall);
- return;
- }
- }
-
- // set the ringtone uri to prepare for the ring.
- if (ci.contactRingtoneUri != null) {
- if (DBG) log("custom ringtone found, setting up ringer.");
- Ringer r = mRinger;
- r.setCustomRingtoneUri(ci.contactRingtoneUri);
- }
- // ring, and other post-ring actions.
- onCustomRingQueryComplete(c);
- }
- }
- }
-
- /**
- * Called when asynchronous CallerInfo query is taking too long (more than
- * {@link #RINGTONE_QUERY_WAIT_TIME} msec), but we cannot wait any more.
- *
- * This looks up in-memory fallback cache and use it when available. If not, it just calls
- * {@link #onCustomRingQueryComplete()} with default ringtone ("Send to voicemail" flag will
- * be just ignored).
- *
- * @param number The phone number used for the async query. This method will take care of
- * formatting or normalization of the number.
- */
- private void onCustomRingtoneQueryTimeout(Connection c) {
- // First of all, this case itself should be rare enough, though we cannot avoid it in
- // some situations (e.g. IPC is slow due to system overload, database is in sync, etc.)
- Log.w(LOG_TAG, "CallerInfo query took too long; look up local fallback cache.");
-
- // This method is intentionally verbose for now to detect possible bad side-effect for it.
- // TODO: Remove the verbose log when it looks stable and reliable enough.
-
-
- if (c != null) {
- final CallerInfoCache.CacheEntry entry =
- mApplication.callerInfoCache.getCacheEntry(c.getAddress());
- if (entry != null) {
- if (entry.sendToVoicemail) {
- log("send to voicemail flag detected (in fallback cache). hanging up.");
- if (mCM.getFirstActiveRingingCall().getLatestConnection() == c) {
- PhoneUtils.hangupRingingCall(mCM.getFirstActiveRingingCall());
- return;
- }
- }
-
- if (entry.customRingtone != null) {
- log("custom ringtone found (in fallback cache), setting up ringer: "
- + entry.customRingtone);
- this.mRinger.setCustomRingtoneUri(Uri.parse(entry.customRingtone));
- }
- } else {
- // In this case we call onCustomRingQueryComplete(), just
- // like if the query had completed normally. (But we're
- // going to get the default ringtone, since we never got
- // the chance to call Ringer.setCustomRingtoneUri()).
- log("Failed to find fallback cache. Use default ringer tone.");
- }
- }
-
- onCustomRingQueryComplete(c);
- }
-
private void onDisconnect(AsyncResult r) {
if (VDBG) log("onDisconnect()... CallManager state: " + mCM.getState());
@@ -816,30 +565,6 @@
mApplication.cdmaPhoneCallState.resetCdmaPhoneCallState();
}
- // Stop the ringer if it was ringing (for an incoming call that
- // either disconnected by itself, or was rejected by the user.)
- //
- // TODO: We technically *shouldn't* stop the ringer if the
- // foreground or background call disconnects while an incoming call
- // is still ringing, but that's a really rare corner case.
- // It's safest to just unconditionally stop the ringer here.
-
- // CDMA: For Call collision cases i.e. when the user makes an out going call
- // and at the same time receives an Incoming Call, the Incoming Call is given
- // higher preference. At this time framework sends a disconnect for the Out going
- // call connection hence we should *not* be stopping the ringer being played for
- // the Incoming Call
- Call ringingCall = mCM.getFirstActiveRingingCall();
- if (ringingCall.getPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
- if (!PhoneUtils.isRealIncomingCall(ringingCall.getState())) {
- if (DBG) log("stopRing()... (onDisconnect)");
- mRinger.stopRing();
- }
- } else { // GSM
- if (DBG) log("stopRing()... (onDisconnect)");
- mRinger.stopRing();
- }
-
// If this is the end of an OTASP call, pass it on to the PhoneApp.
if (c != null && TelephonyCapabilities.supportsOtasp(c.getCall().getPhone())) {
final String number = c.getAddress();
@@ -1028,44 +753,6 @@
}
/**
- * Indicates whether or not this ringer is ringing.
- */
- boolean isRinging() {
- return mRinger.isRinging();
- }
-
- /**
- * Stops the current ring, and tells the notifier that future
- * ring requests should be ignored.
- */
- void silenceRinger() {
- mSilentRingerRequested = true;
- if (DBG) log("stopRing()... (silenceRinger)");
- mRinger.stopRing();
- }
-
- /**
- * Restarts the ringer after having previously silenced it.
- *
- * (This is a no-op if the ringer is actually still ringing, or if the
- * incoming ringing call no longer exists.)
- */
- /* package */ void restartRinger() {
- if (DBG) log("restartRinger()...");
- // Already ringing or Silent requested; no need to restart.
- if (isRinging() || mSilentRingerRequested) return;
-
- final Call ringingCall = mCM.getFirstActiveRingingCall();
- // Don't check ringingCall.isRinging() here, since that'll be true
- // for the WAITING state also. We only allow the ringer for
- // regular INCOMING calls.
- if (DBG) log("- ringingCall state: " + ringingCall.getState());
- if (ringingCall.getState() == Call.State.INCOMING) {
- mRinger.ring();
- }
- }
-
- /**
* Helper class to play tones through the earpiece (or speaker / BT)
* during a call, using the ToneGenerator.
*
diff --git a/src/com/android/phone/CallStateMonitor.java b/src/com/android/phone/CallStateMonitor.java
index c978e26..eda45b9 100644
--- a/src/com/android/phone/CallStateMonitor.java
+++ b/src/com/android/phone/CallStateMonitor.java
@@ -48,7 +48,6 @@
public static final int PHONE_NEW_RINGING_CONNECTION = 2;
public static final int PHONE_DISCONNECT = 3;
public static final int PHONE_UNKNOWN_CONNECTION_APPEARED = 4;
- public static final int PHONE_INCOMING_RING = 5;
public static final int PHONE_STATE_DISPLAYINFO = 6;
public static final int PHONE_STATE_SIGNALINFO = 7;
public static final int PHONE_CDMA_CALL_WAITING = 8;
@@ -76,20 +75,23 @@
* Register for call state notifications with the CallManager.
*/
private void registerForNotifications() {
- callManager.registerForNewRingingConnection(this, PHONE_NEW_RINGING_CONNECTION, null);
- callManager.registerForPreciseCallStateChanged(this, PHONE_STATE_CHANGED, null);
- callManager.registerForDisconnect(this, PHONE_DISCONNECT, null);
- callManager.registerForUnknownConnection(this, PHONE_UNKNOWN_CONNECTION_APPEARED, null);
- callManager.registerForIncomingRing(this, PHONE_INCOMING_RING, null);
+ //
+ // TODO: The lines commented out here can be removed as their associated functionality in
+ // other files is removed.
+ //
+ //callManager.registerForNewRingingConnection(this, PHONE_NEW_RINGING_CONNECTION, null);
+ //callManager.registerForPreciseCallStateChanged(this, PHONE_STATE_CHANGED, null);
+ //callManager.registerForDisconnect(this, PHONE_DISCONNECT, null);
+ //callManager.registerForUnknownConnection(this, PHONE_UNKNOWN_CONNECTION_APPEARED, null);
callManager.registerForCdmaOtaStatusChange(this, EVENT_OTA_PROVISION_CHANGE, null);
- callManager.registerForCallWaiting(this, PHONE_CDMA_CALL_WAITING, null);
+ //callManager.registerForCallWaiting(this, PHONE_CDMA_CALL_WAITING, null);
callManager.registerForDisplayInfo(this, PHONE_STATE_DISPLAYINFO, null);
callManager.registerForSignalInfo(this, PHONE_STATE_SIGNALINFO, null);
callManager.registerForInCallVoicePrivacyOn(this, PHONE_ENHANCED_VP_ON, null);
callManager.registerForInCallVoicePrivacyOff(this, PHONE_ENHANCED_VP_OFF, null);
- callManager.registerForRingbackTone(this, PHONE_RINGBACK_TONE, null);
- callManager.registerForResendIncallMute(this, PHONE_RESEND_MUTE, null);
- callManager.registerForPostDialCharacter(this, PHONE_ON_DIAL_CHARS, null);
+ //callManager.registerForRingbackTone(this, PHONE_RINGBACK_TONE, null);
+ //callManager.registerForResendIncallMute(this, PHONE_RESEND_MUTE, null);
+ //callManager.registerForPostDialCharacter(this, PHONE_ON_DIAL_CHARS, null);
}
public void addListener(Handler handler) {
@@ -98,13 +100,7 @@
Log.d(LOG_TAG, "Adding Handler: " + handler);
}
- // Commented out so that the listener does not get phone events:
- // 1) CallNotifier - Incoming-call sequence (ringer, etc.)
- //
- // NOTE: This can be deleted, but is left here for documentation purposes until this
- // entire file can be deleted (once we are sure we've addressed each of the events we
- // were previously looking for.
- // registeredHandlers.add(handler);
+ registeredHandlers.add(handler);
}
}
@@ -127,20 +123,19 @@
if (DBG) Log.d(LOG_TAG, "updateCallNotifierRegistrationsAfterRadioTechnologyChange...");
// Unregister all events from the old obsolete phone
- callManager.unregisterForNewRingingConnection(this);
- callManager.unregisterForPreciseCallStateChanged(this);
- callManager.unregisterForDisconnect(this);
- callManager.unregisterForUnknownConnection(this);
- callManager.unregisterForIncomingRing(this);
- callManager.unregisterForCallWaiting(this);
+ //callManager.unregisterForNewRingingConnection(this);
+ //callManager.unregisterForPreciseCallStateChanged(this);
+ //callManager.unregisterForDisconnect(this);
+ //callManager.unregisterForUnknownConnection(this);
+ //callManager.unregisterForCallWaiting(this);
callManager.unregisterForDisplayInfo(this);
callManager.unregisterForSignalInfo(this);
callManager.unregisterForCdmaOtaStatusChange(this);
- callManager.unregisterForRingbackTone(this);
- callManager.unregisterForResendIncallMute(this);
+ //callManager.unregisterForRingbackTone(this);
+ //callManager.unregisterForResendIncallMute(this);
callManager.unregisterForInCallVoicePrivacyOn(this);
callManager.unregisterForInCallVoicePrivacyOff(this);
- callManager.unregisterForPostDialCharacter(this);
+ //callManager.unregisterForPostDialCharacter(this);
registerForNotifications();
}
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index f66ebce..b2e1332 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -144,7 +144,6 @@
private CallGatewayManager callGatewayManager;
private CallStateMonitor callStateMonitor;
private IBluetoothHeadsetPhone mBluetoothPhone;
- private Ringer ringer;
static int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
static boolean sVoiceCapable = true;
@@ -403,15 +402,13 @@
// Bluetooth manager
bluetoothManager = new BluetoothManager();
- ringer = Ringer.init(this, bluetoothManager);
-
phoneMgr = PhoneInterfaceManager.init(this, phone);
// Create the CallNotifer singleton, which handles
// asynchronous events from the telephony layer (like
// launching the incoming-call UI when an incoming call comes
// in.)
- notifier = CallNotifier.init(this, phone, ringer, callLogger, callStateMonitor,
+ notifier = CallNotifier.init(this, phone, callLogger, callStateMonitor,
bluetoothManager);
// register for ICC status
@@ -436,7 +433,6 @@
intentFilter.addAction(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
intentFilter.addAction(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
intentFilter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
- intentFilter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
registerReceiver(mReceiver, intentFilter);
//set the default values for the preferences in the phone.
@@ -503,10 +499,6 @@
return getInstance().phone;
}
- Ringer getRinger() {
- return ringer;
- }
-
IBluetoothHeadsetPhone getBluetoothPhoneService() {
return mBluetoothPhone;
}
@@ -802,7 +794,6 @@
clearOtaState();
}
- ringer.updateRingerContextAfterRadioTechnologyChange(this.phone);
notifier.updateCallNotifierRegistrationsAfterRadioTechnologyChange();
callStateMonitor.updateAfterRadioTechnologyChange();
@@ -885,12 +876,6 @@
Intent.EXTRA_DOCK_STATE_UNDOCKED);
if (VDBG) Log.d(LOG_TAG, "ACTION_DOCK_EVENT -> mDockState = " + mDockState);
mHandler.sendMessage(mHandler.obtainMessage(EVENT_DOCK_STATE_CHANGED, 0));
- } else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
- int ringerMode = intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE,
- AudioManager.RINGER_MODE_NORMAL);
- if (ringerMode == AudioManager.RINGER_MODE_SILENT) {
- notifier.silenceRinger();
- }
}
}
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2ac98d3..5d00163 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -94,7 +94,6 @@
private static final int EVENT_NEIGHBORING_CELL_DONE = 3;
private static final int CMD_ANSWER_RINGING_CALL = 4;
private static final int CMD_END_CALL = 5; // not used yet
- private static final int CMD_SILENCE_RINGER = 6;
private static final int CMD_TRANSMIT_APDU_LOGICAL_CHANNEL = 7;
private static final int EVENT_TRANSMIT_APDU_LOGICAL_CHANNEL_DONE = 8;
private static final int CMD_OPEN_CHANNEL = 9;
@@ -241,10 +240,6 @@
answerRingingCallInternal();
break;
- case CMD_SILENCE_RINGER:
- silenceRingerInternal();
- break;
-
case CMD_END_CALL:
request = (MainThreadRequest) msg.obj;
boolean hungUp;
@@ -842,27 +837,11 @@
}
}
- public void silenceRinger() {
- if (DBG) log("silenceRinger...");
- // TODO: find a more appropriate permission to check here.
- // (That can probably wait till the big TelephonyManager API overhaul.
- // For now, protect this call with the MODIFY_PHONE_STATE permission.)
- enforceModifyPermission();
- sendRequestAsync(CMD_SILENCE_RINGER);
- }
-
/**
- * Internal implemenation of silenceRinger().
- * This should only be called from the main thread of the Phone app.
- * @see #silenceRinger
+ * This method is no longer used and can be removed once TelephonyManager stops referring to it.
*/
- private void silenceRingerInternal() {
- if ((mCM.getState() == PhoneConstants.State.RINGING)
- && mApp.notifier.isRinging()) {
- // Ringer is actually playing, so silence it.
- if (DBG) log("silenceRingerInternal: silencing...");
- mApp.notifier.silenceRinger();
- }
+ public void silenceRinger() {
+ Log.e(LOG_TAG, "silenseRinger not supported");
}
public boolean isOffhook() {
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 2b864cc..c034d8b 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -200,10 +200,6 @@
final PhoneGlobals app = PhoneGlobals.getInstance();
final CallNotifier notifier = app.notifier;
- // If the ringer is currently ringing and/or vibrating, stop it
- // right now (before actually answering the call.)
- notifier.silenceRinger();
-
final Phone phone = ringingCall.getPhone();
final boolean phoneIsCdma = (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA);
boolean answered = false;
@@ -2383,12 +2379,6 @@
Log.d(LOG_TAG, " - CDMA device, but null cdmaPhoneCallState!");
}
}
-
- // Watch out: the isRinging() call below does NOT tell us anything
- // about the state of the telephony layer; it merely tells us whether
- // the Ringer manager is currently playing the ringtone.
- boolean ringing = app.getRinger().isRinging();
- Log.d(LOG_TAG, " - Ringer state: " + ringing);
}
private static void log(String msg) {