Sudheer Shanka | fc46e9b | 2016-10-21 17:55:27 -0700 | [diff] [blame] | 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 android.app; |
| 18 | |
| 19 | import android.content.ComponentName; |
| 20 | import android.os.Parcel; |
| 21 | import android.os.Parcelable; |
| 22 | |
Bryce Lee | 4a19438 | 2017-04-04 14:32:48 -0700 | [diff] [blame] | 23 | import java.io.PrintWriter; |
| 24 | |
Sudheer Shanka | fc46e9b | 2016-10-21 17:55:27 -0700 | [diff] [blame] | 25 | /** |
| 26 | * Information returned after waiting for an activity start. |
| 27 | * |
| 28 | * @hide |
| 29 | */ |
| 30 | public class WaitResult implements Parcelable { |
Vishnu Nair | cf23504 | 2018-11-02 13:27:00 -0700 | [diff] [blame] | 31 | public static final int INVALID_DELAY = -1; |
Sudheer Shanka | fc46e9b | 2016-10-21 17:55:27 -0700 | [diff] [blame] | 32 | public int result; |
| 33 | public boolean timeout; |
| 34 | public ComponentName who; |
Sudheer Shanka | fc46e9b | 2016-10-21 17:55:27 -0700 | [diff] [blame] | 35 | 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 Shanka | fc46e9b | 2016-10-21 17:55:27 -0700 | [diff] [blame] | 50 | 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 Shanka | fc46e9b | 2016-10-21 17:55:27 -0700 | [diff] [blame] | 70 | totalTime = source.readLong(); |
| 71 | } |
Bryce Lee | 4a19438 | 2017-04-04 14:32:48 -0700 | [diff] [blame] | 72 | |
| 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 Lee | 4a19438 | 2017-04-04 14:32:48 -0700 | [diff] [blame] | 78 | pw.println(prefix + " totalTime=" + totalTime); |
| 79 | } |
Sudheer Shanka | fc46e9b | 2016-10-21 17:55:27 -0700 | [diff] [blame] | 80 | } |