diff options
| author | 2018-01-24 16:40:14 +0000 | |
|---|---|---|
| committer | 2018-01-24 16:40:14 +0000 | |
| commit | 3deaafd8cd41a4cda1539fc905d5f4f15b3cedec (patch) | |
| tree | 8e1aafb2600192e2f6be2f68880424aa1c0ae3ac | |
| parent | b91d1b3e3a76520a6a983db9be92e887777a1741 (diff) | |
| parent | c584d2772d6579904868dab3562720bfec51112c (diff) | |
Merge "Add PhysicalChannelConfig."
am: c584d2772d
Change-Id: I3377d0502e74e58aed9f2cba746993130a4469dd
3 files changed, 170 insertions, 2 deletions
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index 98ea45158ba1..0ee870aaa24b 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -251,7 +251,15 @@ public class PhoneStateListener { */ public static final int LISTEN_USER_MOBILE_DATA_STATE = 0x00080000; - /* + /** + * Listen for changes to the physical channel configuration. + * + * @see #onPhysicalChannelConfigurationChanged + * @hide + */ + public static final int LISTEN_PHYSICAL_CHANNEL_CONFIGURATION = 0x00100000; + + /* * Subscription used to listen to the phone state changes * @hide */ @@ -362,7 +370,10 @@ public class PhoneStateListener { case LISTEN_CARRIER_NETWORK_CHANGE: PhoneStateListener.this.onCarrierNetworkChange((boolean)msg.obj); break; - + case LISTEN_PHYSICAL_CHANNEL_CONFIGURATION: + PhoneStateListener.this.onPhysicalChannelConfigurationChanged( + (List<PhysicalChannelConfig>)msg.obj); + break; } } }; @@ -561,6 +572,16 @@ public class PhoneStateListener { } /** + * Callback invoked when the current physical channel configuration has changed + * + * @param configs List of the current {@link PhysicalChannelConfig}s + * @hide + */ + public void onPhysicalChannelConfigurationChanged(List<PhysicalChannelConfig> configs) { + // default implementation empty + } + + /** * Callback invoked when telephony has received notice from a carrier * app that a network action that could result in connectivity loss * has been requested by an app using diff --git a/telephony/java/android/telephony/PhysicalChannelConfig.aidl b/telephony/java/android/telephony/PhysicalChannelConfig.aidl new file mode 100644 index 000000000000..651c103b439d --- /dev/null +++ b/telephony/java/android/telephony/PhysicalChannelConfig.aidl @@ -0,0 +1,20 @@ +/* +** +** Copyright 2018, 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 PhysicalChannelConfig;
\ No newline at end of file diff --git a/telephony/java/android/telephony/PhysicalChannelConfig.java b/telephony/java/android/telephony/PhysicalChannelConfig.java new file mode 100644 index 000000000000..651d68d833dc --- /dev/null +++ b/telephony/java/android/telephony/PhysicalChannelConfig.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2018 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; +import android.annotation.IntDef; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * @hide + */ +public final class PhysicalChannelConfig implements Parcelable { + + @Retention(RetentionPolicy.SOURCE) + @IntDef({CONNECTION_PRIMARY_SERVING, CONNECTION_SECONDARY_SERVING}) + public @interface ConnectionStatus {} + + /** + * UE has connection to cell for signalling and possibly data (3GPP 36.331, 25.331). + */ + public static final int CONNECTION_PRIMARY_SERVING = 1; + + /** + * UE has connection to cell for data (3GPP 36.331, 25.331). + */ + public static final int CONNECTION_SECONDARY_SERVING = 2; + + /** + * Connection status of the cell. + * + * <p>One of {@link #CONNECTION_PRIMARY_SERVING}, {@link #CONNECTION_SECONDARY_SERVING}. + */ + private int mCellConnectionStatus; + + /** + * Cell bandwidth, in kHz. + */ + private int mCellBandwidthDownlinkKhz; + + public PhysicalChannelConfig(int status, int bandwidth) { + mCellConnectionStatus = status; + mCellBandwidthDownlinkKhz = bandwidth; + } + + public PhysicalChannelConfig(Parcel in) { + mCellConnectionStatus = in.readInt(); + mCellBandwidthDownlinkKhz = in.readInt(); + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mCellConnectionStatus); + dest.writeInt(mCellBandwidthDownlinkKhz); + } + + /** + * @return Cell bandwidth, in kHz + */ + public int getCellBandwidthDownlink() { + return mCellBandwidthDownlinkKhz; + } + + /** + * Gets the connection status of the cell. + * + * @see #CONNECTION_PRIMARY_SERVING + * @see #CONNECTION_SECONDARY_SERVING + * + * @return Connection status of the cell + */ + @ConnectionStatus + public int getConnectionStatus() { + return mCellConnectionStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (!(o instanceof PhysicalChannelConfig)) { + return false; + } + + PhysicalChannelConfig config = (PhysicalChannelConfig) o; + return mCellConnectionStatus == config.mCellConnectionStatus + && mCellBandwidthDownlinkKhz == config.mCellBandwidthDownlinkKhz; + } + + @Override + public int hashCode() { + return (mCellBandwidthDownlinkKhz * 29) + (mCellConnectionStatus * 31); + } + + public static final Parcelable.Creator<PhysicalChannelConfig> CREATOR = + new Parcelable.Creator<PhysicalChannelConfig>() { + public PhysicalChannelConfig createFromParcel(Parcel in) { + return new PhysicalChannelConfig(in); + } + + public PhysicalChannelConfig[] newArray(int size) { + return new PhysicalChannelConfig[size]; + } + }; +} |