diff options
| author | 2022-06-09 19:52:04 +0000 | |
|---|---|---|
| committer | 2022-06-09 19:52:04 +0000 | |
| commit | 322db8517ec8da83c4f7281cb74a4d6a1458d922 (patch) | |
| tree | 9702ea0dd2111a3b36800273143fed65d2974b62 | |
| parent | c20aecad481ad3b9c72ef5fc86180be71f4e1e27 (diff) | |
| parent | abcff90b2359b49b9e2257c0d570955d8258c08e (diff) | |
Merge "AudioService: update display rotation monitoring" into tm-dev am: abcff90b23
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18806553
Change-Id: I0142264a861171a440932b66b16b0ee971aa9f94
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/audio/RotationHelper.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/audio/RotationHelper.java b/services/core/java/com/android/server/audio/RotationHelper.java index d4f4245f19c5..eb8387fe85e5 100644 --- a/services/core/java/com/android/server/audio/RotationHelper.java +++ b/services/core/java/com/android/server/audio/RotationHelper.java @@ -20,12 +20,13 @@ import android.content.Context; import android.hardware.devicestate.DeviceStateManager; import android.hardware.devicestate.DeviceStateManager.FoldStateListener; import android.hardware.display.DisplayManager; +import android.hardware.display.DisplayManagerGlobal; import android.media.AudioSystem; import android.os.Handler; import android.os.HandlerExecutor; import android.util.Log; +import android.view.Display; import android.view.Surface; -import android.view.WindowManager; /** * Class to handle device rotation events for AudioService, and forward device rotation @@ -48,6 +49,8 @@ class RotationHelper { private static final String TAG = "AudioService.RotationHelper"; + private static final boolean DEBUG_ROTATION = false; + private static AudioDisplayListener sDisplayListener; private static FoldStateListener sFoldStateListener; @@ -98,8 +101,8 @@ class RotationHelper { // Even though we're responding to device orientation events, // use display rotation so audio stays in sync with video/dialogs // TODO(b/148458001): Support multi-display - int newRotation = ((WindowManager) sContext.getSystemService( - Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation(); + int newRotation = DisplayManagerGlobal.getInstance() + .getDisplayInfo(Display.DEFAULT_DISPLAY).rotation; synchronized(sRotationLock) { if (newRotation != sDeviceRotation) { sDeviceRotation = newRotation; @@ -109,7 +112,9 @@ class RotationHelper { } private static void publishRotation(int rotation) { - Log.v(TAG, "publishing device rotation =" + rotation + " (x90deg)"); + if (DEBUG_ROTATION) { + Log.i(TAG, "publishing device rotation =" + rotation + " (x90deg)"); + } switch (rotation) { case Surface.ROTATION_0: AudioSystem.setParameters("rotation=0"); @@ -159,6 +164,9 @@ class RotationHelper { @Override public void onDisplayChanged(int displayId) { + if (DEBUG_ROTATION) { + Log.i(TAG, "onDisplayChanged diplayId:" + displayId); + } updateOrientation(); } } |