summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/DataConnectionRealTimeInfo.java1
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java113
2 files changed, 62 insertions, 52 deletions
diff --git a/telephony/java/android/telephony/DataConnectionRealTimeInfo.java b/telephony/java/android/telephony/DataConnectionRealTimeInfo.java
index 4a9ae39..96069213 100644
--- a/telephony/java/android/telephony/DataConnectionRealTimeInfo.java
+++ b/telephony/java/android/telephony/DataConnectionRealTimeInfo.java
@@ -23,6 +23,7 @@ import android.os.Parcelable;
* Data connection real time information
*
* TODO: How to handle multiple subscriptions?
+ * @hide
*/
public class DataConnectionRealTimeInfo implements Parcelable {
private long mTime; // Time the info was collected since boot in nanos;
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index 7c5c648..59ec6f5 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -18,6 +18,7 @@ package android.telephony;
import android.os.Bundle;
import android.os.Handler;
+import android.os.Looper;
import android.os.Message;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
@@ -199,7 +200,67 @@ public class PhoneStateListener {
*/
public static final int LISTEN_DATA_CONNECTION_REAL_TIME_INFO = 0x00002000;
+ private final Handler mHandler;
+
public PhoneStateListener() {
+ this(Looper.myLooper());
+ }
+
+ /** @hide */
+ public PhoneStateListener(Looper looper) {
+ mHandler = new Handler(looper) {
+ public void handleMessage(Message msg) {
+ //Rlog.d("TelephonyRegistry", "what=0x" + Integer.toHexString(msg.what)
+ // + " msg=" + msg);
+ switch (msg.what) {
+ case LISTEN_SERVICE_STATE:
+ PhoneStateListener.this.onServiceStateChanged((ServiceState)msg.obj);
+ break;
+ case LISTEN_SIGNAL_STRENGTH:
+ PhoneStateListener.this.onSignalStrengthChanged(msg.arg1);
+ break;
+ case LISTEN_MESSAGE_WAITING_INDICATOR:
+ PhoneStateListener.this.onMessageWaitingIndicatorChanged(msg.arg1 != 0);
+ break;
+ case LISTEN_CALL_FORWARDING_INDICATOR:
+ PhoneStateListener.this.onCallForwardingIndicatorChanged(msg.arg1 != 0);
+ break;
+ case LISTEN_CELL_LOCATION:
+ PhoneStateListener.this.onCellLocationChanged((CellLocation)msg.obj);
+ break;
+ case LISTEN_CALL_STATE:
+ PhoneStateListener.this.onCallStateChanged(msg.arg1, (String)msg.obj);
+ break;
+ case LISTEN_DATA_CONNECTION_STATE:
+ PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1, msg.arg2);
+ PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1);
+ break;
+ case LISTEN_DATA_ACTIVITY:
+ PhoneStateListener.this.onDataActivity(msg.arg1);
+ break;
+ case LISTEN_SIGNAL_STRENGTHS:
+ PhoneStateListener.this.onSignalStrengthsChanged((SignalStrength)msg.obj);
+ break;
+ case LISTEN_OTASP_CHANGED:
+ PhoneStateListener.this.onOtaspChanged(msg.arg1);
+ break;
+ case LISTEN_CELL_INFO:
+ PhoneStateListener.this.onCellInfoChanged((List<CellInfo>)msg.obj);
+ break;
+ case LISTEN_PRECISE_CALL_STATE:
+ PhoneStateListener.this.onPreciseCallStateChanged((PreciseCallState)msg.obj);
+ break;
+ case LISTEN_PRECISE_DATA_CONNECTION_STATE:
+ PhoneStateListener.this.onPreciseDataConnectionStateChanged(
+ (PreciseDataConnectionState)msg.obj);
+ break;
+ case LISTEN_DATA_CONNECTION_REAL_TIME_INFO:
+ PhoneStateListener.this.onDataConnectionRealTimeInfoChanged(
+ (DataConnectionRealTimeInfo)msg.obj);
+ break;
+ }
+ }
+ };
}
/**
@@ -424,56 +485,4 @@ public class PhoneStateListener {
dcRtInfo).sendToTarget();
}
};
-
- Handler mHandler = new Handler() {
- public void handleMessage(Message msg) {
- //Rlog.d("TelephonyRegistry", "what=0x" + Integer.toHexString(msg.what) + " msg=" + msg);
- switch (msg.what) {
- case LISTEN_SERVICE_STATE:
- PhoneStateListener.this.onServiceStateChanged((ServiceState)msg.obj);
- break;
- case LISTEN_SIGNAL_STRENGTH:
- PhoneStateListener.this.onSignalStrengthChanged(msg.arg1);
- break;
- case LISTEN_MESSAGE_WAITING_INDICATOR:
- PhoneStateListener.this.onMessageWaitingIndicatorChanged(msg.arg1 != 0);
- break;
- case LISTEN_CALL_FORWARDING_INDICATOR:
- PhoneStateListener.this.onCallForwardingIndicatorChanged(msg.arg1 != 0);
- break;
- case LISTEN_CELL_LOCATION:
- PhoneStateListener.this.onCellLocationChanged((CellLocation)msg.obj);
- break;
- case LISTEN_CALL_STATE:
- PhoneStateListener.this.onCallStateChanged(msg.arg1, (String)msg.obj);
- break;
- case LISTEN_DATA_CONNECTION_STATE:
- PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1, msg.arg2);
- PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1);
- break;
- case LISTEN_DATA_ACTIVITY:
- PhoneStateListener.this.onDataActivity(msg.arg1);
- break;
- case LISTEN_SIGNAL_STRENGTHS:
- PhoneStateListener.this.onSignalStrengthsChanged((SignalStrength)msg.obj);
- break;
- case LISTEN_OTASP_CHANGED:
- PhoneStateListener.this.onOtaspChanged(msg.arg1);
- break;
- case LISTEN_CELL_INFO:
- PhoneStateListener.this.onCellInfoChanged((List<CellInfo>)msg.obj);
- break;
- case LISTEN_PRECISE_CALL_STATE:
- PhoneStateListener.this.onPreciseCallStateChanged((PreciseCallState)msg.obj);
- break;
- case LISTEN_PRECISE_DATA_CONNECTION_STATE:
- PhoneStateListener.this.onPreciseDataConnectionStateChanged((PreciseDataConnectionState)msg.obj);
- break;
- case LISTEN_DATA_CONNECTION_REAL_TIME_INFO:
- PhoneStateListener.this.onDataConnectionRealTimeInfoChanged(
- (DataConnectionRealTimeInfo)msg.obj);
- break;
- }
- }
- };
}