SurfaceFlinger: Add touch events to Scheduler
Add the notion of Touch Events to Scheduler to enhance the algorithm
to move to Performance refresh rate.
Scheduler selects Performance when:
- There is a touch event
- There is a buffer to HWC
This change also removes the behavior of Scheduler to move to Performance
on Choreographer callbacks.
Test: Switch between apps using gesture navigation
Bug: 131906818
Change-Id: I588cfc32449e87744e829dc7c5261a2e4151a8f8
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 4372e16..6c9d81a 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -955,6 +955,27 @@
}
return NO_ERROR;
}
+
+ virtual status_t notifyPowerHint(int32_t hintId) {
+ Parcel data, reply;
+ status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
+ if (error != NO_ERROR) {
+ ALOGE("notifyPowerHint: failed to write interface token: %d", error);
+ return error;
+ }
+ error = data.writeInt32(hintId);
+ if (error != NO_ERROR) {
+ ALOGE("notifyPowerHint: failed to write hintId: %d", error);
+ return error;
+ }
+ error = remote()->transact(BnSurfaceComposer::NOTIFY_POWER_HINT, data, &reply,
+ IBinder::FLAG_ONEWAY);
+ if (error != NO_ERROR) {
+ ALOGE("notifyPowerHint: failed to transact: %d", error);
+ return error;
+ }
+ return NO_ERROR;
+ }
};
// Out-of-line virtual method definition to trigger vtable emission in this
@@ -1556,6 +1577,16 @@
}
return setDisplayBrightness(displayToken, brightness);
}
+ case NOTIFY_POWER_HINT: {
+ CHECK_INTERFACE(ISurfaceComposer, data, reply);
+ int32_t hintId;
+ status_t error = data.readInt32(&hintId);
+ if (error != NO_ERROR) {
+ ALOGE("notifyPowerHint: failed to read hintId: %d", error);
+ return error;
+ }
+ return notifyPowerHint(hintId);
+ }
default: {
return BBinder::onTransact(code, data, reply, flags);
}