blob: a978e5b54c45b700d926828f18aec73ca16b5420 [file] [log] [blame]
Jason Monk8f5f7ff2017-10-17 14:12:42 -04001/*
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.app.slice;
18
Jason Monk4ef50bc2018-01-22 10:52:23 -050019import android.annotation.CallbackExecutor;
Jason Monke2c64512017-12-11 15:14:54 -050020import android.annotation.NonNull;
Jason Monkb9e06a82018-01-16 15:32:53 -050021import android.annotation.Nullable;
Jason Monk8f5f7ff2017-10-17 14:12:42 -040022import android.annotation.SystemService;
Jason Monk632def12018-02-01 15:21:16 -050023import android.content.ContentProviderClient;
Jason Monkb9e06a82018-01-16 15:32:53 -050024import android.content.ContentResolver;
Jason Monk8f5f7ff2017-10-17 14:12:42 -040025import android.content.Context;
Jason Monkb9e06a82018-01-16 15:32:53 -050026import android.content.Intent;
27import android.content.pm.ResolveInfo;
Jason Monk74f5e362017-12-06 08:56:33 -050028import android.net.Uri;
Jason Monkb9e06a82018-01-16 15:32:53 -050029import android.os.Bundle;
Jason Monk8f5f7ff2017-10-17 14:12:42 -040030import android.os.Handler;
Jason Monk74f5e362017-12-06 08:56:33 -050031import android.os.RemoteException;
Jason Monk8f5f7ff2017-10-17 14:12:42 -040032import android.os.ServiceManager;
33import android.os.ServiceManager.ServiceNotFoundException;
Jason Monke2c64512017-12-11 15:14:54 -050034import android.util.ArrayMap;
Jason Monk5f8cc272018-01-16 17:57:20 -050035import android.util.Log;
Jason Monke2c64512017-12-11 15:14:54 -050036import android.util.Pair;
37
Jason Monkb9e06a82018-01-16 15:32:53 -050038import com.android.internal.util.Preconditions;
39
40import java.util.ArrayList;
Jason Monke2c64512017-12-11 15:14:54 -050041import java.util.Arrays;
Jason Monk5f8cc272018-01-16 17:57:20 -050042import java.util.Collection;
43import java.util.Collections;
Jason Monke2c64512017-12-11 15:14:54 -050044import java.util.List;
45import java.util.concurrent.Executor;
Jason Monk8f5f7ff2017-10-17 14:12:42 -040046
47/**
Jason Monke2c64512017-12-11 15:14:54 -050048 * Class to handle interactions with {@link Slice}s.
49 * <p>
50 * The SliceManager manages permissions and pinned state for slices.
Jason Monk8f5f7ff2017-10-17 14:12:42 -040051 */
52@SystemService(Context.SLICE_SERVICE)
53public class SliceManager {
54
Jason Monk5f8cc272018-01-16 17:57:20 -050055 private static final String TAG = "SliceManager";
56
Jason Monke8f8be72018-01-21 10:10:35 -050057 /**
58 * @hide
59 */
60 public static final String ACTION_REQUEST_SLICE_PERMISSION =
61 "android.intent.action.REQUEST_SLICE_PERMISSION";
62
Mady Mellor3267ed82018-02-21 11:42:31 -080063 /**
64 * The meta-data key that allows an activity to easily be linked directly to a slice.
65 * <p>
66 * An activity can be statically linked to a slice uri by including a meta-data item
67 * for this key that contains a valid slice uri for the same application declaring
68 * the activity.
69 */
70 public static final String SLICE_METADATA_KEY = "android.metadata.SLICE_URI";
71
Jason Monk8f5f7ff2017-10-17 14:12:42 -040072 private final ISliceManager mService;
73 private final Context mContext;
Jason Monke2c64512017-12-11 15:14:54 -050074 private final ArrayMap<Pair<Uri, SliceCallback>, ISliceListener> mListenerLookup =
75 new ArrayMap<>();
Jason Monk8f5f7ff2017-10-17 14:12:42 -040076
Jason Monke2c64512017-12-11 15:14:54 -050077 /**
Jason Monke8f8be72018-01-21 10:10:35 -050078 * Permission denied.
79 * @hide
80 */
81 public static final int PERMISSION_DENIED = -1;
82 /**
83 * Permission granted.
84 * @hide
85 */
86 public static final int PERMISSION_GRANTED = 0;
87 /**
88 * Permission just granted by the user, and should be granted uri permission as well.
89 * @hide
90 */
91 public static final int PERMISSION_USER_GRANTED = 1;
92
93 /**
Jason Monke2c64512017-12-11 15:14:54 -050094 * @hide
95 */
Jason Monk8f5f7ff2017-10-17 14:12:42 -040096 public SliceManager(Context context, Handler handler) throws ServiceNotFoundException {
97 mContext = context;
98 mService = ISliceManager.Stub.asInterface(
99 ServiceManager.getServiceOrThrow(Context.SLICE_SERVICE));
100 }
Jason Monk74f5e362017-12-06 08:56:33 -0500101
102 /**
Jason Monk4ef50bc2018-01-22 10:52:23 -0500103 * @deprecated TO BE REMOVED.
Jason Monk74f5e362017-12-06 08:56:33 -0500104 */
Jason Monk4ef50bc2018-01-22 10:52:23 -0500105 @Deprecated
Jason Monke2c64512017-12-11 15:14:54 -0500106 public void registerSliceCallback(@NonNull Uri uri, @NonNull SliceCallback callback,
107 @NonNull List<SliceSpec> specs) {
Jason Monk4ef50bc2018-01-22 10:52:23 -0500108 registerSliceCallback(uri, specs, mContext.getMainExecutor(), callback);
Jason Monke2c64512017-12-11 15:14:54 -0500109 }
110
111 /**
Jason Monk4ef50bc2018-01-22 10:52:23 -0500112 * @deprecated TO BE REMOVED.
Jason Monke2c64512017-12-11 15:14:54 -0500113 */
Jason Monk4ef50bc2018-01-22 10:52:23 -0500114 @Deprecated
Jason Monke2c64512017-12-11 15:14:54 -0500115 public void registerSliceCallback(@NonNull Uri uri, @NonNull SliceCallback callback,
116 @NonNull List<SliceSpec> specs, Executor executor) {
Jason Monk4ef50bc2018-01-22 10:52:23 -0500117 registerSliceCallback(uri, specs, executor, callback);
118 }
119
120 /**
121 * Adds a callback to a specific slice uri.
122 * <p>
123 * This is a convenience that performs a few slice actions at once. It will put
124 * the slice in a pinned state since there is a callback attached. It will also
125 * listen for content changes, when a content change observes, the android system
126 * will bind the new slice and provide it to all registered {@link SliceCallback}s.
127 *
128 * @param uri The uri of the slice being listened to.
129 * @param callback The listener that should receive the callbacks.
130 * @param specs The list of supported {@link SliceSpec}s of the callback.
131 * @see SliceProvider#onSlicePinned(Uri)
132 */
133 public void registerSliceCallback(@NonNull Uri uri, @NonNull List<SliceSpec> specs,
134 @NonNull SliceCallback callback) {
135 registerSliceCallback(uri, specs, mContext.getMainExecutor(), callback);
136 }
137
138 /**
139 * Adds a callback to a specific slice uri.
140 * <p>
141 * This is a convenience that performs a few slice actions at once. It will put
142 * the slice in a pinned state since there is a callback attached. It will also
143 * listen for content changes, when a content change observes, the android system
144 * will bind the new slice and provide it to all registered {@link SliceCallback}s.
145 *
146 * @param uri The uri of the slice being listened to.
147 * @param callback The listener that should receive the callbacks.
148 * @param specs The list of supported {@link SliceSpec}s of the callback.
149 * @see SliceProvider#onSlicePinned(Uri)
150 */
151 public void registerSliceCallback(@NonNull Uri uri, @NonNull List<SliceSpec> specs,
152 @NonNull @CallbackExecutor Executor executor, @NonNull SliceCallback callback) {
Jason Monk74f5e362017-12-06 08:56:33 -0500153 try {
Jason Monke2c64512017-12-11 15:14:54 -0500154 mService.addSliceListener(uri, mContext.getPackageName(),
155 getListener(uri, callback, new ISliceListener.Stub() {
156 @Override
157 public void onSliceUpdated(Slice s) throws RemoteException {
158 executor.execute(() -> callback.onSliceUpdated(s));
159 }
160 }), specs.toArray(new SliceSpec[specs.size()]));
161 } catch (RemoteException e) {
162 throw e.rethrowFromSystemServer();
163 }
164 }
165
166 private ISliceListener getListener(Uri uri, SliceCallback callback,
167 ISliceListener listener) {
168 Pair<Uri, SliceCallback> key = new Pair<>(uri, callback);
169 if (mListenerLookup.containsKey(key)) {
170 try {
171 mService.removeSliceListener(uri, mContext.getPackageName(),
172 mListenerLookup.get(key));
173 } catch (RemoteException e) {
174 throw e.rethrowFromSystemServer();
175 }
176 }
177 mListenerLookup.put(key, listener);
178 return listener;
179 }
180
181 /**
182 * Removes a callback for a specific slice uri.
183 * <p>
184 * Removes the app from the pinned state (if there are no other apps/callbacks pinning it)
185 * in addition to removing the callback.
186 *
187 * @param uri The uri of the slice being listened to
188 * @param callback The listener that should no longer receive callbacks.
189 * @see #registerSliceCallback
190 */
191 public void unregisterSliceCallback(@NonNull Uri uri, @NonNull SliceCallback callback) {
192 try {
193 mService.removeSliceListener(uri, mContext.getPackageName(),
194 mListenerLookup.remove(new Pair<>(uri, callback)));
Jason Monk74f5e362017-12-06 08:56:33 -0500195 } catch (RemoteException e) {
196 throw e.rethrowFromSystemServer();
197 }
198 }
199
200 /**
Jason Monke2c64512017-12-11 15:14:54 -0500201 * Ensures that a slice is in a pinned state.
202 * <p>
203 * Pinned state is not persisted across reboots, so apps are expected to re-pin any slices
204 * they still care about after a reboot.
Jason Monk632def12018-02-01 15:21:16 -0500205 * <p>
206 * This may only be called by apps that are the default launcher for the device
207 * or the default voice interaction service. Otherwise will throw {@link SecurityException}.
Jason Monke2c64512017-12-11 15:14:54 -0500208 *
209 * @param uri The uri of the slice being pinned.
210 * @param specs The list of supported {@link SliceSpec}s of the callback.
211 * @see SliceProvider#onSlicePinned(Uri)
Jason Monk632def12018-02-01 15:21:16 -0500212 * @see Intent#ACTION_ASSIST
213 * @see Intent#CATEGORY_HOME
Jason Monk74f5e362017-12-06 08:56:33 -0500214 */
Jason Monke2c64512017-12-11 15:14:54 -0500215 public void pinSlice(@NonNull Uri uri, @NonNull List<SliceSpec> specs) {
Jason Monk74f5e362017-12-06 08:56:33 -0500216 try {
Jason Monke2c64512017-12-11 15:14:54 -0500217 mService.pinSlice(mContext.getPackageName(), uri,
218 specs.toArray(new SliceSpec[specs.size()]));
Jason Monk74f5e362017-12-06 08:56:33 -0500219 } catch (RemoteException e) {
220 throw e.rethrowFromSystemServer();
221 }
222 }
223
224 /**
Jason Monke2c64512017-12-11 15:14:54 -0500225 * Remove a pin for a slice.
226 * <p>
227 * If the slice has no other pins/callbacks then the slice will be unpinned.
Jason Monk632def12018-02-01 15:21:16 -0500228 * <p>
229 * This may only be called by apps that are the default launcher for the device
230 * or the default voice interaction service. Otherwise will throw {@link SecurityException}.
Jason Monke2c64512017-12-11 15:14:54 -0500231 *
232 * @param uri The uri of the slice being unpinned.
233 * @see #pinSlice
234 * @see SliceProvider#onSliceUnpinned(Uri)
Jason Monk632def12018-02-01 15:21:16 -0500235 * @see Intent#ACTION_ASSIST
236 * @see Intent#CATEGORY_HOME
Jason Monk74f5e362017-12-06 08:56:33 -0500237 */
Jason Monke2c64512017-12-11 15:14:54 -0500238 public void unpinSlice(@NonNull Uri uri) {
Jason Monk74f5e362017-12-06 08:56:33 -0500239 try {
240 mService.unpinSlice(mContext.getPackageName(), uri);
241 } catch (RemoteException e) {
242 throw e.rethrowFromSystemServer();
243 }
244 }
245
246 /**
Jason Monke2c64512017-12-11 15:14:54 -0500247 * @hide
Jason Monk74f5e362017-12-06 08:56:33 -0500248 */
249 public boolean hasSliceAccess() {
250 try {
251 return mService.hasSliceAccess(mContext.getPackageName());
252 } catch (RemoteException e) {
253 throw e.rethrowFromSystemServer();
254 }
255 }
256
257 /**
Jason Monke2c64512017-12-11 15:14:54 -0500258 * Get the current set of specs for a pinned slice.
259 * <p>
260 * This is the set of specs supported for a specific pinned slice. It will take
261 * into account all clients and returns only specs supported by all.
262 * @see SliceSpec
Jason Monk74f5e362017-12-06 08:56:33 -0500263 */
Jason Monke2c64512017-12-11 15:14:54 -0500264 public @NonNull List<SliceSpec> getPinnedSpecs(Uri uri) {
Jason Monk74f5e362017-12-06 08:56:33 -0500265 try {
Jason Monke2c64512017-12-11 15:14:54 -0500266 return Arrays.asList(mService.getPinnedSpecs(uri, mContext.getPackageName()));
Jason Monk74f5e362017-12-06 08:56:33 -0500267 } catch (RemoteException e) {
268 throw e.rethrowFromSystemServer();
269 }
270 }
271
272 /**
Jason Monk5f8cc272018-01-16 17:57:20 -0500273 * Obtains a list of slices that are descendants of the specified Uri.
274 * <p>
275 * Not all slice providers will implement this functionality, in which case,
276 * an empty collection will be returned.
277 *
278 * @param uri The uri to look for descendants under.
279 * @return All slices within the space.
280 * @see SliceProvider#onGetSliceDescendants(Uri)
281 */
282 public @NonNull Collection<Uri> getSliceDescendants(@NonNull Uri uri) {
283 ContentResolver resolver = mContext.getContentResolver();
Jason Monk632def12018-02-01 15:21:16 -0500284 try (ContentProviderClient provider = resolver.acquireContentProviderClient(uri)) {
Jason Monk5f8cc272018-01-16 17:57:20 -0500285 Bundle extras = new Bundle();
286 extras.putParcelable(SliceProvider.EXTRA_BIND_URI, uri);
Jason Monk632def12018-02-01 15:21:16 -0500287 final Bundle res = provider.call(SliceProvider.METHOD_GET_DESCENDANTS, null, extras);
Jason Monk5f8cc272018-01-16 17:57:20 -0500288 return res.getParcelableArrayList(SliceProvider.EXTRA_SLICE_DESCENDANTS);
289 } catch (RemoteException e) {
290 Log.e(TAG, "Unable to get slice descendants", e);
Jason Monk5f8cc272018-01-16 17:57:20 -0500291 }
292 return Collections.emptyList();
293 }
294
295 /**
Jason Monkb9e06a82018-01-16 15:32:53 -0500296 * Turns a slice Uri into slice content.
297 *
298 * @param uri The URI to a slice provider
299 * @param supportedSpecs List of supported specs.
300 * @return The Slice provided by the app or null if none is given.
301 * @see Slice
302 */
303 public @Nullable Slice bindSlice(@NonNull Uri uri, @NonNull List<SliceSpec> supportedSpecs) {
304 Preconditions.checkNotNull(uri, "uri");
305 ContentResolver resolver = mContext.getContentResolver();
Jason Monk632def12018-02-01 15:21:16 -0500306 try (ContentProviderClient provider = resolver.acquireContentProviderClient(uri)) {
307 if (provider == null) {
308 throw new IllegalArgumentException("Unknown URI " + uri);
309 }
Jason Monkb9e06a82018-01-16 15:32:53 -0500310 Bundle extras = new Bundle();
311 extras.putParcelable(SliceProvider.EXTRA_BIND_URI, uri);
312 extras.putParcelableArrayList(SliceProvider.EXTRA_SUPPORTED_SPECS,
313 new ArrayList<>(supportedSpecs));
Jason Monk632def12018-02-01 15:21:16 -0500314 final Bundle res = provider.call(SliceProvider.METHOD_SLICE, null, extras);
Jason Monkb9e06a82018-01-16 15:32:53 -0500315 Bundle.setDefusable(res, true);
316 if (res == null) {
317 return null;
318 }
319 return res.getParcelable(SliceProvider.EXTRA_SLICE);
320 } catch (RemoteException e) {
321 // Arbitrary and not worth documenting, as Activity
322 // Manager will kill this process shortly anyway.
323 return null;
Jason Monkb9e06a82018-01-16 15:32:53 -0500324 }
325 }
326
327 /**
Jason Monk7b8fef22018-01-30 16:04:14 -0500328 * Turns a slice intent into a slice uri. Expects an explicit intent. If there is no
329 * {@link android.content.ContentProvider} associated with the given intent this will throw
330 * {@link IllegalArgumentException}.
331 *
332 * @param intent The intent associated with a slice.
333 * @return The Slice Uri provided by the app or null if none is given.
334 * @see Slice
335 * @see SliceProvider#onMapIntentToUri(Intent)
336 * @see Intent
337 */
338 public @Nullable Uri mapIntentToUri(@NonNull Intent intent) {
339 Preconditions.checkNotNull(intent, "intent");
340 Preconditions.checkArgument(intent.getComponent() != null || intent.getPackage() != null,
341 "Slice intent must be explicit %s", intent);
342 ContentResolver resolver = mContext.getContentResolver();
343
344 // Check if the intent has data for the slice uri on it and use that
345 final Uri intentData = intent.getData();
346 if (intentData != null && SliceProvider.SLICE_TYPE.equals(resolver.getType(intentData))) {
347 return intentData;
348 }
349 // Otherwise ask the app
350 List<ResolveInfo> providers =
351 mContext.getPackageManager().queryIntentContentProviders(intent, 0);
352 if (providers == null || providers.isEmpty()) {
353 throw new IllegalArgumentException("Unable to resolve intent " + intent);
354 }
355 String authority = providers.get(0).providerInfo.authority;
356 Uri uri = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT)
357 .authority(authority).build();
Jason Monk632def12018-02-01 15:21:16 -0500358 try (ContentProviderClient provider = resolver.acquireContentProviderClient(uri)) {
359 if (provider == null) {
360 throw new IllegalArgumentException("Unknown URI " + uri);
361 }
Jason Monk7b8fef22018-01-30 16:04:14 -0500362 Bundle extras = new Bundle();
363 extras.putParcelable(SliceProvider.EXTRA_INTENT, intent);
Jason Monk632def12018-02-01 15:21:16 -0500364 final Bundle res = provider.call(SliceProvider.METHOD_MAP_ONLY_INTENT, null, extras);
Jason Monk7b8fef22018-01-30 16:04:14 -0500365 if (res == null) {
366 return null;
367 }
368 return res.getParcelable(SliceProvider.EXTRA_SLICE);
369 } catch (RemoteException e) {
370 // Arbitrary and not worth documenting, as Activity
371 // Manager will kill this process shortly anyway.
372 return null;
Jason Monk7b8fef22018-01-30 16:04:14 -0500373 }
374 }
375
376 /**
Jason Monkb9e06a82018-01-16 15:32:53 -0500377 * Turns a slice intent into slice content. Expects an explicit intent. If there is no
378 * {@link android.content.ContentProvider} associated with the given intent this will throw
379 * {@link IllegalArgumentException}.
380 *
381 * @param intent The intent associated with a slice.
382 * @param supportedSpecs List of supported specs.
383 * @return The Slice provided by the app or null if none is given.
384 * @see Slice
385 * @see SliceProvider#onMapIntentToUri(Intent)
386 * @see Intent
387 */
388 public @Nullable Slice bindSlice(@NonNull Intent intent,
389 @NonNull List<SliceSpec> supportedSpecs) {
390 Preconditions.checkNotNull(intent, "intent");
391 Preconditions.checkArgument(intent.getComponent() != null || intent.getPackage() != null,
Jason Monk7b8fef22018-01-30 16:04:14 -0500392 "Slice intent must be explicit %s", intent);
Jason Monkb9e06a82018-01-16 15:32:53 -0500393 ContentResolver resolver = mContext.getContentResolver();
394
395 // Check if the intent has data for the slice uri on it and use that
396 final Uri intentData = intent.getData();
397 if (intentData != null && SliceProvider.SLICE_TYPE.equals(resolver.getType(intentData))) {
398 return bindSlice(intentData, supportedSpecs);
399 }
400 // Otherwise ask the app
401 List<ResolveInfo> providers =
402 mContext.getPackageManager().queryIntentContentProviders(intent, 0);
Jason Monk7b8fef22018-01-30 16:04:14 -0500403 if (providers == null || providers.isEmpty()) {
Jason Monkb9e06a82018-01-16 15:32:53 -0500404 throw new IllegalArgumentException("Unable to resolve intent " + intent);
405 }
406 String authority = providers.get(0).providerInfo.authority;
407 Uri uri = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT)
408 .authority(authority).build();
Jason Monk632def12018-02-01 15:21:16 -0500409 try (ContentProviderClient provider = resolver.acquireContentProviderClient(uri)) {
410 if (provider == null) {
411 throw new IllegalArgumentException("Unknown URI " + uri);
412 }
Jason Monkb9e06a82018-01-16 15:32:53 -0500413 Bundle extras = new Bundle();
414 extras.putParcelable(SliceProvider.EXTRA_INTENT, intent);
415 extras.putParcelableArrayList(SliceProvider.EXTRA_SUPPORTED_SPECS,
416 new ArrayList<>(supportedSpecs));
Jason Monk632def12018-02-01 15:21:16 -0500417 final Bundle res = provider.call(SliceProvider.METHOD_MAP_INTENT, null, extras);
Jason Monkb9e06a82018-01-16 15:32:53 -0500418 if (res == null) {
419 return null;
420 }
421 return res.getParcelable(SliceProvider.EXTRA_SLICE);
422 } catch (RemoteException e) {
423 // Arbitrary and not worth documenting, as Activity
424 // Manager will kill this process shortly anyway.
425 return null;
Jason Monkb9e06a82018-01-16 15:32:53 -0500426 }
427 }
428
429 /**
Jason Monke8f8be72018-01-21 10:10:35 -0500430 * Does the permission check to see if a caller has access to a specific slice.
431 * @hide
432 */
433 public void enforceSlicePermission(Uri uri, String pkg, int pid, int uid) {
434 try {
435 if (pkg == null) {
436 throw new SecurityException("No pkg specified");
437 }
438 int result = mService.checkSlicePermission(uri, pkg, pid, uid);
439 if (result == PERMISSION_DENIED) {
440 throw new SecurityException("User " + uid + " does not have slice permission for "
441 + uri + ".");
442 }
443 if (result == PERMISSION_USER_GRANTED) {
444 // We just had a user grant of this permission and need to grant this to the app
445 // permanently.
446 mContext.grantUriPermission(pkg, uri.buildUpon().path("").build(),
447 Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
448 | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
449 | Intent.FLAG_GRANT_PREFIX_URI_PERMISSION);
450 }
451 } catch (RemoteException e) {
452 throw e.rethrowFromSystemServer();
453 }
454 }
455
456 /**
457 * Called by SystemUI to grant a slice permission after a dialog is shown.
458 * @hide
459 */
460 public void grantPermissionFromUser(Uri uri, String pkg, boolean allSlices) {
461 try {
462 mService.grantPermissionFromUser(uri, pkg, mContext.getPackageName(), allSlices);
463 } catch (RemoteException e) {
464 throw e.rethrowFromSystemServer();
465 }
466 }
467
468 /**
Jason Monke2c64512017-12-11 15:14:54 -0500469 * Class that listens to changes in {@link Slice}s.
Jason Monk74f5e362017-12-06 08:56:33 -0500470 */
Jason Monke2c64512017-12-11 15:14:54 -0500471 public interface SliceCallback {
Jason Monk74f5e362017-12-06 08:56:33 -0500472
473 /**
Jason Monke2c64512017-12-11 15:14:54 -0500474 * Called when slice is updated.
475 *
476 * @param s The updated slice.
477 * @see #registerSliceCallback
Jason Monk74f5e362017-12-06 08:56:33 -0500478 */
Jason Monke2c64512017-12-11 15:14:54 -0500479 void onSliceUpdated(Slice s);
Jason Monk74f5e362017-12-06 08:56:33 -0500480 }
Jason Monk8f5f7ff2017-10-17 14:12:42 -0400481}