Loading core/java/android/view/DisplayEventReceiver.java +16 −1 Original line number Diff line number Diff line Loading @@ -286,13 +286,22 @@ public abstract class DisplayEventReceiver { * @param timestampNanos The timestamp of the event, in the {@link System#nanoTime()} * timebase. * @param physicalDisplayId Stable display ID that uniquely describes a (display, port) pair. * @param modeId The new mode Id * @param modeId The new mode ID * @param renderPeriod The render frame period, which is a multiple of the mode's vsync period */ public void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId, long renderPeriod) { } /** * Called when a display mode rejection event is received. * * @param physicalDisplayId Stable display ID that uniquely describes a (display, port) pair. * @param modeId The mode ID of the mode that was rejected */ public void onModeRejected(long physicalDisplayId, int modeId) { } /** * Called when a display hdcp levels change event is received. * Loading Loading @@ -384,6 +393,12 @@ public abstract class DisplayEventReceiver { onModeChanged(timestampNanos, physicalDisplayId, modeId, renderPeriod); } // Called from native code. @SuppressWarnings("unused") private void dispatchModeRejected(long physicalDisplayId, int modeId) { onModeRejected(physicalDisplayId, modeId); } // Called from native code. @SuppressWarnings("unused") private void dispatchFrameRateOverrides(long timestampNanos, long physicalDisplayId, Loading core/jni/android_view_DisplayEventReceiver.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ static struct { jmethodID dispatchHotplug; jmethodID dispatchHotplugConnectionError; jmethodID dispatchModeChanged; jmethodID dispatchModeRejected; jmethodID dispatchFrameRateOverrides; jmethodID dispatchHdcpLevelsChanged; Loading Loading @@ -95,6 +96,7 @@ private: void dispatchHotplugConnectionError(nsecs_t timestamp, int errorCode) override; void dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId, nsecs_t renderPeriod) override; void dispatchModeRejected(PhysicalDisplayId displayId, int32_t modeId) override; void dispatchFrameRateOverrides(nsecs_t timestamp, PhysicalDisplayId displayId, std::vector<FrameRateOverride> overrides) override; void dispatchNullEvent(nsecs_t timestamp, PhysicalDisplayId displayId) override {} Loading Loading @@ -271,6 +273,18 @@ void NativeDisplayEventReceiver::dispatchModeChanged(nsecs_t timestamp, Physical mMessageQueue->raiseAndClearException(env, "dispatchModeChanged"); } void NativeDisplayEventReceiver::dispatchModeRejected(PhysicalDisplayId displayId, int32_t modeId) { JNIEnv* env = AndroidRuntime::getJNIEnv(); ScopedLocalRef<jobject> receiverObj(env, GetReferent(env, mReceiverWeakGlobal)); if (receiverObj.get()) { ALOGV("receiver %p ~ Invoking Mode Rejected handler.", this); env->CallVoidMethod(receiverObj.get(), gDisplayEventReceiverClassInfo.dispatchModeRejected, displayId.value, modeId); ALOGV("receiver %p ~ Returned from Mode Rejected handler.", this); } } void NativeDisplayEventReceiver::dispatchFrameRateOverrides( nsecs_t timestamp, PhysicalDisplayId displayId, std::vector<FrameRateOverride> overrides) { JNIEnv* env = AndroidRuntime::getJNIEnv(); Loading Loading @@ -405,6 +419,9 @@ int register_android_view_DisplayEventReceiver(JNIEnv* env) { gDisplayEventReceiverClassInfo.dispatchModeChanged = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchModeChanged", "(JJIJ)V"); gDisplayEventReceiverClassInfo.dispatchModeRejected = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchModeRejected", "(JI)V"); gDisplayEventReceiverClassInfo.dispatchFrameRateOverrides = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchFrameRateOverrides", Loading Loading
core/java/android/view/DisplayEventReceiver.java +16 −1 Original line number Diff line number Diff line Loading @@ -286,13 +286,22 @@ public abstract class DisplayEventReceiver { * @param timestampNanos The timestamp of the event, in the {@link System#nanoTime()} * timebase. * @param physicalDisplayId Stable display ID that uniquely describes a (display, port) pair. * @param modeId The new mode Id * @param modeId The new mode ID * @param renderPeriod The render frame period, which is a multiple of the mode's vsync period */ public void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId, long renderPeriod) { } /** * Called when a display mode rejection event is received. * * @param physicalDisplayId Stable display ID that uniquely describes a (display, port) pair. * @param modeId The mode ID of the mode that was rejected */ public void onModeRejected(long physicalDisplayId, int modeId) { } /** * Called when a display hdcp levels change event is received. * Loading Loading @@ -384,6 +393,12 @@ public abstract class DisplayEventReceiver { onModeChanged(timestampNanos, physicalDisplayId, modeId, renderPeriod); } // Called from native code. @SuppressWarnings("unused") private void dispatchModeRejected(long physicalDisplayId, int modeId) { onModeRejected(physicalDisplayId, modeId); } // Called from native code. @SuppressWarnings("unused") private void dispatchFrameRateOverrides(long timestampNanos, long physicalDisplayId, Loading
core/jni/android_view_DisplayEventReceiver.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ static struct { jmethodID dispatchHotplug; jmethodID dispatchHotplugConnectionError; jmethodID dispatchModeChanged; jmethodID dispatchModeRejected; jmethodID dispatchFrameRateOverrides; jmethodID dispatchHdcpLevelsChanged; Loading Loading @@ -95,6 +96,7 @@ private: void dispatchHotplugConnectionError(nsecs_t timestamp, int errorCode) override; void dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId, nsecs_t renderPeriod) override; void dispatchModeRejected(PhysicalDisplayId displayId, int32_t modeId) override; void dispatchFrameRateOverrides(nsecs_t timestamp, PhysicalDisplayId displayId, std::vector<FrameRateOverride> overrides) override; void dispatchNullEvent(nsecs_t timestamp, PhysicalDisplayId displayId) override {} Loading Loading @@ -271,6 +273,18 @@ void NativeDisplayEventReceiver::dispatchModeChanged(nsecs_t timestamp, Physical mMessageQueue->raiseAndClearException(env, "dispatchModeChanged"); } void NativeDisplayEventReceiver::dispatchModeRejected(PhysicalDisplayId displayId, int32_t modeId) { JNIEnv* env = AndroidRuntime::getJNIEnv(); ScopedLocalRef<jobject> receiverObj(env, GetReferent(env, mReceiverWeakGlobal)); if (receiverObj.get()) { ALOGV("receiver %p ~ Invoking Mode Rejected handler.", this); env->CallVoidMethod(receiverObj.get(), gDisplayEventReceiverClassInfo.dispatchModeRejected, displayId.value, modeId); ALOGV("receiver %p ~ Returned from Mode Rejected handler.", this); } } void NativeDisplayEventReceiver::dispatchFrameRateOverrides( nsecs_t timestamp, PhysicalDisplayId displayId, std::vector<FrameRateOverride> overrides) { JNIEnv* env = AndroidRuntime::getJNIEnv(); Loading Loading @@ -405,6 +419,9 @@ int register_android_view_DisplayEventReceiver(JNIEnv* env) { gDisplayEventReceiverClassInfo.dispatchModeChanged = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchModeChanged", "(JJIJ)V"); gDisplayEventReceiverClassInfo.dispatchModeRejected = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchModeRejected", "(JI)V"); gDisplayEventReceiverClassInfo.dispatchFrameRateOverrides = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchFrameRateOverrides", Loading