summaryrefslogtreecommitdiff
path: root/android/provider/SettingsSlicesContract.java
blob: 7dc948899dfe1b1e86a98fbf3c8a2643e07c5936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.provider;

import android.content.ContentResolver;
import android.net.Uri;

/**
 * Provides a contract for platform-supported Settings {@link android.app.slice.Slice Slices}.
 * <p>
 * Contains definitions for the supported {@link android.app.slice.SliceProvider SliceProvider}
 * authority, authority {@link Uri}, and key constants.
 * <p>
 * {@link android.app.slice.Slice Slice} presenters interested in learning meta-data about the
 * {@link android.app.slice.Slice Slice} should read the {@link android.app.slice.Slice Slice}
 * object at runtime.
 * <p>
 * {@link Uri} builder example:
 * <pre>
 * Uri wifiActionUri = BASE_URI
 *         .buildUpon()
 *         .appendPath(PATH_SETTING_ACTION)
 *         .appendPath(KEY_WIFI)
 *         .build();
 * Uri bluetoothIntentUri = BASE_URI
 *         .buildUpon()
 *         .appendPath(PATH_SETTING_INTENT)
 *         .appendPath(KEY_BLUETOOTH)
 *         .build();
 * </pre>
 */
public class SettingsSlicesContract {
    private SettingsSlicesContract() {
    }

    /**
     * Authority for platform Settings Slices.
     */
    public static final String AUTHORITY = "android.settings.slices";

    /**
     * A content:// style uri to the Settings Slices authority, {@link #AUTHORITY}.
     */
    public static final Uri BASE_URI = new Uri.Builder()
            .scheme(ContentResolver.SCHEME_CONTENT)
            .authority(AUTHORITY)
            .build();

    /**
     * {@link Uri} path indicating that the requested {@link android.app.slice.Slice Slice} should
     * have inline controls for the corresponding setting.
     * <p>
     * This path will only contain Slices defined by keys in this class.
     */
    public static final String PATH_SETTING_ACTION = "action";

    /**
     * {@link Uri} path indicating that the requested {@link android.app.slice.Slice Slice} should
     * be {@link android.content.Intent Intent}-only.
     * <p>
     * {@link android.app.slice.Slice Slices} with actions should use the {@link
     * #PATH_SETTING_ACTION} path.
     * <p>
     * This path will only contain Slices defined by keys in this class
     */
    public static final String PATH_SETTING_INTENT = "intent";

    /**
     * {@link Uri} key for the Airplane Mode setting.
     */
    public static final String KEY_AIRPLANE_MODE = "airplane_mode";

    /**
     * {@link Uri} key for the Battery Saver setting.
     */
    public static final String KEY_BATTERY_SAVER = "battery_saver";

    /**
     * {@link Uri} key for the Bluetooth setting.
     */
    public static final String KEY_BLUETOOTH = "bluetooth";

    /**
     * {@link Uri} key for the Location setting.
     */
    public static final String KEY_LOCATION = "location";

    /**
     * {@link Uri} key for the Wi-fi setting.
     */
    public static final String KEY_WIFI = "wifi";
}