summaryrefslogtreecommitdiffstats
path: root/telephony/java/android/telephony/PhoneStateListener.java
diff options
context:
space:
mode:
authorJohn Wang <johnwang@google.com>2012-03-30 16:04:06 -0700
committerJohn Wang <johnwang@google.com>2012-04-05 11:30:37 -0700
commit963db55d59a170f4b17ff907c96615a19ef6fe17 (patch)
tree31256fd7b86014cf11b5e0ba54a7ba662908007a /telephony/java/android/telephony/PhoneStateListener.java
parentdedf1b2727556223aafcebba1a567ffa816412d2 (diff)
downloadframeworks_base-963db55d59a170f4b17ff907c96615a19ef6fe17.zip
frameworks_base-963db55d59a170f4b17ff907c96615a19ef6fe17.tar.gz
frameworks_base-963db55d59a170f4b17ff907c96615a19ef6fe17.tar.bz2
Enhance Cell Location Api.
To boost accurary and enhance capability of cell location api, two new APIs, TelephonyManager.getAllCellInfo() and TelephonyManager.listen(LISTEN_CELL_INFO), are added. Two new Class, CellInfo and CellIdentity, are created. This API change returns all information of one cell locaiton at the same time. It also provides additional LTE and timestamp information. Change-Id: I4d0f813107e625ec4ac88c8d980ffd171aa5fc30
Diffstat (limited to 'telephony/java/android/telephony/PhoneStateListener.java')
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index eda9b71..698206c 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -22,6 +22,7 @@ import android.os.Message;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.CellLocation;
+import android.telephony.CellInfo;
import android.util.Log;
import com.android.internal.telephony.IPhoneStateListener;
@@ -156,6 +157,14 @@ public class PhoneStateListener {
*/
public static final int LISTEN_OTASP_CHANGED = 0x00000200;
+ /**
+ * Listen for changes to observed cell info.
+ *
+ * @see #onCellInfoChanged
+ * @hide pending API review
+ */
+ public static final int LISTEN_CELL_INFO = 0x00000400;
+
public PhoneStateListener() {
}
@@ -276,6 +285,20 @@ public class PhoneStateListener {
}
/**
+ * Callback invoked when a observed cell info gets changed.
+ *
+ * A notification should be sent when:
+ * 1. a cell is newly-observed.
+ * 2. a observed cell is not visible.
+ * 3. any of the cell info of a observed cell has changed.
+ *
+ * @hide pending API review
+ */
+ public void onCellInfoChanged(CellInfo cellInfo) {
+ // default implementation empty
+ }
+
+ /**
* The callback methods need to be called on the handler thread where
* this object was created. If the binder did that for us it'd be nice.
*/
@@ -323,6 +346,10 @@ public class PhoneStateListener {
public void onOtaspChanged(int otaspMode) {
Message.obtain(mHandler, LISTEN_OTASP_CHANGED, otaspMode, 0).sendToTarget();
}
+
+ public void onCellInfoChanged(CellInfo cellInfo) {
+ Message.obtain(mHandler, LISTEN_CELL_INFO, 0, 0).sendToTarget();
+ }
};
Handler mHandler = new Handler() {
@@ -360,6 +387,8 @@ public class PhoneStateListener {
case LISTEN_OTASP_CHANGED:
PhoneStateListener.this.onOtaspChanged(msg.arg1);
break;
+ case LISTEN_CELL_INFO:
+ PhoneStateListener.this.onCellInfoChanged((CellInfo)msg.obj);
}
}
};