Skip to content

Frequency enforcement#2388

Merged
HoangHongHieu merged 2 commits into
mainfrom
hieuhh/frequency_enforcement
Jun 23, 2026
Merged

Frequency enforcement#2388
HoangHongHieu merged 2 commits into
mainfrom
hieuhh/frequency_enforcement

Conversation

@HoangHongHieu

@HoangHongHieu HoangHongHieu commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Frequency tests require a high volume to generate a clear frequency response from the speaker or microphone; however, the volume level is often left unset. Additionally, peripheral adjustments or volume changes during testing can lead to unexpected results. This ticket introduces an enforcement mode to automatically set the volume and monitor any changes during the test. Following is the app behavior when the feature is disabled or enabled:

  • Disable: The test will not adjust the volume, allowing users to configure settings for their own needs. There are no peripheral constraints, enabling testing across various scenarios.
  • Enable: The test will set the volume to the maximum level and verify all required peripherals before starting. Any changes to the volume or device connections during the test will result in a failure.

The default enforcement mode is enabled, though users are free to change. This approach increases the application's flexibility.

@HoangHongHieu HoangHongHieu requested a review from robertwu1 June 18, 2026 04:30
@HoangHongHieu HoangHongHieu self-assigned this Jun 18, 2026
@HoangHongHieu HoangHongHieu marked this pull request as draft June 18, 2026 04:34
@robertwu1

Copy link
Copy Markdown
Collaborator

Please merge the other PR first as this one shares a lot of common code

@robertwu1

Copy link
Copy Markdown
Collaborator

Having medium and high enforcement makes sense to me so we can test this. Do we plan on adding a low enforcement? If not, why not have a boolean variable like shouldSetVolumeToMax that's easier to understand?

@HoangHongHieu HoangHongHieu force-pushed the hieuhh/frequency_enforcement branch from c31d074 to d7579b4 Compare June 18, 2026 10:39
Following is the app behavior when the feature is enabled or disabled:
- Enable:
    The volume is set to maximum at the beginning of all frequency tests.
    During the test, any changes to the volume or peripherals will cause the test to fail.
    The test will fail if the required peripherals are missing.
- Disable:
    A warning will be raised if the required peripherals are missing or volume is changed.
@HoangHongHieu HoangHongHieu force-pushed the hieuhh/frequency_enforcement branch from d7579b4 to 131f34b Compare June 18, 2026 12:15
@HoangHongHieu HoangHongHieu marked this pull request as ready for review June 18, 2026 12:24
@HoangHongHieu

Copy link
Copy Markdown
Collaborator Author

Having medium and high enforcement makes sense to me so we can test this. Do we plan on adding a low enforcement? If not, why not have a boolean variable like shouldSetVolumeToMax that's easier to understand?

Thanks for reviewing, I didn't intend to add a low enforcement, so I updated the commit to use the boolean variable. The vibe code looked a bit messy and hard to read, so I refactored some of the functions in the frequency tests.

import java.util.TimerTask;
import java.util.Timer;

public class TestSupervisor extends AudioDeviceCallback {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments on why we need a test supervisor and why it's intended to be used. If we don't plan on having this for multiple tests, why not just subscribe to device changed callbacks within the test and check for volume changes in the test?

I personally don't like classes like this as it's not obvious what the class does from the naming. One thing we can do is maybe add a simple class that just checks whether the volume has changed. For checking if the devices have changed, we already have onAudioDevicesAdded and onAudioDevicesRemoved

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I placed it in the same package as the other test activities since it is used in both FrequencyTest and DualFrequencyTest. I have renamed the class to specify that it is intended only for frequency tests. If this clutters the com.mobileer.oboetester package, I am happy to move all frequency utility classes into a subpackage.

Regarding the class name, I agree that the previous one was not ideal. The class has been renamed, though all functionality remains the same. It is simple enough to ensure it maintains a single responsibility; while the activity could listen for device events directly, doing so would conflict with its other responsibilities.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

Comment thread apps/OboeTester/app/src/main/java/com/mobileer/oboetester/FrequencyActivity.java Outdated
Comment thread apps/OboeTester/app/src/main/java/com/mobileer/oboetester/FrequencyActivity.java Outdated
@robertwu1 robertwu1 self-requested a review June 22, 2026 18:22
@HoangHongHieu HoangHongHieu merged commit e3a488d into main Jun 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants