blob: e80528b10aaf621eca77499746128e2ccc3e542f [file] [log] [blame]
Alan Viverette3da604b2020-06-10 18:34:39 +00001/*
2 * Copyright (C) 2006 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.os;
18
19import android.compat.annotation.UnsupportedAppUsage;
20
21/** @hide */
22public class AsyncResult
23{
24
25 /*************************** Instance Variables **************************/
26
27 // Expect either exception or result to be null
28 @UnsupportedAppUsage
29 public Object userObj;
30 @UnsupportedAppUsage
31 public Throwable exception;
32 @UnsupportedAppUsage
33 public Object result;
34
35 /***************************** Class Methods *****************************/
36
37 /** Saves and sets m.obj */
38 @UnsupportedAppUsage
39 public static AsyncResult
40 forMessage(Message m, Object r, Throwable ex)
41 {
42 AsyncResult ret;
43
44 ret = new AsyncResult (m.obj, r, ex);
45
46 m.obj = ret;
47
48 return ret;
49 }
50
51 /** Saves and sets m.obj */
52 @UnsupportedAppUsage
53 public static AsyncResult
54 forMessage(Message m)
55 {
56 AsyncResult ret;
57
58 ret = new AsyncResult (m.obj, null, null);
59
60 m.obj = ret;
61
62 return ret;
63 }
64
65 /** please note, this sets m.obj to be this */
66 @UnsupportedAppUsage
67 public
68 AsyncResult (Object uo, Object r, Throwable ex)
69 {
70 userObj = uo;
71 result = r;
72 exception = ex;
73 }
74}