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

Commit 5e783732 authored by John Spurlock's avatar John Spurlock
Browse files

AudioService: easier forced camera sound debugging.

 - Add mCameraSoundForced to the service state dumpsys output.
 - Add a sysprop to opt-in to this behavior for testing.  Does
   not replace the configuration check.
 - Centralize the configuration read in one place.

Change-Id: I83f84394b616f0788029412233ae1412b3cdedf2
parent fadfc4e1
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -581,8 +581,7 @@ public class AudioService extends IAudioService.Stub {

        AudioSystem.setErrorCallback(mAudioSystemCallback);

        boolean cameraSoundForced = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_camera_sound_forced);
        boolean cameraSoundForced = readCameraSoundForced();
        mCameraSoundForced = new Boolean(cameraSoundForced);
        sendMsg(mAudioHandler,
                MSG_SET_FORCE_USE,
@@ -5071,6 +5070,12 @@ public class AudioService extends IAudioService.Stub {
        return mMediaFocusControl.getCurrentAudioFocus();
    }

    private boolean readCameraSoundForced() {
        return SystemProperties.getBoolean("audio.camerasound.force", false) ||
                mContext.getResources().getBoolean(
                        com.android.internal.R.bool.config_camera_sound_forced);
    }

    //==========================================================================================
    // Device orientation
    //==========================================================================================
@@ -5101,8 +5106,7 @@ public class AudioService extends IAudioService.Stub {
                    null,
                    0);

            boolean cameraSoundForced = mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_camera_sound_forced);
            boolean cameraSoundForced = readCameraSoundForced();
            synchronized (mSettingsLock) {
                boolean cameraSoundForcedChanged = false;
                synchronized (mCameraSoundForced) {
@@ -5517,6 +5521,7 @@ public class AudioService extends IAudioService.Stub {
        pw.print("  mPendingVolumeCommand="); pw.println(mPendingVolumeCommand);
        pw.print("  mMusicActiveMs="); pw.println(mMusicActiveMs);
        pw.print("  mMcc="); pw.println(mMcc);
        pw.print("  mCameraSoundForced="); pw.println(mCameraSoundForced);
        pw.print("  mHasVibrator="); pw.println(mHasVibrator);
        pw.print("  mControllerService="); pw.println(mControllerService);