| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
package android.service.euicc; |
| 17 |
|
| 18 |
import android.annotation.Nullable; |
| 19 |
import android.annotation.SystemApi; |
| 20 |
import android.os.Parcel; |
| 21 |
import android.os.Parcelable; |
| 22 |
|
| 23 |
import java.util.Arrays; |
| 24 |
import java.util.List; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
@SystemApi |
| 31 |
public final class GetEuiccProfileInfoListResult implements Parcelable { |
| 32 |
|
| 33 |
public static final @android.annotation.NonNull Creator<GetEuiccProfileInfoListResult> CREATOR = |
| 34 |
new Creator<GetEuiccProfileInfoListResult>() { |
| 35 |
@Override |
| 36 |
public GetEuiccProfileInfoListResult createFromParcel(Parcel in) { |
| 37 |
return new GetEuiccProfileInfoListResult(in); |
| 38 |
} |
| 39 |
|
| 40 |
@Override |
| 41 |
public GetEuiccProfileInfoListResult[] newArray(int size) { |
| 42 |
return new GetEuiccProfileInfoListResult[size]; |
| 43 |
} |
| 44 |
}; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
@Deprecated |
| 51 |
public final int result; |
| 52 |
|
| 53 |
@Nullable |
| 54 |
private final EuiccProfileInfo[] mProfiles; |
| 55 |
|
| 56 |
private final boolean mIsRemovable; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
public int getResult() { |
| 65 |
return result; |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
@Nullable |
| 70 |
public List<EuiccProfileInfo> getProfiles() { |
| 71 |
if (mProfiles == null) return null; |
| 72 |
return Arrays.asList(mProfiles); |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
public boolean getIsRemovable() { |
| 77 |
return mIsRemovable; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
public GetEuiccProfileInfoListResult( |
| 94 |
int result, @Nullable EuiccProfileInfo[] profiles, boolean isRemovable) { |
| 95 |
this.result = result; |
| 96 |
this.mIsRemovable = isRemovable; |
| 97 |
if (this.result == EuiccService.RESULT_OK) { |
| 98 |
this.mProfiles = profiles; |
| 99 |
} else { |
| 100 |
|
| 101 |
if (profiles != null && profiles.length > 0) { |
| 102 |
throw new IllegalArgumentException( |
| 103 |
"Error result with non-empty profiles: " + result); |
| 104 |
} |
| 105 |
this.mProfiles = null; |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
private GetEuiccProfileInfoListResult(Parcel in) { |
| 110 |
this.result = in.readInt(); |
| 111 |
this.mProfiles = in.createTypedArray(EuiccProfileInfo.CREATOR); |
| 112 |
this.mIsRemovable = in.readBoolean(); |
| 113 |
} |
| 114 |
|
| 115 |
@Override |
| 116 |
public void writeToParcel(Parcel dest, int flags) { |
| 117 |
dest.writeInt(result); |
| 118 |
dest.writeTypedArray(mProfiles, flags); |
| 119 |
dest.writeBoolean(mIsRemovable); |
| 120 |
} |
| 121 |
|
| 122 |
@Override |
| 123 |
public int describeContents() { |
| 124 |
return 0; |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
@Override |
| 133 |
public String toString() { |
| 134 |
return "[GetEuiccProfileInfoListResult: result=" + EuiccService.resultToString(result) |
| 135 |
+ ", isRemovable=" + mIsRemovable + ", mProfiles=" + Arrays.toString(mProfiles) |
| 136 |
+ "]"; |
| 137 |
} |
| 138 |
} |