OSDN Git Service

Add ITelephonyDebugSubscriber.aidl
[android-x86/frameworks-base.git] / telephony / java / com / android / internal / telephony / TelephonyEvent.java
1 /*
2  * Copyright (C) 2016 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 com.android.internal.telephony;
18
19 import android.os.Bundle;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22
23 /**
24  *  A parcelable used in ITelephonyDebugSubscriber.aidl
25  */
26 public class TelephonyEvent implements Parcelable {
27
28     final public long timestamp;
29     final public int phoneId;
30     final public int tag;
31     final public int param1;
32     final public int param2;
33     final public Bundle data;
34
35     public TelephonyEvent(long timestamp, int phoneId, int tag,
36             int param1, int param2, Bundle data) {
37         this.timestamp = timestamp;
38         this.phoneId = phoneId;
39         this.tag = tag;
40         this.param1 = param1;
41         this.param2 = param2;
42         this.data = data;
43     }
44
45     /** Implement the Parcelable interface */
46     public static final Parcelable.Creator<TelephonyEvent> CREATOR
47             = new Parcelable.Creator<TelephonyEvent> (){
48         public TelephonyEvent createFromParcel(Parcel source) {
49             final long timestamp = source.readLong();
50             final int phoneId = source.readInt();
51             final int tag = source.readInt();
52             final int param1 = source.readInt();
53             final int param2 = source.readInt();
54             final Bundle data = source.readBundle();
55             return new TelephonyEvent(timestamp, phoneId, tag, param1, param2, data);
56         }
57
58         public TelephonyEvent[] newArray(int size) {
59             return new TelephonyEvent[size];
60         }
61     };
62
63     /** Implement the Parcelable interface */
64     @Override
65     public int describeContents() {
66         return 0;
67     }
68
69     /** Implement the Parcelable interface */
70     @Override
71     public void writeToParcel(Parcel dest, int flags) {
72         dest.writeLong(timestamp);
73         dest.writeInt(phoneId);
74         dest.writeInt(tag);
75         dest.writeInt(param1);
76         dest.writeInt(param2);
77         dest.writeBundle(data);
78     }
79
80     public String toString() {
81         return String.format("%d,%d,%d,%d,%d,%s",
82                 timestamp, phoneId, tag, param1, param2, data);
83     }
84 }