Task: Implement a lightweight AudioManager wrapper in the app module
Description:
Create a small, test-friendly wrapper around Android's AudioManager that exposes the same basic volume control operations used in the tests. The wrapper should delegate all calls to the platform AudioManager obtained via a Context. This enables clean, testable usage in production code and compatibility with Robolectric shadow behavior used in tests.
What to implement:
New class: AudioManagerCompat (package of your app, e.g., com.example.app)
Internally obtain an AudioManager instance: (AudioManager) context.getSystemService(Context.AUDIO_SERVICE)
Methods (delegating to Android AudioManager):
public int getStreamMaxVolume(int streamType)
public int getStreamVolume(int streamType)
public void setStreamVolume(int streamType, int index, int flags)
Constants: Do not redefine AudioManager constants; use android.media.AudioManager’s existing constants (e.g., AudioManager.STREAM_MUSIC) when calling methods.
Imports: Include necessary Android imports (android.media.AudioManager, android.content.Context, etc.)
Documentation: Add Javadoc comments describing that this is a thin wrapper delegating to the system AudioManager.
Compatibility: Ensure the implementation compiles under Robolectric tests (i.e., avoid any API usage beyond what AudioManager provides).
Acceptance criteria:
A single Java file at the specified path implementing AudioManagerCompat with the described constructor and three methods delegating to AudioManager.
The class compiles in the project and is usable in tests (Robolectric shadowing remains compatible since it delegates to the platform AudioManager).
Example usage (optional, in comments) demonstrates creating an instance with a Context and calling the three methods with AudioManager.STREAM_MUSIC.
Notes:
Tests provided (which use Robolectric shadows on AudioManager) will remain valid and unaffected since the wrapper delegates to the underlying AudioManager.