am 7306c670: Add error for format and make sure setActiveConfig fails with an invalid mode.

* commit '7306c670eb3ddb471d983a7458eb9f522afd0763':
  Add error for format and make sure setActiveConfig fails with an invalid mode.
This commit is contained in:
Michael Lentine 2014-07-30 22:25:08 +00:00 committed by Android Git Automerger
commit 7a35ea2c8d
2 changed files with 9 additions and 3 deletions

View File

@ -83,7 +83,7 @@ else
LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0 LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0
endif endif
LOCAL_CFLAGS += -fvisibility=hidden LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
LOCAL_CFLAGS += -std=c++11 LOCAL_CFLAGS += -std=c++11
LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \

View File

@ -637,10 +637,16 @@ status_t SurfaceFlinger::setActiveConfig(const sp<IBinder>& display, int mode) {
int mode) : int mode) :
mFlinger(flinger), mDisplay(disp) { mMode = mode; } mFlinger(flinger), mDisplay(disp) { mMode = mode; }
virtual bool handler() { virtual bool handler() {
Vector<DisplayInfo> configs;
mFlinger.getDisplayConfigs(mDisplay, &configs);
if(mMode < 0 || mMode >= configs.size()) {
ALOGE("Attempt to set active config = %d for display with %d configs",
mMode, configs.size());
}
sp<DisplayDevice> hw(mFlinger.getDisplayDevice(mDisplay)); sp<DisplayDevice> hw(mFlinger.getDisplayDevice(mDisplay));
if (hw == NULL) { if (hw == NULL) {
ALOGE("Attempt to set active config = %d for null display %p", ALOGE("Attempt to set active config = %d for null display %p",
mDisplay.get(), mMode); mMode, mDisplay.get());
} else if (hw->getDisplayType() >= DisplayDevice::DISPLAY_VIRTUAL) { } else if (hw->getDisplayType() >= DisplayDevice::DISPLAY_VIRTUAL) {
ALOGW("Attempt to set active config = %d for virtual display", ALOGW("Attempt to set active config = %d for virtual display",
mMode); mMode);
@ -2267,7 +2273,7 @@ void SurfaceFlinger::setPowerMode(const sp<IBinder>& display, int mode) {
sp<DisplayDevice> hw(mFlinger.getDisplayDevice(mDisplay)); sp<DisplayDevice> hw(mFlinger.getDisplayDevice(mDisplay));
if (hw == NULL) { if (hw == NULL) {
ALOGE("Attempt to set power mode = %d for null display %p", ALOGE("Attempt to set power mode = %d for null display %p",
mDisplay.get(), mMode); mMode, mDisplay.get());
} else if (hw->getDisplayType() >= DisplayDevice::DISPLAY_VIRTUAL) { } else if (hw->getDisplayType() >= DisplayDevice::DISPLAY_VIRTUAL) {
ALOGW("Attempt to set power mode = %d for virtual display", ALOGW("Attempt to set power mode = %d for virtual display",
mMode); mMode);