Rename registerPhoneStateChange to registerPreciseCallStateChange

As registerPhoneStateChange was actually notifying CallStateChange,
rename appropriately.
This commit is contained in:
Jaikumar Ganesh
2009-07-13 12:12:06 -07:00
parent 740cb12eba
commit 1c42769339
9 changed files with 63 additions and 58 deletions

Binary file not shown.

View File

@@ -22,6 +22,7 @@ import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.telephony.CellLocation;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
@@ -260,8 +261,8 @@ public interface Phone {
/**
* Get current coarse-grained voice call state.
* Use {@link #registerForPhoneStateChanged(Handler, int, Object)
* registerForPhoneStateChanged()} for change notification. <p>
* Use {@link #registerForPreciseCallStateChanged(Handler, int, Object)
* registerForPreciseCallStateChanged()} for change notification. <p>
* If the phone has an active call and call waiting occurs,
* then the phone state is RINGING not OFFHOOK
* <strong>Note:</strong>
@@ -315,18 +316,21 @@ public interface Phone {
void unregisterForUnknownConnection(Handler h);
/**
* Notifies when any aspect of the voice call state changes.
* Register for getting notifications for change in the Call State {@link Call.State}
* This is called PreciseCallState because the call state is more precise than the
* {@link Phone.State} which can be obtained using the {@link PhoneStateListener}
*
* Resulting events will have an AsyncResult in <code>Message.obj</code>.
* AsyncResult.userData will be set to the obj argument here.
* The <em>h</em> parameter is held only by a weak reference.
*/
void registerForPhoneStateChanged(Handler h, int what, Object obj);
void registerForPreciseCallStateChanged(Handler h, int what, Object obj);
/**
* Unregisters for voice call state change notifications.
* Extraneous calls are tolerated silently.
*/
void unregisterForPhoneStateChanged(Handler h);
void unregisterForPreciseCallStateChanged(Handler h);
/**
@@ -556,8 +560,8 @@ public interface Phone {
/**
* Answers a ringing or waiting call. Active calls, if any, go on hold.
* Answering occurs asynchronously, and final notification occurs via
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}.
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}.
*
* @exception CallStateException when no call is ringing or waiting
*/
@@ -567,8 +571,8 @@ public interface Phone {
* Reject (ignore) a ringing call. In GSM, this means UDUB
* (User Determined User Busy). Reject occurs asynchronously,
* and final notification occurs via
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}.
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}.
*
* @exception CallStateException when no call is ringing or waiting
*/
@@ -578,8 +582,8 @@ public interface Phone {
* Places any active calls on hold, and makes any held calls
* active. Switch occurs asynchronously and may fail.
* Final notification occurs via
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}.
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}.
*
* @exception CallStateException if a call is ringing, waiting, or
* dialing/alerting. In these cases, this operation may not be performed.
@@ -596,8 +600,8 @@ public interface Phone {
/**
* Conferences holding and active. Conference occurs asynchronously
* and may fail. Final notification occurs via
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}.
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}.
*
* @exception CallStateException if canConference() would return false.
* In these cases, this operation may not be performed.
@@ -631,8 +635,8 @@ public interface Phone {
* Connects the two calls and disconnects the subscriber from both calls
* Explicit Call Transfer occurs asynchronously
* and may fail. Final notification occurs via
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}.
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}.
*
* @exception CallStateException if canTransfer() would return false.
* In these cases, this operation may not be performed.
@@ -659,8 +663,8 @@ public interface Phone {
* IDLE, ACTIVE, DIALING, ALERTING, or DISCONNECTED.
*
* State change notification is available via
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}.
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}.
*/
Call getForegroundCall();
@@ -676,8 +680,8 @@ public interface Phone {
* IDLE, HOLDING or DISCONNECTED.
*
* State change notification is available via
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}.
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}.
*/
Call getBackgroundCall();
@@ -693,8 +697,8 @@ public interface Phone {
* IDLE, INCOMING, WAITING or DISCONNECTED.
*
* State change notification is available via
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}.
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}.
*/
Call getRingingCall();
@@ -1067,8 +1071,8 @@ public interface Phone {
/**
* Gets current mute status. Use
* {@link #registerForPhoneStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPhoneStateChanged()}
* {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
* java.lang.Object) registerForPreciseCallStateChanged()}
* as a change notifcation, although presently phone state changed is not
* fired when setMute() is called.
*

View File

@@ -119,7 +119,7 @@ public abstract class PhoneBase implements Phone {
}
protected final RegistrantList mPhoneStateRegistrants
protected final RegistrantList mPreciseCallStateRegistrants
= new RegistrantList();
protected final RegistrantList mNewRingingConnectionRegistrants
@@ -221,25 +221,24 @@ public abstract class PhoneBase implements Phone {
}
// Inherited documentation suffices.
public void registerForPhoneStateChanged(Handler h, int what, Object obj) {
public void registerForPreciseCallStateChanged(Handler h, int what, Object obj) {
checkCorrectThread(h);
mPhoneStateRegistrants.addUnique(h, what, obj);
mPreciseCallStateRegistrants.addUnique(h, what, obj);
}
// Inherited documentation suffices.
public void unregisterForPhoneStateChanged(Handler h) {
mPhoneStateRegistrants.remove(h);
public void unregisterForPreciseCallStateChanged(Handler h) {
mPreciseCallStateRegistrants.remove(h);
}
/**
* Notify registrants of a PhoneStateChanged.
* Subclasses of Phone probably want to replace this with a
* version scoped to their packages
*/
protected void notifyCallStateChangedP() {
protected void notifyPreciseCallStateChangedP() {
AsyncResult ar = new AsyncResult(null, this, null);
mPhoneStateRegistrants.notifyRegistrants(ar);
mPreciseCallStateRegistrants.notifyRegistrants(ar);
}
// Inherited documentation suffices.

View File

@@ -25,6 +25,7 @@ import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.telephony.CellLocation;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.util.Log;
@@ -210,12 +211,12 @@ public class PhoneProxy extends Handler implements Phone {
mActivePhone.unregisterForUnknownConnection(h);
}
public void registerForPhoneStateChanged(Handler h, int what, Object obj) {
mActivePhone.registerForPhoneStateChanged(h, what, obj);
public void registerForPreciseCallStateChanged(Handler h, int what, Object obj) {
mActivePhone.registerForPreciseCallStateChanged(h, what, obj);
}
public void unregisterForPhoneStateChanged(Handler h) {
mActivePhone.unregisterForPhoneStateChanged(h);
public void unregisterForPreciseCallStateChanged(Handler h) {
mActivePhone.unregisterForPreciseCallStateChanged(h);
}
public void registerForNewRingingConnection(Handler h, int what, Object obj) {

View File

@@ -36,6 +36,7 @@ import android.telephony.SignalStrength;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
@@ -783,19 +784,19 @@ public class CDMAPhone extends PhoneBase {
}
/**
* Notify any interested party of a Phone state change.
* Notify any interested party of a Phone state change {@link Phone.State}
*/
/*package*/ void notifyPhoneStateChanged() {
mNotifier.notifyPhoneState(this);
}
/**
* Notifies registrants (ie, activities in the Phone app) about
* changes to call state (including Phone and Connection changes).
* Notify registrants of a change in the call state. This notifies changes in {@link Call.State}
* Use this when changes in the precise call state are needed, else use notifyPhoneStateChanged.
*/
/*package*/ void notifyCallStateChanged() {
/*package*/ void notifyPreciseCallStateChanged() {
/* we'd love it if this was package-scoped*/
super.notifyCallStateChangedP();
super.notifyPreciseCallStateChangedP();
}
void notifyServiceStateChanged(ServiceState ss) {

View File

@@ -222,7 +222,7 @@ public final class CdmaCallTracker extends CallTracker {
}
updatePhoneState();
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
return pendingMO;
}
@@ -305,7 +305,7 @@ public final class CdmaCallTracker extends CallTracker {
internalClearDisconnected();
updatePhoneState();
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
}
boolean
@@ -644,7 +644,7 @@ public final class CdmaCallTracker extends CallTracker {
}
if (hasNonHangupStateChanged || newRinging != null) {
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
}
//dumpState();
@@ -678,7 +678,7 @@ public final class CdmaCallTracker extends CallTracker {
// the hangup reason is user ignoring or timing out. So conn.onDisconnect()
// is not called here. Instead, conn.onLocalDisconnect() is called.
conn.onLocalDisconnect();
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
return;
} else {
try {
@@ -821,7 +821,7 @@ public final class CdmaCallTracker extends CallTracker {
// the status of the call is after a call waiting is answered,
// 3 way call merged or a switch between calls.
foregroundCall.setGeneric(true);
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
}
private Phone.SuppService getFailedService(int what) {
@@ -926,7 +926,7 @@ public final class CdmaCallTracker extends CallTracker {
updatePhoneState();
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
droppedDuringPoll.clear();
break;

View File

@@ -51,6 +51,7 @@ import static com.android.internal.telephony.CommandsInterface.CF_REASON_UNCONDI
import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOICE;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_BASEBAND_VERSION;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallForwardInfo;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.CommandsInterface;
@@ -378,20 +379,19 @@ public class GSMPhone extends PhoneBase {
}
/**
* Notify any interested party of a Phone state change.
* Notify any interested party of a Phone state change {@link Phone.State}
*/
/*package*/ void notifyPhoneStateChanged() {
mNotifier.notifyPhoneState(this);
}
/**
* Notifies registrants (ie, activities in the Phone app) about
* changes to call state (including Phone and Connection changes).
* Notify registrants of a change in the call state. This notifies changes in {@link Call.State}
* Use this when changes in the precise call state are needed, else use notifyPhoneStateChanged.
*/
/*package*/ void
notifyCallStateChanged() {
/*package*/ void notifyPreciseCallStateChanged() {
/* we'd love it if this was package-scoped*/
super.notifyCallStateChangedP();
super.notifyPreciseCallStateChangedP();
}
/*package*/ void

View File

@@ -212,7 +212,7 @@ public final class GsmCallTracker extends CallTracker {
}
updatePhoneState();
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
return pendingMO;
}
@@ -279,7 +279,7 @@ public final class GsmCallTracker extends CallTracker {
internalClearDisconnected();
updatePhoneState();
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
}
boolean
@@ -600,7 +600,7 @@ public final class GsmCallTracker extends CallTracker {
}
if (hasNonHangupStateChanged || newRinging != null) {
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
}
//dumpState();
@@ -883,7 +883,7 @@ public final class GsmCallTracker extends CallTracker {
updatePhoneState();
phone.notifyCallStateChanged();
phone.notifyPreciseCallStateChanged();
droppedDuringPoll.clear();
break;

View File

@@ -81,7 +81,7 @@ public class GSMPhoneTest extends AndroidTestCase implements PerformanceTestCase
mRadioControl = mGSMTestHandler.getSimulatedCommands();
mHandler = mGSMTestHandler.getHandler();
mGSMPhone.registerForPhoneStateChanged(mHandler, EVENT_PHONE_STATE_CHANGED, null);
mGSMPhone.registerForPreciseCallStateChanged(mHandler, EVENT_PHONE_STATE_CHANGED, null);
mGSMPhone.registerForNewRingingConnection(mHandler, EVENT_RINGING, null);
mGSMPhone.registerForDisconnect(mHandler, EVENT_DISCONNECT, null);
@@ -109,7 +109,7 @@ public class GSMPhoneTest extends AndroidTestCase implements PerformanceTestCase
protected void tearDown() throws Exception {
mRadioControl.shutdown();
mGSMPhone.unregisterForPhoneStateChanged(mHandler);
mGSMPhone.unregisterForPreciseCallStateChanged(mHandler);
mGSMPhone.unregisterForNewRingingConnection(mHandler);
mGSMPhone.unregisterForDisconnect(mHandler);
mGSMPhone.setOnPostDialCharacter(mHandler, 0, null);