am bc120be8: am 2121b937: am 04eeb288: am 50be1df7: Merge "SF: Track missed frames and optionally drop them" into mnc-dr-dev
* commit 'bc120be8d7ff639408048fc3f105abd0aa6cfbe2':
SF: Track missed frames and optionally drop them
diff --git a/services/sensorservice/BatteryService.cpp b/services/sensorservice/BatteryService.cpp
index cb962a6..81f32cd 100644
--- a/services/sensorservice/BatteryService.cpp
+++ b/services/sensorservice/BatteryService.cpp
@@ -83,7 +83,7 @@
if (mBatteryStatService != 0) {
Mutex::Autolock _l(mActivationsLock);
int64_t identity = IPCThreadState::self()->clearCallingIdentity();
- for (ssize_t i=0 ; i<mActivations.size() ; i++) {
+ for (size_t i=0 ; i<mActivations.size() ; i++) {
const Info& info(mActivations[i]);
if (info.uid == uid) {
mBatteryStatService->noteStopSensor(info.uid, info.handle);
diff --git a/services/sensorservice/GravitySensor.cpp b/services/sensorservice/GravitySensor.cpp
index 3cb3745..61118bc 100644
--- a/services/sensorservice/GravitySensor.cpp
+++ b/services/sensorservice/GravitySensor.cpp
@@ -44,7 +44,6 @@
bool GravitySensor::process(sensors_event_t* outEvent,
const sensors_event_t& event)
{
- const static double NS2S = 1.0 / 1000000000.0;
if (event.type == SENSOR_TYPE_ACCELEROMETER) {
vec3_t g;
if (!mSensorFusion.hasEstimate())
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index dd1bccf..40d596f 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -388,7 +388,7 @@
status_t SensorDevice::injectSensorData(const sensors_event_t *injected_sensor_event) {
ALOGD_IF(DEBUG_CONNECTIONS,
- "sensor_event handle=%d ts=%lld data=%.2f, %.2f, %.2f %.2f %.2f %.2f",
+ "sensor_event handle=%d ts=%" PRId64 " data=%.2f, %.2f, %.2f %.2f %.2f %.2f",
injected_sensor_event->sensor,
injected_sensor_event->timestamp, injected_sensor_event->data[0],
injected_sensor_event->data[1], injected_sensor_event->data[2],
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 40b21a9..1a486a3 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -118,7 +118,7 @@
// it's safe to instantiate the SensorFusion object here
// (it wants to be instantiated after h/w sensors have been
// registered)
- const SensorFusion& fusion(SensorFusion::getInstance());
+ SensorFusion::getInstance();
// build the sensor list returned to users
mUserSensorList = mSensorList;
@@ -381,7 +381,7 @@
mActiveSensors.valueAt(i)->getNumConnections());
}
- result.appendFormat("Socket Buffer size = %d events\n",
+ result.appendFormat("Socket Buffer size = %zd events\n",
mSocketBufferSize/sizeof(sensors_event_t));
result.appendFormat("WakeLock Status: %s \n", mWakeLockAcquired ? "acquired" :
"not held");
@@ -1104,7 +1104,7 @@
AppOpsManager appOps;
if (appOps.noteOp(opCode, IPCThreadState::self()->getCallingUid(), opPackageName)
!= AppOpsManager::MODE_ALLOWED) {
- ALOGE("%s a sensor (%s) without enabled required app op: %D",
+ ALOGE("%s a sensor (%s) without enabled required app op: %d",
operation, sensor.getName().string(), opCode);
return false;
}
@@ -1307,13 +1307,13 @@
}
result.appendFormat("%d) ", eventNum++);
if (mSensorType == SENSOR_TYPE_STEP_COUNTER) {
- result.appendFormat("%llu,", mTrimmedSensorEventArr[i]->mStepCounter);
+ result.appendFormat("%" PRIu64 ",", mTrimmedSensorEventArr[i]->mStepCounter);
} else {
for (int j = 0; j < numData; ++j) {
result.appendFormat("%5.1f,", mTrimmedSensorEventArr[i]->mData[j]);
}
}
- result.appendFormat("%lld %02d:%02d:%02d ", mTrimmedSensorEventArr[i]->mTimestamp,
+ result.appendFormat("%" PRId64 " %02d:%02d:%02d ", mTrimmedSensorEventArr[i]->mTimestamp,
mTrimmedSensorEventArr[i]->mHour, mTrimmedSensorEventArr[i]->mMin,
mTrimmedSensorEventArr[i]->mSec);
i = (i + 1) % mBufSize;
diff --git a/services/sensorservice/vec.h b/services/sensorservice/vec.h
index 24f30ff..a142bad 100644
--- a/services/sensorservice/vec.h
+++ b/services/sensorservice/vec.h
@@ -37,7 +37,7 @@
class vec;
template <typename TYPE, size_t SIZE>
-class vbase;
+struct vbase;
namespace helpers {
diff --git a/services/surfaceflinger/EventLog/EventLogTags.logtags b/services/surfaceflinger/EventLog/EventLogTags.logtags
index 791e0e4..6c851dd 100644
--- a/services/surfaceflinger/EventLog/EventLogTags.logtags
+++ b/services/surfaceflinger/EventLog/EventLogTags.logtags
@@ -36,6 +36,7 @@
# 60100 - 60199 reserved for surfaceflinger
60100 sf_frame_dur (window|3),(dur0|1),(dur1|1),(dur2|1),(dur3|1),(dur4|1),(dur5|1),(dur6|1)
+60110 sf_stop_bootanim (time|2|3)
# NOTE - the range 1000000-2000000 is reserved for partners and others who
# want to define their own log tags without conflicting with the core platform.
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 01ffac2..f74f599 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -52,6 +52,7 @@
#include <utils/String8.h>
#include <utils/String16.h>
#include <utils/StopWatch.h>
+#include <utils/Timers.h>
#include <utils/Trace.h>
#include <private/android_filesystem_config.h>
@@ -304,6 +305,10 @@
// formerly we would just kill the process, but we now ask it to exit so it
// can choose where to stop the animation.
property_set("service.bootanim.exit", "1");
+
+ const int LOGTAG_SF_STOP_BOOTANIM = 60110;
+ LOG_EVENT_LONG(LOGTAG_SF_STOP_BOOTANIM,
+ ns2ms(systemTime(SYSTEM_TIME_MONOTONIC)));
}
void SurfaceFlinger::deleteTextureAsync(uint32_t texture) {
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index dcde512..3ae85a9 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -249,4 +249,111 @@
}
}
+TEST_F(LayerUpdateTest, LayerCropWorks) {
+ sp<ScreenCapture> sc;
+ {
+ SCOPED_TRACE("before crop");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 195, 63, 63);
+ sc->checkPixel(145, 145, 63, 63, 195);
+ }
+
+ SurfaceComposerClient::openGlobalTransaction();
+ Rect cropRect(16, 16, 32, 32);
+ ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setCrop(cropRect));
+ SurfaceComposerClient::closeGlobalTransaction(true);
+ {
+ // This should crop the foreground surface.
+ SCOPED_TRACE("after crop");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 63, 63, 195);
+ sc->checkPixel( 95, 80, 195, 63, 63);
+ sc->checkPixel( 80, 95, 195, 63, 63);
+ sc->checkPixel( 96, 96, 63, 63, 195);
+ }
+}
+
+TEST_F(LayerUpdateTest, LayerSetLayerWorks) {
+ sp<ScreenCapture> sc;
+ {
+ SCOPED_TRACE("before setLayer");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 195, 63, 63);
+ sc->checkPixel(145, 145, 63, 63, 195);
+ }
+
+ SurfaceComposerClient::openGlobalTransaction();
+ ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setLayer(INT_MAX - 3));
+ SurfaceComposerClient::closeGlobalTransaction(true);
+ {
+ // This should hide the foreground surface beneath the background.
+ SCOPED_TRACE("after setLayer");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 63, 63, 195);
+ sc->checkPixel(145, 145, 63, 63, 195);
+ }
+}
+
+TEST_F(LayerUpdateTest, LayerShowHideWorks) {
+ sp<ScreenCapture> sc;
+ {
+ SCOPED_TRACE("before hide");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 195, 63, 63);
+ sc->checkPixel(145, 145, 63, 63, 195);
+ }
+
+ SurfaceComposerClient::openGlobalTransaction();
+ ASSERT_EQ(NO_ERROR, mFGSurfaceControl->hide());
+ SurfaceComposerClient::closeGlobalTransaction(true);
+ {
+ // This should hide the foreground surface.
+ SCOPED_TRACE("after hide, before show");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 63, 63, 195);
+ sc->checkPixel(145, 145, 63, 63, 195);
+ }
+
+ SurfaceComposerClient::openGlobalTransaction();
+ ASSERT_EQ(NO_ERROR, mFGSurfaceControl->show());
+ SurfaceComposerClient::closeGlobalTransaction(true);
+ {
+ // This should show the foreground surface.
+ SCOPED_TRACE("after show");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 195, 63, 63);
+ sc->checkPixel(145, 145, 63, 63, 195);
+ }
+}
+
+TEST_F(LayerUpdateTest, LayerSetAlphaWorks) {
+ sp<ScreenCapture> sc;
+ {
+ SCOPED_TRACE("before setAlpha");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 195, 63, 63);
+ sc->checkPixel(145, 145, 63, 63, 195);
+ }
+
+ SurfaceComposerClient::openGlobalTransaction();
+ ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setAlpha(0.75f));
+ SurfaceComposerClient::closeGlobalTransaction(true);
+ {
+ // This should set foreground to be 75% opaque.
+ SCOPED_TRACE("after setAlpha");
+ ScreenCapture::captureScreen(&sc);
+ sc->checkPixel( 24, 24, 63, 63, 195);
+ sc->checkPixel( 75, 75, 162, 63, 96);
+ sc->checkPixel(145, 145, 63, 63, 195);
+ }
+}
+
}
diff --git a/services/surfaceflinger/tests/resize/Android.mk b/services/surfaceflinger/tests/resize/Android.mk
deleted file mode 100644
index d81679e..0000000
--- a/services/surfaceflinger/tests/resize/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- resize.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libui \
- libgui
-
-LOCAL_MODULE:= test-resize
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/resize/resize.cpp b/services/surfaceflinger/tests/resize/resize.cpp
deleted file mode 100644
index 8b051e8..0000000
--- a/services/surfaceflinger/tests/resize/resize.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cutils/memory.h>
-
-#include <utils/Log.h>
-
-#include <binder/IPCThreadState.h>
-#include <binder/ProcessState.h>
-#include <binder/IServiceManager.h>
-
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
-
-using namespace android;
-
-namespace android {
-
-int main(int argc, char** argv)
-{
- // set up the thread-pool
- sp<ProcessState> proc(ProcessState::self());
- ProcessState::self()->startThreadPool();
-
- // create a client to surfaceflinger
- sp<SurfaceComposerClient> client = new SurfaceComposerClient();
-
- sp<SurfaceControl> surfaceControl = client->createSurface(String8("resize"),
- 160, 240, PIXEL_FORMAT_RGB_565, 0);
-
- sp<Surface> surface = surfaceControl->getSurface();
-
- SurfaceComposerClient::openGlobalTransaction();
- surfaceControl->setLayer(100000);
- SurfaceComposerClient::closeGlobalTransaction();
-
- ANativeWindow_Buffer outBuffer;
- surface->lock(&outBuffer, NULL);
- ssize_t bpr = outBuffer.stride * bytesPerPixel(outBuffer.format);
- android_memset16((uint16_t*)outBuffer.bits, 0xF800, bpr*outBuffer.height);
- surface->unlockAndPost();
-
- surface->lock(&outBuffer);
- android_memset16((uint16_t*)outBuffer.bits, 0x07E0, bpr*outBuffer.height);
- surface->unlockAndPost();
-
- SurfaceComposerClient::openGlobalTransaction();
- surfaceControl->setSize(320, 240);
- SurfaceComposerClient::closeGlobalTransaction();
-
-
- IPCThreadState::self()->joinThreadPool();
-
- return 0;
-}
diff --git a/services/surfaceflinger/tests/screencap/Android.mk b/services/surfaceflinger/tests/screencap/Android.mk
deleted file mode 100644
index 5cdd1a8..0000000
--- a/services/surfaceflinger/tests/screencap/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- screencap.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libbinder \
- libskia \
- libui \
- libgui
-
-LOCAL_MODULE:= test-screencap
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_C_INCLUDES += \
- external/skia/include/core \
- external/skia/include/effects \
- external/skia/include/images \
- external/skia/src/ports \
- external/skia/include/utils
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/screencap/screencap.cpp b/services/surfaceflinger/tests/screencap/screencap.cpp
deleted file mode 100644
index f842fc3..0000000
--- a/services/surfaceflinger/tests/screencap/screencap.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <utils/Log.h>
-
-#include <binder/IPCThreadState.h>
-#include <binder/ProcessState.h>
-#include <binder/IServiceManager.h>
-
-#include <binder/IMemory.h>
-#include <gui/ISurfaceComposer.h>
-
-#include <SkImageEncoder.h>
-#include <SkBitmap.h>
-
-using namespace android;
-
-int main(int argc, char** argv)
-{
- if (argc != 2) {
- printf("usage: %s path\n", argv[0]);
- exit(0);
- }
-
- const String16 name("SurfaceFlinger");
- sp<ISurfaceComposer> composer;
- getService(name, &composer);
-
- sp<IMemoryHeap> heap;
- uint32_t w, h;
- PixelFormat f;
- sp<IBinder> display(composer->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain));
- status_t err = composer->captureScreen(display, &heap, &w, &h, &f, 0, 0);
- if (err != NO_ERROR) {
- fprintf(stderr, "screen capture failed: %s\n", strerror(-err));
- exit(0);
- }
-
- printf("screen capture success: w=%u, h=%u, pixels=%p\n",
- w, h, heap->getBase());
-
- printf("saving file as PNG in %s ...\n", argv[1]);
-
- SkBitmap b;
- b.setConfig(SkBitmap::kARGB_8888_Config, w, h);
- b.setPixels(heap->getBase());
- SkImageEncoder::EncodeFile(argv[1], b,
- SkImageEncoder::kPNG_Type, SkImageEncoder::kDefaultQuality);
-
- return 0;
-}
diff --git a/services/surfaceflinger/tests/transform/Android.mk b/services/surfaceflinger/tests/transform/Android.mk
deleted file mode 100644
index 6219dae..0000000
--- a/services/surfaceflinger/tests/transform/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- TransformTest.cpp \
- ../../Transform.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- libutils \
- libui \
-
-LOCAL_MODULE:= test-transform
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_C_INCLUDES += ../..
-
-include $(BUILD_EXECUTABLE)
diff --git a/services/surfaceflinger/tests/transform/TransformTest.cpp b/services/surfaceflinger/tests/transform/TransformTest.cpp
deleted file mode 100644
index e112c4e..0000000
--- a/services/surfaceflinger/tests/transform/TransformTest.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <utils/Errors.h>
-#include "../../Transform.h"
-
-using namespace android;
-
-int main(int argc, char **argv)
-{
- Transform tr90(Transform::ROT_90);
- Transform trFH(Transform::FLIP_H);
- Transform trFV(Transform::FLIP_V);
-
- Transform tr90FH(Transform::ROT_90 | Transform::FLIP_H);
- Transform tr90FV(Transform::ROT_90 | Transform::FLIP_V);
-
- tr90.dump("tr90");
- trFH.dump("trFH");
- trFV.dump("trFV");
-
- tr90FH.dump("tr90FH");
- tr90FV.dump("tr90FV");
-
- (trFH*tr90).dump("trFH*tr90");
- (trFV*tr90).dump("trFV*tr90");
-
- (tr90*trFH).dump("tr90*trFH");
- (tr90*trFV).dump("tr90*trFV");
-
- return 0;
-}