Home | History | Annotate | Download | only in provider
      1 /*
      2  * Copyright (C) 2018 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.content.ContentResolver;
     20 import android.net.Uri;
     21 
     22 /**
     23  * Provides a contract for platform-supported Settings {@link android.app.slice.Slice Slices}.
     24  * <p>
     25  * Contains definitions for the supported {@link android.app.slice.SliceProvider SliceProvider}
     26  * authority, authority {@link Uri}, and key constants.
     27  * <p>
     28  * {@link android.app.slice.Slice Slice} presenters interested in learning meta-data about the
     29  * {@link android.app.slice.Slice Slice} should read the {@link android.app.slice.Slice Slice}
     30  * object at runtime.
     31  * <p>
     32  * {@link Uri} builder example:
     33  * <pre>
     34  * Uri wifiActionUri = BASE_URI
     35  *         .buildUpon()
     36  *         .appendPath(PATH_SETTING_ACTION)
     37  *         .appendPath(KEY_WIFI)
     38  *         .build();
     39  * Uri bluetoothIntentUri = BASE_URI
     40  *         .buildUpon()
     41  *         .appendPath(PATH_SETTING_INTENT)
     42  *         .appendPath(KEY_BLUETOOTH)
     43  *         .build();
     44  * </pre>
     45  */
     46 public class SettingsSlicesContract {
     47     private SettingsSlicesContract() {
     48     }
     49 
     50     /**
     51      * Authority for platform Settings Slices.
     52      */
     53     public static final String AUTHORITY = "android.settings.slices";
     54 
     55     /**
     56      * A content:// style uri to the Settings Slices authority, {@link #AUTHORITY}.
     57      */
     58     public static final Uri BASE_URI = new Uri.Builder()
     59             .scheme(ContentResolver.SCHEME_CONTENT)
     60             .authority(AUTHORITY)
     61             .build();
     62 
     63     /**
     64      * {@link Uri} path indicating that the requested {@link android.app.slice.Slice Slice} should
     65      * have inline controls for the corresponding setting.
     66      * <p>
     67      * This path will only contain Slices defined by keys in this class.
     68      */
     69     public static final String PATH_SETTING_ACTION = "action";
     70 
     71     /**
     72      * {@link Uri} path indicating that the requested {@link android.app.slice.Slice Slice} should
     73      * be {@link android.content.Intent Intent}-only.
     74      * <p>
     75      * {@link android.app.slice.Slice Slices} with actions should use the {@link
     76      * #PATH_SETTING_ACTION} path.
     77      * <p>
     78      * This path will only contain Slices defined by keys in this class
     79      */
     80     public static final String PATH_SETTING_INTENT = "intent";
     81 
     82     /**
     83      * {@link Uri} key for the Airplane Mode setting.
     84      */
     85     public static final String KEY_AIRPLANE_MODE = "airplane_mode";
     86 
     87     /**
     88      * {@link Uri} key for the Battery Saver setting.
     89      */
     90     public static final String KEY_BATTERY_SAVER = "battery_saver";
     91 
     92     /**
     93      * {@link Uri} key for the Bluetooth setting.
     94      */
     95     public static final String KEY_BLUETOOTH = "bluetooth";
     96 
     97     /**
     98      * {@link Uri} key for the Location setting.
     99      */
    100     public static final String KEY_LOCATION = "location";
    101 
    102     /**
    103      * {@link Uri} key for the Wi-fi setting.
    104      */
    105     public static final String KEY_WIFI = "wifi";
    106 }
    107