diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/hardware/Camera.java | 15 | ||||
-rw-r--r-- | core/java/android/view/Choreographer.java | 20 | ||||
-rw-r--r-- | core/java/android/view/DisplayEventReceiver.java | 26 |
3 files changed, 56 insertions, 5 deletions
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index 7b3a8af..375d788 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -233,6 +233,21 @@ public class Camera { * @see Parameters#setJpegThumbnailSize(int, int) */ public int orientation; + + /** + * <p>Whether the shutter sound can be disabled.</p> + * + * <p>On some devices, the camera shutter sound cannot be turned off + * through {@link #enableShutterSound enableShutterSound}. This field + * can be used to determine whether a call to disable the shutter sound + * will succeed.</p> + * + * <p>If this field is set to true, then a call of + * {@code enableShutterSound(false)} will be successful. If set to + * false, then that call will fail, and the shutter sound will be played + * when {@link Camera#takePicture takePicture} is called.</p> + */ + public boolean canDisableShutterSound; }; /** diff --git a/core/java/android/view/Choreographer.java b/core/java/android/view/Choreographer.java index 6848606..b661748 100644 --- a/core/java/android/view/Choreographer.java +++ b/core/java/android/view/Choreographer.java @@ -16,7 +16,6 @@ package android.view; -import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManagerGlobal; import android.os.Handler; import android.os.Looper; @@ -685,7 +684,24 @@ public final class Choreographer { } @Override - public void onVsync(long timestampNanos, int frame) { + public void onVsync(long timestampNanos, int builtInDisplayId, int frame) { + // Ignore vsync from secondary display. + // This can be problematic because the call to scheduleVsync() is a one-shot. + // We need to ensure that we will still receive the vsync from the primary + // display which is the one we really care about. Ideally we should schedule + // vsync for a particular display. + // At this time Surface Flinger won't send us vsyncs for secondary displays + // but that could change in the future so let's log a message to help us remember + // that we need to fix this. + if (builtInDisplayId != Surface.BUILT_IN_DISPLAY_ID_MAIN) { + Log.d(TAG, "Received vsync from secondary display, but we don't support " + + "this case yet. Choreographer needs a way to explicitly request " + + "vsync for a specific display to ensure it doesn't lose track " + + "of its scheduled vsync."); + scheduleVsync(); + return; + } + // Post the vsync event to the Handler. // The idea is to prevent incoming vsync events from completely starving // the message queue. If there are no messages in the queue with timestamps diff --git a/core/java/android/view/DisplayEventReceiver.java b/core/java/android/view/DisplayEventReceiver.java index 0b138c2..a919ffc 100644 --- a/core/java/android/view/DisplayEventReceiver.java +++ b/core/java/android/view/DisplayEventReceiver.java @@ -101,9 +101,23 @@ public abstract class DisplayEventReceiver { * * @param timestampNanos The timestamp of the pulse, in the {@link System#nanoTime()} * timebase. + * @param builtInDisplayId The surface flinger built-in display id such as + * {@link Surface#BUILT_IN_DISPLAY_ID_MAIN}. * @param frame The frame number. Increases by one for each vertical sync interval. */ - public void onVsync(long timestampNanos, int frame) { + public void onVsync(long timestampNanos, int builtInDisplayId, int frame) { + } + + /** + * Called when a display hotplug event is received. + * + * @param timestampNanos The timestamp of the event, in the {@link System#nanoTime()} + * timebase. + * @param builtInDisplayId The surface flinger built-in display id such as + * {@link Surface#BUILT_IN_DISPLAY_ID_HDMI}. + * @param connected True if the display is connected, false if it disconnected. + */ + public void onHotplug(long timestampNanos, int builtInDisplayId, boolean connected) { } /** @@ -121,7 +135,13 @@ public abstract class DisplayEventReceiver { // Called from native code. @SuppressWarnings("unused") - private void dispatchVsync(long timestampNanos, int frame) { - onVsync(timestampNanos, frame); + private void dispatchVsync(long timestampNanos, int builtInDisplayId, int frame) { + onVsync(timestampNanos, builtInDisplayId, frame); + } + + // Called from native code. + @SuppressWarnings("unused") + private void dispatchHotplug(long timestampNanos, int builtInDisplayId, boolean connected) { + onHotplug(timestampNanos, builtInDisplayId, connected); } } |