1 /** 2 * Copyright (c) 2015, 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 android.service.carrier; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 /** 23 * Used to pass info to CarrierConfigService implementations so they can decide what values to 24 * return. 25 */ 26 public class CarrierIdentifier implements Parcelable { 27 28 /** Used to create a {@link CarrierIdentifier} from a {@link Parcel}. */ 29 public static final Creator<CarrierIdentifier> CREATOR = new Creator<CarrierIdentifier>() { 30 @Override 31 public CarrierIdentifier createFromParcel(Parcel parcel) { 32 return new CarrierIdentifier(parcel); 33 } 34 35 @Override 36 public CarrierIdentifier[] newArray(int i) { 37 return new CarrierIdentifier[i]; 38 } 39 }; 40 41 private String mMcc; 42 private String mMnc; 43 private String mSpn; 44 private String mImsi; 45 private String mGid1; 46 private String mGid2; 47 CarrierIdentifier(String mcc, String mnc, String spn, String imsi, String gid1, String gid2)48 public CarrierIdentifier(String mcc, String mnc, String spn, String imsi, String gid1, 49 String gid2) { 50 mMcc = mcc; 51 mMnc = mnc; 52 mSpn = spn; 53 mImsi = imsi; 54 mGid1 = gid1; 55 mGid2 = gid2; 56 } 57 58 /** @hide */ CarrierIdentifier(Parcel parcel)59 public CarrierIdentifier(Parcel parcel) { 60 readFromParcel(parcel); 61 } 62 63 /** Get the mobile country code. */ getMcc()64 public String getMcc() { 65 return mMcc; 66 } 67 68 /** Get the mobile network code. */ getMnc()69 public String getMnc() { 70 return mMnc; 71 } 72 73 /** Get the service provider name. */ getSpn()74 public String getSpn() { 75 return mSpn; 76 } 77 78 /** Get the international mobile subscriber identity. */ getImsi()79 public String getImsi() { 80 return mImsi; 81 } 82 83 /** Get the group identifier level 1. */ getGid1()84 public String getGid1() { 85 return mGid1; 86 } 87 88 /** Get the group identifier level 2. */ getGid2()89 public String getGid2() { 90 return mGid2; 91 } 92 93 @Override describeContents()94 public int describeContents() { 95 return 0; 96 } 97 98 @Override writeToParcel(Parcel out, int flags)99 public void writeToParcel(Parcel out, int flags) { 100 out.writeString(mMcc); 101 out.writeString(mMnc); 102 out.writeString(mSpn); 103 out.writeString(mImsi); 104 out.writeString(mGid1); 105 out.writeString(mGid2); 106 } 107 108 @Override toString()109 public String toString() { 110 return "CarrierIdentifier{" 111 + "mcc=" + mMcc 112 + ",mnc=" + mMnc 113 + ",spn=" + mSpn 114 + ",imsi=" + mImsi 115 + ",gid1=" + mGid1 116 + ",gid2=" + mGid2 117 + "}"; 118 } 119 120 /** @hide */ readFromParcel(Parcel in)121 public void readFromParcel(Parcel in) { 122 mMcc = in.readString(); 123 mMnc = in.readString(); 124 mSpn = in.readString(); 125 mImsi = in.readString(); 126 mGid1 = in.readString(); 127 mGid2 = in.readString(); 128 } 129 130 /** @hide */ 131 public interface MatchType { 132 int ALL = 0; 133 int SPN = 1; 134 int IMSI_PREFIX = 2; 135 int GID1 = 3; 136 int GID2 = 4; 137 } 138 } 139