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 23 import java.io.PrintWriter; 24 25 /** 26 * Information returned after waiting for an activity start. 27 * 28 * @hide 29 */ 30 public class WaitResult implements Parcelable { 31 public int result; 32 public boolean timeout; 33 public ComponentName who; 34 public long thisTime; 35 public long totalTime; 36 WaitResult()37 public WaitResult() { 38 } 39 40 @Override describeContents()41 public int describeContents() { 42 return 0; 43 } 44 45 @Override writeToParcel(Parcel dest, int flags)46 public void writeToParcel(Parcel dest, int flags) { 47 dest.writeInt(result); 48 dest.writeInt(timeout ? 1 : 0); 49 ComponentName.writeToParcel(who, dest); 50 dest.writeLong(thisTime); 51 dest.writeLong(totalTime); 52 } 53 54 public static final Parcelable.Creator<WaitResult> CREATOR 55 = new Parcelable.Creator<WaitResult>() { 56 @Override 57 public WaitResult createFromParcel(Parcel source) { 58 return new WaitResult(source); 59 } 60 61 @Override 62 public WaitResult[] newArray(int size) { 63 return new WaitResult[size]; 64 } 65 }; 66 WaitResult(Parcel source)67 private WaitResult(Parcel source) { 68 result = source.readInt(); 69 timeout = source.readInt() != 0; 70 who = ComponentName.readFromParcel(source); 71 thisTime = source.readLong(); 72 totalTime = source.readLong(); 73 } 74 dump(PrintWriter pw, String prefix)75 public void dump(PrintWriter pw, String prefix) { 76 pw.println(prefix + "WaitResult:"); 77 pw.println(prefix + " result=" + result); 78 pw.println(prefix + " timeout=" + timeout); 79 pw.println(prefix + " who=" + who); 80 pw.println(prefix + " thisTime=" + thisTime); 81 pw.println(prefix + " totalTime=" + totalTime); 82 } 83 }