Home | History | Annotate | Download | only in ims
      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 
     18 package com.android.ims;
     19 
     20 import android.os.Parcel;
     21 import android.os.Parcelable;
     22 
     23 import java.util.Arrays;
     24 
     25 
     26 /**
     27  * Parcelable object to handle IMS supplementary service notifications.
     28  *
     29  * @hide
     30  */
     31 public class ImsSuppServiceNotification implements Parcelable {
     32     private static final String TAG = "ImsSuppServiceNotification";
     33 
     34     /** Type of notification: 0 = MO; 1 = MT */
     35     public int notificationType;
     36     /** TS 27.007 7.17 "code1" or "code2" */
     37     public int code;
     38     /** TS 27.007 7.17 "index" - Not used currently*/
     39     public int index;
     40     /** TS 27.007 7.17 "type" (MT only) - Not used currently */
     41     public int type;
     42     /** TS 27.007 7.17 "number" (MT only) */
     43     public String number;
     44     /** List of forwarded numbers, if any */
     45     public String[] history;
     46 
     47     public ImsSuppServiceNotification() {
     48     }
     49 
     50     public ImsSuppServiceNotification(Parcel in) {
     51         readFromParcel(in);
     52     }
     53 
     54     @Override
     55     public String toString() {
     56         return "{ notificationType=" + notificationType +
     57                 ", code=" + code +
     58                 ", index=" + index +
     59                 ", type=" + type +
     60                 ", number=" + number +
     61                 ", history=" + Arrays.toString(history) +
     62                 " }";
     63     }
     64 
     65     @Override
     66     public int describeContents() {
     67         return 0;
     68     }
     69 
     70     @Override
     71     public void writeToParcel(Parcel out, int flags) {
     72         out.writeInt(notificationType);
     73         out.writeInt(code);
     74         out.writeInt(index);
     75         out.writeInt(type);
     76         out.writeString(number);
     77         out.writeStringArray(history);
     78     }
     79 
     80     private void readFromParcel(Parcel in) {
     81         notificationType = in.readInt();
     82         code = in.readInt();
     83         index = in.readInt();
     84         type = in.readInt();
     85         number = in.readString();
     86         history = in.createStringArray();
     87     }
     88 
     89     public static final Creator<ImsSuppServiceNotification> CREATOR =
     90             new Creator<ImsSuppServiceNotification>() {
     91         @Override
     92         public ImsSuppServiceNotification createFromParcel(Parcel in) {
     93             return new ImsSuppServiceNotification(in);
     94         }
     95 
     96         @Override
     97         public ImsSuppServiceNotification[] newArray(int size) {
     98             return new ImsSuppServiceNotification[size];
     99         }
    100     };
    101 }
    102