blob: 5baf2e22bc313b8b2bcba249dca9e2f000c28cff [file] [log] [blame]
Sudheer Shankafc46e9b2016-10-21 17:55:27 -07001/*
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
17package android.app;
18
19import android.content.ComponentName;
20import android.os.Parcel;
21import android.os.Parcelable;
22
Bryce Lee4a194382017-04-04 14:32:48 -070023import java.io.PrintWriter;
24
Sudheer Shankafc46e9b2016-10-21 17:55:27 -070025/**
26 * Information returned after waiting for an activity start.
27 *
28 * @hide
29 */
30public class WaitResult implements Parcelable {
Vishnu Naircf235042018-11-02 13:27:00 -070031 public static final int INVALID_DELAY = -1;
Sudheer Shankafc46e9b2016-10-21 17:55:27 -070032 public int result;
33 public boolean timeout;
34 public ComponentName who;
Sudheer Shankafc46e9b2016-10-21 17:55:27 -070035 public long totalTime;
36
37 public WaitResult() {
38 }
39
40 @Override
41 public int describeContents() {
42 return 0;
43 }
44
45 @Override
46 public void writeToParcel(Parcel dest, int flags) {
47 dest.writeInt(result);
48 dest.writeInt(timeout ? 1 : 0);
49 ComponentName.writeToParcel(who, dest);
Sudheer Shankafc46e9b2016-10-21 17:55:27 -070050 dest.writeLong(totalTime);
51 }
52
53 public static final Parcelable.Creator<WaitResult> CREATOR
54 = new Parcelable.Creator<WaitResult>() {
55 @Override
56 public WaitResult createFromParcel(Parcel source) {
57 return new WaitResult(source);
58 }
59
60 @Override
61 public WaitResult[] newArray(int size) {
62 return new WaitResult[size];
63 }
64 };
65
66 private WaitResult(Parcel source) {
67 result = source.readInt();
68 timeout = source.readInt() != 0;
69 who = ComponentName.readFromParcel(source);
Sudheer Shankafc46e9b2016-10-21 17:55:27 -070070 totalTime = source.readLong();
71 }
Bryce Lee4a194382017-04-04 14:32:48 -070072
73 public void dump(PrintWriter pw, String prefix) {
74 pw.println(prefix + "WaitResult:");
75 pw.println(prefix + " result=" + result);
76 pw.println(prefix + " timeout=" + timeout);
77 pw.println(prefix + " who=" + who);
Bryce Lee4a194382017-04-04 14:32:48 -070078 pw.println(prefix + " totalTime=" + totalTime);
79 }
Sudheer Shankafc46e9b2016-10-21 17:55:27 -070080}