From a0349b96409261ac9f6de65af8d281a287cb5f38 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Fri, 21 Feb 2020 01:34:57 +0000 Subject: [PATCH] Revert "PhoneCapability cleanup" This reverts commit d2283c4067a2458070821cb6dee10ec5b773424f. Reason for revert: Change not supported by vendor Change-Id: Ie435e8f049a621bf02c79c8154eef395c96c9ed3 Merged-In: Ia6a528b5677eb561a0845fca3d8141385d8bc2da --- .../java/android/telephony/ModemInfo.java | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 telephony/java/android/telephony/ModemInfo.java diff --git a/telephony/java/android/telephony/ModemInfo.java b/telephony/java/android/telephony/ModemInfo.java new file mode 100644 index 0000000000000..c0833af954d8f --- /dev/null +++ b/telephony/java/android/telephony/ModemInfo.java @@ -0,0 +1,109 @@ +/* + * 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 java.util.Objects; + +/** + * Information of a single logical modem indicating + * its id, supported rats and whether it supports voice or data, etc. + * @hide + */ +public class ModemInfo implements Parcelable { + public final int modemId; + public final int rat; /* bitset */ + public final boolean isVoiceSupported; + public final boolean isDataSupported; + + // TODO b/121394331: Clean up this class after V1_1.PhoneCapability cleanup. + public ModemInfo(int modemId) { + this(modemId, 0, true, true); + } + + public ModemInfo(int modemId, int rat, boolean isVoiceSupported, boolean isDataSupported) { + this.modemId = modemId; + this.rat = rat; + this.isVoiceSupported = isVoiceSupported; + this.isDataSupported = isDataSupported; + } + + public ModemInfo(Parcel in) { + modemId = in.readInt(); + rat = in.readInt(); + isVoiceSupported = in.readBoolean(); + isDataSupported = in.readBoolean(); + } + + @Override + public String toString() { + return "modemId=" + modemId + " rat=" + rat + " isVoiceSupported:" + isVoiceSupported + + " isDataSupported:" + isDataSupported; + } + + @Override + public int hashCode() { + return Objects.hash(modemId, rat, isVoiceSupported, isDataSupported); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof ModemInfo) || hashCode() != o.hashCode()) { + return false; + } + + if (this == o) { + return true; + } + + ModemInfo s = (ModemInfo) o; + + return (modemId == s.modemId + && rat == s.rat + && isVoiceSupported == s.isVoiceSupported + && isDataSupported == s.isDataSupported); + } + + /** + * {@link Parcelable#describeContents} + */ + public @ContentsFlags int describeContents() { + return 0; + } + + /** + * {@link Parcelable#writeToParcel} + */ + public void writeToParcel(Parcel dest, @WriteFlags int flags) { + dest.writeInt(modemId); + dest.writeInt(rat); + dest.writeBoolean(isVoiceSupported); + dest.writeBoolean(isDataSupported); + } + + public static final @android.annotation.NonNull Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ModemInfo createFromParcel(Parcel in) { + return new ModemInfo(in); + } + + public ModemInfo[] newArray(int size) { + return new ModemInfo[size]; + } + }; +}