Skip to content

OboeTester_ScreenRotation

Robert Wu edited this page May 26, 2026 · 1 revision

OboeTester Screen Rotation

Main OboeTester Docs

This document explains how OboeTester handles device rotation, why audio streams are preserved when the screen rotates, and how Android's dynamic audio policies can affect audio streams during orientation changes.

How OboeTester Handles Rotation

In a standard Android application, rotating the device from portrait to landscape (or vice versa) triggers a configuration change that destroys and recreates the active Activity. For real-time audio apps, this default behavior is highly disruptive because recreating the activity would tear down and recreate the active Oboe audio streams, resetting the test in progress.

To prevent this, OboeTester configures its activities in AndroidManifest.xml with the android:configChanges attribute:

android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize"

The Result

  • No Stream Teardowns: The Activity remains alive during rotation.
  • Uninterrupted Testing: Audio streams, native callback loops, and ongoing measurements (such as latency or glitch detection) continue to run smoothly without resetting.
  • Visual Adaptation: The UI layout adjusts to fit the new screen dimensions without destroying the JNI bridges or native state.

Why Streams Can "Act Funny" During Rotation

While the Oboe audio stream itself remains open and running, the Android OS may dynamically modify its underlying audio routing and policies as the physical orientation changes. This can lead to unexpected audio behavior mid-test:

1. Stereo Channel Swapping (Left/Right Swapping)

Many modern smartphones and tablets physically swap the audio output channels (Left and Right) dynamically as the device rotates. This is done to ensure that physical "Left" always corresponds to the speaker on the left side of the screen from the user's perspective.

  • Acoustic Impact: If you are running a stereo output test, you may experience a brief volume dip, phase alignment shift, or transient glitch when the hardware switches the channel routing during rotation.

2. Microphone Selection & Acoustic Tuning

Android's audio framework applies different acoustic tuning profiles depending on the device orientation and how it is held:

  • Microphone Switching: In portrait mode, the system might route audio from the bottom microphone (optimized for handheld telephony). In landscape mode, it may switch to a top or back microphone (optimized for video recording or speakerphone use).
  • Noise Suppression & Gain: The orientation change can trigger different software gain controls, echo cancellation profiles, or noise reduction filters.
  • Acoustic Impact: This can cause sudden changes in input volume, frequency response, or phase during a Tap-to-Tone or Round-Trip Latency test.

3. Physical Acoustic Obstruction

The physical handling of the device changes when rotating.

  • Acoustic Impact: You or the user may inadvertently cover the microphone or speaker ports with hands or a tablet stand when rotating, dramatically altering the measured latency or volume.

Best Practices for Testing

To get consistent, accurate results when using OboeTester:

  1. Lock Your Orientation First: Choose the target orientation (typically portrait) before starting sensitive measurements.
  2. Avoid Rotating Mid-Test: Try not to rotate the device while running active latency, glitch, or data path tests, as the OS audio policy changes can introduce artificial anomalies.
  3. Be Mindful of Stereo Tuning: If testing stereo performance, be aware that channel routing and speaker tuning may differ between landscape and portrait orientations.

Clone this wiki locally