Merge "Updating the error message for clear understanding of Deprecated methods. Test: manual Bug: 234089071" into tm-dev

This commit is contained in:
Chen Xu
2022-05-27 20:53:12 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 3 deletions

View File

@@ -162,7 +162,8 @@ public final class UiccCardInfo implements Parcelable {
@Deprecated @Deprecated
public String getIccId() { public String getIccId() {
if (mIccIdAccessRestricted) { if (mIccIdAccessRestricted) {
throw new UnsupportedOperationException("getIccId from UiccPortInfo"); throw new UnsupportedOperationException("getIccId() is not supported by UiccCardInfo."
+ " Please Use UiccPortInfo API instead");
} }
//always return ICCID from first port. //always return ICCID from first port.
return getPorts().stream().findFirst().get().getIccId(); return getPorts().stream().findFirst().get().getIccId();

View File

@@ -161,7 +161,8 @@ public class UiccSlotInfo implements Parcelable {
@Deprecated @Deprecated
public boolean getIsActive() { public boolean getIsActive() {
if (mLogicalSlotAccessRestricted) { if (mLogicalSlotAccessRestricted) {
throw new UnsupportedOperationException("get port status from UiccPortInfo"); throw new UnsupportedOperationException("getIsActive() is not supported by "
+ "UiccSlotInfo. Please Use UiccPortInfo API instead");
} }
//always return status from first port. //always return status from first port.
return getPorts().stream().findFirst().get().isActive(); return getPorts().stream().findFirst().get().isActive();
@@ -198,7 +199,8 @@ public class UiccSlotInfo implements Parcelable {
@Deprecated @Deprecated
public int getLogicalSlotIdx() { public int getLogicalSlotIdx() {
if (mLogicalSlotAccessRestricted) { if (mLogicalSlotAccessRestricted) {
throw new UnsupportedOperationException("get logical slot index from UiccPortInfo"); throw new UnsupportedOperationException("getLogicalSlotIdx() is not supported by "
+ "UiccSlotInfo. Please use UiccPortInfo API instead");
} }
//always return logical slot index from first port. //always return logical slot index from first port.
//portList always have at least one element. //portList always have at least one element.