}
static void usage() {
- fprintf(stderr, "usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-s]\n"
+ fprintf(stderr, "usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-s] [-q]\n"
" -o: write to file (instead of stdout)\n"
" -d: append date to filename (requires -o)\n"
" -z: gzip output (requires -o)\n"
" -s: write output to control socket (for init)\n"
" -b: play sound file instead of vibrate, at beginning of job\n"
" -e: play sound file instead of vibrate, at end of job\n"
+ " -q: disable vibrate\n"
);
}
int main(int argc, char *argv[]) {
int do_add_date = 0;
int do_compress = 0;
+ int do_vibrate = 1;
char* use_outfile = 0;
char* begin_sound = 0;
char* end_sound = 0;
dump_traces_path = dump_traces();
int c;
- while ((c = getopt(argc, argv, "b:de:ho:svzp")) != -1) {
+ while ((c = getopt(argc, argv, "b:de:ho:svqzp")) != -1) {
switch (c) {
case 'b': begin_sound = optarg; break;
case 'd': do_add_date = 1; break;
case 'o': use_outfile = optarg; break;
case 's': use_socket = 1; break;
case 'v': break; // compatibility no-op
+ case 'q': do_vibrate = 0; break;
case 'z': do_compress = 6; break;
case 'p': do_fb = 1; break;
case '?': printf("\n");
}
}
- /* open the vibrator before dropping root */
- FILE *vibrator = fopen("/sys/class/timed_output/vibrator/enable", "w");
- if (vibrator) fcntl(fileno(vibrator), F_SETFD, FD_CLOEXEC);
+ FILE *vibrator = 0;
+ if (do_vibrate) {
+ /* open the vibrator before dropping root */
+ vibrator = fopen("/sys/class/timed_output/vibrator/enable", "w");
+ if (vibrator) fcntl(fileno(vibrator), F_SETFD, FD_CLOEXEC);
+ }
/* read /proc/cmdline before dropping root */
FILE *cmdline = fopen("/proc/cmdline", "r");
eElectronBeamAnimationOff = 0x10
};
+ enum {
+ eDisplayIdMain = 0
+ };
+
/* create connection with surface flinger, requires
* ACCESS_SURFACE_FLINGER permission
*/
static ssize_t getDisplayHeight(DisplayID dpy);
static ssize_t getDisplayOrientation(DisplayID dpy);
+ static inline sp<IBinder> getBuiltInDisplay(int32_t dpy) {
+ return NULL;
+ }
+
+ static inline status_t getDisplayInfo(const sp<IBinder>& dpy, DisplayInfo* info) {
+ return getDisplayInfo(0, info);
+ }
+
status_t linkToComposerDeath(const sp<IBinder::DeathRecipient>& recipient,
void* cookie = NULL, uint32_t flags = 0);
*/
#define ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) \
- template class Singleton< TYPE >; \
template<> Mutex Singleton< TYPE >::sLock(Mutex::PRIVATE); \
- template<> TYPE* Singleton< TYPE >::sInstance(0);
+ template<> TYPE* Singleton< TYPE >::sInstance(0); \
+ template class Singleton< TYPE >;
// ---------------------------------------------------------------------------
status_t IPCThreadState::talkWithDriver(bool doReceive)
{
- ALOG_ASSERT(mProcess->mDriverFD >= 0, "Binder driver is not opened");
+ if (mProcess->mDriverFD <= 0) {
+ return -EBADF;
+ }
binder_write_read bwr;
#else
err = INVALID_OPERATION;
#endif
+ if (mProcess->mDriverFD <= 0) {
+ err = -EBADF;
+ }
IF_LOG_COMMANDS() {
alog << "Finished read/write, write size = " << mOut.dataSize() << endl;
}
if (self) {
self->flushCommands();
#if defined(HAVE_ANDROID_OS)
- ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0);
+ if (self->mProcess->mDriverFD > 0) {
+ ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0);
+ }
#endif
delete self;
}
{
int32_t exception_code = readAligned<int32_t>();
if (exception_code == EX_HAS_REPLY_HEADER) {
+ int32_t header_start = dataPosition();
int32_t header_size = readAligned<int32_t>();
// Skip over fat responses headers. Not used (or propagated) in
// native code
- setDataPosition(dataPosition() + header_size);
+ setDataPosition(header_start + header_size);
// And fat response headers are currently only used when there are no
// exceptions, so return no error:
return 0;
ALOGW_IF(res, "failed locking buffer (handle = %p)",
backBuffer->handle);
- mLockedBuffer = backBuffer;
- outBuffer->width = backBuffer->width;
- outBuffer->height = backBuffer->height;
- outBuffer->stride = backBuffer->stride;
- outBuffer->format = backBuffer->format;
- outBuffer->bits = vaddr;
+ if (res != 0) {
+ err = INVALID_OPERATION;
+ } else {
+ mLockedBuffer = backBuffer;
+ outBuffer->width = backBuffer->width;
+ outBuffer->height = backBuffer->height;
+ outBuffer->stride = backBuffer->stride;
+ outBuffer->format = backBuffer->format;
+ outBuffer->bits = vaddr;
+ }
}
}
return err;
// compute vertex-to-light vector
if (ggl_unlikely(l.position.w)) {
// lightPos/1.0 - vertex/vertex.w == lightPos*vertex.w - vertex
+#if !OBJECT_SPACE_LIGHTING
+ vec4_t o;
+ const transform_t& mv = c->transforms.modelview.transform;
+ mv.point4(&mv, &o, &v->obj);
+ vss3(d.v, l.objPosition.v, o.w, o.v);
+#else
vss3(d.v, l.objPosition.v, v->obj.w, v->obj.v);
+#endif
sqDist = dot3(d.v, d.v);
vscale3(d.v, d.v, gglSqrtRecipx(sqDist));
} else {
}
size_t fileSize = headerSize + cacheSize;
- if (ftruncate(fd, fileSize) == -1) {
- ALOGE("error setting cache file size: %s (%d)", strerror(errno),
- errno);
- close(fd);
- unlink(fname);
- return;
- }
- uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize,
- PROT_WRITE, MAP_SHARED, fd, 0));
- if (buf == MAP_FAILED) {
- ALOGE("error mmaping cache file: %s (%d)", strerror(errno),
- errno);
+ uint8_t* buf = new uint8_t [fileSize];
+ if (!buf) {
+ ALOGE("error allocating buffer for cache contents: %s (%d)",
+ strerror(errno), errno);
close(fd);
unlink(fname);
return;
if (err != OK) {
ALOGE("error writing cache contents: %s (%d)", strerror(-err),
-err);
- munmap(buf, fileSize);
+ delete [] buf;
close(fd);
unlink(fname);
return;
uint32_t* crc = reinterpret_cast<uint32_t*>(buf + 4);
*crc = crc32c(buf + headerSize, cacheSize);
- munmap(buf, fileSize);
+ if (write(fd, buf, fileSize) == -1) {
+ ALOGE("error writing cache file: %s (%d)", strerror(errno),
+ errno);
+ delete [] buf;
+ close(fd);
+ unlink(fname);
+ return;
+ }
+
+ delete [] buf;
fchmod(fd, S_IRUSR);
close(fd);
}