blob: 33d25880226eb43fd2a4c5f709b34bdd900acf0f [file] [log] [blame]
Neil Fullera8889fa2017-03-16 18:31:56 +00001/*
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.provider;
18
Neil Fullerbaf1c3d2017-07-03 14:38:50 +010019import android.annotation.SystemApi;
Neil Fullera8889fa2017-03-16 18:31:56 +000020import 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 */
Neil Fullerbaf1c3d2017-07-03 14:38:50 +010028@SystemApi
Neil Fullera8889fa2017-03-16 18:31:56 +000029public final class TimeZoneRulesDataContract {
30
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 /**
Neil Fullerd07c3312017-07-10 19:18:01 +010044 * Defines fields exposed through the {@link Operation#CONTENT_URI} for describing a time zone
45 * distro operation.
Neil Fullera8889fa2017-03-16 18:31:56 +000046 */
Neil Fullerd07c3312017-07-10 19:18:01 +010047 public static final class Operation {
48
49 /** Not instantiable. */
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)};
Neil Fuller493781a2017-07-11 15:25:48 +010058 * 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
Neil Fullerd07c3312017-07-10 19:18:01 +010061 * 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 */
Neil Fuller493781a2017-07-11 15:25:48 +010070 public static final String COLUMN_TYPE = "type";
Neil Fullerd07c3312017-07-10 19:18:01 +010071
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.
Neil Fuller493781a2017-07-11 15:25:48 +010095 * Only non-null if {@link #COLUMN_TYPE} contains {@link #TYPE_INSTALL}.
Neil Fullerd07c3312017-07-10 19:18:01 +010096 */
Neil Fuller493781a2017-07-11 15:25:48 +010097 public static final String COLUMN_DISTRO_MAJOR_VERSION = "distro_major_version";
Neil Fullerd07c3312017-07-10 19:18:01 +010098
99 /**
100 * The {@code nullable int} column of the {@link #CONTENT_URI} that describes the minor
101 * version of the distro to be installed.
Neil Fuller493781a2017-07-11 15:25:48 +0100102 * Only non-null if {@link #COLUMN_TYPE} contains {@link #TYPE_INSTALL}.
Neil Fullerd07c3312017-07-10 19:18:01 +0100103 */
Neil Fuller493781a2017-07-11 15:25:48 +0100104 public static final String COLUMN_DISTRO_MINOR_VERSION = "distro_minor_version";
Neil Fullerd07c3312017-07-10 19:18:01 +0100105
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.
Neil Fuller493781a2017-07-11 15:25:48 +0100109 * Only non-null if {@link #COLUMN_TYPE} contains {@link #TYPE_INSTALL}.
Neil Fullerd07c3312017-07-10 19:18:01 +0100110 */
Neil Fuller493781a2017-07-11 15:25:48 +0100111 public static final String COLUMN_RULES_VERSION = "rules_version";
Neil Fullerd07c3312017-07-10 19:18:01 +0100112
113 /**
114 * The {@code nullable int} column of the {@link #CONTENT_URI} that describes the revision
115 * number of the distro to be installed.
Neil Fuller493781a2017-07-11 15:25:48 +0100116 * Only non-null if {@link #COLUMN_TYPE} contains {@link #TYPE_INSTALL}.
Neil Fullerd07c3312017-07-10 19:18:01 +0100117 */
Neil Fuller493781a2017-07-11 15:25:48 +0100118 public static final String COLUMN_REVISION = "revision";
Neil Fullerd07c3312017-07-10 19:18:01 +0100119 }
Neil Fullera8889fa2017-03-16 18:31:56 +0000120}