Loading api/current.txt +12 −0 Original line number Diff line number Diff line Loading @@ -25202,6 +25202,18 @@ package android.telephony { field public static final android.os.Parcelable.Creator CREATOR; } public class DataConnectionRealTimeInfo implements android.os.Parcelable { method public int describeContents(); method public int getDcPowerState(); method public long getTime(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; field public static int DC_POWER_STATE_HIGH; field public static int DC_POWER_STATE_LOW; field public static int DC_POWER_STATE_MEDIUM; field public static int DC_POWER_STATE_UNKNOWN; } public class NeighboringCellInfo implements android.os.Parcelable { ctor public deprecated NeighboringCellInfo(); ctor public deprecated NeighboringCellInfo(int, int); services/core/java/com/android/server/TelephonyRegistry.java +36 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.telephony.CellLocation; import android.telephony.DataConnectionRealTimeInfo; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; Loading Loading @@ -129,6 +130,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private List<CellInfo> mCellInfo = null; private DataConnectionRealTimeInfo mDcRtInfo = new DataConnectionRealTimeInfo(); private int mRingingCallState = PreciseCallState.PRECISE_CALL_STATE_IDLE; private int mForegroundCallState = PreciseCallState.PRECISE_CALL_STATE_IDLE; Loading Loading @@ -324,6 +327,13 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { remove(r.binder); } } if ((events & PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO) != 0) { try { r.callback.onDataConnectionRealTimeInfoChanged(mDcRtInfo); } catch (RemoteException ex) { remove(r.binder); } } if ((events & PhoneStateListener.LISTEN_PRECISE_CALL_STATE) != 0) { try { r.callback.onPreciseCallStateChanged(mPreciseCallState); Loading Loading @@ -451,6 +461,31 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } } public void notifyDataConnectionRealTimeInfo(DataConnectionRealTimeInfo dcRtInfo) { if (!checkNotifyPermission("notifyDataConnectionRealTimeInfo()")) { return; } synchronized (mRecords) { mDcRtInfo = dcRtInfo; for (Record r : mRecords) { if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO)) { try { if (DBG_LOC) { Slog.d(TAG, "notifyDataConnectionRealTimeInfo: mDcRtInfo=" + mDcRtInfo + " r=" + r); } r.callback.onDataConnectionRealTimeInfoChanged(mDcRtInfo); } catch (RemoteException ex) { mRemoveList.add(r.binder); } } } handleRemoveListLocked(); } } public void notifyMessageWaitingChanged(boolean mwi) { if (!checkNotifyPermission("notifyMessageWaitingChanged()")) { return; Loading Loading @@ -754,6 +789,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { pw.println(" mDataConnectionLinkCapabilities=" + mDataConnectionLinkCapabilities); pw.println(" mCellLocation=" + mCellLocation); pw.println(" mCellInfo=" + mCellInfo); pw.println(" mDcRtInfo=" + mDcRtInfo); pw.println("registrations: count=" + recordCount); for (Record r : mRecords) { pw.println(" " + r.pkgForDebug + " 0x" + Integer.toHexString(r.events)); Loading telephony/java/android/telephony/DataConnectionRealTimeInfo.aidl 0 → 100644 +20 −0 Original line number Diff line number Diff line /* ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package android.telephony; parcelable DataConnectionRealTimeInfo; telephony/java/android/telephony/DataConnectionRealTimeInfo.java 0 → 100644 +138 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.telephony; import android.os.Parcel; import android.os.Parcelable; /** * Data connection real time information * * TODO: How to handle multiple subscriptions? */ public class DataConnectionRealTimeInfo implements Parcelable { private long mTime; // Time the info was collected since boot in nanos; public static int DC_POWER_STATE_LOW = 1; public static int DC_POWER_STATE_MEDIUM = 2; public static int DC_POWER_STATE_HIGH = 3; public static int DC_POWER_STATE_UNKNOWN = Integer.MAX_VALUE; private int mDcPowerState; // DC_POWER_STATE_[LOW | MEDIUM | HIGH | UNKNOWN] /** * Constructor * * @hide */ public DataConnectionRealTimeInfo(long time, int dcPowerState) { mTime = time; mDcPowerState = dcPowerState; } /** * Constructor * * @hide */ public DataConnectionRealTimeInfo() { mTime = Long.MAX_VALUE; mDcPowerState = DC_POWER_STATE_UNKNOWN; } /** * Construct a PreciseCallState object from the given parcel. */ private DataConnectionRealTimeInfo(Parcel in) { mTime = in.readLong(); mDcPowerState = in.readInt(); } /** * @return time the information was collected or Long.MAX_VALUE if unknown */ public long getTime() { return mTime; } /** * @return DC_POWER_STATE_[LOW | MEDIUM | HIGH | UNKNOWN] */ public int getDcPowerState() { return mDcPowerState; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel out, int flags) { out.writeLong(mTime); out.writeInt(mDcPowerState); } public static final Parcelable.Creator<DataConnectionRealTimeInfo> CREATOR = new Parcelable.Creator<DataConnectionRealTimeInfo>() { @Override public DataConnectionRealTimeInfo createFromParcel(Parcel in) { return new DataConnectionRealTimeInfo(in); } @Override public DataConnectionRealTimeInfo[] newArray(int size) { return new DataConnectionRealTimeInfo[size]; } }; @Override public int hashCode() { final long prime = 17; long result = 1; result = (prime * result) + mTime; result += (prime * result) + mDcPowerState; return (int)result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } DataConnectionRealTimeInfo other = (DataConnectionRealTimeInfo) obj; return (mTime == other.mTime) && (mDcPowerState == other.mDcPowerState); } @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("mTime=").append(mTime); sb.append(" mDcPowerState=").append(mDcPowerState); return sb.toString(); } } telephony/java/android/telephony/PhoneStateListener.java +32 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,17 @@ public class PhoneStateListener { */ public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 0x00001000; /** * Listen for real time info for all data connections (cellular)). * {@more} * Requires Permission: {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE * READ_PRECISE_PHONE_STATE} * * @see #onDataConnectionRealTimeInfoChanged(DataConnectionRealTimeInfo) * @hide */ public static final int LISTEN_DATA_CONNECTION_REAL_TIME_INFO = 0x00002000; public PhoneStateListener() { } Loading Loading @@ -334,6 +345,16 @@ public class PhoneStateListener { // default implementation empty } /** * Callback invoked when data connection state changes with precise information. * * @hide */ public void onDataConnectionRealTimeInfoChanged( DataConnectionRealTimeInfo dcRtInfo) { // 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. Loading Loading @@ -396,6 +417,12 @@ public class PhoneStateListener { Message.obtain(mHandler, LISTEN_PRECISE_DATA_CONNECTION_STATE, 0, 0, dataConnectionState).sendToTarget(); } public void onDataConnectionRealTimeInfoChanged( DataConnectionRealTimeInfo dcRtInfo) { Message.obtain(mHandler, LISTEN_DATA_CONNECTION_REAL_TIME_INFO, 0, 0, dcRtInfo).sendToTarget(); } }; Handler mHandler = new Handler() { Loading Loading @@ -441,6 +468,11 @@ public class PhoneStateListener { 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; } } }; Loading Loading
api/current.txt +12 −0 Original line number Diff line number Diff line Loading @@ -25202,6 +25202,18 @@ package android.telephony { field public static final android.os.Parcelable.Creator CREATOR; } public class DataConnectionRealTimeInfo implements android.os.Parcelable { method public int describeContents(); method public int getDcPowerState(); method public long getTime(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; field public static int DC_POWER_STATE_HIGH; field public static int DC_POWER_STATE_LOW; field public static int DC_POWER_STATE_MEDIUM; field public static int DC_POWER_STATE_UNKNOWN; } public class NeighboringCellInfo implements android.os.Parcelable { ctor public deprecated NeighboringCellInfo(); ctor public deprecated NeighboringCellInfo(int, int);
services/core/java/com/android/server/TelephonyRegistry.java +36 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.telephony.CellLocation; import android.telephony.DataConnectionRealTimeInfo; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; Loading Loading @@ -129,6 +130,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private List<CellInfo> mCellInfo = null; private DataConnectionRealTimeInfo mDcRtInfo = new DataConnectionRealTimeInfo(); private int mRingingCallState = PreciseCallState.PRECISE_CALL_STATE_IDLE; private int mForegroundCallState = PreciseCallState.PRECISE_CALL_STATE_IDLE; Loading Loading @@ -324,6 +327,13 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { remove(r.binder); } } if ((events & PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO) != 0) { try { r.callback.onDataConnectionRealTimeInfoChanged(mDcRtInfo); } catch (RemoteException ex) { remove(r.binder); } } if ((events & PhoneStateListener.LISTEN_PRECISE_CALL_STATE) != 0) { try { r.callback.onPreciseCallStateChanged(mPreciseCallState); Loading Loading @@ -451,6 +461,31 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } } public void notifyDataConnectionRealTimeInfo(DataConnectionRealTimeInfo dcRtInfo) { if (!checkNotifyPermission("notifyDataConnectionRealTimeInfo()")) { return; } synchronized (mRecords) { mDcRtInfo = dcRtInfo; for (Record r : mRecords) { if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO)) { try { if (DBG_LOC) { Slog.d(TAG, "notifyDataConnectionRealTimeInfo: mDcRtInfo=" + mDcRtInfo + " r=" + r); } r.callback.onDataConnectionRealTimeInfoChanged(mDcRtInfo); } catch (RemoteException ex) { mRemoveList.add(r.binder); } } } handleRemoveListLocked(); } } public void notifyMessageWaitingChanged(boolean mwi) { if (!checkNotifyPermission("notifyMessageWaitingChanged()")) { return; Loading Loading @@ -754,6 +789,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { pw.println(" mDataConnectionLinkCapabilities=" + mDataConnectionLinkCapabilities); pw.println(" mCellLocation=" + mCellLocation); pw.println(" mCellInfo=" + mCellInfo); pw.println(" mDcRtInfo=" + mDcRtInfo); pw.println("registrations: count=" + recordCount); for (Record r : mRecords) { pw.println(" " + r.pkgForDebug + " 0x" + Integer.toHexString(r.events)); Loading
telephony/java/android/telephony/DataConnectionRealTimeInfo.aidl 0 → 100644 +20 −0 Original line number Diff line number Diff line /* ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package android.telephony; parcelable DataConnectionRealTimeInfo;
telephony/java/android/telephony/DataConnectionRealTimeInfo.java 0 → 100644 +138 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.telephony; import android.os.Parcel; import android.os.Parcelable; /** * Data connection real time information * * TODO: How to handle multiple subscriptions? */ public class DataConnectionRealTimeInfo implements Parcelable { private long mTime; // Time the info was collected since boot in nanos; public static int DC_POWER_STATE_LOW = 1; public static int DC_POWER_STATE_MEDIUM = 2; public static int DC_POWER_STATE_HIGH = 3; public static int DC_POWER_STATE_UNKNOWN = Integer.MAX_VALUE; private int mDcPowerState; // DC_POWER_STATE_[LOW | MEDIUM | HIGH | UNKNOWN] /** * Constructor * * @hide */ public DataConnectionRealTimeInfo(long time, int dcPowerState) { mTime = time; mDcPowerState = dcPowerState; } /** * Constructor * * @hide */ public DataConnectionRealTimeInfo() { mTime = Long.MAX_VALUE; mDcPowerState = DC_POWER_STATE_UNKNOWN; } /** * Construct a PreciseCallState object from the given parcel. */ private DataConnectionRealTimeInfo(Parcel in) { mTime = in.readLong(); mDcPowerState = in.readInt(); } /** * @return time the information was collected or Long.MAX_VALUE if unknown */ public long getTime() { return mTime; } /** * @return DC_POWER_STATE_[LOW | MEDIUM | HIGH | UNKNOWN] */ public int getDcPowerState() { return mDcPowerState; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel out, int flags) { out.writeLong(mTime); out.writeInt(mDcPowerState); } public static final Parcelable.Creator<DataConnectionRealTimeInfo> CREATOR = new Parcelable.Creator<DataConnectionRealTimeInfo>() { @Override public DataConnectionRealTimeInfo createFromParcel(Parcel in) { return new DataConnectionRealTimeInfo(in); } @Override public DataConnectionRealTimeInfo[] newArray(int size) { return new DataConnectionRealTimeInfo[size]; } }; @Override public int hashCode() { final long prime = 17; long result = 1; result = (prime * result) + mTime; result += (prime * result) + mDcPowerState; return (int)result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } DataConnectionRealTimeInfo other = (DataConnectionRealTimeInfo) obj; return (mTime == other.mTime) && (mDcPowerState == other.mDcPowerState); } @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("mTime=").append(mTime); sb.append(" mDcPowerState=").append(mDcPowerState); return sb.toString(); } }
telephony/java/android/telephony/PhoneStateListener.java +32 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,17 @@ public class PhoneStateListener { */ public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 0x00001000; /** * Listen for real time info for all data connections (cellular)). * {@more} * Requires Permission: {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE * READ_PRECISE_PHONE_STATE} * * @see #onDataConnectionRealTimeInfoChanged(DataConnectionRealTimeInfo) * @hide */ public static final int LISTEN_DATA_CONNECTION_REAL_TIME_INFO = 0x00002000; public PhoneStateListener() { } Loading Loading @@ -334,6 +345,16 @@ public class PhoneStateListener { // default implementation empty } /** * Callback invoked when data connection state changes with precise information. * * @hide */ public void onDataConnectionRealTimeInfoChanged( DataConnectionRealTimeInfo dcRtInfo) { // 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. Loading Loading @@ -396,6 +417,12 @@ public class PhoneStateListener { Message.obtain(mHandler, LISTEN_PRECISE_DATA_CONNECTION_STATE, 0, 0, dataConnectionState).sendToTarget(); } public void onDataConnectionRealTimeInfoChanged( DataConnectionRealTimeInfo dcRtInfo) { Message.obtain(mHandler, LISTEN_DATA_CONNECTION_REAL_TIME_INFO, 0, 0, dcRtInfo).sendToTarget(); } }; Handler mHandler = new Handler() { Loading Loading @@ -441,6 +468,11 @@ public class PhoneStateListener { 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; } } }; Loading