Loading core/java/android/view/DisplayEventReceiver.java +15 −0 Original line number Diff line number Diff line Loading @@ -263,6 +263,16 @@ public abstract class DisplayEventReceiver { public void onHotplug(long timestampNanos, long physicalDisplayId, boolean connected) { } /** * Called when a display hotplug event with connection error is received. * * @param timestampNanos The timestamp of the event, in the {@link System#nanoTime()} * timebase. * @param connectionError the hotplug connection error code. */ public void onHotplugConnectionError(long timestampNanos, int connectionError) { } /** * Called when a display mode changed event is received. * Loading Loading @@ -345,6 +355,11 @@ public abstract class DisplayEventReceiver { onHotplug(timestampNanos, physicalDisplayId, connected); } @SuppressWarnings("unused") private void dispatchHotplugConnectionError(long timestampNanos, int connectionError) { onHotplugConnectionError(timestampNanos, connectionError); } // Called from native code. @SuppressWarnings("unused") private void dispatchModeChanged(long timestampNanos, long physicalDisplayId, int modeId, Loading core/jni/android_view_DisplayEventReceiver.cpp +24 −2 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ static struct { jmethodID dispatchVsync; jmethodID dispatchHotplug; jmethodID dispatchHotplugConnectionError; jmethodID dispatchModeChanged; jmethodID dispatchFrameRateOverrides; Loading Loading @@ -89,6 +90,7 @@ private: void dispatchVsync(nsecs_t timestamp, PhysicalDisplayId displayId, uint32_t count, VsyncEventData vsyncEventData) override; void dispatchHotplug(nsecs_t timestamp, PhysicalDisplayId displayId, bool connected) override; void dispatchHotplugConnectionError(nsecs_t timestamp, int errorCode) override; void dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId, nsecs_t renderPeriod) override; void dispatchFrameRateOverrides(nsecs_t timestamp, PhysicalDisplayId displayId, Loading Loading @@ -230,6 +232,22 @@ void NativeDisplayEventReceiver::dispatchHotplug(nsecs_t timestamp, PhysicalDisp mMessageQueue->raiseAndClearException(env, "dispatchHotplug"); } void NativeDisplayEventReceiver::dispatchHotplugConnectionError(nsecs_t timestamp, int connectionError) { JNIEnv* env = AndroidRuntime::getJNIEnv(); ScopedLocalRef<jobject> receiverObj(env, GetReferent(env, mReceiverWeakGlobal)); if (receiverObj.get()) { ALOGV("receiver %p ~ Invoking hotplug dispatchHotplugConnectionError handler.", this); env->CallVoidMethod(receiverObj.get(), gDisplayEventReceiverClassInfo.dispatchHotplugConnectionError, timestamp, connectionError); ALOGV("receiver %p ~ Returned from hotplug dispatchHotplugConnectionError handler.", this); } mMessageQueue->raiseAndClearException(env, "dispatchHotplugConnectionError"); } void NativeDisplayEventReceiver::dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId, nsecs_t renderPeriod) { JNIEnv* env = AndroidRuntime::getJNIEnv(); Loading Loading @@ -354,8 +372,12 @@ int register_android_view_DisplayEventReceiver(JNIEnv* env) { gDisplayEventReceiverClassInfo.dispatchVsync = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchVsync", "(JJI)V"); gDisplayEventReceiverClassInfo.dispatchHotplug = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchHotplug", "(JJZ)V"); gDisplayEventReceiverClassInfo.dispatchHotplug = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchHotplug", "(JJZ)V"); gDisplayEventReceiverClassInfo.dispatchHotplugConnectionError = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchHotplugConnectionError", "(JI)V"); gDisplayEventReceiverClassInfo.dispatchModeChanged = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchModeChanged", "(JJIJ)V"); Loading services/core/java/com/android/server/display/LocalDisplayAdapter.java +15 −0 Original line number Diff line number Diff line Loading @@ -1345,6 +1345,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { public interface DisplayEventListener { void onHotplug(long timestampNanos, long physicalDisplayId, boolean connected); void onHotplugConnectionError(long timestampNanos, int connectionError); void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId, long renderPeriod); void onFrameRateOverridesChanged(long timestampNanos, long physicalDisplayId, Loading @@ -1366,6 +1367,11 @@ final class LocalDisplayAdapter extends DisplayAdapter { mListener.onHotplug(timestampNanos, physicalDisplayId, connected); } @Override public void onHotplugConnectionError(long timestampNanos, int errorCode) { mListener.onHotplugConnectionError(timestampNanos, errorCode); } @Override public void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId, long renderPeriod) { Loading @@ -1391,6 +1397,15 @@ final class LocalDisplayAdapter extends DisplayAdapter { } } @Override public void onHotplugConnectionError(long timestampNanos, int connectionError) { if (DEBUG) { Slog.d(TAG, "onHotplugConnectionError(" + "timestampNanos=" + timestampNanos + ", connectionError=" + connectionError + ")"); } } @Override public void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId, long renderPeriod) { Loading Loading
core/java/android/view/DisplayEventReceiver.java +15 −0 Original line number Diff line number Diff line Loading @@ -263,6 +263,16 @@ public abstract class DisplayEventReceiver { public void onHotplug(long timestampNanos, long physicalDisplayId, boolean connected) { } /** * Called when a display hotplug event with connection error is received. * * @param timestampNanos The timestamp of the event, in the {@link System#nanoTime()} * timebase. * @param connectionError the hotplug connection error code. */ public void onHotplugConnectionError(long timestampNanos, int connectionError) { } /** * Called when a display mode changed event is received. * Loading Loading @@ -345,6 +355,11 @@ public abstract class DisplayEventReceiver { onHotplug(timestampNanos, physicalDisplayId, connected); } @SuppressWarnings("unused") private void dispatchHotplugConnectionError(long timestampNanos, int connectionError) { onHotplugConnectionError(timestampNanos, connectionError); } // Called from native code. @SuppressWarnings("unused") private void dispatchModeChanged(long timestampNanos, long physicalDisplayId, int modeId, Loading
core/jni/android_view_DisplayEventReceiver.cpp +24 −2 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ static struct { jmethodID dispatchVsync; jmethodID dispatchHotplug; jmethodID dispatchHotplugConnectionError; jmethodID dispatchModeChanged; jmethodID dispatchFrameRateOverrides; Loading Loading @@ -89,6 +90,7 @@ private: void dispatchVsync(nsecs_t timestamp, PhysicalDisplayId displayId, uint32_t count, VsyncEventData vsyncEventData) override; void dispatchHotplug(nsecs_t timestamp, PhysicalDisplayId displayId, bool connected) override; void dispatchHotplugConnectionError(nsecs_t timestamp, int errorCode) override; void dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId, nsecs_t renderPeriod) override; void dispatchFrameRateOverrides(nsecs_t timestamp, PhysicalDisplayId displayId, Loading Loading @@ -230,6 +232,22 @@ void NativeDisplayEventReceiver::dispatchHotplug(nsecs_t timestamp, PhysicalDisp mMessageQueue->raiseAndClearException(env, "dispatchHotplug"); } void NativeDisplayEventReceiver::dispatchHotplugConnectionError(nsecs_t timestamp, int connectionError) { JNIEnv* env = AndroidRuntime::getJNIEnv(); ScopedLocalRef<jobject> receiverObj(env, GetReferent(env, mReceiverWeakGlobal)); if (receiverObj.get()) { ALOGV("receiver %p ~ Invoking hotplug dispatchHotplugConnectionError handler.", this); env->CallVoidMethod(receiverObj.get(), gDisplayEventReceiverClassInfo.dispatchHotplugConnectionError, timestamp, connectionError); ALOGV("receiver %p ~ Returned from hotplug dispatchHotplugConnectionError handler.", this); } mMessageQueue->raiseAndClearException(env, "dispatchHotplugConnectionError"); } void NativeDisplayEventReceiver::dispatchModeChanged(nsecs_t timestamp, PhysicalDisplayId displayId, int32_t modeId, nsecs_t renderPeriod) { JNIEnv* env = AndroidRuntime::getJNIEnv(); Loading Loading @@ -354,8 +372,12 @@ int register_android_view_DisplayEventReceiver(JNIEnv* env) { gDisplayEventReceiverClassInfo.dispatchVsync = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchVsync", "(JJI)V"); gDisplayEventReceiverClassInfo.dispatchHotplug = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchHotplug", "(JJZ)V"); gDisplayEventReceiverClassInfo.dispatchHotplug = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchHotplug", "(JJZ)V"); gDisplayEventReceiverClassInfo.dispatchHotplugConnectionError = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchHotplugConnectionError", "(JI)V"); gDisplayEventReceiverClassInfo.dispatchModeChanged = GetMethodIDOrDie(env, gDisplayEventReceiverClassInfo.clazz, "dispatchModeChanged", "(JJIJ)V"); Loading
services/core/java/com/android/server/display/LocalDisplayAdapter.java +15 −0 Original line number Diff line number Diff line Loading @@ -1345,6 +1345,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { public interface DisplayEventListener { void onHotplug(long timestampNanos, long physicalDisplayId, boolean connected); void onHotplugConnectionError(long timestampNanos, int connectionError); void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId, long renderPeriod); void onFrameRateOverridesChanged(long timestampNanos, long physicalDisplayId, Loading @@ -1366,6 +1367,11 @@ final class LocalDisplayAdapter extends DisplayAdapter { mListener.onHotplug(timestampNanos, physicalDisplayId, connected); } @Override public void onHotplugConnectionError(long timestampNanos, int errorCode) { mListener.onHotplugConnectionError(timestampNanos, errorCode); } @Override public void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId, long renderPeriod) { Loading @@ -1391,6 +1397,15 @@ final class LocalDisplayAdapter extends DisplayAdapter { } } @Override public void onHotplugConnectionError(long timestampNanos, int connectionError) { if (DEBUG) { Slog.d(TAG, "onHotplugConnectionError(" + "timestampNanos=" + timestampNanos + ", connectionError=" + connectionError + ")"); } } @Override public void onModeChanged(long timestampNanos, long physicalDisplayId, int modeId, long renderPeriod) { Loading