Merge "Add PhysicalChannelConfig."

am: c584d2772d

Change-Id: I3377d0502e74e58aed9f2cba746993130a4469dd
This commit is contained in:
Eric Schwarzenbach
2018-01-24 16:40:14 +00:00
committed by android-build-merger
3 changed files with 170 additions and 2 deletions

View File

@@ -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;
}
}
};
@@ -560,6 +571,16 @@ public class PhoneStateListener {
// default implementation empty
}
/**
* 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

View File

@@ -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;

View File

@@ -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];
}
};
}