1/*
2 * Copyright (C) 2017 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.timezone;
18
19import android.annotation.IntDef;
20
21import java.lang.annotation.Retention;
22import java.lang.annotation.RetentionPolicy;
23
24/**
25 * Callback interface for receiving information about an async time zone operation.
26 * The methods will be called on your application's main thread.
27 *
28 * @hide
29 */
30public abstract class Callback {
31
32    @Retention(RetentionPolicy.SOURCE)
33    @IntDef({SUCCESS, ERROR_UNKNOWN_FAILURE, ERROR_INSTALL_BAD_DISTRO_STRUCTURE,
34        ERROR_INSTALL_BAD_DISTRO_FORMAT_VERSION, ERROR_INSTALL_RULES_TOO_OLD,
35        ERROR_INSTALL_VALIDATION_ERROR})
36    public @interface AsyncResultCode {}
37
38    /**
39     * Indicates that an operation succeeded.
40     */
41    public static final int SUCCESS = 0;
42
43    /**
44     * Indicates an install / uninstall did not fully succeed for an unknown reason.
45     */
46    public static final int ERROR_UNKNOWN_FAILURE = 1;
47
48    /**
49     * Indicates an install failed because of a structural issue with the provided distro,
50     * e.g. it wasn't in the right format or the contents were structured incorrectly.
51     */
52    public static final int ERROR_INSTALL_BAD_DISTRO_STRUCTURE = 2;
53
54    /**
55     * Indicates an install failed because of a versioning issue with the provided distro,
56     * e.g. it was created for a different version of Android.
57     */
58    public static final int ERROR_INSTALL_BAD_DISTRO_FORMAT_VERSION = 3;
59
60    /**
61     * Indicates an install failed because the rules provided are too old for the device,
62     * e.g. the Android device shipped with a newer rules version.
63     */
64    public static final int ERROR_INSTALL_RULES_TOO_OLD = 4;
65
66    /**
67     * Indicates an install failed because the distro contents failed validation.
68     */
69    public static final int ERROR_INSTALL_VALIDATION_ERROR = 5;
70
71    /**
72     * Reports the result of an async time zone operation.
73     */
74    public abstract void onFinished(@AsyncResultCode int status);
75}
76