1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.internal.telephony.uicc; 18 19 import android.telephony.SubscriptionInfo; 20 import android.text.TextUtils; 21 22 import java.util.Objects; 23 24 public class IccSimPortInfo { 25 26 public String mIccId; /* iccid of the currently enabled profile */ 27 public int mLogicalSlotIndex; /* logical slotId of the active slot */ 28 public boolean mPortActive; /* port state in the slot */ 29 30 @Override equals(Object obj)31 public boolean equals(Object obj) { 32 if (this == obj) { 33 return true; 34 } 35 if (obj == null || getClass() != obj.getClass()) { 36 return false; 37 } 38 39 IccSimPortInfo that = (IccSimPortInfo) obj; 40 return (mPortActive == that.mPortActive) 41 && (mLogicalSlotIndex == that.mLogicalSlotIndex) 42 && (TextUtils.equals(mIccId, that.mIccId)); 43 } 44 45 @Override hashCode()46 public int hashCode() { 47 return Objects.hash(mPortActive, mLogicalSlotIndex, mIccId); 48 } 49 50 @Override toString()51 public String toString() { 52 StringBuilder sb = new StringBuilder(); 53 sb.append("{").append("iccid=") 54 .append(SubscriptionInfo.getPrintableId(mIccId)).append(",") 55 .append("logicalSlotIndex=").append(mLogicalSlotIndex).append(",") 56 .append("portActive=").append(mPortActive) 57 .append("}"); 58 return sb.toString(); 59 } 60 }