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.provider; 18 19 import android.annotation.SystemApi; 20 import android.net.Uri; 21 22 /** 23 * A set of constants for implementing a time zone data content provider, which is used by the time 24 * zone updater application. 25 * 26 * @hide 27 */ 28 @SystemApi 29 public final class TimeZoneRulesDataContract { 30 TimeZoneRulesDataContract()31 private TimeZoneRulesDataContract() {} 32 33 /** 34 * The authority that <em>must</em> be used for the time zone data content provider. 35 * To be accepted by the time zone updater application it <em>must</em> be exposed by the 36 * package specified in the config_timeZoneRulesDataPackage config value. 37 */ 38 public static final String AUTHORITY = "com.android.timezone"; 39 40 /** A content:// style uri to the authority for the time zone data content provider */ 41 private static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY); 42 43 /** 44 * Defines fields exposed through the {@link Operation#CONTENT_URI} for describing a time zone 45 * distro operation. 46 */ 47 public static final class Operation { 48 49 /** Not instantiable. */ Operation()50 private Operation() { 51 } 52 53 /** 54 * The content:// style URI for determining what type of update is available. 55 * 56 * <p>The URI can be queried using 57 * {@link android.content.ContentProvider#query(Uri, String[], String, String[], String)}; 58 * the result will be a cursor with a single row. If the {@link Operation#COLUMN_TYPE} 59 * column is {@link Operation#TYPE_INSTALL} then 60 * {@link android.content.ContentProvider#openFile(Uri, String)} can be used with "r" mode 61 * to obtain the binary data. 62 */ 63 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "operation"); 64 65 /** 66 * The {@code String} column of the {@link #CONTENT_URI} that provides an int specifying 67 * the type of operation to perform. See {@link #TYPE_NO_OP}, 68 * {@link #TYPE_UNINSTALL} and {@link #TYPE_INSTALL}. 69 */ 70 public static final String COLUMN_TYPE = "type"; 71 72 /** 73 * An operation type used when the current time zone rules on device should be replaced by 74 * a new set obtained via the {@link android.content.ContentProvider#openFile(Uri, String)} 75 * method. 76 */ 77 public static final String TYPE_INSTALL = "INSTALL"; 78 79 /** 80 * An operation type used when the current time zone rules on device should be uninstalled, 81 * returning to the values held in the system partition. 82 */ 83 public static final String TYPE_UNINSTALL = "UNINSTALL"; 84 85 /** 86 * An operation type used when the time zone rules on device should be left as they are. 87 * This is not expected to be used in normal operation but a safe result in the event of an 88 * error that cannot be recovered from. 89 */ 90 public static final String TYPE_NO_OP = "NOOP"; 91 92 /** 93 * The {@code nullable int} column of the {@link #CONTENT_URI} that describes the major 94 * version of the distro to be installed. 95 * Only non-null if {@link #COLUMN_TYPE} contains {@link #TYPE_INSTALL}. 96 */ 97 public static final String COLUMN_DISTRO_MAJOR_VERSION = "distro_major_version"; 98 99 /** 100 * The {@code nullable int} column of the {@link #CONTENT_URI} that describes the minor 101 * version of the distro to be installed. 102 * Only non-null if {@link #COLUMN_TYPE} contains {@link #TYPE_INSTALL}. 103 */ 104 public static final String COLUMN_DISTRO_MINOR_VERSION = "distro_minor_version"; 105 106 /** 107 * The {@code nullable String} column of the {@link #CONTENT_URI} that describes the IANA 108 * rules version of the distro to be installed. 109 * Only non-null if {@link #COLUMN_TYPE} contains {@link #TYPE_INSTALL}. 110 */ 111 public static final String COLUMN_RULES_VERSION = "rules_version"; 112 113 /** 114 * The {@code nullable int} column of the {@link #CONTENT_URI} that describes the revision 115 * number of the distro to be installed. 116 * Only non-null if {@link #COLUMN_TYPE} contains {@link #TYPE_INSTALL}. 117 */ 118 public static final String COLUMN_REVISION = "revision"; 119 } 120 } 121