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

Commit 8a595e73 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8191458 from a1d372c4 to sc-qpr3-release

Change-Id: If1047228d9ac5289d426fd047e8e633660536904
parents f952e603 a1d372c4
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -164,6 +164,31 @@ public class InfoMediaManager extends MediaManager {
        return sessionInfos.get(sessionInfos.size() - 1);
        return sessionInfos.get(sessionInfos.size() - 1);
    }
    }


    boolean isRoutingSessionAvailableForVolumeControl() {
        if (mVolumeAdjustmentForRemoteGroupSessions) {
            return true;
        }
        List<RoutingSessionInfo> sessions =
                mRouterManager.getRoutingSessions(mPackageName);
        boolean foundNonSystemSession = false;
        boolean isGroup = false;
        for (RoutingSessionInfo session : sessions) {
            if (!session.isSystemSession()) {
                foundNonSystemSession = true;
                int selectedRouteCount = session.getSelectedRoutes().size();
                if (selectedRouteCount > 1) {
                    isGroup = true;
                    break;
                }
            }
        }
        if (!foundNonSystemSession) {
            Log.d(TAG, "No routing session for " + mPackageName);
            return false;
        }
        return !isGroup;
    }

    /**
    /**
     * Remove a {@code device} from current media.
     * Remove a {@code device} from current media.
     *
     *
+8 −0
Original line number Original line Diff line number Diff line
@@ -195,6 +195,14 @@ public class LocalMediaManager implements BluetoothCallback {
        }
        }
    }
    }


    /**
     * Returns if the media session is available for volume control.
     * @return True if this media session is available for colume control, false otherwise.
     */
    public boolean isMediaSessionAvailableForVolumeControl() {
        return mInfoMediaManager.isRoutingSessionAvailableForVolumeControl();
    }

    /**
    /**
     * Start scan connected MediaDevice
     * Start scan connected MediaDevice
     */
     */
+3 −1
Original line number Original line Diff line number Diff line
@@ -118,9 +118,11 @@ public class DozeMachine {
            switch (this) {
            switch (this) {
                case UNINITIALIZED:
                case UNINITIALIZED:
                case INITIALIZED:
                case INITIALIZED:
                case DOZE_REQUEST_PULSE:
                    return parameters.shouldControlScreenOff() ? Display.STATE_ON
                    return parameters.shouldControlScreenOff() ? Display.STATE_ON
                            : Display.STATE_OFF;
                            : Display.STATE_OFF;
                case DOZE_REQUEST_PULSE:
                    return parameters.getDisplayNeedsBlanking() ? Display.STATE_OFF
                            : Display.STATE_ON;
                case DOZE_AOD_PAUSED:
                case DOZE_AOD_PAUSED:
                case DOZE:
                case DOZE:
                    return Display.STATE_OFF;
                    return Display.STATE_OFF;
+2 −1
Original line number Original line Diff line number Diff line
@@ -111,7 +111,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
            }
            }
            mBottomDivider.setVisibility(View.GONE);
            mBottomDivider.setVisibility(View.GONE);
            mCheckBox.setVisibility(View.GONE);
            mCheckBox.setVisibility(View.GONE);
            if (currentlyConnected && mController.isActiveRemoteDevice(device)) {
            if (currentlyConnected && mController.isActiveRemoteDevice(device)
                    && mController.getSelectableMediaDevice().size() > 0) {
                // Init active device layout
                // Init active device layout
                mAddIcon.setVisibility(View.VISIBLE);
                mAddIcon.setVisibility(View.VISIBLE);
                mAddIcon.setTransitionAlpha(1);
                mAddIcon.setTransitionAlpha(1);
+8 −6
Original line number Original line Diff line number Diff line
@@ -84,7 +84,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
    private final SystemUIDialogManager mDialogManager;
    private final SystemUIDialogManager mDialogManager;
    private final List<MediaDevice> mGroupMediaDevices = new CopyOnWriteArrayList<>();
    private final List<MediaDevice> mGroupMediaDevices = new CopyOnWriteArrayList<>();
    private final boolean mAboveStatusbar;
    private final boolean mAboveStatusbar;
    private final boolean mVolumeAdjustmentForRemoteGroupSessions;
    private final NotificationEntryManager mNotificationEntryManager;
    private final NotificationEntryManager mNotificationEntryManager;
    @VisibleForTesting
    @VisibleForTesting
    final List<MediaDevice> mMediaDevices = new CopyOnWriteArrayList<>();
    final List<MediaDevice> mMediaDevices = new CopyOnWriteArrayList<>();
@@ -117,8 +116,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
        mMetricLogger = new MediaOutputMetricLogger(mContext, mPackageName);
        mMetricLogger = new MediaOutputMetricLogger(mContext, mPackageName);
        mUiEventLogger = uiEventLogger;
        mUiEventLogger = uiEventLogger;
        mDialogLaunchAnimator = dialogLaunchAnimator;
        mDialogLaunchAnimator = dialogLaunchAnimator;
        mVolumeAdjustmentForRemoteGroupSessions = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_volumeAdjustmentForRemoteGroupSessions);
        mDialogManager = dialogManager;
        mDialogManager = dialogManager;
    }
    }


@@ -496,10 +493,15 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
                || features.contains(MediaRoute2Info.FEATURE_REMOTE_GROUP_PLAYBACK));
                || features.contains(MediaRoute2Info.FEATURE_REMOTE_GROUP_PLAYBACK));
    }
    }


    private boolean isPlayBackInfoLocal() {
        return mMediaController.getPlaybackInfo() != null
                && mMediaController.getPlaybackInfo().getPlaybackType()
                        == MediaController.PlaybackInfo.PLAYBACK_TYPE_LOCAL;
    }

    boolean isVolumeControlEnabled(@NonNull MediaDevice device) {
    boolean isVolumeControlEnabled(@NonNull MediaDevice device) {
        // TODO(b/202500642): Also enable volume control for remote non-group sessions.
        return isPlayBackInfoLocal()
        return !isActiveRemoteDevice(device)
                || mLocalMediaManager.isMediaSessionAvailableForVolumeControl();
            || mVolumeAdjustmentForRemoteGroupSessions;
    }
    }


    private final MediaController.Callback mCb = new MediaController.Callback() {
    private final MediaController.Callback mCb = new MediaController.Callback() {
Loading