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.app.timezone.ICallback;
     20 import android.app.timezone.RulesState;
     21 import android.os.ParcelFileDescriptor;
     22 
     23  /**
     24   * Interface to the TimeZone Rules Manager Service.
     25   *
     26   * <p>This interface is only intended for system apps to call. They should use the
     27   * {@link android.app.timezone.RulesManager} class rather than going through this
     28   * Binder interface directly. See {@link android.app.timezone.RulesManager} for more complete
     29   * documentation.
     30   *
     31   * {@hide}
     32   */
     33 interface IRulesManager {
     34 
     35     /**
     36      * Returns information about the current time zone rules state such as the IANA version of
     37      * the system and any currently installed distro. This method is intended to allow clients to
     38      * determine if the current state can be improved; for example by passing the information to a
     39      * server that may provide a new distro for download.
     40      */
     41     RulesState getRulesState();
     42 
     43     /**
     44      * Requests installation of the supplied distro. The distro must have been checked for integrity
     45      * by the caller or have been received via a trusted mechanism.
     46      *
     47      * @param distroFileDescriptor the file descriptor for the distro
     48      * @param checkToken an optional token provided if the install was triggered in response to a
     49      *     {@link RulesUpdaterContract#ACTION_TRIGGER_RULES_UPDATE_CHECK} intent
     50      * @param callback the {@link ICallback} to receive callbacks related to the
     51      *     installation
     52      * @return zero if the installation will be attempted; nonzero on error
     53      */
     54     int requestInstall(in ParcelFileDescriptor distroFileDescriptor, in byte[] checkToken,
     55             ICallback callback);
     56 
     57     /**
     58      * Requests uninstallation of the currently installed distro (leaving the device with no
     59      * distro installed).
     60      *
     61      * @param checkToken an optional token provided if the uninstall was triggered in response to a
     62      *     {@link RulesUpdaterContract#ACTION_TRIGGER_RULES_UPDATE_CHECK} intent
     63      * @param callback the {@link ICallback} to receive callbacks related to the
     64      *     uninstall
     65      * @return zero if the uninstallation will be attempted; nonzero on error
     66      */
     67     int requestUninstall(in byte[] checkToken, ICallback callback);
     68 
     69     /**
     70      * Requests the system does not modify the currently installed time zone distro, if any. This
     71      * method records the fact that a time zone check operation triggered by the system is now
     72      * complete and there was nothing to do. The token passed should be the one presented when the
     73      * check was triggered.
     74      *
     75      * <p>Note: Passing {@code success == false} may result in more checks being triggered. Clients
     76      * should be careful not to pass false if the failure is unlikely to resolve by itself.
     77      *
     78      * @param checkToken an optional token provided if the install was triggered in response to a
     79      *     {@link RulesUpdaterContract#ACTION_TRIGGER_RULES_UPDATE_CHECK} intent
     80      * @param success true if the check was successful, false if it was not successful but may
     81      *     succeed if it is retried
     82      */
     83     void requestNothing(in byte[] token, boolean success);
     84 }
     85