diff options
| author | Jeff Brown <jeffbrown@google.com> | 2013-03-07 16:25:37 -0800 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2013-03-07 16:39:27 -0800 |
| commit | c21f57ed68b81a77167f1df000b0e272e1598bc0 (patch) | |
| tree | 0a0d697c38257863b4c71bf1b128a25b34c95975 /v4/jellybean-mr1 | |
| parent | 65c3f741461ceaaa6107ee7fcb7082950ffd6b41 (diff) | |
| download | android_frameworks_support-c21f57ed68b81a77167f1df000b0e272e1598bc0.tar.gz android_frameworks_support-c21f57ed68b81a77167f1df000b0e272e1598bc0.tar.bz2 android_frameworks_support-c21f57ed68b81a77167f1df000b0e272e1598bc0.zip | |
Add media router and display manager to support library.
The support library MediaRouter API is somewhat different from
the framework's existing MediaRouter API. It is designed to
be simpler and easier to extend.
In the new MediaRouter, routes are published by MediaRouteProviders.
MediaRouteProviders replace the concept of UserRoutes.
The built-in SystemMediaRouteProvider publishes the default
system routes and interoperates with the framework MediaRouter.
Each route now declares its capabilities and behaviors by way
of MediaControlIntents. The type of the route (live audio,
live video, or remote playback) is specified by the categories
of media control intents that the route supports. A route
may support any number of custom provider-defined media control
intent categories that provide access to specialized features.
The old concepts of route categories and route groups have
been removed. Route providers are now responsible for implementing
the route grouping and configuration through some UI of their
own that is not managed by the media router.
This patch does not include support for route icon drawables,
the new route picker UI or route provider services. These features
will be added in follow on patches.
Change-Id: I10cf078917d053a916254a5aa9d208b8cfd341ea
Diffstat (limited to 'v4/jellybean-mr1')
| -rw-r--r-- | v4/jellybean-mr1/android/support/v4/hardware/display/DisplayManagerJellybeanMr1.java | 38 | ||||
| -rw-r--r-- | v4/jellybean-mr1/android/support/v4/media/MediaRouterJellybeanMr1.java | 52 |
2 files changed, 90 insertions, 0 deletions
diff --git a/v4/jellybean-mr1/android/support/v4/hardware/display/DisplayManagerJellybeanMr1.java b/v4/jellybean-mr1/android/support/v4/hardware/display/DisplayManagerJellybeanMr1.java new file mode 100644 index 0000000000..b44a2e8f78 --- /dev/null +++ b/v4/jellybean-mr1/android/support/v4/hardware/display/DisplayManagerJellybeanMr1.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2013 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.support.v4.hardware.display; + +import android.content.Context; +import android.view.Display; + +final class DisplayManagerJellybeanMr1 { + public static Object getDisplayManager(Context context) { + return context.getSystemService(Context.DISPLAY_SERVICE); + } + + public static Display getDisplay(Object displayManagerObj, int displayId) { + return ((android.hardware.display.DisplayManager)displayManagerObj).getDisplay(displayId); + } + + public static Display[] getDisplays(Object displayManagerObj) { + return ((android.hardware.display.DisplayManager)displayManagerObj).getDisplays(); + } + + public static Display[] getDisplays(Object displayManagerObj, String category) { + return ((android.hardware.display.DisplayManager)displayManagerObj).getDisplays(category); + } +} diff --git a/v4/jellybean-mr1/android/support/v4/media/MediaRouterJellybeanMr1.java b/v4/jellybean-mr1/android/support/v4/media/MediaRouterJellybeanMr1.java new file mode 100644 index 0000000000..7760d58f81 --- /dev/null +++ b/v4/jellybean-mr1/android/support/v4/media/MediaRouterJellybeanMr1.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2013 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.support.v4.media; + +import android.view.Display; + +final class MediaRouterJellybeanMr1 { + public static Object createCallback(Callback callback) { + return new CallbackProxy<Callback>(callback); + } + + public static final class RouteInfo { + public static boolean isEnabled(Object routeObj) { + return ((android.media.MediaRouter.RouteInfo)routeObj).isEnabled(); + } + + public static Display getPresentationDisplay(Object routeObj) { + return ((android.media.MediaRouter.RouteInfo)routeObj).getPresentationDisplay(); + } + } + + public static interface Callback extends MediaRouterJellybean.Callback { + public void onRoutePresentationDisplayChanged(Object routeObj); + } + + static class CallbackProxy<T extends Callback> + extends MediaRouterJellybean.CallbackProxy<T> { + public CallbackProxy(T callback) { + super(callback); + } + + @Override + public void onRoutePresentationDisplayChanged(android.media.MediaRouter router, + android.media.MediaRouter.RouteInfo route) { + mCallback.onRoutePresentationDisplayChanged(route); + } + } +} |
