diff options
| author | Dianne Hackborn <hackbod@google.com> | 2014-04-24 18:28:32 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-24 18:28:32 +0000 |
| commit | 806047caca937d8e3d067b5fb6d5264fd3731904 (patch) | |
| tree | f193d0c828bc645cf6061d97505e30d9f275a4e2 /telephony | |
| parent | 46ca506022cb51543dea0489587477f60c570d5f (diff) | |
| parent | 2ffa11e4b71c545e34533ef827bdc1a07fbe8246 (diff) | |
| download | frameworks_base-806047caca937d8e3d067b5fb6d5264fd3731904.zip frameworks_base-806047caca937d8e3d067b5fb6d5264fd3731904.tar.gz frameworks_base-806047caca937d8e3d067b5fb6d5264fd3731904.tar.bz2 | |
Merge "Start collecting mobile radio activity from the radio."
Diffstat (limited to 'telephony')
| -rw-r--r-- | telephony/java/android/telephony/DataConnectionRealTimeInfo.java | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/PhoneStateListener.java | 113 |
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; - } - } - }; } |
