Home | History | Annotate | Download | only in timezone
      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 
     17 package android.app.timezone;
     18 
     19 import android.annotation.IntDef;
     20 
     21 import java.lang.annotation.Retention;
     22 import 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  */
     30 public abstract class Callback {
     31 
     32     @Retention(RetentionPolicy.SOURCE)
     33     @IntDef(prefix = { "SUCCESS", "ERROR_" }, value = {
     34             SUCCESS,
     35             ERROR_UNKNOWN_FAILURE,
     36             ERROR_INSTALL_BAD_DISTRO_STRUCTURE,
     37             ERROR_INSTALL_BAD_DISTRO_FORMAT_VERSION,
     38             ERROR_INSTALL_RULES_TOO_OLD,
     39             ERROR_INSTALL_VALIDATION_ERROR
     40     })
     41     public @interface AsyncResultCode {}
     42 
     43     /**
     44      * Indicates that an operation succeeded.
     45      */
     46     public static final int SUCCESS = 0;
     47 
     48     /**
     49      * Indicates an install / uninstall did not fully succeed for an unknown reason.
     50      */
     51     public static final int ERROR_UNKNOWN_FAILURE = 1;
     52 
     53     /**
     54      * Indicates an install failed because of a structural issue with the provided distro,
     55      * e.g. it wasn't in the right format or the contents were structured incorrectly.
     56      */
     57     public static final int ERROR_INSTALL_BAD_DISTRO_STRUCTURE = 2;
     58 
     59     /**
     60      * Indicates an install failed because of a versioning issue with the provided distro,
     61      * e.g. it was created for a different version of Android.
     62      */
     63     public static final int ERROR_INSTALL_BAD_DISTRO_FORMAT_VERSION = 3;
     64 
     65     /**
     66      * Indicates an install failed because the rules provided are too old for the device,
     67      * e.g. the Android device shipped with a newer rules version.
     68      */
     69     public static final int ERROR_INSTALL_RULES_TOO_OLD = 4;
     70 
     71     /**
     72      * Indicates an install failed because the distro contents failed validation.
     73      */
     74     public static final int ERROR_INSTALL_VALIDATION_ERROR = 5;
     75 
     76     /**
     77      * Reports the result of an async time zone operation.
     78      */
     79     public abstract void onFinished(@AsyncResultCode int status);
     80 }
     81