Home | History | Annotate | Download | only in ims
      1 /*
      2  * Copyright (C) 2018 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.telephony.ims;
     18 
     19 import android.annotation.SystemApi;
     20 import android.os.Parcel;
     21 import android.os.Parcelable;
     22 
     23 /**
     24  * Provides the result to the update operation for the supplementary service configuration.
     25  *
     26  * @hide
     27  */
     28 @SystemApi
     29 public final class ImsSsInfo implements Parcelable {
     30     /**
     31      * For the status of service registration or activation/deactivation.
     32      */
     33     public static final int NOT_REGISTERED = (-1);
     34     public static final int DISABLED = 0;
     35     public static final int ENABLED = 1;
     36 
     37     // 0: disabled, 1: enabled
     38     /** @hide */
     39     // TODO: Make private, do not modify this field directly, use getter!
     40     public int mStatus;
     41     /** @hide */
     42     // TODO: Make private, do not modify this field directly, use getter!
     43     public String mIcbNum;
     44 
     45     /**@hide*/
     46     // TODO: Remove! Do not use this constructor, instead use public version.
     47     public ImsSsInfo() {
     48     }
     49 
     50     /**
     51      *
     52      * @param status The status of the service registration of activation/deactiviation. Valid
     53      *    entries include:
     54      *    {@link #NOT_REGISTERED},
     55      *    {@link #DISABLED},
     56      *    {@link #ENABLED}
     57      * @param icbNum The Incoming barring number.
     58      */
     59     public ImsSsInfo(int status, String icbNum) {
     60         mStatus = status;
     61         mIcbNum = icbNum;
     62     }
     63 
     64     private ImsSsInfo(Parcel in) {
     65         readFromParcel(in);
     66     }
     67 
     68     @Override
     69     public int describeContents() {
     70         return 0;
     71     }
     72 
     73     @Override
     74     public void writeToParcel(Parcel out, int flags) {
     75         out.writeInt(mStatus);
     76         out.writeString(mIcbNum);
     77     }
     78 
     79     @Override
     80     public String toString() {
     81         return super.toString() + ", Status: " + ((mStatus == 0) ? "disabled" : "enabled");
     82     }
     83 
     84     private void readFromParcel(Parcel in) {
     85         mStatus = in.readInt();
     86         mIcbNum = in.readString();
     87     }
     88 
     89     public static final Creator<ImsSsInfo> CREATOR =
     90             new Creator<ImsSsInfo>() {
     91         @Override
     92         public ImsSsInfo createFromParcel(Parcel in) {
     93             return new ImsSsInfo(in);
     94         }
     95 
     96         @Override
     97         public ImsSsInfo[] newArray(int size) {
     98             return new ImsSsInfo[size];
     99         }
    100     };
    101 
    102     /**
    103      * @return Supplementary Service Configuration status. Valid Values are:
    104      *     {@link #NOT_REGISTERED},
    105      *     {@link #DISABLED},
    106      *     {@link #ENABLED}
    107      */
    108     public int getStatus() {
    109         return mStatus;
    110     }
    111 
    112     public String getIcbNum() {
    113         return mIcbNum;
    114     }
    115 }
    116