Loading packages/SystemUI/src/com/android/systemui/accessibility/hearingaid/AmbientVolumeLayout.java +31 −3 Original line number Diff line number Diff line Loading @@ -58,12 +58,23 @@ public class AmbientVolumeLayout extends LinearLayout implements AmbientVolumeUi private final BiMap<Integer, AmbientVolumeSlider> mSideToSliderMap = HashBiMap.create(); private int mVolumeLevel = AMBIENT_VOLUME_LEVEL_DEFAULT; private HearingDevicesUiEventLogger mUiEventLogger; private int mLaunchSourceId; private final AmbientVolumeSlider.OnChangeListener mSliderOnChangeListener = (slider, value) -> { final Integer side = mSideToSliderMap.inverse().get(slider); if (side != null) { if (mUiEventLogger != null) { HearingDevicesUiEvent uiEvent = side == SIDE_UNIFIED ? HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_CHANGE_UNIFIED : HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_CHANGE_SEPARATED; mUiEventLogger.log(uiEvent, mLaunchSourceId); } if (mListener != null) { final int side = mSideToSliderMap.inverse().get(slider); mListener.onSliderValueChange(side, value); } } }; public AmbientVolumeLayout(@Nullable Context context) { Loading Loading @@ -94,6 +105,12 @@ public class AmbientVolumeLayout extends LinearLayout implements AmbientVolumeUi return; } setMuted(!mMuted); if (mUiEventLogger != null) { HearingDevicesUiEvent uiEvent = mMuted ? HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_MUTE : HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_UNMUTE; mUiEventLogger.log(uiEvent, mLaunchSourceId); } if (mListener != null) { mListener.onAmbientVolumeIconClick(); } Loading @@ -103,6 +120,12 @@ public class AmbientVolumeLayout extends LinearLayout implements AmbientVolumeUi mExpandIcon = requireViewById(R.id.ambient_expand_icon); mExpandIcon.setOnClickListener(v -> { setExpanded(!mExpanded); if (mUiEventLogger != null) { HearingDevicesUiEvent uiEvent = mExpanded ? HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_EXPAND_CONTROLS : HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_COLLAPSE_CONTROLS; mUiEventLogger.log(uiEvent, mLaunchSourceId); } if (mListener != null) { mListener.onExpandIconClick(); } Loading Loading @@ -243,6 +266,11 @@ public class AmbientVolumeLayout extends LinearLayout implements AmbientVolumeUi updateVolumeLevel(); } void setUiEventLogger(HearingDevicesUiEventLogger uiEventLogger, int launchSourceId) { mUiEventLogger = uiEventLogger; mLaunchSourceId = launchSourceId; } private void updateVolumeLevel() { int leftLevel, rightLevel; if (mExpanded) { Loading packages/SystemUI/src/com/android/systemui/accessibility/hearingaid/HearingDevicesDialogDelegate.java +1 −0 Original line number Diff line number Diff line Loading @@ -382,6 +382,7 @@ public class HearingDevicesDialogDelegate implements SystemUIDialog.Delegate, private void setupAmbientControls(CachedBluetoothDevice activeHearingDevice) { final AmbientVolumeLayout ambientLayout = mDialog.requireViewById(R.id.ambient_layout); ambientLayout.setUiEventLogger(mUiEventLogger, mLaunchSourceId); mAmbientController = new AmbientVolumeUiController( mDialog.getContext(), mLocalBluetoothManager, ambientLayout); mAmbientController.setShowUiWhenLocalDataExist(false); Loading packages/SystemUI/src/com/android/systemui/accessibility/hearingaid/HearingDevicesUiEvent.kt +11 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,17 @@ enum class HearingDevicesUiEvent(private val id: Int) : UiEventLogger.UiEventEnu @UiEvent(doc = "Click on the device gear to enter device detail page") HEARING_DEVICES_GEAR_CLICK(1853), @UiEvent(doc = "Select a preset from preset spinner") HEARING_DEVICES_PRESET_SELECT(1854), @UiEvent(doc = "Click on related tool") HEARING_DEVICES_RELATED_TOOL_CLICK(1856); @UiEvent(doc = "Click on related tool") HEARING_DEVICES_RELATED_TOOL_CLICK(1856), @UiEvent(doc = "Change the ambient volume with unified control") HEARING_DEVICES_AMBIENT_CHANGE_UNIFIED(2149), @UiEvent(doc = "Change the ambient volume with separated control") HEARING_DEVICES_AMBIENT_CHANGE_SEPARATED(2150), @UiEvent(doc = "Mute the ambient volume") HEARING_DEVICES_AMBIENT_MUTE(2151), @UiEvent(doc = "Unmute the ambient volume") HEARING_DEVICES_AMBIENT_UNMUTE(2152), @UiEvent(doc = "Expand the ambient volume controls") HEARING_DEVICES_AMBIENT_EXPAND_CONTROLS(2153), @UiEvent(doc = "Collapse the ambient volume controls") HEARING_DEVICES_AMBIENT_COLLAPSE_CONTROLS(2154); override fun getId(): Int = this.id } Loading
packages/SystemUI/src/com/android/systemui/accessibility/hearingaid/AmbientVolumeLayout.java +31 −3 Original line number Diff line number Diff line Loading @@ -58,12 +58,23 @@ public class AmbientVolumeLayout extends LinearLayout implements AmbientVolumeUi private final BiMap<Integer, AmbientVolumeSlider> mSideToSliderMap = HashBiMap.create(); private int mVolumeLevel = AMBIENT_VOLUME_LEVEL_DEFAULT; private HearingDevicesUiEventLogger mUiEventLogger; private int mLaunchSourceId; private final AmbientVolumeSlider.OnChangeListener mSliderOnChangeListener = (slider, value) -> { final Integer side = mSideToSliderMap.inverse().get(slider); if (side != null) { if (mUiEventLogger != null) { HearingDevicesUiEvent uiEvent = side == SIDE_UNIFIED ? HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_CHANGE_UNIFIED : HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_CHANGE_SEPARATED; mUiEventLogger.log(uiEvent, mLaunchSourceId); } if (mListener != null) { final int side = mSideToSliderMap.inverse().get(slider); mListener.onSliderValueChange(side, value); } } }; public AmbientVolumeLayout(@Nullable Context context) { Loading Loading @@ -94,6 +105,12 @@ public class AmbientVolumeLayout extends LinearLayout implements AmbientVolumeUi return; } setMuted(!mMuted); if (mUiEventLogger != null) { HearingDevicesUiEvent uiEvent = mMuted ? HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_MUTE : HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_UNMUTE; mUiEventLogger.log(uiEvent, mLaunchSourceId); } if (mListener != null) { mListener.onAmbientVolumeIconClick(); } Loading @@ -103,6 +120,12 @@ public class AmbientVolumeLayout extends LinearLayout implements AmbientVolumeUi mExpandIcon = requireViewById(R.id.ambient_expand_icon); mExpandIcon.setOnClickListener(v -> { setExpanded(!mExpanded); if (mUiEventLogger != null) { HearingDevicesUiEvent uiEvent = mExpanded ? HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_EXPAND_CONTROLS : HearingDevicesUiEvent.HEARING_DEVICES_AMBIENT_COLLAPSE_CONTROLS; mUiEventLogger.log(uiEvent, mLaunchSourceId); } if (mListener != null) { mListener.onExpandIconClick(); } Loading Loading @@ -243,6 +266,11 @@ public class AmbientVolumeLayout extends LinearLayout implements AmbientVolumeUi updateVolumeLevel(); } void setUiEventLogger(HearingDevicesUiEventLogger uiEventLogger, int launchSourceId) { mUiEventLogger = uiEventLogger; mLaunchSourceId = launchSourceId; } private void updateVolumeLevel() { int leftLevel, rightLevel; if (mExpanded) { Loading
packages/SystemUI/src/com/android/systemui/accessibility/hearingaid/HearingDevicesDialogDelegate.java +1 −0 Original line number Diff line number Diff line Loading @@ -382,6 +382,7 @@ public class HearingDevicesDialogDelegate implements SystemUIDialog.Delegate, private void setupAmbientControls(CachedBluetoothDevice activeHearingDevice) { final AmbientVolumeLayout ambientLayout = mDialog.requireViewById(R.id.ambient_layout); ambientLayout.setUiEventLogger(mUiEventLogger, mLaunchSourceId); mAmbientController = new AmbientVolumeUiController( mDialog.getContext(), mLocalBluetoothManager, ambientLayout); mAmbientController.setShowUiWhenLocalDataExist(false); Loading
packages/SystemUI/src/com/android/systemui/accessibility/hearingaid/HearingDevicesUiEvent.kt +11 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,17 @@ enum class HearingDevicesUiEvent(private val id: Int) : UiEventLogger.UiEventEnu @UiEvent(doc = "Click on the device gear to enter device detail page") HEARING_DEVICES_GEAR_CLICK(1853), @UiEvent(doc = "Select a preset from preset spinner") HEARING_DEVICES_PRESET_SELECT(1854), @UiEvent(doc = "Click on related tool") HEARING_DEVICES_RELATED_TOOL_CLICK(1856); @UiEvent(doc = "Click on related tool") HEARING_DEVICES_RELATED_TOOL_CLICK(1856), @UiEvent(doc = "Change the ambient volume with unified control") HEARING_DEVICES_AMBIENT_CHANGE_UNIFIED(2149), @UiEvent(doc = "Change the ambient volume with separated control") HEARING_DEVICES_AMBIENT_CHANGE_SEPARATED(2150), @UiEvent(doc = "Mute the ambient volume") HEARING_DEVICES_AMBIENT_MUTE(2151), @UiEvent(doc = "Unmute the ambient volume") HEARING_DEVICES_AMBIENT_UNMUTE(2152), @UiEvent(doc = "Expand the ambient volume controls") HEARING_DEVICES_AMBIENT_EXPAND_CONTROLS(2153), @UiEvent(doc = "Collapse the ambient volume controls") HEARING_DEVICES_AMBIENT_COLLAPSE_CONTROLS(2154); override fun getId(): Int = this.id }