diff --git a/api/current.txt b/api/current.txt index 206d377bab470..2abcca3d026af 100644 --- a/api/current.txt +++ b/api/current.txt @@ -36518,6 +36518,18 @@ package android.provider { field public static final deprecated java.lang.String WINDOW_ANIMATION_SCALE = "window_animation_scale"; } + public class SettingsSlicesContract { + field public static final java.lang.String AUTHORITY = "android.settings.slices"; + field public static final android.net.Uri BASE_URI; + field public static final java.lang.String KEY_AIRPLANE_MODE = "airplane_mode"; + field public static final java.lang.String KEY_BATTERY_SAVER = "battery_saver"; + field public static final java.lang.String KEY_BLUETOOTH = "bluetooth"; + field public static final java.lang.String KEY_LOCATION = "location"; + field public static final java.lang.String KEY_WIFI = "wifi"; + field public static final java.lang.String PATH_SETTING_ACTION = "action"; + field public static final java.lang.String PATH_SETTING_INTENT = "intent"; + } + public class SyncStateContract { ctor public SyncStateContract(); } diff --git a/core/java/android/provider/SettingsSlicesContract.java b/core/java/android/provider/SettingsSlicesContract.java new file mode 100644 index 0000000000000..f79d852ddefc7 --- /dev/null +++ b/core/java/android/provider/SettingsSlicesContract.java @@ -0,0 +1,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}. + *
+ * Contains definitions for the supported {@link android.app.slice.SliceProvider SliceProvider} + * authority, authority {@link Uri}, and key constants. + *
+ * {@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. + *
+ * {@link Uri} builder example: + *
+ * Uri wifiActionUri = AUTHORITY_URI + * .buildUpon() + * .appendPath(PATH_SETTING_ACTION) + * .appendPath(KEY_WIFI) + * .build(); + * Uri bluetoothIntentUri = AUTHORITY_URI + * .buildUpon() + * .appendPath(PATH_SETTING_INTENT) + * .appendPath(KEY_BLUETOOTH) + * .build(); + *+ */ +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. + *
+ * 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. + *
+ * {@link android.app.slice.Slice Slices} with actions should use the {@link + * #PATH_SETTING_ACTION} path. + *
+ * 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"; +}