diff options
author | John Wang <johnwang@google.com> | 2012-04-05 16:51:32 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-05 16:51:32 -0700 |
commit | 2119ade6d737345d58145e773f5877c199a3e20d (patch) | |
tree | a50837bde2072400d71f5d67d9a2c64fccf6d17c /services | |
parent | 818e7e9c83ade56574a605e54125b4fdb1b91aaf (diff) | |
parent | 963db55d59a170f4b17ff907c96615a19ef6fe17 (diff) | |
download | frameworks_base-2119ade6d737345d58145e773f5877c199a3e20d.zip frameworks_base-2119ade6d737345d58145e773f5877c199a3e20d.tar.gz frameworks_base-2119ade6d737345d58145e773f5877c199a3e20d.tar.bz2 |
Merge "Enhance Cell Location Api."
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/TelephonyRegistry.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java index 8c8e725..1b1638a 100644 --- a/services/java/com/android/server/TelephonyRegistry.java +++ b/services/java/com/android/server/TelephonyRegistry.java @@ -29,6 +29,7 @@ import android.telephony.CellLocation; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; +import android.telephony.CellInfo; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Slog; @@ -107,6 +108,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private int mOtaspMode = ServiceStateTracker.OTASP_UNKNOWN; + private CellInfo mCellInfo = null; + static final int PHONE_STATE_PERMISSION_MASK = PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR | PhoneStateListener.LISTEN_CALL_STATE | @@ -236,6 +239,13 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { remove(r.binder); } } + if ((events & PhoneStateListener.LISTEN_CELL_INFO) != 0) { + try { + r.callback.onCellInfoChanged(new CellInfo(mCellInfo)); + } catch (RemoteException ex) { + remove(r.binder); + } + } } } } else { @@ -325,6 +335,26 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { broadcastSignalStrengthChanged(signalStrength); } + public void notifyCellInfo(CellInfo cellInfo) { + if (!checkNotifyPermission("notifyCellInfo()")) { + return; + } + + synchronized (mRecords) { + mCellInfo = cellInfo; + for (Record r : mRecords) { + if ((r.events & PhoneStateListener.LISTEN_CELL_INFO) != 0) { + try { + r.callback.onCellInfoChanged(new CellInfo(cellInfo)); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } + } + } + handleRemoveListLocked(); + } + } + public void notifyMessageWaitingChanged(boolean mwi) { if (!checkNotifyPermission("notifyMessageWaitingChanged()")) { return; @@ -530,6 +560,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { pw.println(" mDataConnectionLinkProperties=" + mDataConnectionLinkProperties); pw.println(" mDataConnectionLinkCapabilities=" + mDataConnectionLinkCapabilities); pw.println(" mCellLocation=" + mCellLocation); + pw.println(" mCellInfo=" + mCellInfo); pw.println("registrations: count=" + recordCount); for (Record r : mRecords) { pw.println(" " + r.pkgForDebug + " 0x" + Integer.toHexString(r.events)); @@ -655,6 +686,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } + if ((events & PhoneStateListener.LISTEN_CELL_INFO) != 0) { + mContext.enforceCallingOrSelfPermission( + android.Manifest.permission.ACCESS_COARSE_LOCATION, null); + + } + if ((events & PHONE_STATE_PERMISSION_MASK) != 0) { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.READ_PHONE_STATE, null); |