Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5182ea4b authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am d40a4d74: Merge "Add media router service and integrate with remote displays." into klp-dev

* commit 'd40a4d74':
  Add media router service and integrate with remote displays.
parents eb223425 d40a4d74
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -251,6 +251,8 @@ LOCAL_SRC_FILES += \
	media/java/android/media/IAudioService.aidl \
	media/java/android/media/IAudioFocusDispatcher.aidl \
	media/java/android/media/IAudioRoutesObserver.aidl \
	media/java/android/media/IMediaRouterClient.aidl \
	media/java/android/media/IMediaRouterService.aidl \
	media/java/android/media/IMediaScannerListener.aidl \
	media/java/android/media/IMediaScannerService.aidl \
	media/java/android/media/IRemoteControlClient.aidl \
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class MediaRouteActionProvider extends ActionProvider {
        }
        mRouteTypes = types;
        if (types != 0) {
            mRouter.addCallback(types, mCallback);
            mRouter.addCallback(types, mCallback, MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
        }
        if (mView != null) {
            mView.setRouteTypes(mRouteTypes);
+15 −12
Original line number Diff line number Diff line
@@ -123,14 +123,14 @@ public class MediaRouteButton extends View {

        if (mToggleMode) {
            if (mRemoteActive) {
                mRouter.selectRouteInt(mRouteTypes, mRouter.getDefaultRoute());
                mRouter.selectRouteInt(mRouteTypes, mRouter.getDefaultRoute(), true);
            } else {
                final int N = mRouter.getRouteCount();
                for (int i = 0; i < N; i++) {
                    final RouteInfo route = mRouter.getRouteAt(i);
                    if ((route.getSupportedTypes() & mRouteTypes) != 0 &&
                            route != mRouter.getDefaultRoute()) {
                        mRouter.selectRouteInt(mRouteTypes, route);
                        mRouter.selectRouteInt(mRouteTypes, route, true);
                    }
                }
            }
@@ -201,7 +201,8 @@ public class MediaRouteButton extends View {

        if (mAttachedToWindow) {
            updateRouteInfo();
            mRouter.addCallback(types, mRouterCallback);
            mRouter.addCallback(types, mRouterCallback,
                    MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
        }
    }

@@ -217,8 +218,7 @@ public class MediaRouteButton extends View {
    void updateRemoteIndicator() {
        final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes);
        final boolean isRemote = selected != mRouter.getDefaultRoute();
        final boolean isConnecting = selected != null &&
                selected.getStatusCode() == RouteInfo.STATUS_CONNECTING;
        final boolean isConnecting = selected != null && selected.isConnecting();

        boolean needsRefresh = false;
        if (mRemoteActive != isRemote) {
@@ -238,7 +238,7 @@ public class MediaRouteButton extends View {
    void updateRouteCount() {
        final int N = mRouter.getRouteCount();
        int count = 0;
        boolean hasVideoRoutes = false;
        boolean scanRequired = false;
        for (int i = 0; i < N; i++) {
            final RouteInfo route = mRouter.getRouteAt(i);
            final int routeTypes = route.getSupportedTypes();
@@ -248,8 +248,9 @@ public class MediaRouteButton extends View {
                } else {
                    count++;
                }
                if ((routeTypes & MediaRouter.ROUTE_TYPE_LIVE_VIDEO) != 0) {
                    hasVideoRoutes = true;
                if (((routeTypes & MediaRouter.ROUTE_TYPE_LIVE_VIDEO
                        | MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY)) != 0) {
                    scanRequired = true;
                }
            }
        }
@@ -257,9 +258,10 @@ public class MediaRouteButton extends View {
        setEnabled(count != 0);

        // Only allow toggling if we have more than just user routes.
        // Don't toggle if we support video routes, we may have to let the dialog scan.
        mToggleMode = count == 2 && (mRouteTypes & MediaRouter.ROUTE_TYPE_LIVE_AUDIO) != 0 &&
                !hasVideoRoutes;
        // Don't toggle if we support video or remote display routes, we may have to
        // let the dialog scan.
        mToggleMode = count == 2 && (mRouteTypes & MediaRouter.ROUTE_TYPE_LIVE_AUDIO) != 0
                && !scanRequired;
    }

    @Override
@@ -313,7 +315,8 @@ public class MediaRouteButton extends View {
        super.onAttachedToWindow();
        mAttachedToWindow = true;
        if (mRouteTypes != 0) {
            mRouter.addCallback(mRouteTypes, mRouterCallback);
            mRouter.addCallback(mRouteTypes, mRouterCallback,
                    MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
            updateRouteInfo();
        }
    }
+9 −0
Original line number Diff line number Diff line
@@ -643,6 +643,15 @@ public final class Display {
                || uid == 0;
    }

    /**
     * Returns true if the display is a public presentation display.
     * @hide
     */
    public boolean isPublicPresentation() {
        return (mFlags & (Display.FLAG_PRIVATE | Display.FLAG_PRESENTATION)) ==
                Display.FLAG_PRESENTATION;
    }

    private void updateDisplayInfoLocked() {
        // Note: The display manager caches display info objects on our behalf.
        DisplayInfo newInfo = mGlobal.getDisplayInfo(mDisplayId);
+3 −3
Original line number Diff line number Diff line
@@ -501,7 +501,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {

                final RouteInfo route = (RouteInfo) item;
                if (type == VIEW_ROUTE) {
                    mRouter.selectRouteInt(mRouteTypes, route);
                    mRouter.selectRouteInt(mRouteTypes, route, true);
                    dismiss();
                } else if (type == VIEW_GROUPING_ROUTE) {
                    final Checkable c = (Checkable) view;
@@ -514,7 +514,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
                        if (mRouter.getSelectedRoute(mRouteTypes) == oldGroup) {
                            // Old group was selected but is now empty. Select the group
                            // we're manipulating since that's where the last route went.
                            mRouter.selectRouteInt(mRouteTypes, mEditingGroup);
                            mRouter.selectRouteInt(mRouteTypes, mEditingGroup, true);
                        }
                        oldGroup.removeRoute(route);
                        mEditingGroup.addRoute(route);
@@ -555,7 +555,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
                mEditingGroup = group;
                mCategoryEditingGroups = group.getCategory();
                getDialog().setCanceledOnTouchOutside(false);
                mRouter.selectRouteInt(mRouteTypes, mEditingGroup);
                mRouter.selectRouteInt(mRouteTypes, mEditingGroup, true);
                update();
                scrollToEditingGroup();
            }
Loading