diff options
211 files changed, 11777 insertions, 7733 deletions
diff --git a/awt/javax/imageio/metadata/IIOMetadataNode.java b/awt/javax/imageio/metadata/IIOMetadataNode.java index adc6d67..efbaae8 100644 --- a/awt/javax/imageio/metadata/IIOMetadataNode.java +++ b/awt/javax/imageio/metadata/IIOMetadataNode.java @@ -27,6 +27,8 @@ import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.w3c.dom.TypeInfo; +import org.w3c.dom.UserDataHandler; //???AWT //import org.w3c.dom.TypeInfo; @@ -924,6 +926,14 @@ public class IIOMetadataNode implements Element, NodeList { return userObject; } + public TypeInfo getSchemaTypeInfo() { + throw new UnsupportedOperationException(); + } + + public Object setUserData(String key, Object data, UserDataHandler handler) { + throw new UnsupportedOperationException(); + } + /** * Sets the user object associated with this node. * diff --git a/awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java b/awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java index 4ce5aed..f3b2e28 100644 --- a/awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java +++ b/awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java @@ -1,3 +1,19 @@ +/* + * 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. + */ + package org.apache.harmony.awt.gl.font; import com.android.internal.awt.AndroidGraphics2D; diff --git a/awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java b/awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java index 46545f9..bfb2b51 100644 --- a/awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java +++ b/awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java @@ -1,3 +1,19 @@ +/* + * 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. + */ + package org.apache.harmony.awt.gl.image; // A simple PNG decoder source code in Java. @@ -279,4 +295,4 @@ class PNGChunk { public short getUnsignedByte(int offset) { return (short) (mData[offset] & 0x00ff); } -}
\ No newline at end of file +} diff --git a/camera/libcameraservice/Android.mk b/camera/libcameraservice/Android.mk index ecaebff..df5c166 100644 --- a/camera/libcameraservice/Android.mk +++ b/camera/libcameraservice/Android.mk @@ -48,7 +48,9 @@ LOCAL_SHARED_LIBRARIES:= \ libutils \ libbinder \ libcutils \ - libmedia + libmedia \ + libcamera_client \ + libsurfaceflinger_client LOCAL_MODULE:= libcameraservice diff --git a/camera/libcameraservice/CameraHardwareStub.cpp b/camera/libcameraservice/CameraHardwareStub.cpp index 8ad1f69..8b66389 100644 --- a/camera/libcameraservice/CameraHardwareStub.cpp +++ b/camera/libcameraservice/CameraHardwareStub.cpp @@ -47,16 +47,18 @@ void CameraHardwareStub::initDefaultParameters() { CameraParameters p; - p.setPreviewSize(176, 144); + p.set("preview-size-values","320x240"); + p.setPreviewSize(320, 240); p.setPreviewFrameRate(15); p.setPreviewFormat("yuv422sp"); - p.setPictureSize(kCannedJpegWidth, kCannedJpegHeight); + p.set("picture-size-values", "320x240"); + p.setPictureSize(320, 240); p.setPictureFormat("jpeg"); if (setParameters(p) != NO_ERROR) { LOGE("Failed to set default parameters?!"); - } + } } void CameraHardwareStub::initHeapLocked() @@ -80,14 +82,14 @@ void CameraHardwareStub::initHeapLocked() mPreviewFrameSize = how_big; - // Make a new mmap'ed heap that can be shared across processes. + // Make a new mmap'ed heap that can be shared across processes. // use code below to test with pmem mPreviewHeap = new MemoryHeapBase(mPreviewFrameSize * kBufferCount); // Make an IMemory for each frame so that we can reuse them in callbacks. for (int i = 0; i < kBufferCount; i++) { mBuffers[i] = new MemoryBase(mPreviewHeap, i * mPreviewFrameSize, mPreviewFrameSize); } - + // Recreate the fake camera to reflect the current size. delete mFakeCamera; mFakeCamera = new FakeCamera(preview_width, preview_height); @@ -153,34 +155,34 @@ int CameraHardwareStub::previewThread() ssize_t offset = mCurrentPreviewFrame * mPreviewFrameSize; sp<MemoryHeapBase> heap = mPreviewHeap; - + // this assumes the internal state of fake camera doesn't change // (or is thread safe) FakeCamera* fakeCamera = mFakeCamera; - + sp<MemoryBase> buffer = mBuffers[mCurrentPreviewFrame]; - + mLock.unlock(); // TODO: here check all the conditions that could go wrong if (buffer != 0) { // Calculate how long to wait between frames. int delay = (int)(1000000.0f / float(previewFrameRate)); - + // This is always valid, even if the client died -- the memory // is still mapped in our process. void *base = heap->base(); - + // Fill the current frame with the fake camera. uint8_t *frame = ((uint8_t *)base) + offset; fakeCamera->getNextFrameAsYuv422(frame); - + //LOGV("previewThread: generated frame to buffer %d", mCurrentPreviewFrame); - + // Notify the client of a new frame. if (mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME) mDataCb(CAMERA_MSG_PREVIEW_FRAME, buffer, mCallbackCookie); - + // Advance the buffer pointer. mCurrentPreviewFrame = (mCurrentPreviewFrame + 1) % kBufferCount; @@ -205,7 +207,7 @@ status_t CameraHardwareStub::startPreview() void CameraHardwareStub::stopPreview() { sp<PreviewThread> previewThread; - + { // scope for the lock Mutex::Autolock lock(mLock); previewThread = mPreviewThread; @@ -356,7 +358,6 @@ status_t CameraHardwareStub::setParameters(const CameraParameters& params) } mParameters = params; - initHeapLocked(); return NO_ERROR; diff --git a/camera/libcameraservice/CameraHardwareStub.h b/camera/libcameraservice/CameraHardwareStub.h index 8a67024..957813a 100644 --- a/camera/libcameraservice/CameraHardwareStub.h +++ b/camera/libcameraservice/CameraHardwareStub.h @@ -20,7 +20,7 @@ #include "FakeCamera.h" #include <utils/threads.h> -#include <ui/CameraHardwareInterface.h> +#include <camera/CameraHardwareInterface.h> #include <binder/MemoryBase.h> #include <binder/MemoryHeapBase.h> #include <utils/threads.h> diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 6419a5c..00bd54e 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -16,7 +16,6 @@ ** limitations under the License. */ -//#define LOG_NDEBUG 0 #define LOG_TAG "CameraService" #include <utils/Log.h> @@ -26,7 +25,11 @@ #include <utils/Errors.h> #include <binder/MemoryBase.h> #include <binder/MemoryHeapBase.h> -#include <ui/ICameraService.h> +#include <camera/ICameraService.h> +#include <surfaceflinger/ISurface.h> +#include <ui/Overlay.h> + +#include <hardware/hardware.h> #include <media/mediaplayer.h> #include <media/AudioSystem.h> @@ -95,7 +98,7 @@ CameraService::~CameraService() sp<ICamera> CameraService::connect(const sp<ICameraClient>& cameraClient) { int callingPid = getCallingPid(); - LOGD("CameraService::connect E (pid %d, client %p)", callingPid, + LOGV("CameraService::connect E (pid %d, client %p)", callingPid, cameraClient->asBinder().get()); Mutex::Autolock lock(mServiceLock); @@ -106,30 +109,30 @@ sp<ICamera> CameraService::connect(const sp<ICameraClient>& cameraClient) sp<ICameraClient> currentCameraClient(currentClient->getCameraClient()); if (cameraClient->asBinder() == currentCameraClient->asBinder()) { // This is the same client reconnecting... - LOGD("CameraService::connect X (pid %d, same client %p) is reconnecting...", + LOGV("CameraService::connect X (pid %d, same client %p) is reconnecting...", callingPid, cameraClient->asBinder().get()); return currentClient; } else { // It's another client... reject it - LOGD("CameraService::connect X (pid %d, new client %p) rejected. " + LOGV("CameraService::connect X (pid %d, new client %p) rejected. " "(old pid %d, old client %p)", callingPid, cameraClient->asBinder().get(), currentClient->mClientPid, currentCameraClient->asBinder().get()); if (kill(currentClient->mClientPid, 0) == -1 && errno == ESRCH) { - LOGD("The old client is dead!"); + LOGV("The old client is dead!"); } return client; } } else { // can't promote, the previous client has died... - LOGD("New client (pid %d) connecting, old reference was dangling...", + LOGV("New client (pid %d) connecting, old reference was dangling...", callingPid); mClient.clear(); } } if (mUsers > 0) { - LOGD("Still have client, rejected"); + LOGV("Still have client, rejected"); return client; } @@ -141,7 +144,7 @@ sp<ICamera> CameraService::connect(const sp<ICameraClient>& cameraClient) // the refcount. client->trackMe(true, true); #endif - LOGD("CameraService::connect X"); + LOGV("CameraService::connect X"); return client; } @@ -157,7 +160,7 @@ void CameraService::removeClient(const sp<ICameraClient>& cameraClient) if (mClient == 0) { // This happens when we have already disconnected. - LOGD("removeClient (pid %d): already disconnected", callingPid); + LOGV("removeClient (pid %d): already disconnected", callingPid); return; } @@ -165,7 +168,7 @@ void CameraService::removeClient(const sp<ICameraClient>& cameraClient) // Client::~Client() -> disconnect() -> removeClient(). client = mClient.promote(); if (client == 0) { - LOGD("removeClient (pid %d): no more strong reference", callingPid); + LOGV("removeClient (pid %d): no more strong reference", callingPid); mClient.clear(); return; } @@ -178,7 +181,7 @@ void CameraService::removeClient(const sp<ICameraClient>& cameraClient) mClient.clear(); } - LOGD("removeClient (pid %d) done", callingPid); + LOGV("removeClient (pid %d) done", callingPid); } // The reason we need this count is a new CameraService::connect() request may @@ -198,7 +201,7 @@ void CameraService::decUsers() { static sp<MediaPlayer> newMediaPlayer(const char *file) { sp<MediaPlayer> mp = new MediaPlayer(); - if (mp->setDataSource(file) == NO_ERROR) { + if (mp->setDataSource(file, NULL /* headers */) == NO_ERROR) { mp->setAudioStreamType(AudioSystem::ENFORCED_AUDIBLE); mp->prepare(); } else { @@ -212,7 +215,7 @@ CameraService::Client::Client(const sp<CameraService>& cameraService, const sp<ICameraClient>& cameraClient, pid_t clientPid) { int callingPid = getCallingPid(); - LOGD("Client::Client E (pid %d)", callingPid); + LOGV("Client::Client E (pid %d)", callingPid); mCameraService = cameraService; mCameraClient = cameraClient; mClientPid = clientPid; @@ -236,8 +239,9 @@ CameraService::Client::Client(const sp<CameraService>& cameraService, // Callback is disabled by default mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; + mOrientation = 0; cameraService->incUsers(); - LOGD("Client::Client X (pid %d)", callingPid); + LOGV("Client::Client X (pid %d)", callingPid); } status_t CameraService::Client::checkPid() @@ -253,7 +257,7 @@ status_t CameraService::Client::checkPid() status_t CameraService::Client::lock() { int callingPid = getCallingPid(); - LOGD("lock from pid %d (mClientPid %d)", callingPid, mClientPid); + LOGV("lock from pid %d (mClientPid %d)", callingPid, mClientPid); Mutex::Autolock _l(mLock); // lock camera to this client if the the camera is unlocked if (mClientPid == 0) { @@ -267,13 +271,13 @@ status_t CameraService::Client::lock() status_t CameraService::Client::unlock() { int callingPid = getCallingPid(); - LOGD("unlock from pid %d (mClientPid %d)", callingPid, mClientPid); + LOGV("unlock from pid %d (mClientPid %d)", callingPid, mClientPid); Mutex::Autolock _l(mLock); // allow anyone to use camera status_t result = checkPid(); if (result == NO_ERROR) { mClientPid = 0; - LOGD("clear mCameraClient (pid %d)", callingPid); + LOGV("clear mCameraClient (pid %d)", callingPid); // we need to remove the reference so that when app goes // away, the reference count goes to 0. mCameraClient.clear(); @@ -286,7 +290,7 @@ status_t CameraService::Client::connect(const sp<ICameraClient>& client) int callingPid = getCallingPid(); // connect a new process to the camera - LOGD("Client::connect E (pid %d, client %p)", callingPid, client->asBinder().get()); + LOGV("Client::connect E (pid %d, client %p)", callingPid, client->asBinder().get()); // I hate this hack, but things get really ugly when the media recorder // service is handing back the camera to the app. The ICameraClient @@ -310,14 +314,14 @@ status_t CameraService::Client::connect(const sp<ICameraClient>& client) // did the client actually change? if ((mCameraClient != NULL) && (client->asBinder() == mCameraClient->asBinder())) { - LOGD("Connect to the same client"); + LOGV("Connect to the same client"); return NO_ERROR; } mCameraClient = client; mClientPid = -1; mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; - LOGD("Connect to the new client (pid %d, client %p)", + LOGV("Connect to the new client (pid %d, client %p)", callingPid, mCameraClient->asBinder().get()); } @@ -344,7 +348,7 @@ CameraService::Client::~Client() int callingPid = getCallingPid(); // tear down client - LOGD("Client::~Client E (pid %d, client %p)", + LOGV("Client::~Client E (pid %d, client %p)", callingPid, getCameraClient()->asBinder().get()); if (mSurface != 0 && !mUseOverlay) { #if HAVE_ANDROID_OS @@ -373,23 +377,23 @@ CameraService::Client::~Client() // make sure we tear down the hardware mClientPid = callingPid; disconnect(); - LOGD("Client::~Client X (pid %d)", mClientPid); + LOGV("Client::~Client X (pid %d)", mClientPid); } void CameraService::Client::disconnect() { int callingPid = getCallingPid(); - LOGD("Client::disconnect() E (pid %d client %p)", + LOGV("Client::disconnect() E (pid %d client %p)", callingPid, getCameraClient()->asBinder().get()); Mutex::Autolock lock(mLock); if (mClientPid <= 0) { - LOGD("camera is unlocked (mClientPid = %d), don't tear down hardware", mClientPid); + LOGV("camera is unlocked (mClientPid = %d), don't tear down hardware", mClientPid); return; } if (checkPid() != NO_ERROR) { - LOGD("Different client - don't disconnect"); + LOGV("Different client - don't disconnect"); return; } @@ -397,7 +401,7 @@ void CameraService::Client::disconnect() // from the user directly, or called by the destructor. if (mHardware == 0) return; - LOGD("hardware teardown"); + LOGV("hardware teardown"); // Before destroying mHardware, we must make sure it's in the // idle state. mHardware->stopPreview(); @@ -421,13 +425,13 @@ void CameraService::Client::disconnect() mCameraService->removeClient(mCameraClient); mCameraService->decUsers(); - LOGD("Client::disconnect() X (pid %d)", callingPid); + LOGV("Client::disconnect() X (pid %d)", callingPid); } // pass the buffered ISurface to the camera service status_t CameraService::Client::setPreviewDisplay(const sp<ISurface>& surface) { - LOGD("setPreviewDisplay(%p) (pid %d)", + LOGV("setPreviewDisplay(%p) (pid %d)", ((surface == NULL) ? NULL : surface.get()), getCallingPid()); Mutex::Autolock lock(mLock); status_t result = checkPid(); @@ -438,7 +442,7 @@ status_t CameraService::Client::setPreviewDisplay(const sp<ISurface>& surface) // asBinder() is safe on NULL (returns NULL) if (surface->asBinder() != mSurface->asBinder()) { if (mSurface != 0) { - LOGD("clearing old preview surface %p", mSurface.get()); + LOGV("clearing old preview surface %p", mSurface.get()); if ( !mUseOverlay) { mSurface->unregisterBuffers(); @@ -487,7 +491,7 @@ status_t CameraService::Client::startCameraMode(camera_mode mode) { int callingPid = getCallingPid(); - LOGD("startCameraMode(%d) (pid %d)", mode, callingPid); + LOGV("startCameraMode(%d) (pid %d)", mode, callingPid); /* we cannot call into mHardware with mLock held because * mHardware has callbacks onto us which acquire this lock @@ -512,7 +516,7 @@ status_t CameraService::Client::startCameraMode(camera_mode mode) default: // CAMERA_PREVIEW_MODE if (mSurface == 0) { - LOGD("mSurface is not set yet."); + LOGV("mSurface is not set yet."); } return startPreviewMode(); } @@ -520,7 +524,7 @@ status_t CameraService::Client::startCameraMode(camera_mode mode) status_t CameraService::Client::startRecordingMode() { - LOGD("startRecordingMode (pid %d)", getCallingPid()); + LOGV("startRecordingMode (pid %d)", getCallingPid()); status_t ret = UNKNOWN_ERROR; @@ -547,7 +551,7 @@ status_t CameraService::Client::startRecordingMode() status_t CameraService::Client::setOverlay() { - LOGD("setOverlay"); + LOGV("setOverlay"); int w, h; CameraParameters params(mHardware->getParameters()); params.getPreviewSize(&w, &h); @@ -571,9 +575,10 @@ status_t CameraService::Client::setOverlay() // wait in the createOverlay call if the previous overlay is in the // process of being destroyed. for (int retry = 0; retry < 50; ++retry) { - mOverlayRef = mSurface->createOverlay(w, h, OVERLAY_FORMAT_DEFAULT); + mOverlayRef = mSurface->createOverlay(w, h, OVERLAY_FORMAT_DEFAULT, + mOrientation); if (mOverlayRef != NULL) break; - LOGD("Overlay create failed - retrying"); + LOGW("Overlay create failed - retrying"); usleep(20000); } if ( mOverlayRef.get() == NULL ) @@ -602,15 +607,10 @@ status_t CameraService::Client::registerPreviewBuffers() CameraParameters params(mHardware->getParameters()); params.getPreviewSize(&w, &h); - uint32_t transform = 0; - if (params.getOrientation() == - CameraParameters::CAMERA_ORIENTATION_PORTRAIT) { - LOGV("portrait mode"); - transform = ISurface::BufferHeap::ROT_90; - } + // don't use a hardcoded format here ISurface::BufferHeap buffers(w, h, w, h, - PIXEL_FORMAT_YCbCr_420_SP, - transform, + HAL_PIXEL_FORMAT_YCrCb_420_SP, + mOrientation, 0, mHardware->getPreviewHeap()); @@ -623,7 +623,7 @@ status_t CameraService::Client::registerPreviewBuffers() status_t CameraService::Client::startPreviewMode() { - LOGD("startPreviewMode (pid %d)", getCallingPid()); + LOGV("startPreviewMode (pid %d)", getCallingPid()); // if preview has been enabled, nothing needs to be done if (mHardware->previewEnabled()) { @@ -659,14 +659,14 @@ status_t CameraService::Client::startPreviewMode() status_t CameraService::Client::startPreview() { - LOGD("startPreview (pid %d)", getCallingPid()); + LOGV("startPreview (pid %d)", getCallingPid()); return startCameraMode(CAMERA_PREVIEW_MODE); } status_t CameraService::Client::startRecording() { - LOGD("startRecording (pid %d)", getCallingPid()); + LOGV("startRecording (pid %d)", getCallingPid()); if (mMediaPlayerBeep.get() != NULL) { // do not play record jingle if stream volume is 0 @@ -687,7 +687,7 @@ status_t CameraService::Client::startRecording() // stop preview mode void CameraService::Client::stopPreview() { - LOGD("stopPreview (pid %d)", getCallingPid()); + LOGV("stopPreview (pid %d)", getCallingPid()); // hold main lock during state transition { @@ -701,7 +701,7 @@ void CameraService::Client::stopPreview() mHardware->stopPreview(); mHardware->disableMsgType(CAMERA_MSG_PREVIEW_FRAME); - LOGD("stopPreview(), hardware stopped OK"); + LOGV("stopPreview(), hardware stopped OK"); if (mSurface != 0 && !mUseOverlay) { mSurface->unregisterBuffers(); @@ -718,7 +718,7 @@ void CameraService::Client::stopPreview() // stop recording mode void CameraService::Client::stopRecording() { - LOGD("stopRecording (pid %d)", getCallingPid()); + LOGV("stopRecording (pid %d)", getCallingPid()); // hold main lock during state transition { @@ -737,7 +737,7 @@ void CameraService::Client::stopRecording() mHardware->stopRecording(); mHardware->disableMsgType(CAMERA_MSG_VIDEO_FRAME); - LOGD("stopRecording(), hardware stopped OK"); + LOGV("stopRecording(), hardware stopped OK"); } // hold preview buffer lock @@ -805,14 +805,14 @@ static void dump_to_file(const char *fname, int nw, cnt = 0; uint32_t written = 0; - LOGD("opening file [%s]\n", fname); + LOGV("opening file [%s]\n", fname); int fd = open(fname, O_RDWR | O_CREAT); if (fd < 0) { LOGE("failed to create file [%s]: %s", fname, strerror(errno)); return; } - LOGD("writing %d bytes to file [%s]\n", size, fname); + LOGV("writing %d bytes to file [%s]\n", size, fname); while (written < size) { nw = ::write(fd, buf + written, @@ -825,7 +825,7 @@ static void dump_to_file(const char *fname, written += nw; cnt++; } - LOGD("done writing %d bytes to file [%s] in %d passes\n", + LOGV("done writing %d bytes to file [%s] in %d passes\n", size, fname, cnt); ::close(fd); } @@ -833,7 +833,7 @@ static void dump_to_file(const char *fname, status_t CameraService::Client::autoFocus() { - LOGD("autoFocus (pid %d)", getCallingPid()); + LOGV("autoFocus (pid %d)", getCallingPid()); Mutex::Autolock lock(mLock); status_t result = checkPid(); @@ -849,7 +849,7 @@ status_t CameraService::Client::autoFocus() status_t CameraService::Client::cancelAutoFocus() { - LOGD("cancelAutoFocus (pid %d)", getCallingPid()); + LOGV("cancelAutoFocus (pid %d)", getCallingPid()); Mutex::Autolock lock(mLock); status_t result = checkPid(); @@ -866,7 +866,7 @@ status_t CameraService::Client::cancelAutoFocus() // take a picture - image is returned in callback status_t CameraService::Client::takePicture() { - LOGD("takePicture (pid %d)", getCallingPid()); + LOGV("takePicture (pid %d)", getCallingPid()); Mutex::Autolock lock(mLock); status_t result = checkPid(); @@ -920,12 +920,6 @@ void CameraService::Client::handleShutter( if (mSurface != 0 && !mUseOverlay) { int w, h; CameraParameters params(mHardware->getParameters()); - uint32_t transform = 0; - if (params.getOrientation() == CameraParameters::CAMERA_ORIENTATION_PORTRAIT) { - LOGV("portrait mode"); - transform = ISurface::BufferHeap::ROT_90; - } - if (size == NULL) { params.getPictureSize(&w, &h); } else { @@ -933,10 +927,12 @@ void CameraService::Client::handleShutter( h = size->height; w &= ~1; h &= ~1; - LOGD("Snapshot image width=%d, height=%d", w, h); + LOGV("Snapshot image width=%d, height=%d", w, h); } + // FIXME: don't use hardcoded format constants here ISurface::BufferHeap buffers(w, h, w, h, - PIXEL_FORMAT_YCbCr_420_SP, transform, 0, mHardware->getRawHeap()); + HAL_PIXEL_FORMAT_YCrCb_420_SP, mOrientation, 0, + mHardware->getRawHeap()); mSurface->registerBuffers(buffers); } @@ -952,7 +948,7 @@ void CameraService::Client::handlePreviewData(const sp<IMemory>& mem) #if DEBUG_HEAP_LEAKS && 0 // debugging if (gWeakHeap == NULL) { if (gWeakHeap != heap) { - LOGD("SETTING PREVIEW HEAP"); + LOGV("SETTING PREVIEW HEAP"); heap->trackMe(true, true); gWeakHeap = heap; } @@ -1189,7 +1185,7 @@ void CameraService::Client::dataCallbackTimestamp(nsecs_t timestamp, int32_t msg // set preview/capture parameters - key/value pairs status_t CameraService::Client::setParameters(const String8& params) { - LOGD("setParameters(%s)", params.string()); + LOGV("setParameters(%s)", params.string()); Mutex::Autolock lock(mLock); status_t result = checkPid(); @@ -1201,6 +1197,7 @@ status_t CameraService::Client::setParameters(const String8& params) } CameraParameters p(params); + return mHardware->setParameters(p); } @@ -1215,17 +1212,41 @@ String8 CameraService::Client::getParameters() const } String8 params(mHardware->getParameters().flatten()); - LOGD("getParameters(%s)", params.string()); + LOGV("getParameters(%s)", params.string()); return params; } status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) { - LOGD("sendCommand (pid %d)", getCallingPid()); + LOGV("sendCommand (pid %d)", getCallingPid()); Mutex::Autolock lock(mLock); status_t result = checkPid(); if (result != NO_ERROR) return result; + if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) { + // The orientation cannot be set during preview. + if (mHardware->previewEnabled()) { + return INVALID_OPERATION; + } + switch (arg1) { + case 0: + mOrientation = ISurface::BufferHeap::ROT_0; + break; + case 90: + mOrientation = ISurface::BufferHeap::ROT_90; + break; + case 180: + mOrientation = ISurface::BufferHeap::ROT_180; + break; + case 270: + mOrientation = ISurface::BufferHeap::ROT_270; + break; + default: + return BAD_VALUE; + } + return OK; + } + if (mHardware == 0) { LOGE("mHardware is NULL, returning."); return INVALID_OPERATION; @@ -1270,8 +1291,26 @@ void CameraService::Client::copyFrameAndPostCopiedFrame(const sp<ICameraClient>& client->dataCallback(CAMERA_MSG_PREVIEW_FRAME, frame); } +static const int kDumpLockRetries = 50; +static const int kDumpLockSleep = 60000; + +static bool tryLock(Mutex& mutex) +{ + bool locked = false; + for (int i = 0; i < kDumpLockRetries; ++i) { + if (mutex.tryLock() == NO_ERROR) { + locked = true; + break; + } + usleep(kDumpLockSleep); + } + return locked; +} + status_t CameraService::dump(int fd, const Vector<String16>& args) { + static const char* kDeadlockedString = "CameraService may be deadlocked\n"; + const size_t SIZE = 256; char buffer[SIZE]; String8 result; @@ -1283,7 +1322,13 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) result.append(buffer); write(fd, result.string(), result.size()); } else { - AutoMutex lock(&mServiceLock); + bool locked = tryLock(mServiceLock); + // failed to lock - CameraService is probably deadlocked + if (!locked) { + String8 result(kDeadlockedString); + write(fd, result.string(), result.size()); + } + if (mClient != 0) { sp<Client> currentClient = mClient.promote(); sprintf(buffer, "Client (%p) PID: %d\n", @@ -1296,6 +1341,8 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) result.append("No camera client yet.\n"); write(fd, result.string(), result.size()); } + + if (locked) mServiceLock.unlock(); } return NO_ERROR; } @@ -1327,7 +1374,7 @@ status_t CameraService::onTransact( status_t err = BnCameraService::onTransact(code, data, reply, flags); #if DEBUG_HEAP_LEAKS - LOGD("+++ onTransact err %d code %d", err, code); + LOGV("+++ onTransact err %d code %d", err, code); if (err == UNKNOWN_TRANSACTION || err == PERMISSION_DENIED) { // the 'service' command interrogates this binder for its name, and then supplies it @@ -1335,7 +1382,7 @@ status_t CameraService::onTransact( // ISurfaceComposer (since we delegated the INTERFACE_TRANSACTION handling to // BnSurfaceComposer before falling through to this code). - LOGD("+++ onTransact code %d", code); + LOGV("+++ onTransact code %d", code); CHECK_INTERFACE(ICameraService, data, reply); @@ -1345,13 +1392,13 @@ status_t CameraService::onTransact( if (gWeakHeap != 0) { sp<IMemoryHeap> h = gWeakHeap.promote(); IMemoryHeap *p = gWeakHeap.unsafe_get(); - LOGD("CHECKING WEAK REFERENCE %p (%p)", h.get(), p); + LOGV("CHECKING WEAK REFERENCE %p (%p)", h.get(), p); if (h != 0) h->printRefs(); bool attempt_to_delete = data.readInt32() == 1; if (attempt_to_delete) { // NOT SAFE! - LOGD("DELETING WEAK REFERENCE %p (%p)", h.get(), p); + LOGV("DELETING WEAK REFERENCE %p (%p)", h.get(), p); if (p) delete p; } return NO_ERROR; diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h index 3e3e54f..bc49b1d 100644 --- a/camera/libcameraservice/CameraService.h +++ b/camera/libcameraservice/CameraService.h @@ -19,9 +19,9 @@ #ifndef ANDROID_SERVERS_CAMERA_CAMERASERVICE_H #define ANDROID_SERVERS_CAMERA_CAMERASERVICE_H -#include <ui/ICameraService.h> -#include <ui/CameraHardwareInterface.h> -#include <ui/Camera.h> +#include <camera/ICameraService.h> +#include <camera/CameraHardwareInterface.h> +#include <camera/Camera.h> namespace android { @@ -182,6 +182,7 @@ private: sp<CameraService> mCameraService; sp<ISurface> mSurface; int mPreviewCallbackFlag; + int mOrientation; sp<MediaPlayer> mMediaPlayerClick; sp<MediaPlayer> mMediaPlayerBeep; diff --git a/camera/libcameraservice/CannedJpeg.h b/camera/libcameraservice/CannedJpeg.h index 532560a..b6266fb 100644 --- a/camera/libcameraservice/CannedJpeg.h +++ b/camera/libcameraservice/CannedJpeg.h @@ -1,1546 +1,734 @@ -const int kCannedJpegWidth = 213; -const int kCannedJpegHeight = 350; -const int kCannedJpegSize = 18474; +const int kCannedJpegWidth = 320; +const int kCannedJpegHeight = 240; +const int kCannedJpegSize = 8733; const char kCannedJpeg[] = { - 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, - 0x01, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43, - 0x00, 0x05, 0x03, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04, 0x04, 0x04, 0x05, - 0x05, 0x05, 0x06, 0x07, 0x0c, 0x08, 0x07, 0x07, 0x07, 0x07, 0x0f, 0x0b, - 0x0b, 0x09, 0x0c, 0x11, 0x0f, 0x12, 0x12, 0x11, 0x0f, 0x11, 0x11, 0x13, - 0x16, 0x1c, 0x17, 0x13, 0x14, 0x1a, 0x15, 0x11, 0x11, 0x18, 0x21, 0x18, - 0x1a, 0x1d, 0x1d, 0x1f, 0x1f, 0x1f, 0x13, 0x17, 0x22, 0x24, 0x22, 0x1e, - 0x24, 0x1c, 0x1e, 0x1f, 0x1e, 0xff, 0xdb, 0x00, 0x43, 0x01, 0x05, 0x05, - 0x05, 0x07, 0x06, 0x07, 0x0e, 0x08, 0x08, 0x0e, 0x1e, 0x14, 0x11, 0x14, - 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, - 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, - 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, - 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, - 0x1e, 0x1e, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x01, 0x5e, 0x00, 0xd5, 0x03, - 0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xc4, 0x00, - 0x1c, 0x00, 0x00, 0x02, 0x02, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x07, 0x01, 0x03, - 0x04, 0x02, 0x08, 0xff, 0xc4, 0x00, 0x55, 0x10, 0x00, 0x01, 0x03, 0x04, - 0x00, 0x03, 0x03, 0x05, 0x0a, 0x09, 0x08, 0x09, 0x02, 0x06, 0x03, 0x00, - 0x01, 0x02, 0x03, 0x04, 0x00, 0x05, 0x06, 0x11, 0x07, 0x12, 0x21, 0x13, - 0x31, 0x41, 0x14, 0x22, 0x51, 0x61, 0x71, 0x15, 0x23, 0x32, 0x34, 0x37, - 0x72, 0x75, 0x81, 0xb1, 0xb3, 0x08, 0x17, 0x33, 0x42, 0x52, 0x62, 0x76, - 0x93, 0xb2, 0x16, 0x24, 0x43, 0x53, 0x56, 0x91, 0xa1, 0xd2, 0x25, 0x36, - 0x63, 0x73, 0x82, 0x92, 0xa2, 0xc1, 0xd1, 0x65, 0xf0, 0x26, 0x27, 0x64, - 0x66, 0x74, 0xe1, 0x83, 0xc2, 0xf1, 0xff, 0xc4, 0x00, 0x1b, 0x01, 0x01, - 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0xff, - 0xc4, 0x00, 0x35, 0x11, 0x00, 0x02, 0x01, 0x03, 0x03, 0x01, 0x05, 0x05, - 0x07, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, - 0x04, 0x11, 0x12, 0x21, 0x31, 0x41, 0x05, 0x22, 0x32, 0x51, 0x61, 0x06, - 0x13, 0x71, 0x81, 0xb1, 0x14, 0x33, 0x42, 0x91, 0xa1, 0xc1, 0xd1, 0x15, - 0x23, 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, - 0x80, 0x28, 0x71, 0xb5, 0x72, 0xba, 0xcb, 0x89, 0xea, 0x87, 0x1b, 0x50, - 0xea, 0x95, 0xa4, 0x80, 0xa0, 0x7d, 0x35, 0x57, 0xe3, 0x13, 0x2e, 0x3d, - 0xa4, 0xeb, 0x05, 0xfb, 0x93, 0xdd, 0xcb, 0x3b, 0x81, 0x89, 0x6a, 0x42, - 0x42, 0x53, 0x21, 0x24, 0x73, 0x35, 0x21, 0x00, 0x77, 0x25, 0xc4, 0xec, - 0xeb, 0xc1, 0x41, 0x43, 0xc3, 0x55, 0xe9, 0x5a, 0xd7, 0xd5, 0xdd, 0x97, - 0x27, 0x9b, 0x73, 0x43, 0x4f, 0x7a, 0x3c, 0x1a, 0x73, 0x3f, 0x8d, 0x62, - 0xdf, 0xb4, 0xf6, 0xef, 0xbe, 0x15, 0x78, 0x0e, 0xea, 0xa3, 0xb3, 0x3f, - 0x8d, 0x62, 0xdf, 0xb4, 0xf6, 0xdf, 0xbe, 0x15, 0x78, 0x8e, 0xea, 0xe7, - 0xbc, 0xfb, 0xcf, 0x91, 0xd1, 0x69, 0xf7, 0x61, 0x45, 0x14, 0x57, 0x29, - 0xd4, 0x14, 0x9b, 0xc7, 0x2f, 0x91, 0xdc, 0xbb, 0xe8, 0x79, 0x3f, 0x76, - 0x69, 0xca, 0x93, 0x38, 0xe4, 0x7f, 0xf9, 0x3d, 0x97, 0x74, 0xdf, 0xfa, - 0x22, 0x4f, 0xdd, 0x9a, 0x01, 0x03, 0x28, 0x12, 0xae, 0x49, 0xb5, 0x62, - 0x56, 0xd7, 0x96, 0xcc, 0xdb, 0xfb, 0xbe, 0x4c, 0xa7, 0x50, 0x74, 0xa6, - 0x22, 0xa5, 0x1c, 0xd2, 0x1d, 0x1e, 0x82, 0x10, 0x39, 0x47, 0xeb, 0x2d, - 0x35, 0x74, 0x5a, 0xa0, 0x44, 0xb6, 0x5b, 0x23, 0x5b, 0x60, 0x30, 0x88, - 0xf1, 0x22, 0xb4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9d, 0xaa, 0x8e, 0xc7, - 0x2e, 0x4b, 0xb5, 0x5e, 0x18, 0x98, 0x92, 0x79, 0x52, 0xad, 0x2c, 0x7a, - 0x52, 0x7b, 0xea, 0xee, 0x65, 0xc4, 0x3c, 0xca, 0x1d, 0x6c, 0x85, 0x21, - 0x60, 0x10, 0x47, 0x88, 0xaf, 0xbe, 0xf6, 0x6a, 0xfb, 0xed, 0x16, 0xbe, - 0xea, 0x4f, 0xbd, 0x0d, 0xbe, 0x5d, 0x3f, 0x83, 0x6a, 0x72, 0xca, 0x3d, - 0xd6, 0x08, 0xeb, 0x59, 0xa3, 0x55, 0xf4, 0x66, 0x87, 0xce, 0x37, 0x58, - 0xc2, 0xdb, 0x9b, 0xcf, 0xb5, 0x05, 0xf3, 0x06, 0xf8, 0x8b, 0x6f, 0x96, - 0x9f, 0x52, 0x64, 0x86, 0x5e, 0x3f, 0xf5, 0x29, 0x75, 0xf4, 0x70, 0xee, - 0xaf, 0x9e, 0x33, 0x51, 0xae, 0x33, 0xdc, 0xff, 0x00, 0x6a, 0x71, 0xd3, - 0xf5, 0xf2, 0x01, 0xff, 0x00, 0x8a, 0xfa, 0x1c, 0x77, 0x56, 0x93, 0x79, - 0xc7, 0xc0, 0xce, 0x1c, 0xbf, 0x8f, 0xf0, 0x14, 0x51, 0x45, 0x66, 0x68, - 0x14, 0x9b, 0xc6, 0xf3, 0xae, 0x10, 0x65, 0xa7, 0xff, 0x00, 0x48, 0x91, - 0xf7, 0x66, 0x9c, 0xa9, 0x33, 0x8e, 0x5f, 0x23, 0xb9, 0x77, 0xd0, 0xf2, - 0x7e, 0xec, 0xd0, 0x11, 0x9f, 0x83, 0x79, 0x2d, 0xf0, 0x82, 0xd5, 0x05, - 0x67, 0xdf, 0x60, 0x3f, 0x2e, 0x1b, 0xa0, 0xf7, 0x82, 0xdc, 0x97, 0x53, - 0xaf, 0xee, 0x03, 0xfb, 0xea, 0xc6, 0xaa, 0xb7, 0x82, 0xb2, 0xbc, 0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ba, 0xaa, 0xcd, 0xca, 0x2f, 0x94, 0xf7, 0xca, 0xea, 0x73, - 0xa9, 0xbc, 0xee, 0x17, 0x08, 0xae, 0x42, 0x9a, 0xf4, 0x57, 0x46, 0x96, - 0xd2, 0x8a, 0x4d, 0x68, 0xa7, 0x1e, 0x20, 0x45, 0x6e, 0x5c, 0x78, 0x99, - 0x04, 0x50, 0x0b, 0x72, 0x10, 0x03, 0x9a, 0xf0, 0x55, 0x27, 0x57, 0x25, - 0xf5, 0xb7, 0xd9, 0xab, 0xca, 0x9a, 0xe3, 0x95, 0xea, 0x9f, 0x04, 0x49, - 0x61, 0x85, 0x14, 0x51, 0x5c, 0x64, 0x05, 0x14, 0x51, 0x40, 0x14, 0x51, - 0x45, 0x00, 0x51, 0x45, 0x14, 0x01, 0x4f, 0x56, 0x84, 0xff, 0x00, 0x29, - 0xf0, 0xb7, 0x2d, 0xa4, 0x83, 0x36, 0x11, 0xe6, 0x64, 0x9e, 0xf2, 0x3c, - 0x07, 0xda, 0x3e, 0xb1, 0x48, 0xb5, 0x33, 0x86, 0xdd, 0x0d, 0xa6, 0xfa, - 0xcb, 0xe4, 0x9e, 0xc9, 0x67, 0x91, 0xc1, 0xea, 0x35, 0xe9, 0x76, 0x65, - 0x78, 0x52, 0xad, 0xa2, 0xa7, 0x82, 0x7d, 0xd7, 0xf0, 0x7d, 0x7e, 0x5c, - 0x96, 0x8b, 0xc3, 0x22, 0xa4, 0xc7, 0x7a, 0x33, 0xca, 0x65, 0xf6, 0x94, - 0xdb, 0x89, 0x3a, 0x29, 0x50, 0xd5, 0x32, 0xf0, 0xff, 0x00, 0x1f, 0x7e, - 0xe3, 0x74, 0x6e, 0x6b, 0xc8, 0x28, 0x89, 0x1d, 0x41, 0x44, 0x91, 0xf0, - 0xd4, 0x3b, 0x92, 0x3f, 0xef, 0x56, 0x83, 0xd0, 0xe1, 0x4a, 0xe5, 0x71, - 0xd8, 0xcc, 0xbb, 0xe2, 0x14, 0xa4, 0x03, 0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 0x61, 0x45, - 0x14, 0x57, 0x29, 0xd4, 0x14, 0x99, 0xc7, 0x1f, 0x91, 0xec, 0xb7, 0xe8, - 0x89, 0x1f, 0xc0, 0x69, 0xce, 0x93, 0x38, 0xe3, 0xf2, 0x3d, 0x97, 0x7d, - 0x11, 0x23, 0xf8, 0x0d, 0x00, 0xdb, 0x11, 0x09, 0x4c, 0x56, 0x92, 0x90, - 0x00, 0x09, 0x1d, 0x00, 0xa8, 0x5c, 0xe7, 0x17, 0x81, 0x95, 0xd9, 0xc4, - 0x09, 0x6b, 0x76, 0x3b, 0xec, 0xb8, 0x99, 0x10, 0x66, 0xb2, 0x74, 0xf4, - 0x39, 0x09, 0xf8, 0x0e, 0xb6, 0x7f, 0x48, 0x1f, 0x0e, 0xe2, 0x36, 0x08, - 0x20, 0x9a, 0x9c, 0x8d, 0xf1, 0x76, 0xfe, 0x60, 0xfb, 0x2b, 0x61, 0x1b, - 0xa0, 0x11, 0xf1, 0x3c, 0xb6, 0x74, 0x7b, 0xab, 0x78, 0x96, 0x6c, 0xdb, - 0x30, 0xaf, 0xda, 0x3e, 0x47, 0x29, 0x03, 0x96, 0x35, 0xd9, 0x03, 0xf3, - 0xd9, 0x27, 0xb9, 0xc0, 0x3a, 0xa9, 0xa3, 0xe7, 0x0e, 0xa4, 0x6d, 0x3d, - 0x69, 0xbe, 0xe1, 0x12, 0x3d, 0xc2, 0x13, 0x91, 0x24, 0xa0, 0x2d, 0xa7, - 0x06, 0x88, 0xae, 0x3c, 0x9b, 0x1f, 0xb3, 0xe4, 0x96, 0x87, 0x2d, 0x57, - 0xb8, 0x2d, 0xcc, 0x88, 0xb2, 0x15, 0xc8, 0xad, 0x82, 0x85, 0x0e, 0xe5, - 0xa1, 0x43, 0xaa, 0x14, 0x3b, 0xc2, 0x92, 0x41, 0x07, 0xba, 0x93, 0xfb, - 0x4c, 0xd7, 0x05, 0x46, 0x9f, 0x4c, 0xbc, 0xd3, 0x1e, 0x47, 0x73, 0xad, - 0x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1, - 0xae, 0x8a, 0x74, 0x29, 0xd3, 0xf0, 0x45, 0x2f, 0x82, 0x27, 0x08, 0x79, - 0x27, 0xd5, 0x50, 0xf9, 0x56, 0x51, 0x60, 0xc5, 0xa1, 0x22, 0x66, 0x43, - 0x75, 0x8d, 0x6f, 0x65, 0xc5, 0x72, 0x34, 0x5d, 0x57, 0x9c, 0xe2, 0xb5, - 0xbe, 0x54, 0x24, 0x75, 0x51, 0xd7, 0x80, 0x04, 0xd2, 0x3d, 0x8e, 0xcc, - 0xdd, 0x87, 0x8c, 0xf0, 0x6d, 0x71, 0x2f, 0x77, 0xe9, 0xe3, 0xf9, 0x3f, - 0x26, 0x4c, 0xb1, 0x71, 0xb9, 0xbd, 0x27, 0x9b, 0x6f, 0xb0, 0x86, 0xcf, - 0x2a, 0x89, 0x48, 0xf8, 0x2e, 0x6b, 0x40, 0x78, 0xd4, 0x8c, 0x12, 0x32, - 0x6e, 0x31, 0xbf, 0x3d, 0xb0, 0x95, 0xdb, 0xb1, 0x58, 0x8b, 0x84, 0xdb, - 0x9e, 0x06, 0x7c, 0x8e, 0x55, 0x3a, 0x12, 0x7c, 0x7b, 0x36, 0x92, 0xda, - 0x4f, 0xa0, 0xba, 0x47, 0x78, 0xad, 0x41, 0xb1, 0x59, 0xf5, 0xd2, 0xea, - 0x4a, 0x31, 0x0c, 0x22, 0xf5, 0x73, 0x04, 0x8e, 0x59, 0x77, 0x04, 0x7b, - 0x9b, 0x17, 0x94, 0xfe, 0x76, 0xde, 0x1d, 0xaa, 0x87, 0xcd, 0x6c, 0xd7, - 0x93, 0x8a, 0xe6, 0x39, 0x01, 0xde, 0x5f, 0x96, 0x98, 0x90, 0xd4, 0x7c, - 0xeb, 0x66, 0x3e, 0x95, 0x46, 0x42, 0x87, 0x5e, 0x8b, 0x90, 0xad, 0xbc, - 0xa0, 0x47, 0x7f, 0x2f, 0x67, 0xec, 0xa7, 0xd0, 0x01, 0x1e, 0x04, 0x1f, - 0x55, 0x67, 0x42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 0xc7, 0xf8, - 0x7d, 0x49, 0x07, 0x99, 0xce, 0x51, 0xaf, 0x0a, 0x71, 0x9b, 0x69, 0x89, - 0x32, 0xed, 0x6f, 0xbb, 0x3c, 0x5f, 0x12, 0x60, 0x07, 0x7b, 0x00, 0x87, - 0x96, 0x94, 0x7b, 0xe2, 0x42, 0x54, 0x54, 0x90, 0x74, 0xae, 0x83, 0xa7, - 0x30, 0x3a, 0xeb, 0x50, 0x39, 0x7f, 0x11, 0x71, 0x1c, 0x5e, 0x4f, 0x90, - 0x4e, 0xb9, 0xf9, 0x4d, 0xd5, 0x63, 0x6d, 0xdb, 0x20, 0xb6, 0x64, 0xcc, - 0x70, 0xeb, 0x63, 0x4d, 0x23, 0x6a, 0x03, 0xf5, 0x95, 0xa4, 0xfa, 0xe9, - 0x32, 0xe3, 0x96, 0x71, 0x13, 0x26, 0xda, 0x2d, 0xb1, 0xa3, 0x61, 0x56, - 0xe5, 0x7f, 0x4d, 0x24, 0x22, 0x65, 0xc5, 0x43, 0xd4, 0xd8, 0x3d, 0x93, - 0x47, 0xe7, 0x17, 0x08, 0xf4, 0x78, 0x55, 0xe1, 0x4e, 0x53, 0xf0, 0xa2, - 0x93, 0xa9, 0x18, 0x78, 0x99, 0x67, 0x64, 0x79, 0x05, 0x8f, 0x1a, 0xb5, - 0xae, 0xe5, 0x7f, 0xba, 0xc2, 0xb5, 0x42, 0x6f, 0xbd, 0xe9, 0x6f, 0xa5, - 0xb4, 0x7b, 0x01, 0x27, 0xa9, 0xf5, 0x0e, 0xb5, 0x40, 0x66, 0x9f, 0x85, - 0x35, 0xad, 0x4d, 0xb8, 0xd6, 0x01, 0x66, 0x55, 0xdf, 0x5c, 0xc9, 0xf7, - 0x42, 0x66, 0xda, 0x8e, 0x08, 0x3a, 0x25, 0x28, 0x1e, 0x7a, 0x87, 0xb7, - 0x93, 0xeb, 0x15, 0x3a, 0xce, 0x03, 0x89, 0xcc, 0xf2, 0xa1, 0x94, 0x44, - 0x93, 0x92, 0xbb, 0x3a, 0x3a, 0xa3, 0xc9, 0x9d, 0x75, 0x78, 0xc8, 0x92, - 0x94, 0x2b, 0xc5, 0xb5, 0x2b, 0xa3, 0x5a, 0xef, 0x01, 0x01, 0x35, 0xf2, - 0xb7, 0x10, 0x30, 0xeb, 0xcf, 0xe0, 0xff, 0x00, 0xc4, 0x98, 0xee, 0xa5, - 0x5e, 0xe9, 0x62, 0xd7, 0x25, 0x15, 0x42, 0x98, 0xa6, 0xd2, 0xa2, 0xe3, - 0x40, 0x8e, 0x61, 0xd4, 0x69, 0x0f, 0xa0, 0x11, 0xd4, 0x68, 0xf5, 0x04, - 0x6b, 0x7d, 0x34, 0x9d, 0x19, 0x53, 0x6b, 0x51, 0x48, 0x56, 0x55, 0x13, - 0xd2, 0x36, 0xe4, 0x57, 0x2c, 0xeb, 0x88, 0x6e, 0x89, 0x19, 0x9d, 0xfe, - 0x6c, 0x88, 0x0b, 0x21, 0x4d, 0xc0, 0x1e, 0xf1, 0x11, 0x43, 0x7f, 0x9a, - 0xd2, 0x01, 0x2e, 0xfb, 0x40, 0x77, 0x5e, 0x24, 0x77, 0xd3, 0x9e, 0x26, - 0xfc, 0xdc, 0x32, 0x74, 0x5c, 0xb6, 0xd7, 0xda, 0x49, 0x55, 0x95, 0xb0, - 0x6e, 0x6d, 0x34, 0x94, 0xa4, 0x3d, 0x6d, 0xd0, 0x4b, 0x88, 0x3a, 0x51, - 0x0a, 0x28, 0x00, 0x2d, 0x03, 0x99, 0x44, 0x14, 0x7c, 0x14, 0x6e, 0xba, - 0x20, 0x45, 0x81, 0x21, 0xbf, 0x2d, 0x66, 0x42, 0x66, 0x25, 0xd4, 0x25, - 0xe5, 0x3c, 0x09, 0x29, 0x29, 0x50, 0x04, 0x29, 0x44, 0xe8, 0x9e, 0x84, - 0x69, 0x4b, 0xec, 0xfe, 0x79, 0xa6, 0x2b, 0x25, 0xb8, 0xb8, 0xa6, 0xa4, - 0x06, 0x10, 0x88, 0xa1, 0xc4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f, 0x8c, 0xf3, 0x0f, 0x07, - 0x51, 0xd9, 0x25, 0x6d, 0xab, 0x44, 0x15, 0x36, 0xa1, 0xb4, 0xab, 0x47, - 0xaf, 0x71, 0xf1, 0xeb, 0x5a, 0xe3, 0x34, 0xf2, 0xba, 0x33, 0x27, 0x2c, - 0x54, 0xc3, 0xea, 0x86, 0x02, 0x75, 0xe1, 0xd2, 0xbc, 0xb8, 0xe2, 0x5b, - 0x6d, 0x4b, 0x71, 0x49, 0x42, 0x52, 0x36, 0xa2, 0x4e, 0x80, 0x1e, 0x93, - 0x54, 0x1f, 0x1c, 0x7f, 0x08, 0x85, 0x61, 0xb9, 0x14, 0x9c, 0x4f, 0x14, - 0xc5, 0x9f, 0xbe, 0x5e, 0x59, 0x21, 0xb7, 0x64, 0x3c, 0x4a, 0x22, 0xb4, - 0xb2, 0x90, 0xae, 0x5f, 0x37, 0x6a, 0x70, 0x80, 0x46, 0xc0, 0xe5, 0x03, - 0x7a, 0xdf, 0x7d, 0x7c, 0x77, 0xc6, 0xee, 0x29, 0x71, 0x47, 0x29, 0xbb, - 0x48, 0xb4, 0xe6, 0x17, 0xf9, 0x09, 0x8e, 0x9d, 0x1f, 0x20, 0x8b, 0xef, - 0x51, 0x8a, 0x48, 0xd8, 0xf3, 0x52, 0x7c, 0xee, 0x84, 0x7c, 0x22, 0xa2, - 0x3b, 0xab, 0x34, 0x8d, 0x32, 0x8f, 0xbe, 0xaf, 0x3c, 0x60, 0xc7, 0x3c, - 0xb6, 0x45, 0xaf, 0x11, 0x62, 0x46, 0x63, 0x75, 0x60, 0xf2, 0xbc, 0xd5, - 0xad, 0x49, 0x31, 0xd8, 0x57, 0x87, 0x6b, 0x21, 0x47, 0xb3, 0x47, 0x71, - 0xe8, 0x0a, 0x95, 0xea, 0xa5, 0x6b, 0xa3, 0xb9, 0xb6, 0x44, 0xdb, 0xb2, - 0x32, 0xec, 0x95, 0x18, 0xfd, 0xaf, 0xbc, 0xdb, 0xac, 0x8e, 0x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 0x52, 0xe2, - 0x0f, 0xa1, 0x48, 0x70, 0x6c, 0x1f, 0x52, 0x4d, 0x72, 0x70, 0x13, 0x24, - 0xb9, 0x5c, 0xb1, 0x99, 0x58, 0xbe, 0x48, 0xe7, 0x3e, 0x51, 0x8b, 0x48, - 0xf7, 0x32, 0xe6, 0x4f, 0x7b, 0xe1, 0x23, 0xde, 0x64, 0xf5, 0xea, 0x52, - 0xeb, 0x7c, 0xaa, 0xdf, 0xa7, 0x9b, 0xd1, 0x4b, 0x76, 0x19, 0xa9, 0xc2, - 0xf8, 0x9e, 0xdc, 0x92, 0xae, 0x4b, 0x1e, 0x58, 0xe2, 0x22, 0xcc, 0x04, - 0xf9, 0x91, 0xee, 0x21, 0x3a, 0x65, 0xdf, 0x50, 0x75, 0x29, 0xec, 0xcf, - 0xeb, 0x25, 0xbf, 0x4d, 0x76, 0x71, 0x83, 0x9f, 0x02, 0xcd, 0xac, 0xfc, - 0x5b, 0x88, 0x85, 0x26, 0xde, 0x90, 0x8b, 0x4e, 0x50, 0x84, 0x0e, 0x8a, - 0x86, 0xb5, 0x69, 0xa9, 0x07, 0xd2, 0x59, 0x71, 0x43, 0x67, 0xbf, 0x95, - 0x44, 0x77, 0x0a, 0xf1, 0x6a, 0x41, 0xd3, 0x93, 0x89, 0xec, 0x52, 0x9e, - 0xb8, 0xa6, 0x5b, 0xe9, 0x24, 0x80, 0x4d, 0x66, 0xbc, 0xb4, 0xb4, 0x38, - 0xd2, 0x5c, 0x6d, 0x49, 0x5a, 0x16, 0x02, 0x92, 0xa4, 0x9d, 0x82, 0x0f, - 0x71, 0x15, 0xea, 0xa8, 0x68, 0x14, 0x51, 0x45, 0x00, 0x51, 0x45, 0x14, - 0x02, 0x27, 0x19, 0x7e, 0x25, 0x8b, 0xfe, 0xd5, 0x5b, 0x3e, 0xfc, 0x53, - 0xdd, 0x22, 0x71, 0x97, 0xe2, 0x58, 0xbf, 0xed, 0x55, 0xb3, 0xef, 0xc5, - 0x3d, 0xd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x5b, 0x49, 0xf3, 0x94, 0x95, - 0x12, 0x41, 0x00, 0xf8, 0xfe, 0x77, 0xd5, 0xbe, 0x83, 0x7e, 0x83, 0x5c, - 0x71, 0x6d, 0xb1, 0x63, 0x4c, 0x7e, 0x4c, 0x66, 0xb9, 0x64, 0x48, 0x57, - 0xbe, 0xbc, 0x56, 0x56, 0xa5, 0x1d, 0x6c, 0x9d, 0x92, 0x74, 0x94, 0x8e, - 0xe0, 0x08, 0x03, 0xaf, 0xa2, 0xab, 0x24, 0xdb, 0xce, 0x4b, 0x45, 0xa4, - 0xb1, 0x83, 0x4f, 0x10, 0xdc, 0x67, 0xf1, 0x6b, 0x9a, 0xa5, 0xc2, 0x39, - 0x3d, 0xc2, 0x92, 0x4a, 0x89, 0x1a, 0x4a, 0xb5, 0xe6, 0x7f, 0xd4, 0x05, - 0x78, 0x91, 0x9b, 0x62, 0x50, 0x18, 0x40, 0x9d, 0x93, 0xda, 0x1b, 0x75, - 0x28, 0x1d, 0xa2, 0x04, 0xa4, 0x29, 0x49, 0x3a, 0xea, 0x08, 0x49, 0x24, - 0x52, 0xd5, 0xd6, 0xee, 0xde, 0x4f, 0x2a, 0x0d, 0xa2, 0x03, 0x25, 0xdc, - 0x57, 0xdd, 0x46, 0x99, 0xba, 0xdc, 0x92, 0x90, 0x59, 0x79, 0xf4, 0x92, - 0xe3, 0x51, 0x1b, 0x27, 0xa2, 0xd0, 0x5c, 0x6d, 0x01, 0x6a, 0x1d, 0x36, - 0x94, 0x24, 0x1d, 0xa8, 0xd4, 0x9e, 0x4b, 0x17, 0x12, 0xc7, 0x67, 0x22, - 0xe6, 0xed, 0xe7, 0xf9, 0x3d, 0x71, 0x90, 0xb1, 0xd8, 0xf9, 0x1a, 0x00, - 0x90, 0xfe, 0xcf, 0xc1, 0x42, 0x5a, 0x48, 0x75, 0x67, 0xd0, 0x3c, 0xf4, - 0xfa, 0x50, 0x77, 0x58, 0x4a, 0x72, 0x52, 0x94, 0xe2, 0xb2, 0x74, 0x46, - 0x11, 0x71, 0x8c, 0x24, 0xf0, 0x6d, 0x1c, 0x4e, 0xc0, 0xd5, 0xae, 0x4c, - 0x8d, 0x85, 0xef, 0xbb, 0x91, 0x87, 0x95, 0xf6, 0x20, 0xd7, 0xa3, 0xc4, - 0xdc, 0x05, 0x09, 0x2a, 0x7b, 0x27, 0x87, 0x1d, 0x20, 0xeb, 0x9a, 0x42, - 0x56, 0xc8, 0x27, 0xd0, 0x0a, 0xd2, 0x36, 0x7d, 0x5d, 0xf5, 0x2d, 0x64, - 0xfc, 0x70, 0x64, 0x6c, 0xa1, 0xa8, 0x52, 0x17, 0x8f, 0xc0, 0x0a, 0x20, - 0x5d, 0x6f, 0x51, 0x80, 0x9a, 0xea, 0x37, 0xd1, 0x49, 0x86, 0x83, 0xca, - 0x85, 0x6b, 0xbc, 0xb8, 0x47, 0xa7, 0x90, 0x77, 0x54, 0xef, 0xf2, 0x67, - 0x06, 0xc3, 0xe5, 0xc6, 0xbc, 0xe5, 0x97, 0x69, 0x37, 0xcb, 0xe6, 0xf5, - 0x1a, 0x65, 0xe5, 0xf3, 0x2e, 0x49, 0x56, 0xc1, 0xe5, 0x8e, 0xc0, 0x1a, - 0x49, 0xdf, 0x83, 0x48, 0x07, 0xdb, 0x59, 0x4a, 0xee, 0x4b, 0xc8, 0xd2, - 0x36, 0x91, 0x7e, 0x68, 0x4c, 0x75, 0xbb, 0x97, 0x12, 0x63, 0x37, 0x67, - 0xb3, 0x63, 0xb7, 0x01, 0x61, 0x90, 0xfb, 0x2a, 0x97, 0x79, 0x9c, 0x83, - 0x15, 0xae, 0xc9, 0x2e, 0x25, 0x64, 0xc7, 0x42, 0xbd, 0xf1, 0xc5, 0x1e, - 0x5d, 0x05, 0x04, 0x84, 0x83, 0xa3, 0xba, 0xbb, 0xef, 0x76, 0xd8, 0x37, - 0x9b, 0x34, 0xbb, 0x4d, 0xd2, 0x23, 0x72, 0xe1, 0x4c, 0x61, 0x4c, 0x48, - 0x65, 0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0x46, 0x69, 0x09, 0x2a, 0x7a, 0x41, 0x4f, - 0xe7, 0x72, 0xa0, 0x69, 0x23, 0xc5, 0x45, 0x20, 0xf4, 0xde, 0x97, 0xb1, - 0xcc, 0x42, 0xd5, 0x6f, 0xc9, 0x67, 0x58, 0x12, 0xbb, 0x94, 0x09, 0x26, - 0x3a, 0x67, 0xdb, 0xa7, 0xc7, 0x94, 0x5a, 0x94, 0xa6, 0xd4, 0x40, 0x79, - 0xb7, 0x14, 0x9f, 0x35, 0xc2, 0x97, 0x7a, 0xe9, 0x41, 0x40, 0x07, 0x07, - 0x80, 0x15, 0x1d, 0x27, 0x14, 0x5c, 0x4e, 0x28, 0xb7, 0x2a, 0x7c, 0xb7, - 0xae, 0x72, 0x9e, 0xb4, 0x36, 0xb9, 0x97, 0x17, 0xbc, 0xd0, 0x49, 0x9c, - 0xc8, 0x52, 0x52, 0x37, 0xca, 0xdb, 0x69, 0x6d, 0x04, 0x04, 0xfa, 0x09, - 0x24, 0x92, 0x49, 0xa6, 0xb7, 0xef, 0x71, 0x32, 0x1b, 0xfc, 0x37, 0x70, - 0xfb, 0x4c, 0xec, 0xaa, 0xe7, 0x6e, 0x53, 0xa8, 0x4b, 0x90, 0x48, 0x44, - 0x36, 0xfb, 0x44, 0x72, 0xad, 0x0e, 0xc9, 0x5f, 0xbd, 0x81, 0xd0, 0x1d, - 0x27, 0x99, 0x5b, 0x48, 0xe9, 0xd2, 0xb5, 0x72, 0x59, 0x72, 0x9e, 0xd8, - 0x32, 0x51, 0x78, 0x4a, 0x3b, 0xe4, 0xda, 0xac, 0x77, 0x32, 0x6d, 0x7c, - 0x90, 0xb3, 0xc4, 0xad, 0xa1, 0xa0, 0x8f, 0x2a, 0xb2, 0x32, 0xeb, 0x80, - 0x0e, 0xef, 0x39, 0x2a, 0x40, 0x3f, 0xf2, 0xee, 0x96, 0xee, 0xb1, 0x6d, - 0x2f, 0x5c, 0x7d, 0xc8, 0xbe, 0xe4, 0xb7, 0xfc, 0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, - 0xac, 0xec, 0x39, 0x01, 0xf1, 0xcc, 0xa6, 0x01, 0x3d, 0xea, 0x65, 0xc2, - 0xa4, 0x7c, 0xde, 0x5f, 0x0a, 0x73, 0xb9, 0xe6, 0x17, 0x3c, 0x9a, 0x03, - 0xf0, 0x78, 0x7d, 0x67, 0x93, 0x30, 0x3c, 0x92, 0xd2, 0x6f, 0x32, 0x47, - 0x61, 0x09, 0xad, 0x82, 0x39, 0xd0, 0x55, 0xe7, 0xbb, 0xaf, 0xd4, 0x49, - 0x1e, 0xba, 0x82, 0xe2, 0xa6, 0x0f, 0x2a, 0xd1, 0xc3, 0xfc, 0x76, 0xf3, - 0x88, 0x23, 0xb7, 0xc8, 0x70, 0x26, 0xd1, 0x22, 0xdf, 0xe6, 0xf2, 0xaa, - 0x63, 0x0d, 0xa0, 0x26, 0x43, 0x0a, 0xd7, 0xf5, 0x8d, 0x83, 0xd3, 0xf4, - 0x80, 0xf4, 0xd1, 0xac, 0x12, 0x9e, 0x4b, 0x84, 0x51, 0x50, 0xf8, 0x6e, - 0x45, 0x6c, 0xca, 0xf1, 0x6b, 0x6e, 0x47, 0x67, 0x7b, 0xb6, 0x81, 0x71, - 0x8e, 0x99, 0x0c, 0xab, 0x5d, 0x74, 0xa1, 0xdc, 0x47, 0x82, 0x81, 0xe8, - 0x47, 0x81, 0x06, 0xa6, 0x07, 0x75, 0x41, 0x21, 0x45, 0x14, 0x50, 0x08, - 0x9c, 0x65, 0xf8, 0x96, 0x2f, 0xfb, 0x55, 0x6c, 0xfb, 0xf1, 0x4f, 0x74, - 0x89, 0xc6, 0x5f, 0x89, 0x62, 0xff, 0x00, 0xb5, 0x56, 0xcf, 0xbf, 0x14, - 0xf7, 0x40, 0x1e, 0x26, 0x8a, 0xf2, 0xa4, 0x82, 0x7a, 0xd1, 0x4c, 0x11, - 0x94, 0x7a, 0xa4, 0xce, 0x38, 0xfc, 0x8f, 0x65, 0xdf, 0x44, 0x48, 0xfe, - 0x03, 0x4e, 0x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, 0xa2, 0x8a, - 0x03, 0x96, 0xe9, 0x0a, 0x2d, 0xca, 0xdf, 0x26, 0xdf, 0x39, 0x86, 0xe4, - 0x45, 0x94, 0xd2, 0x99, 0x7d, 0xa5, 0x8d, 0xa5, 0xc4, 0x28, 0x10, 0xa4, - 0x91, 0xe8, 0x20, 0x9a, 0xf8, 0xda, 0xe3, 0x06, 0xe1, 0x84, 0xca, 0xbd, - 0xe2, 0x73, 0x24, 0x2f, 0xb4, 0xc5, 0xd8, 0x54, 0x54, 0xba, 0xb5, 0x12, - 0x5e, 0xb1, 0x49, 0x73, 0x9e, 0x24, 0x8d, 0xf8, 0xf9, 0x2c, 0x92, 0x02, - 0xbf, 0x55, 0xc5, 0x78, 0x26, 0xbe, 0xd3, 0xd5, 0x52, 0xff, 0x00, 0x84, - 0xee, 0x3e, 0xfc, 0x7b, 0x7c, 0x0e, 0x26, 0x5a, 0x20, 0x26, 0x74, 0xfc, - 0x68, 0x38, 0x9b, 0x8c, 0x32, 0x9e, 0x61, 0x70, 0xb5, 0x3a, 0x39, 0x65, - 0x30, 0xa1, 0xe3, 0xe6, 0x92, 0xa1, 0xbe, 0xef, 0x38, 0xd4, 0xa7, 0x87, - 0x92, 0x1a, 0xca, 0xc0, 0xd9, 0x8f, 0x4c, 0x63, 0x39, 0xc0, 0x24, 0xbd, - 0x09, 0xc1, 0x1d, 0xeb, 0x83, 0x45, 0x44, 0xf7, 0x86, 0x24, 0x00, 0x02, - 0x90, 0xaf, 0x5a, 0x1c, 0x49, 0x04, 0x7a, 0x3d, 0xbb, 0xa8, 0x35, 0xe3, - 0xf7, 0x97, 0xef, 0x82, 0x5a, 0xec, 0x97, 0x17, 0xee, 0x4b, 0x5f, 0x94, - 0x11, 0x2e, 0x7e, 0xed, 0xd1, 0x5d, 0x56, 0x8a, 0x96, 0x00, 0xf3, 0x97, - 0xa2, 0x94, 0xe9, 0x1d, 0x7a, 0x01, 0xbd, 0x68, 0x6a, 0xbd, 0xe0, 0x62, - 0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0x5f, 0x31, 0xed, 0x53, 0xde, 0x52, - 0x84, 0x27, 0x98, 0x95, 0x00, 0x48, 0xd1, 0xad, 0x46, 0xd9, 0x69, 0x97, - 0x39, 0x8b, 0x55, 0xad, 0xe9, 0x97, 0x5b, 0x9b, 0xd1, 0x42, 0x5c, 0x6e, - 0xe0, 0xc9, 0x88, 0x83, 0x1d, 0xb4, 0x80, 0x16, 0xf2, 0x83, 0x49, 0x79, - 0xe6, 0xb9, 0x88, 0xd2, 0x0a, 0x94, 0x92, 0x49, 0x04, 0xe8, 0x13, 0x5d, - 0xf9, 0x63, 0xb3, 0x31, 0x0b, 0x94, 0x4c, 0x8e, 0x52, 0xee, 0x39, 0x2c, - 0x34, 0x32, 0xb6, 0x63, 0xb6, 0xe2, 0x5a, 0x2e, 0xb0, 0xfa, 0x88, 0x25, - 0x69, 0xe5, 0x4a, 0x76, 0x14, 0x84, 0xab, 0x43, 0x5b, 0xd8, 0xe5, 0x1f, - 0x0c, 0x01, 0x9c, 0x9e, 0xe9, 0x6e, 0xca, 0xd8, 0xb6, 0x2b, 0x1e, 0x91, - 0x2d, 0x37, 0x49, 0x0a, 0x53, 0x29, 0xec, 0x42, 0x98, 0x7d, 0x31, 0x5c, - 0x1c, 0xae, 0xa9, 0x5b, 0x4e, 0xdb, 0x48, 0xe8, 0xa0, 0xa5, 0x27, 0xe1, - 0xa1, 0x3a, 0x07, 0xb8, 0xc6, 0xfd, 0x42, 0xc6, 0x76, 0x3d, 0x64, 0xb1, - 0xe7, 0x5a, 0x97, 0x6b, 0x39, 0x1c, 0x86, 0x6e, 0x78, 0xf2, 0x0a, 0xca, - 0xe3, 0x46, 0x83, 0xc8, 0x90, 0xf2, 0x53, 0xef, 0x2d, 0xf2, 0x02, 0x79, - 0x9b, 0x24, 0x10, 0x90, 0x7f, 0x3f, 0x90, 0x75, 0xde, 0x86, 0xcc, 0xc2, - 0xe3, 0x68, 0xbb, 0xe1, 0xd0, 0x32, 0x4b, 0x1c, 0x94, 0xa2, 0x53, 0x0b, - 0x47, 0xb9, 0x6e, 0xb2, 0x00, 0x52, 0xcb, 0xba, 0x4a, 0x99, 0x6f, 0xa6, - 0x94, 0x54, 0x9d, 0x8d, 0x0e, 0xe2, 0x90, 0x7f, 0x36, 0xb8, 0x15, 0xee, - 0xd0, 0xb6, 0x44, 0xc7, 0xf2, 0x89, 0x6e, 0x2c, 0x95, 0x36, 0xeb, 0xad, - 0x36, 0x80, 0xf4, 0xd9, 0x49, 0x6d, 0x61, 0x49, 0x09, 0x6d, 0x91, 0xca, - 0xda, 0x76, 0x9d, 0x15, 0x92, 0x77, 0xa3, 0xd1, 0x35, 0xd7, 0x60, 0xb7, - 0xc4, 0xb9, 0xde, 0x64, 0x2e, 0xc0, 0xc3, 0xb6, 0x56, 0xe0, 0x14, 0xc7, - 0x7a, 0x4c, 0xb6, 0xd4, 0xec, 0xd4, 0xb8, 0xa4, 0xf3, 0x29, 0xa6, 0xbb, - 0x62, 0xa0, 0xd2, 0x42, 0x54, 0x36, 0x40, 0x21, 0x5b, 0xe9, 0xd0, 0x6c, - 0xb6, 0x5c, 0x05, 0x97, 0xc9, 0xcf, 0x70, 0x99, 0x7b, 0x7b, 0x11, 0x36, - 0x5c, 0x91, 0xf4, 0xc6, 0x0f, 0x28, 0x33, 0x26, 0xe5, 0x35, 0x86, 0xe3, - 0x02, 0x90, 0xa1, 0xd1, 0x96, 0x50, 0xe2, 0xd4, 0xb7, 0x48, 0x1b, 0x04, - 0x10, 0x90, 0x41, 0x23, 0xc0, 0x52, 0xde, 0x39, 0x78, 0xb7, 0xe1, 0x7c, - 0x74, 0x90, 0xc4, 0x09, 0x04, 0xe2, 0xd9, 0xd3, 0xca, 0x5a, 0x02, 0x90, - 0xa4, 0x08, 0x77, 0x94, 0x24, 0x17, 0x10, 0x52, 0xad, 0x29, 0x3d, 0xb3, - 0x7a, 0x5f, 0x51, 0xd5, 0x43, 0xa7, 0x4a, 0x6d, 0x9c, 0x6e, 0x18, 0xbe, - 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 0x65, 0x11, 0xb1, 0xdb, 0xc2, 0x9c, 0xba, - 0x3e, 0x5b, 0x42, 0x9f, 0x62, 0x22, 0xbb, 0x67, 0xe5, 0x34, 0x95, 0x12, - 0x90, 0xeb, 0xab, 0x4b, 0x6d, 0xb2, 0xd9, 0x29, 0x00, 0xe8, 0x6d, 0x5a, - 0x3a, 0x3d, 0xf5, 0xd1, 0x6f, 0x66, 0x12, 0xf2, 0x09, 0x76, 0xf5, 0x5b, - 0x93, 0x88, 0x88, 0xec, 0xb6, 0xb9, 0x09, 0x8d, 0xd9, 0x87, 0xe5, 0x17, - 0x56, 0xae, 0x50, 0xdb, 0xa9, 0xea, 0x1a, 0xf3, 0x34, 0x79, 0x79, 0x4f, - 0x31, 0xd6, 0xc6, 0xba, 0xe9, 0xbf, 0x2d, 0x78, 0x54, 0xe9, 0x0e, 0x63, - 0x22, 0x0a, 0x18, 0xba, 0x21, 0x12, 0x5a, 0x43, 0xc5, 0x7d, 0x92, 0x0b, - 0x2b, 0x42, 0x5d, 0x68, 0x29, 0x29, 0x57, 0x66, 0x85, 0x25, 0xcd, 0xa5, - 0x5a, 0x29, 0x42, 0x81, 0xd8, 0x00, 0xf4, 0x32, 0x26, 0x1a, 0xce, 0x13, - 0x01, 0xe9, 0x2d, 0xb5, 0x02, 0x23, 0x1c, 0xe1, 0xdb, 0x83, 0xe9, 0x53, - 0x4d, 0xad, 0x4a, 0xe5, 0x28, 0x6d, 0xad, 0xa9, 0x0a, 0x59, 0x0b, 0x4a, - 0x55, 0xce, 0x92, 0x91, 0xe6, 0x8e, 0x52, 0x77, 0x53, 0xcf, 0x21, 0x7a, - 0x1b, 0x72, 0x36, 0x64, 0xe1, 0x73, 0xdd, 0xba, 0x59, 0x48, 0x96, 0x99, - 0x90, 0xcc, 0x78, 0x88, 0x9f, 0x35, 0x4a, 0x4c, 0x77, 0x9b, 0x25, 0xd5, - 0x36, 0x97, 0x1c, 0x3d, 0x03, 0x88, 0x0b, 0xd6, 0xce, 0x82, 0xd0, 0x91, - 0xd0, 0x1e, 0x9a, 0x72, 0x67, 0xd9, 0xcf, 0x1a, 0x83, 0x12, 0x04, 0x1e, - 0x69, 0x6b, 0x49, 0x4c, 0xa1, 0xdb, 0x10, 0x18, 0x8e, 0xb4, 0x12, 0xa4, - 0x3c, 0xb4, 0x6c, 0x21, 0x5c, 0xe9, 0x6d, 0x49, 0x48, 0x25, 0x41, 0x48, - 0x0a, 0xd6, 0x87, 0x5e, 0xeb, 0x5c, 0x2b, 0x8c, 0x9b, 0x82, 0x9e, 0x87, - 0x1d, 0xab, 0xc1, 0x82, 0xa7, 0x18, 0x44, 0x89, 0x4a, 0xf2, 0x58, 0x2d, - 0x2f, 0x5c, 0xae, 0x06, 0x9a, 0x48, 0x52, 0x9c, 0x57, 0x52, 0x92, 0xb5, - 0x6f, 0xf3, 0x82, 0x4f, 0x78, 0xad, 0x56, 0x85, 0xda, 0x2e, 0x4b, 0x2c, - 0xe4, 0xea, 0x4c, 0x17, 0x55, 0x31, 0xf8, 0x91, 0xec, 0xa8, 0x7f, 0xb3, - 0x8e, 0xc1, 0x6b, 0x44, 0xec, 0x23, 0x41, 0xc2, 0x52, 0x52, 0xbe, 0x65, - 0x7e, 0x6a, 0xc6, 0x80, 0xa8, 0xf4, 0x43, 0x18, 0xdd, 0x9e, 0x11, 0x1e, - 0x43, 0x92, 0x23, 0x59, 0x27, 0x34, 0xe5, 0xe0, 0x5b, 0x56, 0x97, 0x15, - 0x02, 0x17, 0xbe, 0x6d, 0xc0, 0x9f, 0x35, 0x72, 0xa4, 0x3a, 0x10, 0x92, - 0xad, 0x1e, 0x60, 0x80, 0x12, 0x49, 0xd1, 0xea, 0x3a, 0x57, 0x45, 0x85, - 0x16, 0xfb, 0x83, 0xaf, 0xb6, 0xe1, 0x56, 0x35, 0x08, 0x4f, 0x30, 0xda, - 0xb5, 0x45, 0xe4, 0x88, 0xe3, 0xaf, 0x21, 0x1c, 0xca, 0xed, 0x16, 0xd9, - 0xd9,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 0x0b, 0xf3, 0xd9, 0x2a, 0xa1, 0xb1, 0x6c, 0x25, - 0xd4, 0xb9, 0x19, 0x32, 0x59, 0x74, 0x39, 0xbe, 0x44, 0x87, 0x1c, 0x28, - 0x6d, 0xd4, 0x68, 0x28, 0xa1, 0x3e, 0xf6, 0xe7, 0x36, 0xf9, 0x41, 0x20, - 0x12, 0x45, 0x31, 0xd5, 0x8c, 0xf4, 0x42, 0x54, 0x59, 0xb2, 0x78, 0x6b, - 0xc7, 0x74, 0xcc, 0x9a, 0xe9, 0x5d, 0x9b, 0x27, 0x71, 0x9b, 0x6d, 0xd5, - 0xfe, 0x81, 0x02, 0x61, 0x49, 0xf2, 0x39, 0x67, 0xb8, 0x02, 0xea, 0x12, - 0xa6, 0x96, 0x75, 0xd5, 0x6d, 0x95, 0x78, 0x81, 0x5f, 0x42, 0x27, 0xaa, - 0x77, 0x55, 0xf6, 0x4d, 0x82, 0xda, 0x72, 0x0b, 0x15, 0xdf, 0x11, 0xb9, - 0xba, 0xec, 0xd7, 0x2f, 0x11, 0xb9, 0xe5, 0xce, 0x70, 0x8e, 0xd5, 0xb7, - 0x11, 0xae, 0xc9, 0x68, 0x4a, 0x40, 0x08, 0x08, 0x57, 0x54, 0x81, 0xad, - 0x7a, 0xce, 0xc9, 0xcf, 0x00, 0xb2, 0x4b, 0xae, 0x43, 0xc3, 0xe4, 0x35, - 0x90, 0x68, 0xdf, 0x6c, 0xb2, 0xdf, 0xb3, 0xdd, 0x17, 0xbd, 0x87, 0x24, - 0x47, 0x57, 0x21, 0x5e, 0xff, 0x00, 0x58, 0x72, 0xa8, 0xfa, 0xc9, 0xa8, - 0x69, 0xa0, 0x9a, 0x66, 0xee, 0x32, 0xfc, 0x4b, 0x17, 0xfd, 0xaa, 0xb6, - 0x7d, 0xf8, 0xa7, 0xba, 0x44, 0xe3, 0x27, 0xc4, 0x71, 0x7f, 0xda, 0xab, - 0x67, 0xdf, 0x8a, 0x7b, 0xa8, 0x24, 0x28, 0xac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x17, 0x96, 0xcd, 0x9a, 0xe1, 0x02, 0xdf, 0x24, 0x36, 0xa5, 0x26, 0xdb, - 0x0d, 0x80, 0x5b, 0x20, 0xef, 0x69, 0x53, 0xaa, 0x3c, 0xea, 0x75, 0x49, - 0xfe, 0x93, 0xcd, 0xf3, 0xba, 0x90, 0x6b, 0x7c, 0x0c, 0xab, 0x1e, 0xb2, - 0xdb, 0x10, 0xa8, 0x16, 0x0b, 0xb3, 0x76, 0xf7, 0x58, 0x4c, 0x96, 0x5c, - 0x85, 0x6c, 0x75, 0xf4, 0x39, 0xcc, 0x3c, 0xee, 0x65, 0x36, 0x93, 0xca, - 0xe0, 0x20, 0x85, 0x73, 0x90, 0x7a, 0x6f, 0x7a, 0xeb, 0x4c, 0x92, 0x92, - 0x36, 0x58, 0xf1, 0xfb, 0xe8, 0x71, 0xe7, 0xd7, 0x2c, 0x5a, 0xd7, 0x2b, - 0x97, 0xb7, 0x79, 0x4b, 0x12, 0x67, 0x3a, 0x90, 0x4e, 0x92, 0x56, 0x40, - 0x69, 0xa0, 0x37, 0xf0, 0x50, 0x82, 0x91, 0xb3, 0xae, 0xbb, 0x35, 0x3f, - 0x6c, 0xb4, 0xda, 0x2c, 0x85, 0xd7, 0xd9, 0x6c, 0x99, 0x2b, 0x47, 0xbf, - 0x49, 0x79, 0x6a, 0x75, 0xf7, 0x40, 0xfd, 0x25, 0x2b, 0x6a, 0x23, 0xd5, - 0xdd, 0xe8, 0x14, 0x82, 0xac, 0xc3, 0x3a, 0xcb, 0xd6, 0x23, 0xe1, 0xf6, - 0x2f, 0x72, 0x20, 0x13, 0xa5, 0x5c, 0x66, 0x29, 0x0e, 0xb8, 0x47, 0x4f, - 0x82, 0x06, 0xda, 0x49, 0xf5, 0xed, 0xd2, 0x3c, 0x51, 0xba, 0x9b, 0xc6, - 0xb8, 0x7e, 0x98, 0xf1, 0x94, 0x6f, 0xf7, 0x17, 0xee, 0x2e, 0x3e, 0x42, - 0xa4, 0x36, 0x1d, 0x51, 0x4b, 0xe7, 0xfd, 0xaa, 0xcf, 0x9e, 0xe8, 0xfd, - 0x52, 0x43, 0x7e, 0x84, 0x01, 0xa1, 0x50, 0x49, 0x2e, 0xac, 0xba, 0xd9, - 0x21, 0x45, 0x8b, 0x33, 0x32, 0xaf, 0x32, 0x47, 0x9a, 0x5a, 0x88, 0xdf, - 0x44, 0x1f, 0xd7, 0x5a, 0xb4, 0x94, 0x7b, 0x14, 0x77, 0xea, 0xa8, 0x36, - 0x30, 0x69, 0x97, 0x15, 0x22, 0x7d, 0xd6, 0x44, 0x68, 0x72, 0x7c, 0xbd, - 0xc9, 0xcd, 0xc7, 0x66, 0x3b, 0x72, 0x04, 0x45, 0x2f, 0x5f, 0x93, 0x71, - 0xc4, 0xed, 0x2b, 0x3a, 0xda, 0xba, 0x14, 0xec, 0x9e, 0x9e, 0x25, 0xbd, - 0xd9, 0x16, 0xbb, 0x34, 0x34, 0x30, 0x90, 0xcc, 0x66, 0x90, 0x34, 0xdb, - 0x2d, 0x20, 0x0d, 0x7a, 0x82, 0x45, 0x25, 0x66, 0xbc, 0x47, 0xb7, 0x59, - 0x5b, 0x6c, 0x4a, 0x96, 0x88, 0x21, 0xf3, 0xca, 0xc3, 0x41, 0x25, 0xd9, - 0x2f, 0x9f, 0x43, 0x6d, 0xa7, 0x6a, 0x51, 0xf5, 0x24, 0x13, 0xec, 0xad, - 0x69, 0xd1, 0x94, 0xf7, 0x5c, 0x79, 0x98, 0xce, 0xb4, 0x61, 0xb7, 0x51, - 0xb6, 0x0c, 0x6b, 0x46, 0x37, 0x01, 0x4d, 0xa5, 0xd5, 0x24, 0xb8, 0xe1, - 0x75, 0xd7, 0x1e, 0x70, 0xb8, 0xf3, 0xee, 0x10, 0x01, 0x5a, 0x89, 0xea, - 0xa5, 0x74, 0x03, 0xd0, 0x00, 0x00, 0x68, 0x00, 0x2a, 0x26, 0xe5, 0x92, - 0x3c, 0xf7, 0xbd, 0x42, 0x41, 0x65, 0x04, 0xeb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, 0xa6, 0x12, 0xa4, 0x17, 0x54, 0x19, 0x58, 0x57, 0x2a, - 0x42, 0xc6, 0xba, 0xea, 0xac, 0xea, 0x00, 0xa2, 0xb0, 0x49, 0xf0, 0xa2, - 0x80, 0xcd, 0x1a, 0xeb, 0x45, 0x14, 0x01, 0x45, 0x14, 0x50, 0x05, 0x14, - 0x51, 0x40, 0x14, 0x51, 0x45, 0x00, 0x51, 0x45, 0x14, 0x01, 0x5f, 0x2b, - 0x7e, 0x11, 0x38, 0x75, 0xcf, 0x0a, 0xc9, 0xef, 0x79, 0x7c, 0x1c, 0x7d, - 0xeb, 0xf6, 0x09, 0x91, 0x86, 0x9c, 0xc8, 0xe0, 0x43, 0x51, 0x4c, 0xa8, - 0x12, 0xdb, 0xdf, 0x24, 0xe6, 0x08, 0xf8, 0x0b, 0x1f, 0x0b, 0x98, 0x74, - 0xdf, 0x30, 0x57, 0x42, 0x0d, 0x7d, 0x53, 0x58, 0x52, 0x42, 0xba, 0x28, - 0x6c, 0x1e, 0x84, 0x50, 0x1f, 0x19, 0xe3, 0x3c, 0x46, 0xe2, 0x5c, 0x7b, - 0x12, 0x2e, 0x96, 0x9b, 0x64, 0x1e, 0x28, 0x63, 0xcd, 0x68, 0x79, 0x75, - 0xad, 0x65, 0xab, 0x93, 0x49, 0xf0, 0x12, 0x23, 0x8d, 0xa9, 0x0e, 0x01, - 0xde, 0x42, 0x08, 0xdf, 0xe7, 0x10, 0x76, 0x58, 0xec, 0xdc, 0x52, 0xcb, - 0xb2, 0x08, 0xcb, 0x7e, 0xd5, 0xc3, 0x29, 0x76, 0x88, 0x6d, 0x90, 0x97, - 0xae, 0x99, 0x1c, 0xe4, 0xdb, 0xe1, 0x32, 0x77, 0xd4, 0xa9, 0x6a, 0x4e, - 0xd5, 0xeb, 0x09, 0xd9, 0xf5, 0x55, 0x8d, 0xc4, 0x0f, 0xc1, 0xd7, 0x05, - 0xc8, 0xee, 0xc6, 0xfb, 0x65, 0x72, 0xe3, 0x87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, 0x51, 0x35, 0xb1, 0xf1, 0xe9, - 0x43, 0xb7, 0x92, 0x4f, 0xa7, 0x9d, 0x7b, 0xe5, 0x3f, 0x37, 0x43, 0xd5, - 0x56, 0x0f, 0x28, 0xac, 0x81, 0xae, 0xea, 0x2a, 0xa5, 0x8c, 0x68, 0x56, - 0x68, 0xa2, 0x80, 0x28, 0xa2, 0x8a, 0x00, 0xa2, 0x8a, 0x28, 0x03, 0x42, - 0x8a, 0x28, 0xa0, 0x30, 0x52, 0x0f, 0x7d, 0x15, 0x9a, 0x28, 0x02, 0x8a, - 0x28, 0xa0, 0x0a, 0x28, 0xa2, 0x80, 0x28, 0xa2, 0x8a, 0x00, 0xa2, 0x8a, - 0x28, 0x02, 0x8a, 0x28, 0xa0, 0x0a, 0x28, 0xa2, 0x80, 0x35, 0x45, 0x14, - 0x50, 0x05, 0x14, 0x51, 0x40, 0x14, 0x51, 0x45, 0x00, 0x51, 0x45, 0x14, - 0x01, 0x45, 0x14, 0x50, 0x05, 0x14, 0x51, 0x40, 0x14, 0x51, 0x45, 0x00, - 0x51, 0x45, 0x14, 0x07, 0xff, 0xd9 + 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, + 0x01, 0x01, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0xff, 0xe1, 0x00, 0x66, + 0x45, 0x78, 0x69, 0x66, 0x00, 0x00, 0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x1a, 0x01, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x3e, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x46, 0x00, 0x00, 0x00, 0x28, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x31, 0x01, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x50, 0x61, 0x69, 0x6e, 0x74, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x76, 0x33, + 0x2e, 0x33, 0x36, 0x00, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x03, 0x02, 0x02, + 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x03, 0x03, 0x04, 0x05, + 0x08, 0x05, 0x05, 0x04, 0x04, 0x05, 0x0a, 0x07, 0x07, 0x06, 0x08, 0x0c, + 0x0a, 0x0c, 0x0c, 0x0b, 0x0a, 0x0b, 0x0b, 0x0d, 0x0e, 0x12, 0x10, 0x0d, + 0x0e, 0x11, 0x0e, 0x0b, 0x0b, 0x10, 0x16, 0x10, 0x11, 0x13, 0x14, 0x15, + 0x15, 0x15, 0x0c, 0x0f, 0x17, 0x18, 0x16, 0x14, 0x18, 0x12, 0x14, 0x15, + 0x14, 0xff, 0xdb, 0x00, 0x43, 0x01, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, + 0x09, 0x05, 0x05, 0x09, 0x14, 0x0d, 0x0b, 0x0d, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0xff, 0xc0, + 0x00, 0x11, 0x08, 0x00, 0xf0, 0x01, 0x40, 0x03, 0x01, 0x22, 0x00, 0x02, + 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xc4, 0x00, 0x1f, 0x00, 0x00, 0x01, + 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x0a, 0x0b, 0xff, 0xc4, 0x00, 0xb5, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, + 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d, 0x01, + 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, + 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23, + 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, + 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, + 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, + 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, + 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, + 0x77, 0x78, 0x79, 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, + 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, + 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, + 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, 0xe3, + 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, + 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xff, 0xc4, 0x00, 0x1f, 0x01, 0x00, 0x03, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x0a, 0x0b, 0xff, 0xc4, 0x00, 0xb5, 0x11, 0x00, 0x02, 0x01, 0x02, 0x04, + 0x04, 0x03, 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, + 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, + 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xa1, + 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, 0x15, 0x62, 0x72, 0xd1, 0x0a, + 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, + 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, + 0x76, 0x77, 0x78, 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, + 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, + 0xa3, 0xa4, 0xa5, 0x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0x1e, 0x57, 0x0a, 0x09, + 0x3d, 0x06, 0x4f, 0x7a, 0x9e, 0x95, 0xd3, 0x76, 0xea, 0x01, 0x45, 0x14, + 0x53, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x82, 0xda, 0xf6, 0xde, + 0xf0, 0xca, 0x2d, 0xe7, 0x8a, 0x73, 0x13, 0x98, 0xe4, 0xf2, 0xdc, 0x36, + 0xc6, 0x1d, 0x54, 0xe3, 0xa1, 0xf6, 0xa4, 0xda, 0x4e, 0xcc, 0x09, 0xe8, + 0xa2, 0x8a, 0x60, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, + 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, + 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, 0x02, 0xb8, + 0x51, 0x45, 0x14, 0x05, 0xc2, 0x8a, 0x28, 0xa0, 0x2e, 0x14, 0x51, 0x45, + 0x01, 0x70, 0xa2, 0x8a, 0x28, 0x18, 0x51, 0x45, 0x14, 0x0a, 0xe1, 0x45, + 0x14, 0x50, 0x17, 0x0a, 0x28, 0xa2, 0x80, 0xb9, 0xca, 0xfc, 0x4a, 0xf0, + 0x52, 0x78, 0xef, 0xc2, 0xb7, 0x1a, 0x76, 0xef, 0x2e, 0xe5, 0x4f, 0x9d, + 0x6c, 0xe4, 0xe0, 0x09, 0x00, 0x38, 0xcf, 0xb1, 0xc9, 0x1f, 0x8e, 0x7b, + 0x57, 0x3d, 0xf0, 0x5b, 0xc7, 0x53, 0x6b, 0xba, 0x6c, 0xda, 0x16, 0xaa, + 0x5a, 0x3d, 0x73, 0x4a, 0xfd, 0xd4, 0x8b, 0x2f, 0xdf, 0x91, 0x01, 0xc0, + 0x27, 0xdc, 0x1e, 0x0f, 0xe0, 0x7b, 0xd7, 0xa3, 0x5c, 0xdc, 0xc5, 0x67, + 0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, + 0xd9, 0x3f, 0xcb, 0xbf, 0xc8, 0xd1, 0x49, 0x3d, 0x2e, 0x74, 0xdb, 0xa8, + 0xcd, 0x37, 0x34, 0x64, 0x57, 0xb2, 0x55, 0xc7, 0x6e, 0xa3, 0x75, 0x37, + 0x34, 0x66, 0x8b, 0x05, 0xc7, 0x6e, 0xa3, 0x75, 0x37, 0x34, 0x66, 0x8b, + 0x05, 0xc7, 0x6e, 0xa3, 0x75, 0x37, 0x34, 0x66, 0x8b, 0x05, 0xc7, 0x6e, + 0xa3, 0x75, 0x37, 0x34, 0x64, 0x51, 0x60, 0xb8, 0xed, 0xd4, 0x6e, 0xa6, + 0xe4, 0x51, 0x9a, 0x2c, 0x17, 0x1b, 0x9a, 0x33, 0x51, 0xee, 0xa3, 0x75, + 0x55, 0x88, 0xb9, 0x26, 0x68, 0xcd, 0x47, 0xba, 0x8d, 0xd4, 0x58, 0x2e, + 0x49, 0x9a, 0x33, 0x51, 0xee, 0xa3, 0x75, 0x16, 0x15, 0xc9, 0x32, 0x28, + 0xa8, 0xf7, 0x51, 0xba, 0x8b, 0x0e, 0xe4, 0x99, 0xa3, 0x35, 0x1e, 0xea, + 0x37, 0x51, 0x60, 0xb9, 0x26, 0x68, 0xcd, 0x47, 0xba, 0x8c, 0xd3, 0xb0, + 0x5c, 0xf9, 0x7b, 0xe3, 0xb6, 0xaf, 0x3e, 0xa5, 0xf1, 0x0e, 0xf2, 0xde, + 0x47, 0x26, 0x1b, 0x24, 0x48, 0x62, 0x4e, 0xc0, 0x15, 0x0c, 0x4f, 0xe2, + 0x58, 0xfe, 0x95, 0xe7, 0x95, 0xda, 0x7c, 0x64, 0xff, 0x00, 0x92, 0x97, + 0xad, 0xff, 0x00, 0xbf, 0x1f, 0xfe, 0x8a, 0x4a, 0xe2, 0xeb, 0xf9, 0x47, + 0x3a, 0x9c, 0xaa, 0x66, 0x78, 0x99, 0x49, 0xdd, 0xf3, 0xcb, 0xf0, 0x6d, + 0x23, 0x92, 0x5b, 0x9e, 0xf7, 0xfb, 0x34, 0xeb, 0x13, 0xcd, 0x67, 0xac, + 0xe9, 0xb2, 0x39, 0x6b, 0x78, 0x1a, 0x39, 0xa2, 0x04, 0xfd, 0xd2, 0xdb, + 0x83, 0x0f, 0xc7, 0x68, 0xfd, 0x6b, 0xc1, 0x2b, 0xda, 0xff, 0x00, 0x66, + 0x73, 0x8b, 0xed, 0x7f, 0xfe, 0xb9, 0xc3, 0xfc, 0xde, 0xbc, 0x52, 0xbd, + 0x8c, 0xd2, 0x72, 0x9e, 0x4b, 0x97, 0x39, 0x3b, 0xdb, 0xda, 0xaf, 0x92, + 0x92, 0xb1, 0x4f, 0xe1, 0x41, 0x45, 0x14, 0x57, 0xc6, 0x90, 0x14, 0x51, + 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x15, 0xef, + 0x7f, 0x13, 0xf5, 0x89, 0xf4, 0xef, 0x82, 0xbe, 0x19, 0xb6, 0x81, 0xca, + 0x0b, 0xc8, 0x2d, 0x62, 0x94, 0x83, 0xd5, 0x04, 0x3b, 0x88, 0xfc, 0x48, + 0x15, 0xe0, 0x95, 0xed, 0x7f, 0x17, 0x0f, 0xfc, 0x5a, 0x5f, 0x05, 0xff, + 0x00, 0xd7, 0x38, 0x3f, 0xf4, 0x45, 0x7d, 0x96, 0x47, 0x39, 0x43, 0x03, + 0x98, 0x4a, 0x2e, 0xcf, 0x91, 0x7e, 0x32, 0xb3, 0xfc, 0x0a, 0x8e, 0xcc, + 0xf1, 0x4a, 0xe9, 0xbe, 0x1a, 0x6a, 0xf3, 0xe8, 0xbe, 0x3a, 0xd1, 0x67, + 0x81, 0xca, 0x99, 0x2e, 0x52, 0x07, 0x00, 0xfd, 0xe4, 0x76, 0x0a, 0xc0, + 0xfe, 0x07, 0xf4, 0xae, 0x66, 0xb6, 0x3c, 0x1b, 0xff, 0x00, 0x23, 0x7e, + 0x87, 0xff, 0x00, 0x5f, 0xd0, 0x7f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4b, + 0xb8, 0x27, 0x70, 0xae, 0x87, 0x47, 0xf0, 0x07, 0x88, 0x35, 0xfb, 0x04, + 0xbd, 0xb0, 0xd3, 0x64, 0xb9, 0xb5, 0x72, 0x42, 0xc8, 0xae, 0xa0, 0x12, + 0x0e, 0x0f, 0x53, 0xeb, 0x5c, 0xf5, 0x7d, 0x27, 0xf0, 0x54, 0xe3, 0xe1, + 0xed, 0x8f, 0xfd, 0x74, 0x97, 0xff, 0x00, 0x43, 0x35, 0xe7, 0x70, 0xbe, + 0x4f, 0x43, 0x3c, 0xc6, 0xcb, 0x0d, 0x5e, 0x4d, 0x25, 0x16, 0xf4, 0xb5, + 0xee, 0x9a, 0x5d, 0x53, 0xee, 0x0d, 0xd8, 0xf3, 0x1f, 0x0d, 0x7c, 0x12, + 0xd7, 0xb5, 0x3d, 0x42, 0x31, 0xa9, 0x40, 0x34, 0xdb, 0x20, 0xc0, 0xc8, + 0xee, 0xea, 0xce, 0x47, 0x70, 0xa0, 0x13, 0xcf, 0xb9, 0xe2, 0xbe, 0x87, + 0xb7, 0x82, 0x3b, 0x4b, 0x78, 0xa0, 0x89, 0x42, 0x45, 0x12, 0x84, 0x45, + 0x1d, 0x80, 0x18, 0x02, 0x97, 0x34, 0x9b, 0xab, 0xfa, 0x07, 0x25, 0xe1, + 0xfc, 0x1e, 0x45, 0x09, 0x47, 0x0d, 0x76, 0xe5, 0xbb, 0x7a, 0xbd, 0x36, + 0x5a, 0x24, 0xad, 0xf2, 0x22, 0xf7, 0x24, 0xcd, 0x19, 0xa8, 0xf7, 0x51, + 0xba, 0xbe, 0x96, 0xc1, 0x71, 0xd2, 0x48, 0x22, 0x46, 0x76, 0xe0, 0x0e, + 0x6b, 0x2a, 0x5b, 0xd9, 0x18, 0x17, 0x47, 0x11, 0xe4, 0xe3, 0x60, 0xeb, + 0xf5, 0xa7, 0x49, 0x78, 0xef, 0xe7, 0xa9, 0x00, 0xa8, 0xe8, 0x08, 0xf7, + 0x02, 0xaa, 0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 0x07, 0x16, 0xac, 0x45, + 0x53, 0x85, 0x24, 0x41, 0x80, 0x4f, 0xff, 0x00, 0xae, 0x9a, 0x6d, 0xd9, + 0x66, 0x11, 0x64, 0x6e, 0xf5, 0xed, 0x5a, 0x76, 0xd1, 0x98, 0x21, 0x0a, + 0x48, 0x27, 0xda, 0x89, 0x4a, 0xc8, 0x29, 0xc1, 0xc9, 0xb4, 0xc9, 0xab, + 0x20, 0xa9, 0x02, 0x7c, 0x82, 0x3f, 0xfd, 0x75, 0xab, 0x9a, 0x8a, 0xe6, + 0x33, 0x34, 0x45, 0x41, 0xc1, 0xf7, 0xac, 0x60, 0xf9, 0x4e, 0x9a, 0x91, + 0xe6, 0x46, 0x45, 0x15, 0x28, 0xb7, 0x66, 0x98, 0xc5, 0x91, 0xb8, 0x77, + 0xed, 0x47, 0xd9, 0xdb, 0xcf, 0xf2, 0xb2, 0x37, 0x7a, 0xf6, 0xae, 0x9b, + 0xa3, 0x87, 0x95, 0x8f, 0x55, 0x25, 0xad, 0xf0, 0x0f, 0xf9, 0x63, 0x5a, + 0xd5, 0x0d, 0xba, 0x18, 0x61, 0x54, 0x24, 0x12, 0x3d, 0x2a, 0x4c, 0xd7, + 0x34, 0xdf, 0x33, 0x3b, 0xe9, 0xc7, 0x95, 0x19, 0x6c, 0xa4, 0x35, 0xc6, + 0x41, 0xff, 0x00, 0x2c, 0x2a, 0xbd, 0x6c, 0x5c, 0x46, 0x66, 0x85, 0x90, + 0x1c, 0x13, 0xeb, 0x59, 0x9f, 0x67, 0x6f, 0x3f, 0xca, 0xc8, 0xdd, 0xfa, + 0x56, 0xd0, 0x92, 0x68, 0xe5, 0xa9, 0x06, 0x9a, 0xb1, 0xa0, 0xd6, 0xc1, + 0xae, 0x04, 0xb9, 0x39, 0x1d, 0xaa, 0x6a, 0x28, 0xae, 0x76, 0xdb, 0x3a, + 0xd2, 0xb6, 0xc1, 0x45, 0x14, 0x52, 0x19, 0x0a, 0xdb, 0x05, 0xb8, 0x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, + 0xa6, 0xf5, 0xa0, 0x07, 0xc4, 0xb9, 0x39, 0xf4, 0xa9, 0x69, 0x14, 0x6d, + 0x18, 0xa5, 0xe9, 0x40, 0x0c, 0x95, 0xb0, 0x31, 0x51, 0x52, 0xb1, 0xdc, + 0x49, 0xa0, 0x0c, 0x9c, 0x50, 0x03, 0xe2, 0x5e, 0xf5, 0x25, 0x00, 0x60, + 0x62, 0x82, 0x70, 0x33, 0x40, 0x11, 0xca, 0xdd, 0xaa, 0x3a, 0x52, 0x72, + 0x73, 0x42, 0x8d, 0xc4, 0x0a, 0x00, 0x92, 0x25, 0xc0, 0xcd, 0x3e, 0x8e, + 0x94, 0x8c, 0x76, 0x82, 0x68, 0x02, 0x39, 0x5b, 0x27, 0x1e, 0x94, 0xca, + 0x3a, 0xd3, 0x91, 0x77, 0x35, 0x00, 0x49, 0x1a, 0xe1, 0x7d, 0xcd, 0x3a, + 0x8a, 0x47, 0x6d, 0xab, 0x40, 0x11, 0xc8, 0xd9, 0x6f, 0x61, 0x4c, 0xa2, + 0x9d, 0x1a, 0xee, 0x6f, 0x61, 0x40, 0x1f, 0xff, 0xd9 }; diff --git a/camera/libcameraservice/FakeCamera.cpp b/camera/libcameraservice/FakeCamera.cpp index 3daf47d..6749899 100644 --- a/camera/libcameraservice/FakeCamera.cpp +++ b/camera/libcameraservice/FakeCamera.cpp @@ -234,7 +234,7 @@ uint32_t temp; uint8_t y0, y1, u, v; pixels = inputRGB[i]; - temp = (ALPHA*(pixels & 0x001F) + BETA*(pixels>>11) ); + temp = (BETA*(pixels & 0x001F) + ALPHA*(pixels>>11) ); y0 = y_tab[(temp>>SHIFT1) + ((pixels>>3) & 0x00FC)]; G_ds += (pixels>>1) & 0x03E0; @@ -242,7 +242,7 @@ uint32_t temp; R_ds += (pixels>>6) & 0x03E0; pixels = inputRGB[i+1]; - temp = (ALPHA*(pixels & 0x001F) + BETA*(pixels>>11) ); + temp = (BETA*(pixels & 0x001F) + ALPHA*(pixels>>11) ); y1 = y_tab[(temp>>SHIFT1) + ((pixels>>3) & 0x00FC)]; G_ds += (pixels>>1) & 0x03E0; @@ -255,8 +255,8 @@ uint32_t temp; tmp = R_ds - B_ds; - u = cb_tab[(((R_ds-G_ds)<<SHIFT2) + DELTA*tmp)>>(SHIFT2+2)]; - v = cr_tab[(((B_ds-G_ds)<<SHIFT2) - GAMMA*tmp)>>(SHIFT2+2)]; + u = cb_tab[(((B_ds-G_ds)<<SHIFT2) - GAMMA*tmp)>>(SHIFT2+2)]; + v = cr_tab[(((R_ds-G_ds)<<SHIFT2) + DELTA*tmp)>>(SHIFT2+2)]; tempY[0] = y0; tempY[1] = y1; diff --git a/camera/tests/CameraServiceTest/Android.mk b/camera/tests/CameraServiceTest/Android.mk new file mode 100644 index 0000000..9bb190a --- /dev/null +++ b/camera/tests/CameraServiceTest/Android.mk @@ -0,0 +1,24 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= CameraServiceTest.cpp + +LOCAL_MODULE:= CameraServiceTest + +LOCAL_MODULE_TAGS := tests + +LOCAL_C_INCLUDES += \ + frameworks/base/libs + +LOCAL_CFLAGS := + +LOCAL_SHARED_LIBRARIES += \ + libbinder \ + libcutils \ + libutils \ + libui \ + libcamera_client \ + libsurfaceflinger_client + +include $(BUILD_EXECUTABLE) diff --git a/camera/tests/CameraServiceTest/CameraServiceTest.cpp b/camera/tests/CameraServiceTest/CameraServiceTest.cpp new file mode 100644 index 0000000..9fc795b --- /dev/null +++ b/camera/tests/CameraServiceTest/CameraServiceTest.cpp @@ -0,0 +1,849 @@ +#define LOG_TAG "CameraServiceTest" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <unistd.h> +#include <surfaceflinger/ISurface.h> +#include <camera/Camera.h> +#include <camera/CameraParameters.h> +#include <ui/GraphicBuffer.h> +#include <camera/ICamera.h> +#include <camera/ICameraClient.h> +#include <camera/ICameraService.h> +#include <ui/Overlay.h> +#include <binder/IPCThreadState.h> +#include <binder/IServiceManager.h> +#include <binder/ProcessState.h> +#include <utils/KeyedVector.h> +#include <utils/Log.h> +#include <utils/Vector.h> +#include <utils/threads.h> + +using namespace android; + +// +// Assertion and Logging utilities +// +#define INFO(...) \ + do { \ + printf(__VA_ARGS__); \ + printf("\n"); \ + LOGD(__VA_ARGS__); \ + } while(0) + +void assert_fail(const char *file, int line, const char *func, const char *expr) { + INFO("assertion failed at file %s, line %d, function %s:", + file, line, func); + INFO("%s", expr); + exit(1); +} + +void assert_eq_fail(const char *file, int line, const char *func, + const char *expr, int actual) { + INFO("assertion failed at file %s, line %d, function %s:", + file, line, func); + INFO("(expected) %s != (actual) %d", expr, actual); + exit(1); +} + +#define ASSERT(e) \ + do { \ + if (!(e)) \ + assert_fail(__FILE__, __LINE__, __func__, #e); \ + } while(0) + +#define ASSERT_EQ(expected, actual) \ + do { \ + int _x = (actual); \ + if (_x != (expected)) \ + assert_eq_fail(__FILE__, __LINE__, __func__, #expected, _x); \ + } while(0) + +// +// Holder service for pass objects between processes. +// +class IHolder : public IInterface { +protected: + enum { + HOLDER_PUT = IBinder::FIRST_CALL_TRANSACTION, + HOLDER_GET, + HOLDER_CLEAR + }; +public: + DECLARE_META_INTERFACE(Holder); + + virtual void put(sp<IBinder> obj) = 0; + virtual sp<IBinder> get() = 0; + virtual void clear() = 0; +}; + +class BnHolder : public BnInterface<IHolder> { + virtual status_t onTransact(uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); +}; + +class BpHolder : public BpInterface<IHolder> { +public: + BpHolder(const sp<IBinder>& impl) + : BpInterface<IHolder>(impl) { + } + + virtual void put(sp<IBinder> obj) { + Parcel data, reply; + data.writeStrongBinder(obj); + remote()->transact(HOLDER_PUT, data, &reply, IBinder::FLAG_ONEWAY); + } + + virtual sp<IBinder> get() { + Parcel data, reply; + remote()->transact(HOLDER_GET, data, &reply); + return reply.readStrongBinder(); + } + + virtual void clear() { + Parcel data, reply; + remote()->transact(HOLDER_CLEAR, data, &reply); + } +}; + +IMPLEMENT_META_INTERFACE(Holder, "CameraServiceTest.Holder"); + +status_t BnHolder::onTransact( + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { + switch(code) { + case HOLDER_PUT: { + put(data.readStrongBinder()); + return NO_ERROR; + } break; + case HOLDER_GET: { + reply->writeStrongBinder(get()); + return NO_ERROR; + } break; + case HOLDER_CLEAR: { + clear(); + return NO_ERROR; + } break; + default: + return BBinder::onTransact(code, data, reply, flags); + } +} + +class HolderService : public BnHolder { + virtual void put(sp<IBinder> obj) { + mObj = obj; + } + virtual sp<IBinder> get() { + return mObj; + } + virtual void clear() { + mObj.clear(); + } +private: + sp<IBinder> mObj; +}; + +// +// A mock CameraClient +// +class MCameraClient : public BnCameraClient { +public: + virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2); + virtual void dataCallback(int32_t msgType, const sp<IMemory>& data); + virtual void dataCallbackTimestamp(nsecs_t timestamp, + int32_t msgType, const sp<IMemory>& data) {} + + // new functions + void clearStat(); + enum OP { EQ, GE, LE, GT, LT }; + void assertNotify(int32_t msgType, OP op, int count); + void assertData(int32_t msgType, OP op, int count); + void waitNotify(int32_t msgType, OP op, int count); + void waitData(int32_t msgType, OP op, int count); + void assertDataSize(int32_t msgType, OP op, int dataSize); + + void setReleaser(ICamera *releaser) { + mReleaser = releaser; + } +private: + Mutex mLock; + Condition mCond; + DefaultKeyedVector<int32_t, int> mNotifyCount; + DefaultKeyedVector<int32_t, int> mDataCount; + DefaultKeyedVector<int32_t, int> mDataSize; + bool test(OP op, int v1, int v2); + + ICamera *mReleaser; +}; + +void MCameraClient::clearStat() { + Mutex::Autolock _l(mLock); + mNotifyCount.clear(); + mDataCount.clear(); + mDataSize.clear(); +} + +bool MCameraClient::test(OP op, int v1, int v2) { + switch (op) { + case EQ: return v1 == v2; + case GT: return v1 > v2; + case LT: return v1 < v2; + case GE: return v1 >= v2; + case LE: return v1 <= v2; + default: ASSERT(0); break; + } + return false; +} + +void MCameraClient::assertNotify(int32_t msgType, OP op, int count) { + Mutex::Autolock _l(mLock); + int v = mNotifyCount.valueFor(msgType); + ASSERT(test(op, v, count)); +} + +void MCameraClient::assertData(int32_t msgType, OP op, int count) { + Mutex::Autolock _l(mLock); + int v = mDataCount.valueFor(msgType); + ASSERT(test(op, v, count)); +} + +void MCameraClient::assertDataSize(int32_t msgType, OP op, int dataSize) { + Mutex::Autolock _l(mLock); + int v = mDataSize.valueFor(msgType); + ASSERT(test(op, v, dataSize)); +} + +void MCameraClient::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) { + INFO(__func__); + Mutex::Autolock _l(mLock); + ssize_t i = mNotifyCount.indexOfKey(msgType); + if (i < 0) { + mNotifyCount.add(msgType, 1); + } else { + ++mNotifyCount.editValueAt(i); + } + mCond.signal(); +} + +void MCameraClient::dataCallback(int32_t msgType, const sp<IMemory>& data) { + INFO(__func__); + int dataSize = data->size(); + INFO("data type = %d, size = %d", msgType, dataSize); + Mutex::Autolock _l(mLock); + ssize_t i = mDataCount.indexOfKey(msgType); + if (i < 0) { + mDataCount.add(msgType, 1); + mDataSize.add(msgType, dataSize); + } else { + ++mDataCount.editValueAt(i); + mDataSize.editValueAt(i) = dataSize; + } + mCond.signal(); + + if (msgType == CAMERA_MSG_VIDEO_FRAME) { + ASSERT(mReleaser != NULL); + mReleaser->releaseRecordingFrame(data); + } +} + +void MCameraClient::waitNotify(int32_t msgType, OP op, int count) { + INFO("waitNotify: %d, %d, %d", msgType, op, count); + Mutex::Autolock _l(mLock); + while (true) { + int v = mNotifyCount.valueFor(msgType); + if (test(op, v, count)) { + break; + } + mCond.wait(mLock); + } +} + +void MCameraClient::waitData(int32_t msgType, OP op, int count) { + INFO("waitData: %d, %d, %d", msgType, op, count); + Mutex::Autolock _l(mLock); + while (true) { + int v = mDataCount.valueFor(msgType); + if (test(op, v, count)) { + break; + } + mCond.wait(mLock); + } +} + +// +// A mock Surface +// +class MSurface : public BnSurface { +public: + virtual status_t registerBuffers(const BufferHeap& buffers); + virtual void postBuffer(ssize_t offset); + virtual void unregisterBuffers(); + virtual sp<OverlayRef> createOverlay( + uint32_t w, uint32_t h, int32_t format, int32_t orientation); + virtual sp<GraphicBuffer> requestBuffer(int bufferIdx, int usage); + + // new functions + void clearStat(); + void waitUntil(int c0, int c1, int c2); + +private: + // check callback count + Condition mCond; + Mutex mLock; + int registerBuffersCount; + int postBufferCount; + int unregisterBuffersCount; +}; + +status_t MSurface::registerBuffers(const BufferHeap& buffers) { + INFO(__func__); + Mutex::Autolock _l(mLock); + ++registerBuffersCount; + mCond.signal(); + return NO_ERROR; +} + +void MSurface::postBuffer(ssize_t offset) { + // INFO(__func__); + Mutex::Autolock _l(mLock); + ++postBufferCount; + mCond.signal(); +} + +void MSurface::unregisterBuffers() { + INFO(__func__); + Mutex::Autolock _l(mLock); + ++unregisterBuffersCount; + mCond.signal(); +} + +sp<GraphicBuffer> MSurface::requestBuffer(int bufferIdx, int usage) { + INFO(__func__); + return NULL; +} + +void MSurface::clearStat() { + Mutex::Autolock _l(mLock); + registerBuffersCount = 0; + postBufferCount = 0; + unregisterBuffersCount = 0; +} + +void MSurface::waitUntil(int c0, int c1, int c2) { + INFO("waitUntil: %d %d %d", c0, c1, c2); + Mutex::Autolock _l(mLock); + while (true) { + if (registerBuffersCount >= c0 && + postBufferCount >= c1 && + unregisterBuffersCount >= c2) { + break; + } + mCond.wait(mLock); + } +} + +sp<OverlayRef> MSurface::createOverlay(uint32_t w, uint32_t h, int32_t format, + int32_t orientation) { + // We don't expect this to be called in current hardware. + ASSERT(0); + sp<OverlayRef> dummy; + return dummy; +} + +// +// Utilities to use the Holder service +// +sp<IHolder> getHolder() { + sp<IServiceManager> sm = defaultServiceManager(); + ASSERT(sm != 0); + sp<IBinder> binder = sm->getService(String16("CameraServiceTest.Holder")); + ASSERT(binder != 0); + sp<IHolder> holder = interface_cast<IHolder>(binder); + ASSERT(holder != 0); + return holder; +} + +void putTempObject(sp<IBinder> obj) { + INFO(__func__); + getHolder()->put(obj); +} + +sp<IBinder> getTempObject() { + INFO(__func__); + return getHolder()->get(); +} + +void clearTempObject() { + INFO(__func__); + getHolder()->clear(); +} + +// +// Get a Camera Service +// +sp<ICameraService> getCameraService() { + sp<IServiceManager> sm = defaultServiceManager(); + ASSERT(sm != 0); + sp<IBinder> binder = sm->getService(String16("media.camera")); + ASSERT(binder != 0); + sp<ICameraService> cs = interface_cast<ICameraService>(binder); + ASSERT(cs != 0); + return cs; +} + +// +// Various Connect Tests +// +void testConnect() { + INFO(__func__); + sp<ICameraService> cs = getCameraService(); + sp<MCameraClient> cc = new MCameraClient(); + sp<ICamera> c = cs->connect(cc); + ASSERT(c != 0); + c->disconnect(); +} + +void testAllowConnectOnceOnly() { + INFO(__func__); + sp<ICameraService> cs = getCameraService(); + // Connect the first client. + sp<MCameraClient> cc = new MCameraClient(); + sp<ICamera> c = cs->connect(cc); + ASSERT(c != 0); + // Same client -- ok. + ASSERT(cs->connect(cc) != 0); + // Different client -- not ok. + sp<MCameraClient> cc2 = new MCameraClient(); + ASSERT(cs->connect(cc2) == 0); + c->disconnect(); +} + +void testReconnectFailed() { + INFO(__func__); + sp<ICamera> c = interface_cast<ICamera>(getTempObject()); + sp<MCameraClient> cc2 = new MCameraClient(); + ASSERT(c->connect(cc2) != NO_ERROR); +} + +void testReconnectSuccess() { + INFO(__func__); + sp<ICamera> c = interface_cast<ICamera>(getTempObject()); + sp<MCameraClient> cc = new MCameraClient(); + ASSERT(c->connect(cc) == NO_ERROR); +} + +void testLockFailed() { + INFO(__func__); + sp<ICamera> c = interface_cast<ICamera>(getTempObject()); + ASSERT(c->lock() != NO_ERROR); +} + +void testLockUnlockSuccess() { + INFO(__func__); + sp<ICamera> c = interface_cast<ICamera>(getTempObject()); + ASSERT(c->lock() == NO_ERROR); + ASSERT(c->unlock() == NO_ERROR); +} + +void testLockSuccess() { + INFO(__func__); + sp<ICamera> c = interface_cast<ICamera>(getTempObject()); + ASSERT(c->lock() == NO_ERROR); +} + +// +// Run the connect tests in another process. +// +const char *gExecutable; + +struct FunctionTableEntry { + const char *name; + void (*func)(); +}; + +FunctionTableEntry function_table[] = { +#define ENTRY(x) {#x, &x} + ENTRY(testReconnectFailed), + ENTRY(testReconnectSuccess), + ENTRY(testLockUnlockSuccess), + ENTRY(testLockFailed), + ENTRY(testLockSuccess), +#undef ENTRY +}; + +void runFunction(const char *tag) { + INFO("runFunction: %s", tag); + int entries = sizeof(function_table) / sizeof(function_table[0]); + for (int i = 0; i < entries; i++) { + if (strcmp(function_table[i].name, tag) == 0) { + (*function_table[i].func)(); + return; + } + } + ASSERT(0); +} + +void runInAnotherProcess(const char *tag) { + pid_t pid = fork(); + if (pid == 0) { + execlp(gExecutable, gExecutable, tag, NULL); + ASSERT(0); + } else { + int status; + ASSERT_EQ(pid, wait(&status)); + ASSERT_EQ(0, status); + } +} + +void testReconnect() { + INFO(__func__); + sp<ICameraService> cs = getCameraService(); + sp<MCameraClient> cc = new MCameraClient(); + sp<ICamera> c = cs->connect(cc); + ASSERT(c != 0); + // Reconnect to the same client -- ok. + ASSERT(c->connect(cc) == NO_ERROR); + // Reconnect to a different client (but the same pid) -- ok. + sp<MCameraClient> cc2 = new MCameraClient(); + ASSERT(c->connect(cc2) == NO_ERROR); + c->disconnect(); + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); +} + +void testLockUnlock() { + sp<ICameraService> cs = getCameraService(); + sp<MCameraClient> cc = new MCameraClient(); + sp<ICamera> c = cs->connect(cc); + ASSERT(c != 0); + // We can lock as many times as we want. + ASSERT(c->lock() == NO_ERROR); + ASSERT(c->lock() == NO_ERROR); + // Lock from a different process -- not ok. + putTempObject(c->asBinder()); + runInAnotherProcess("testLockFailed"); + // Unlock then lock from a different process -- ok. + ASSERT(c->unlock() == NO_ERROR); + runInAnotherProcess("testLockUnlockSuccess"); + // Unlock then lock from a different process -- ok. + runInAnotherProcess("testLockSuccess"); + c->disconnect(); + clearTempObject(); +} + +void testReconnectFromAnotherProcess() { + INFO(__func__); + + sp<ICameraService> cs = getCameraService(); + sp<MCameraClient> cc = new MCameraClient(); + sp<ICamera> c = cs->connect(cc); + ASSERT(c != 0); + // Reconnect from a different process -- not ok. + putTempObject(c->asBinder()); + runInAnotherProcess("testReconnectFailed"); + // Unlock then reconnect from a different process -- ok. + ASSERT(c->unlock() == NO_ERROR); + runInAnotherProcess("testReconnectSuccess"); + c->disconnect(); + clearTempObject(); +} + +// We need to flush the command buffer after the reference +// to ICamera is gone. The sleep is for the server to run +// the destructor for it. +static void flushCommands() { + IPCThreadState::self()->flushCommands(); + usleep(200000); // 200ms +} + +// Run a test case +#define RUN(class_name) do { \ + { \ + INFO(#class_name); \ + class_name instance; \ + instance.run(); \ + } \ + flushCommands(); \ +} while(0) + +// Base test case after the the camera is connected. +class AfterConnect { +protected: + sp<ICameraService> cs; + sp<MCameraClient> cc; + sp<ICamera> c; + + AfterConnect() { + cs = getCameraService(); + cc = new MCameraClient(); + c = cs->connect(cc); + ASSERT(c != 0); + } + + ~AfterConnect() { + c.clear(); + cc.clear(); + cs.clear(); + } +}; + +class TestSetPreviewDisplay : public AfterConnect { +public: + void run() { + sp<MSurface> surface = new MSurface(); + ASSERT(c->setPreviewDisplay(surface) == NO_ERROR); + c->disconnect(); + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); + } +}; + +class TestStartPreview : public AfterConnect { +public: + void run() { + sp<MSurface> surface = new MSurface(); + ASSERT(c->setPreviewDisplay(surface) == NO_ERROR); + + ASSERT(c->startPreview() == NO_ERROR); + ASSERT(c->previewEnabled() == true); + + surface->waitUntil(1, 10, 0); // needs 1 registerBuffers and 10 postBuffer + surface->clearStat(); + + c->disconnect(); + // TODO: CameraService crashes for this. Fix it. +#if 0 + sp<MSurface> another_surface = new MSurface(); + c->setPreviewDisplay(another_surface); // just to make sure unregisterBuffers + // is called. + surface->waitUntil(0, 0, 1); // needs unregisterBuffers +#endif + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); + } +}; + +class TestStartPreviewWithoutDisplay : AfterConnect { +public: + void run() { + ASSERT(c->startPreview() == NO_ERROR); + ASSERT(c->previewEnabled() == true); + c->disconnect(); + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); + } +}; + +// Base test case after the the camera is connected and the preview is started. +class AfterStartPreview : public AfterConnect { +protected: + sp<MSurface> surface; + + AfterStartPreview() { + surface = new MSurface(); + ASSERT(c->setPreviewDisplay(surface) == NO_ERROR); + ASSERT(c->startPreview() == NO_ERROR); + } + + ~AfterStartPreview() { + surface.clear(); + } +}; + +class TestAutoFocus : public AfterStartPreview { +public: + void run() { + cc->assertNotify(CAMERA_MSG_FOCUS, MCameraClient::EQ, 0); + c->autoFocus(); + cc->waitNotify(CAMERA_MSG_FOCUS, MCameraClient::EQ, 1); + c->disconnect(); + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); + } +}; + +class TestStopPreview : public AfterStartPreview { +public: + void run() { + ASSERT(c->previewEnabled() == true); + c->stopPreview(); + ASSERT(c->previewEnabled() == false); + c->disconnect(); + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); + } +}; + +class TestTakePicture: public AfterStartPreview { +public: + void run() { + ASSERT(c->takePicture() == NO_ERROR); + cc->waitNotify(CAMERA_MSG_SHUTTER, MCameraClient::EQ, 1); + cc->waitData(CAMERA_MSG_RAW_IMAGE, MCameraClient::EQ, 1); + cc->waitData(CAMERA_MSG_COMPRESSED_IMAGE, MCameraClient::EQ, 1); + c->stopPreview(); +#if 1 // TODO: It crashes if we don't have this. Fix it. + usleep(100000); +#endif + c->disconnect(); + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); + } +}; + +class TestTakeMultiplePictures: public AfterStartPreview { +public: + void run() { + for (int i = 0; i < 10; i++) { + cc->clearStat(); + ASSERT(c->takePicture() == NO_ERROR); + cc->waitNotify(CAMERA_MSG_SHUTTER, MCameraClient::EQ, 1); + cc->waitData(CAMERA_MSG_RAW_IMAGE, MCameraClient::EQ, 1); + cc->waitData(CAMERA_MSG_COMPRESSED_IMAGE, MCameraClient::EQ, 1); + usleep(100000); // 100ms + } + c->disconnect(); + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); + } +}; + +class TestGetParameters: public AfterStartPreview { +public: + void run() { + String8 param_str = c->getParameters(); + INFO(param_str); + } +}; + +class TestPictureSize : public AfterStartPreview { +public: + void checkOnePicture(int w, int h) { + const float rate = 0.5; // byte per pixel limit + int pixels = w * h; + + CameraParameters param(c->getParameters()); + param.setPictureSize(w, h); + c->setParameters(param.flatten()); + + cc->clearStat(); + ASSERT(c->takePicture() == NO_ERROR); + cc->waitData(CAMERA_MSG_RAW_IMAGE, MCameraClient::EQ, 1); + cc->assertDataSize(CAMERA_MSG_RAW_IMAGE, MCameraClient::EQ, pixels*3/2); + cc->waitData(CAMERA_MSG_COMPRESSED_IMAGE, MCameraClient::EQ, 1); + cc->assertDataSize(CAMERA_MSG_COMPRESSED_IMAGE, MCameraClient::LT, + int(pixels * rate)); + cc->assertDataSize(CAMERA_MSG_COMPRESSED_IMAGE, MCameraClient::GT, 0); + cc->assertNotify(CAMERA_MSG_ERROR, MCameraClient::EQ, 0); + usleep(100000); // 100ms + } + + void run() { + checkOnePicture(2048, 1536); + checkOnePicture(1600, 1200); + checkOnePicture(1024, 768); + } +}; + +class TestPreviewCallbackFlag : public AfterConnect { +public: + void run() { + sp<MSurface> surface = new MSurface(); + ASSERT(c->setPreviewDisplay(surface) == NO_ERROR); + + // Try all flag combinations. + for (int v = 0; v < 8; v++) { + cc->clearStat(); + c->setPreviewCallbackFlag(v); + ASSERT(c->previewEnabled() == false); + ASSERT(c->startPreview() == NO_ERROR); + ASSERT(c->previewEnabled() == true); + sleep(2); + c->stopPreview(); + if ((v & FRAME_CALLBACK_FLAG_ENABLE_MASK) == 0) { + cc->assertData(CAMERA_MSG_PREVIEW_FRAME, MCameraClient::EQ, 0); + } else { + if ((v & FRAME_CALLBACK_FLAG_ONE_SHOT_MASK) == 0) { + cc->assertData(CAMERA_MSG_PREVIEW_FRAME, MCameraClient::GE, 10); + } else { + cc->assertData(CAMERA_MSG_PREVIEW_FRAME, MCameraClient::EQ, 1); + } + } + } + } +}; + +class TestRecording : public AfterConnect { +public: + void run() { + ASSERT(c->recordingEnabled() == false); + sp<MSurface> surface = new MSurface(); + ASSERT(c->setPreviewDisplay(surface) == NO_ERROR); + c->setPreviewCallbackFlag(FRAME_CALLBACK_FLAG_ENABLE_MASK); + cc->setReleaser(c.get()); + c->startRecording(); + ASSERT(c->recordingEnabled() == true); + sleep(2); + c->stopRecording(); + cc->setReleaser(NULL); + cc->assertData(CAMERA_MSG_VIDEO_FRAME, MCameraClient::GE, 10); + } +}; + +class TestPreviewSize : public AfterStartPreview { +public: + void checkOnePicture(int w, int h) { + int size = w*h*3/2; // should read from parameters + + c->stopPreview(); + + CameraParameters param(c->getParameters()); + param.setPreviewSize(w, h); + c->setPreviewCallbackFlag(FRAME_CALLBACK_FLAG_ENABLE_MASK); + c->setParameters(param.flatten()); + + c->startPreview(); + + cc->clearStat(); + cc->waitData(CAMERA_MSG_PREVIEW_FRAME, MCameraClient::GE, 1); + cc->assertDataSize(CAMERA_MSG_PREVIEW_FRAME, MCameraClient::EQ, size); + } + + void run() { + checkOnePicture(480, 320); + checkOnePicture(352, 288); + checkOnePicture(176, 144); + } +}; + +void runHolderService() { + defaultServiceManager()->addService( + String16("CameraServiceTest.Holder"), new HolderService()); + ProcessState::self()->startThreadPool(); +} + +int main(int argc, char **argv) +{ + if (argc != 1) { + runFunction(argv[1]); + return 0; + } + INFO("CameraServiceTest start"); + gExecutable = argv[0]; + runHolderService(); + + testConnect(); flushCommands(); + testAllowConnectOnceOnly(); flushCommands(); + testReconnect(); flushCommands(); + testLockUnlock(); flushCommands(); + testReconnectFromAnotherProcess(); flushCommands(); + + RUN(TestSetPreviewDisplay); + RUN(TestStartPreview); + RUN(TestStartPreviewWithoutDisplay); + RUN(TestAutoFocus); + RUN(TestStopPreview); + RUN(TestTakePicture); + RUN(TestTakeMultiplePictures); + RUN(TestGetParameters); + RUN(TestPictureSize); + RUN(TestPreviewCallbackFlag); + RUN(TestRecording); + RUN(TestPreviewSize); +} diff --git a/cmds/keystore/keystore.c b/cmds/keystore/keystore.c index ba74c78..60cc521 100644 --- a/cmds/keystore/keystore.c +++ b/cmds/keystore/keystore.c @@ -46,7 +46,7 @@ * user-defined password. To keep things simple, buffers are always larger than * the maximum space we needed, so boundary checks on buffers are omitted. */ -#define KEY_SIZE 120 +#define KEY_SIZE ((NAME_MAX - 15) / 2) #define VALUE_SIZE 32768 #define PASSWORD_SIZE VALUE_SIZE @@ -163,19 +163,19 @@ static struct __attribute__((packed)) { static int8_t encrypt_blob(char *name, AES_KEY *aes_key) { uint8_t vector[AES_BLOCK_SIZE]; - int length = blob.length; + int length; int fd; if (read(the_entropy, vector, AES_BLOCK_SIZE) != AES_BLOCK_SIZE) { return SYSTEM_ERROR; } - length += blob.value - blob.digested; + length = blob.length + blob.value - blob.encrypted; + length = (length + AES_BLOCK_SIZE - 1) / AES_BLOCK_SIZE * AES_BLOCK_SIZE; + blob.length = htonl(blob.length); - MD5(blob.digested, length, blob.digest); + MD5(blob.digested, length - (blob.digested - blob.encrypted), blob.digest); - length += blob.digested - blob.encrypted; - length = (length + AES_BLOCK_SIZE - 1) / AES_BLOCK_SIZE * AES_BLOCK_SIZE; memcpy(vector, blob.vector, AES_BLOCK_SIZE); AES_cbc_encrypt(blob.encrypted, blob.encrypted, length, aes_key, vector, AES_ENCRYPT); @@ -184,11 +184,9 @@ static int8_t encrypt_blob(char *name, AES_KEY *aes_key) length += blob.encrypted - (uint8_t *)&blob; fd = open(".tmp", O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR); - if (fd == -1 || write(fd, &blob, length) != length) { - return SYSTEM_ERROR; - } + length -= write(fd, &blob, length); close(fd); - return rename(".tmp", name) ? SYSTEM_ERROR : NO_ERROR; + return (length || rename(".tmp", name)) ? SYSTEM_ERROR : NO_ERROR; } static int8_t decrypt_blob(char *name, AES_KEY *aes_key) @@ -210,14 +208,15 @@ static int8_t decrypt_blob(char *name, AES_KEY *aes_key) AES_cbc_encrypt(blob.encrypted, blob.encrypted, length, aes_key, blob.vector, AES_DECRYPT); length -= blob.digested - blob.encrypted; - if (!memcmp(blob.digest, MD5(blob.digested, length, NULL), - MD5_DIGEST_LENGTH)) { + if (memcmp(blob.digest, MD5(blob.digested, length, NULL), + MD5_DIGEST_LENGTH)) { return VALUE_CORRUPTED; } length -= blob.value - blob.digested; blob.length = ntohl(blob.length); - return (length < blob.length) ? VALUE_CORRUPTED : NO_ERROR; + return (blob.length < 0 || blob.length > length) ? VALUE_CORRUPTED : + NO_ERROR; } /* Here are the actions. Each of them is a function without arguments. All @@ -443,10 +442,11 @@ static struct user { uid_t euid; uint32_t perms; } users[] = { - {AID_SYSTEM, 0, ~GET}, + {AID_SYSTEM, ~0, ~GET}, {AID_VPN, AID_SYSTEM, GET}, {AID_WIFI, AID_SYSTEM, GET}, - {0, 0, TEST | GET | INSERT | DELETE | EXIST | SAW}, + {AID_ROOT, AID_SYSTEM, GET}, + {~0, ~0, TEST | GET | INSERT | DELETE | EXIST | SAW}, }; static int8_t process(int8_t code) { @@ -454,7 +454,7 @@ static int8_t process(int8_t code) { struct action *action = actions; int i; - while (user->uid && user->uid != uid) { + while (~user->uid && user->uid != uid) { ++user; } while (action->code && action->code != code) { @@ -469,7 +469,7 @@ static int8_t process(int8_t code) { if (action->state && action->state != state) { return state; } - if (user->euid) { + if (~user->euid) { uid = user->euid; } for (i = 0; i < MAX_PARAM && action->lengths[i]; ++i) { diff --git a/cmds/keystore/keystore_get.h b/cmds/keystore/keystore_get.h index 0e7e1ae..141f69b 100644 --- a/cmds/keystore/keystore_get.h +++ b/cmds/keystore/keystore_get.h @@ -19,7 +19,6 @@ #include <stdio.h> #include <stdint.h> -#include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> @@ -28,18 +27,23 @@ #define KEYSTORE_MESSAGE_SIZE 65535 +#ifdef __cplusplus +extern "C" { +#endif + /* This function is provided for native components to get values from keystore. - * Users are required to link against libcutils. The lengths of keys and values - * are limited to KEYSTORE_MESSAGE_SIZE. This function returns the length of - * the requested value or -1 if something goes wrong. */ -static int keystore_get(const char *key, char *value) + * Users are required to link against libcutils. Keys are values are 8-bit safe. + * The first two arguments are the key and its length. The third argument + * specifies the buffer to store the retrieved value, which must be an array of + * KEYSTORE_MESSAGE_SIZE bytes. This function returns the length of the value or + * -1 if an error happens. */ +static int keystore_get(const char *key, int length, char *value) { - int length = strlen(key); uint8_t bytes[2] = {length >> 8, length}; uint8_t code = 'g'; int sock; - if (length > KEYSTORE_MESSAGE_SIZE) { + if (length < 0 || length > KEYSTORE_MESSAGE_SIZE) { return -1; } sock = socket_local_client("keystore", ANDROID_SOCKET_NAMESPACE_RESERVED, @@ -66,4 +70,8 @@ static int keystore_get(const char *key, char *value) return length; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/cmds/runtime/main_runtime.cpp b/cmds/runtime/main_runtime.cpp index 21e0e4d..83cb533 100644 --- a/cmds/runtime/main_runtime.cpp +++ b/cmds/runtime/main_runtime.cpp @@ -19,7 +19,7 @@ #include <private/utils/Static.h> -#include <ui/ISurfaceComposer.h> +#include <surfaceflinger/ISurfaceComposer.h> #include <android_runtime/AndroidRuntime.h> diff --git a/common/Android.mk b/common/Android.mk new file mode 100644 index 0000000..1f78840 --- /dev/null +++ b/common/Android.mk @@ -0,0 +1,32 @@ +# Copyright (C) 2009 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. + +LOCAL_PATH := $(call my-dir) + +# Note: the source code is in java/, not src/, because this code is also part of +# the framework library, and build/core/pathmap.mk expects a java/ subdirectory. + +include $(CLEAR_VARS) +LOCAL_MODULE := android-common +LOCAL_SDK_VERSION := current +LOCAL_SRC_FILES := \ + $(call all-java-files-under, java) \ + $(call all-logtags-files-under, java) +include $(BUILD_STATIC_JAVA_LIBRARY) + +# Include this library in the build server's output directory +$(call dist-for-goals, droid, $(LOCAL_BUILT_MODULE):android-common.jar) + +# Build the test package +include $(call all-makefiles-under, $(LOCAL_PATH)) diff --git a/common/java/com/android/common/ArrayListCursor.java b/common/java/com/android/common/ArrayListCursor.java new file mode 100644 index 0000000..9ad5c36 --- /dev/null +++ b/common/java/com/android/common/ArrayListCursor.java @@ -0,0 +1,167 @@ +/* + * Copyright (C) 2006 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. + */ + +package com.android.common; + +import android.database.AbstractCursor; +import android.database.CursorWindow; + +import java.lang.System; +import java.util.ArrayList; + +/** + * A convenience class that presents a two-dimensional ArrayList + * as a Cursor. + * @deprecated This is has been replaced by MatrixCursor. +*/ +public class ArrayListCursor extends AbstractCursor { + private String[] mColumnNames; + private ArrayList<Object>[] mRows; + + @SuppressWarnings({"unchecked"}) + public ArrayListCursor(String[] columnNames, ArrayList<ArrayList> rows) { + int colCount = columnNames.length; + boolean foundID = false; + // Add an _id column if not in columnNames + for (int i = 0; i < colCount; ++i) { + if (columnNames[i].compareToIgnoreCase("_id") == 0) { + mColumnNames = columnNames; + foundID = true; + break; + } + } + + if (!foundID) { + mColumnNames = new String[colCount + 1]; + System.arraycopy(columnNames, 0, mColumnNames, 0, columnNames.length); + mColumnNames[colCount] = "_id"; + } + + int rowCount = rows.size(); + mRows = new ArrayList[rowCount]; + + for (int i = 0; i < rowCount; ++i) { + mRows[i] = rows.get(i); + if (!foundID) { + mRows[i].add(i); + } + } + } + + @Override + public void fillWindow(int position, CursorWindow window) { + if (position < 0 || position > getCount()) { + return; + } + + window.acquireReference(); + try { + int oldpos = mPos; + mPos = position - 1; + window.clear(); + window.setStartPosition(position); + int columnNum = getColumnCount(); + window.setNumColumns(columnNum); + while (moveToNext() && window.allocRow()) { + for (int i = 0; i < columnNum; i++) { + final Object data = mRows[mPos].get(i); + if (data != null) { + if (data instanceof byte[]) { + byte[] field = (byte[]) data; + if (!window.putBlob(field, mPos, i)) { + window.freeLastRow(); + break; + } + } else { + String field = data.toString(); + if (!window.putString(field, mPos, i)) { + window.freeLastRow(); + break; + } + } + } else { + if (!window.putNull(mPos, i)) { + window.freeLastRow(); + break; + } + } + } + } + + mPos = oldpos; + } catch (IllegalStateException e){ + // simply ignore it + } finally { + window.releaseReference(); + } + } + + @Override + public int getCount() { + return mRows.length; + } + + @Override + public String[] getColumnNames() { + return mColumnNames; + } + + @Override + public byte[] getBlob(int columnIndex) { + return (byte[]) mRows[mPos].get(columnIndex); + } + + @Override + public String getString(int columnIndex) { + Object cell = mRows[mPos].get(columnIndex); + return (cell == null) ? null : cell.toString(); + } + + @Override + public short getShort(int columnIndex) { + Number num = (Number) mRows[mPos].get(columnIndex); + return num.shortValue(); + } + + @Override + public int getInt(int columnIndex) { + Number num = (Number) mRows[mPos].get(columnIndex); + return num.intValue(); + } + + @Override + public long getLong(int columnIndex) { + Number num = (Number) mRows[mPos].get(columnIndex); + return num.longValue(); + } + + @Override + public float getFloat(int columnIndex) { + Number num = (Number) mRows[mPos].get(columnIndex); + return num.floatValue(); + } + + @Override + public double getDouble(int columnIndex) { + Number num = (Number) mRows[mPos].get(columnIndex); + return num.doubleValue(); + } + + @Override + public boolean isNull(int columnIndex) { + return mRows[mPos].get(columnIndex) == null; + } +} diff --git a/common/java/com/android/common/GoogleLogTags.logtags b/common/java/com/android/common/GoogleLogTags.logtags new file mode 100644 index 0000000..a5c9bb0 --- /dev/null +++ b/common/java/com/android/common/GoogleLogTags.logtags @@ -0,0 +1,100 @@ +# 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. + +option java_package com.android.common + +##### +# This file contains definitions for event log (android.util.EventLog) tags +# used by Google Mobile Services applications. These definitions are part of +# the platform even when the Google applications are not. +# +# See system/core/logcat/event.logtags for a description of the file format. +# +# These event log tags must be assigned specific numbers (no "?") in the range +# 200000-300000. If new tags are added, be aware that older platforms will be +# missing the tag definitions, and may not be able to show them in their logs. + +##### +# System Update (OTA) + +# System update status bits +# [31- 9] Reserved for future use +# [ 8- 7] package verified (0=not attempted, 1=succeeded, 2=failed) +# [ 6] install approved +# [ 5] download approved +# [ 4- 0] status +201001 system_update (status|1|5),(download_result|1|5),(bytes|2|2),(url|3) +201002 system_update_user (action|3) + +##### +# Android Market + +# @param changes Number of changes made to database in reconstruct +202001 vending_reconstruct (changes|1) + +##### +# Google Services Framework + +203001 sync_details (authority|3),(send|1|2),(recv|1|2),(details|3) + +203002 google_http_request (elapsed|2|3),(status|1),(appname|3),(reused|1) + +##### +# Google Talk Service + +# This event is logged when GTalkService encounters important events +204001 gtalkservice (eventType|1) +# This event is logged for GTalk connection state changes. The status field is an int, but +# it really contains 4 separate values, each taking up a byte +# (eventType << 24) + (connection state << 16) + (connection error << 8) + network state +204002 gtalk_connection (status|1) + +# This event is logged when GTalk connection is closed. +# The status field is an int, but contains 2 different values, it's represented as +# +# (networkType << 8) + connection error +# +# the possible error values are +# +# no_error=0, no_network=1, connection_failed=2, unknown_host=3, auth_failed=4, +# auth_expired=5, heart_beat_timeout=6, server_error=7, server_reject_rate_limiting=8, unknown=10 +# +# duration is the connection duration. +204003 gtalk_conn_close (status|1),(duration|1) + +# This event is logged for GTalk heartbeat resets +# interval_and_nt contains both the heartbeat interval and the network type, It's represented as +# (networkType << 16) + interval +# interval is in seconds; network type can be 0 (mobile) or 1 (wifi); ip is the host ip addr. +204004 gtalk_heartbeat_reset (interval_and_nt|1),(ip|3) + +# This event is logged when an Rmq v2 packet is sent or received. +204005 push_messaging (packet_type|1),(persistent_id|3),(stream_id|1),(last_stream_id|1) + +##### +# Google Login Service and Setup Wizard + +# This event is for when communicating to the server times out during account setup +205001 setup_server_timeout +205002 setup_required_captcha (action|3) +205003 setup_io_error (status|3) +205004 setup_server_error +205005 setup_retries_exhausted +205006 setup_no_data_network +205007 setup_completed + +205008 gls_account_tried (status|1) +205009 gls_account_saved (status|1) +205010 gls_authenticate (status|1),(service|3) +205011 google_mail_switch (direction|1) diff --git a/common/java/com/android/common/NetworkConnectivityListener.java b/common/java/com/android/common/NetworkConnectivityListener.java new file mode 100644 index 0000000..b49b80d --- /dev/null +++ b/common/java/com/android/common/NetworkConnectivityListener.java @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2006 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. + */ + +package com.android.common; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.Handler; +import android.os.Message; +import android.util.Log; + +import java.util.HashMap; +import java.util.Iterator; + +/** + * A wrapper for a broadcast receiver that provides network connectivity + * state information, independent of network type (mobile, Wi-Fi, etc.). + * @deprecated Code tempted to use this class should simply listen for connectivity intents + * (or poll ConnectivityManager) directly. + * {@hide} + */ +public class NetworkConnectivityListener { + private static final String TAG = "NetworkConnectivityListener"; + private static final boolean DBG = false; + + private Context mContext; + private HashMap<Handler, Integer> mHandlers = new HashMap<Handler, Integer>(); + private State mState; + private boolean mListening; + private String mReason; + private boolean mIsFailover; + + /** Network connectivity information */ + private NetworkInfo mNetworkInfo; + + /** + * In case of a Disconnect, the connectivity manager may have + * already established, or may be attempting to establish, connectivity + * with another network. If so, {@code mOtherNetworkInfo} will be non-null. + */ + private NetworkInfo mOtherNetworkInfo; + + private ConnectivityBroadcastReceiver mReceiver; + + private class ConnectivityBroadcastReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + + if (!action.equals(ConnectivityManager.CONNECTIVITY_ACTION) || + mListening == false) { + Log.w(TAG, "onReceived() called with " + mState.toString() + " and " + intent); + return; + } + + boolean noConnectivity = + intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); + + if (noConnectivity) { + mState = State.NOT_CONNECTED; + } else { + mState = State.CONNECTED; + } + + mNetworkInfo = (NetworkInfo) + intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); + mOtherNetworkInfo = (NetworkInfo) + intent.getParcelableExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO); + + mReason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON); + mIsFailover = + intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false); + + if (DBG) { + Log.d(TAG, "onReceive(): mNetworkInfo=" + mNetworkInfo + " mOtherNetworkInfo = " + + (mOtherNetworkInfo == null ? "[none]" : mOtherNetworkInfo + + " noConn=" + noConnectivity) + " mState=" + mState.toString()); + } + + // Notifiy any handlers. + Iterator<Handler> it = mHandlers.keySet().iterator(); + while (it.hasNext()) { + Handler target = it.next(); + Message message = Message.obtain(target, mHandlers.get(target)); + target.sendMessage(message); + } + } + }; + + public enum State { + UNKNOWN, + + /** This state is returned if there is connectivity to any network **/ + CONNECTED, + /** + * This state is returned if there is no connectivity to any network. This is set + * to true under two circumstances: + * <ul> + * <li>When connectivity is lost to one network, and there is no other available + * network to attempt to switch to.</li> + * <li>When connectivity is lost to one network, and the attempt to switch to + * another network fails.</li> + */ + NOT_CONNECTED + } + + /** + * Create a new NetworkConnectivityListener. + */ + public NetworkConnectivityListener() { + mState = State.UNKNOWN; + mReceiver = new ConnectivityBroadcastReceiver(); + } + + /** + * This method starts listening for network connectivity state changes. + * @param context + */ + public synchronized void startListening(Context context) { + if (!mListening) { + mContext = context; + + IntentFilter filter = new IntentFilter(); + filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); + context.registerReceiver(mReceiver, filter); + mListening = true; + } + } + + /** + * This method stops this class from listening for network changes. + */ + public synchronized void stopListening() { + if (mListening) { + mContext.unregisterReceiver(mReceiver); + mContext = null; + mNetworkInfo = null; + mOtherNetworkInfo = null; + mIsFailover = false; + mReason = null; + mListening = false; + } + } + + /** + * This methods registers a Handler to be called back onto with the specified what code when + * the network connectivity state changes. + * + * @param target The target handler. + * @param what The what code to be used when posting a message to the handler. + */ + public void registerHandler(Handler target, int what) { + mHandlers.put(target, what); + } + + /** + * This methods unregisters the specified Handler. + * @param target + */ + public void unregisterHandler(Handler target) { + mHandlers.remove(target); + } + + public State getState() { + return mState; + } + + /** + * Return the NetworkInfo associated with the most recent connectivity event. + * @return {@code NetworkInfo} for the network that had the most recent connectivity event. + */ + public NetworkInfo getNetworkInfo() { + return mNetworkInfo; + } + + /** + * If the most recent connectivity event was a DISCONNECT, return + * any information supplied in the broadcast about an alternate + * network that might be available. If this returns a non-null + * value, then another broadcast should follow shortly indicating + * whether connection to the other network succeeded. + * + * @return NetworkInfo + */ + public NetworkInfo getOtherNetworkInfo() { + return mOtherNetworkInfo; + } + + /** + * Returns true if the most recent event was for an attempt to switch over to + * a new network following loss of connectivity on another network. + * @return {@code true} if this was a failover attempt, {@code false} otherwise. + */ + public boolean isFailover() { + return mIsFailover; + } + + /** + * An optional reason for the connectivity state change may have been supplied. + * This returns it. + * @return the reason for the state change, if available, or {@code null} + * otherwise. + */ + public String getReason() { + return mReason; + } +} diff --git a/common/java/com/android/common/OperationScheduler.java b/common/java/com/android/common/OperationScheduler.java new file mode 100644 index 0000000..1786957 --- /dev/null +++ b/common/java/com/android/common/OperationScheduler.java @@ -0,0 +1,348 @@ +/* + * Copyright (C) 2009 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. + */ + +package com.android.common; + +import android.content.SharedPreferences; +import android.net.http.AndroidHttpClient; +import android.text.format.Time; + +import java.util.Map; +import java.util.TreeSet; + +/** + * Tracks the success/failure history of a particular network operation in + * persistent storage and computes retry strategy accordingly. Handles + * exponential backoff, periodic rescheduling, event-driven triggering, + * retry-after moratorium intervals, etc. based on caller-specified parameters. + * + * <p>This class does not directly perform or invoke any operations, + * it only keeps track of the schedule. Somebody else needs to call + * {@link #getNextTimeMillis()} as appropriate and do the actual work. + */ +public class OperationScheduler { + /** Tunable parameter options for {@link #getNextTimeMillis}. */ + public static class Options { + /** Wait this long after every error before retrying. */ + public long backoffFixedMillis = 0; + + /** Wait this long times the number of consecutive errors so far before retrying. */ + public long backoffIncrementalMillis = 5000; + + /** Maximum duration of moratorium to honor. Mostly an issue for clock rollbacks. */ + public long maxMoratoriumMillis = 24 * 3600 * 1000; + + /** Minimum duration after success to wait before allowing another trigger. */ + public long minTriggerMillis = 0; + + /** Automatically trigger this long after the last success. */ + public long periodicIntervalMillis = 0; + + @Override + public String toString() { + return String.format( + "OperationScheduler.Options[backoff=%.1f+%.1f max=%.1f min=%.1f period=%.1f]", + backoffFixedMillis / 1000.0, backoffIncrementalMillis / 1000.0, + maxMoratoriumMillis / 1000.0, minTriggerMillis / 1000.0, + periodicIntervalMillis / 1000.0); + } + } + + private static final String PREFIX = "OperationScheduler_"; + private final SharedPreferences mStorage; + + /** + * Initialize the scheduler state. + * @param storage to use for recording the state of operations across restarts/reboots + */ + public OperationScheduler(SharedPreferences storage) { + mStorage = storage; + } + + /** + * Parse scheduler options supplied in this string form: + * + * <pre> + * backoff=(fixed)+(incremental) max=(maxmoratorium) min=(mintrigger) [period=](interval) + * </pre> + * + * All values are times in (possibly fractional) <em>seconds</em> (not milliseconds). + * Omitted settings are left at whatever existing default value was passed in. + * + * <p> + * The default options: <code>backoff=0+5 max=86400 min=0 period=0</code><br> + * Fractions are OK: <code>backoff=+2.5 period=10.0</code><br> + * The "period=" can be omitted: <code>3600</code><br> + * + * @param spec describing some or all scheduler options. + * @param options to update with parsed values. + * @return the options passed in (for convenience) + * @throws IllegalArgumentException if the syntax is invalid + */ + public static Options parseOptions(String spec, Options options) + throws IllegalArgumentException { + for (String param : spec.split(" +")) { + if (param.length() == 0) continue; + if (param.startsWith("backoff=")) { + int plus = param.indexOf('+', 8); + if (plus < 0) { + options.backoffFixedMillis = parseSeconds(param.substring(8)); + } else { + if (plus > 8) { + options.backoffFixedMillis = parseSeconds(param.substring(8, plus)); + } + options.backoffIncrementalMillis = parseSeconds(param.substring(plus + 1)); + } + } else if (param.startsWith("max=")) { + options.maxMoratoriumMillis = parseSeconds(param.substring(4)); + } else if (param.startsWith("min=")) { + options.minTriggerMillis = parseSeconds(param.substring(4)); + } else if (param.startsWith("period=")) { + options.periodicIntervalMillis = parseSeconds(param.substring(7)); + } else { + options.periodicIntervalMillis = parseSeconds(param); + } + } + return options; + } + + private static long parseSeconds(String param) throws NumberFormatException { + return (long) (Float.parseFloat(param) * 1000); + } + + /** + * Compute the time of the next operation. Does not modify any state + * (unless the clock rolls backwards, in which case timers are reset). + * + * @param options to use for this computation. + * @return the wall clock time ({@link System#currentTimeMillis()}) when the + * next operation should be attempted -- immediately, if the return value is + * before the current time. + */ + public long getNextTimeMillis(Options options) { + boolean enabledState = mStorage.getBoolean(PREFIX + "enabledState", true); + if (!enabledState) return Long.MAX_VALUE; + + boolean permanentError = mStorage.getBoolean(PREFIX + "permanentError", false); + if (permanentError) return Long.MAX_VALUE; + + // We do quite a bit of limiting to prevent a clock rollback from totally + // hosing the scheduler. Times which are supposed to be in the past are + // clipped to the current time so we don't languish forever. + + int errorCount = mStorage.getInt(PREFIX + "errorCount", 0); + long now = currentTimeMillis(); + long lastSuccessTimeMillis = getTimeBefore(PREFIX + "lastSuccessTimeMillis", now); + long lastErrorTimeMillis = getTimeBefore(PREFIX + "lastErrorTimeMillis", now); + long triggerTimeMillis = mStorage.getLong(PREFIX + "triggerTimeMillis", Long.MAX_VALUE); + long moratoriumSetMillis = getTimeBefore(PREFIX + "moratoriumSetTimeMillis", now); + long moratoriumTimeMillis = getTimeBefore(PREFIX + "moratoriumTimeMillis", + moratoriumSetMillis + options.maxMoratoriumMillis); + + long time = triggerTimeMillis; + if (options.periodicIntervalMillis > 0) { + time = Math.min(time, lastSuccessTimeMillis + options.periodicIntervalMillis); + } + + time = Math.max(time, moratoriumTimeMillis); + time = Math.max(time, lastSuccessTimeMillis + options.minTriggerMillis); + if (errorCount > 0) { + time = Math.max(time, lastErrorTimeMillis + options.backoffFixedMillis + + options.backoffIncrementalMillis * errorCount); + } + return time; + } + + /** + * Return the last time the operation completed. Does not modify any state. + * + * @return the wall clock time when {@link #onSuccess()} was last called. + */ + public long getLastSuccessTimeMillis() { + return mStorage.getLong(PREFIX + "lastSuccessTimeMillis", 0); + } + + /** + * Return the last time the operation was attempted. Does not modify any state. + * + * @return the wall clock time when {@link #onSuccess()} or {@link + * #onTransientError()} was last called. + */ + public long getLastAttemptTimeMillis() { + return Math.max( + mStorage.getLong(PREFIX + "lastSuccessTimeMillis", 0), + mStorage.getLong(PREFIX + "lastErrorTimeMillis", 0)); + } + + /** + * Fetch a {@link SharedPreferences} property, but force it to be before + * a certain time, updating the value if necessary. This is to recover + * gracefully from clock rollbacks which could otherwise strand our timers. + * + * @param name of SharedPreferences key + * @param max time to allow in result + * @return current value attached to key (default 0), limited by max + */ + private long getTimeBefore(String name, long max) { + long time = mStorage.getLong(name, 0); + if (time > max) mStorage.edit().putLong(name, (time = max)).commit(); + return time; + } + + /** + * Request an operation to be performed at a certain time. The actual + * scheduled time may be affected by error backoff logic and defined + * minimum intervals. Use {@link Long#MAX_VALUE} to disable triggering. + * + * @param millis wall clock time ({@link System#currentTimeMillis()}) to + * trigger another operation; 0 to trigger immediately + */ + public void setTriggerTimeMillis(long millis) { + mStorage.edit().putLong(PREFIX + "triggerTimeMillis", millis).commit(); + } + + /** + * Forbid any operations until after a certain (absolute) time. + * Limited by {@link #Options.maxMoratoriumMillis}. + * + * @param millis wall clock time ({@link System#currentTimeMillis()}) + * when operations should be allowed again; 0 to remove moratorium + */ + public void setMoratoriumTimeMillis(long millis) { + mStorage.edit() + .putLong(PREFIX + "moratoriumTimeMillis", millis) + .putLong(PREFIX + "moratoriumSetTimeMillis", currentTimeMillis()) + .commit(); + } + + /** + * Forbid any operations until after a certain time, as specified in + * the format used by the HTTP "Retry-After" header. + * Limited by {@link #Options.maxMoratoriumMillis}. + * + * @param retryAfter moratorium time in HTTP format + * @return true if a time was successfully parsed + */ + public boolean setMoratoriumTimeHttp(String retryAfter) { + try { + long ms = Long.valueOf(retryAfter) * 1000; + setMoratoriumTimeMillis(ms + currentTimeMillis()); + return true; + } catch (NumberFormatException nfe) { + try { + setMoratoriumTimeMillis(AndroidHttpClient.parseDate(retryAfter)); + return true; + } catch (IllegalArgumentException iae) { + return false; + } + } + } + + /** + * Enable or disable all operations. When disabled, all calls to + * {@link #getNextTimeMillis()} return {@link Long#MAX_VALUE}. + * Commonly used when data network availability goes up and down. + * + * @param enabled if operations can be performed + */ + public void setEnabledState(boolean enabled) { + mStorage.edit().putBoolean(PREFIX + "enabledState", enabled).commit(); + } + + /** + * Report successful completion of an operation. Resets all error + * counters, clears any trigger directives, and records the success. + */ + public void onSuccess() { + resetTransientError(); + resetPermanentError(); + mStorage.edit() + .remove(PREFIX + "errorCount") + .remove(PREFIX + "lastErrorTimeMillis") + .remove(PREFIX + "permanentError") + .remove(PREFIX + "triggerTimeMillis") + .putLong(PREFIX + "lastSuccessTimeMillis", currentTimeMillis()).commit(); + } + + /** + * Report a transient error (usually a network failure). Increments + * the error count and records the time of the latest error for backoff + * purposes. + */ + public void onTransientError() { + mStorage.edit().putLong(PREFIX + "lastErrorTimeMillis", currentTimeMillis()).commit(); + mStorage.edit().putInt(PREFIX + "errorCount", + mStorage.getInt(PREFIX + "errorCount", 0) + 1).commit(); + } + + /** + * Reset all transient error counts, allowing the next operation to proceed + * immediately without backoff. Commonly used on network state changes, when + * partial progress occurs (some data received), and in other circumstances + * where there is reason to hope things might start working better. + */ + public void resetTransientError() { + mStorage.edit().remove(PREFIX + "errorCount").commit(); + } + + /** + * Report a permanent error that will not go away until further notice. + * No operation will be scheduled until {@link #resetPermanentError()} + * is called. Commonly used for authentication failures (which are reset + * when the accounts database is updated). + */ + public void onPermanentError() { + mStorage.edit().putBoolean(PREFIX + "permanentError", true).commit(); + } + + /** + * Reset any permanent error status set by {@link #onPermanentError}, + * allowing operations to be scheduled as normal. + */ + public void resetPermanentError() { + mStorage.edit().remove(PREFIX + "permanentError").commit(); + } + + /** + * Return a string description of the scheduler state for debugging. + */ + public String toString() { + StringBuilder out = new StringBuilder("[OperationScheduler:"); + for (String key : new TreeSet<String>(mStorage.getAll().keySet())) { // Sort keys + if (key.startsWith(PREFIX)) { + if (key.endsWith("TimeMillis")) { + Time time = new Time(); + time.set(mStorage.getLong(key, 0)); + out.append(" ").append(key.substring(PREFIX.length(), key.length() - 10)); + out.append("=").append(time.format("%Y-%m-%d/%H:%M:%S")); + } else { + out.append(" ").append(key.substring(PREFIX.length())); + out.append("=").append(mStorage.getAll().get(key).toString()); + } + } + } + return out.append("]").toString(); + } + + /** + * Gets the current time. Can be overridden for unit testing. + * + * @return {@link System#currentTimeMillis()} + */ + protected long currentTimeMillis() { + return System.currentTimeMillis(); + } +} diff --git a/common/java/com/android/common/Rfc822InputFilter.java b/common/java/com/android/common/Rfc822InputFilter.java new file mode 100644 index 0000000..6dfdc7b --- /dev/null +++ b/common/java/com/android/common/Rfc822InputFilter.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2008 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. + */ + +package com.android.common; + +import android.text.InputFilter; +import android.text.Spanned; +import android.text.SpannableStringBuilder; + +/** + * Implements special address cleanup rules: + * The first space key entry following an "@" symbol that is followed by any combination + * of letters and symbols, including one+ dots and zero commas, should insert an extra + * comma (followed by the space). + * + * @hide + */ +public class Rfc822InputFilter implements InputFilter { + + public CharSequence filter(CharSequence source, int start, int end, Spanned dest, + int dstart, int dend) { + + // quick check - did they enter a single space? + if (end-start != 1 || source.charAt(start) != ' ') { + return null; + } + + // determine if the characters before the new space fit the pattern + // follow backwards and see if we find a comma, dot, or @ + int scanBack = dstart; + boolean dotFound = false; + while (scanBack > 0) { + char c = dest.charAt(--scanBack); + switch (c) { + case '.': + dotFound = true; // one or more dots are req'd + break; + case ',': + return null; + case '@': + if (!dotFound) { + return null; + } + // we have found a comma-insert case. now just do it + // in the least expensive way we can. + if (source instanceof Spanned) { + SpannableStringBuilder sb = new SpannableStringBuilder(","); + sb.append(source); + return sb; + } else { + return ", "; + } + default: + // just keep going + } + } + + // no termination cases were found, so don't edit the input + return null; + } +} diff --git a/common/java/com/android/common/Rfc822Validator.java b/common/java/com/android/common/Rfc822Validator.java new file mode 100644 index 0000000..087e425 --- /dev/null +++ b/common/java/com/android/common/Rfc822Validator.java @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2008 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. + */ + +package com.android.common; + +import android.text.TextUtils; +import android.text.util.Rfc822Token; +import android.text.util.Rfc822Tokenizer; +import android.widget.AutoCompleteTextView; + +import java.util.regex.Pattern; + +/** + * This class works as a Validator for AutoCompleteTextView for + * email addresses. If a token does not appear to be a valid address, + * it is trimmed of characters that cannot legitimately appear in one + * and has the specified domain name added. It is meant for use with + * {@link Rfc822Token} and {@link Rfc822Tokenizer}. + * + * @deprecated In the future make sure we don't quietly alter the user's + * text in ways they did not intend. Meanwhile, hide this + * class from the public API because it does not even have + * a full understanding of the syntax it claims to correct. + * @hide + */ +public class Rfc822Validator implements AutoCompleteTextView.Validator { + /* + * Regex.EMAIL_ADDRESS_PATTERN hardcodes the TLD that we accept, but we + * want to make sure we will keep accepting email addresses with TLD's + * that don't exist at the time of this writing, so this regexp relaxes + * that constraint by accepting any kind of top level domain, not just + * ".com", ".fr", etc... + */ + private static final Pattern EMAIL_ADDRESS_PATTERN = + Pattern.compile("[^\\s@]+@[^\\s@]+\\.[a-zA-z][a-zA-Z][a-zA-Z]*"); + + private String mDomain; + + /** + * Constructs a new validator that uses the specified domain name as + * the default when none is specified. + */ + public Rfc822Validator(String domain) { + mDomain = domain; + } + + /** + * {@inheritDoc} + */ + public boolean isValid(CharSequence text) { + Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(text); + + return tokens.length == 1 && + EMAIL_ADDRESS_PATTERN. + matcher(tokens[0].getAddress()).matches(); + } + + /** + * @return a string in which all the characters that are illegal for the username + * or the domain name part of the email address have been removed. + */ + private String removeIllegalCharacters(String s) { + StringBuilder result = new StringBuilder(); + int length = s.length(); + for (int i = 0; i < length; i++) { + char c = s.charAt(i); + + /* + * An RFC822 atom can contain any ASCII printing character + * except for periods and any of the following punctuation. + * A local-part can contain multiple atoms, concatenated by + * periods, so do allow periods here. + */ + + if (c <= ' ' || c > '~') { + continue; + } + + if (c == '(' || c == ')' || c == '<' || c == '>' || + c == '@' || c == ',' || c == ';' || c == ':' || + c == '\\' || c == '"' || c == '[' || c == ']') { + continue; + } + + result.append(c); + } + return result.toString(); + } + + /** + * {@inheritDoc} + */ + public CharSequence fixText(CharSequence cs) { + // Return an empty string if the email address only contains spaces, \n or \t + if (TextUtils.getTrimmedLength(cs) == 0) return ""; + + Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(cs); + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < tokens.length; i++) { + String text = tokens[i].getAddress(); + int index = text.indexOf('@'); + if (index < 0) { + // If there is no @, just append the domain of the account + tokens[i].setAddress(removeIllegalCharacters(text) + "@" + mDomain); + } else { + // Otherwise, remove the illegal characters on both sides of the '@' + String fix = removeIllegalCharacters(text.substring(0, index)); + String domain = removeIllegalCharacters(text.substring(index + 1)); + tokens[i].setAddress(fix + "@" + (domain.length() != 0 ? domain : mDomain)); + } + + sb.append(tokens[i].toString()); + if (i + 1 < tokens.length) { + sb.append(", "); + } + } + + return sb; + } +} diff --git a/common/java/com/android/common/Search.java b/common/java/com/android/common/Search.java new file mode 100644 index 0000000..55fa6f5 --- /dev/null +++ b/common/java/com/android/common/Search.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +package com.android.common; + +/** + * Utilities for search implementations. + * + * @see android.app.SearchManager + */ +public class Search { + + /** + * Key for the source identifier set by the application that launched a search intent. + * The identifier is search-source specific string. It can be used + * by the search provider to keep statistics of where searches are started from. + * + * The source identifier is stored in the {@link android.app.SearchManager#APP_DATA} + * Bundle in {@link android.content.Intent#ACTION_SEARCH} and + * {@link android.content.Intent#ACTION_WEB_SEARCH} intents. + */ + public final static String SOURCE = "source"; + + private Search() { } // don't instantiate +} diff --git a/common/java/com/android/common/speech/LoggingEvents.java b/common/java/com/android/common/speech/LoggingEvents.java new file mode 100644 index 0000000..1f3c6ef --- /dev/null +++ b/common/java/com/android/common/speech/LoggingEvents.java @@ -0,0 +1,136 @@ +/* + * 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. + */ + +package com.android.common.speech; + +/** + * Logging event constants used for Voice Search and VoiceIME. These are the + * keys and values of extras to be specified in logging broadcast intents. + * This class is used by clients of the android.speech APIs to log how the + * user interacts with the IME settings and speech recognition result. + */ +public class LoggingEvents { + // The name of the broadcast intent for logging. + public static final String ACTION_LOG_EVENT = "com.android.common.speech.LOG_EVENT"; + + // The extra key used for the name of the app being logged. + public static final String EXTRA_APP_NAME = "app_name"; + + // The extra key used for the name of the app issuing the VoiceSearch + // or VoiceIME request + public static final String EXTRA_CALLING_APP_NAME = ""; + + // The extra key used for the event value. The possible event values depend + // on the app being logged for, and are defined in the subclasses below. + public static final String EXTRA_EVENT = "extra_event"; + + // The extra key used to log the time in milliseconds at which the EXTRA_EVENT + // occurred in the client. + public static final String EXTRA_TIMESTAMP = "timestamp"; + + // The extra key used (with a boolean value of 'true') as a way to trigger a + // flush of the log events to the server. + public static final String EXTRA_FLUSH = "flush"; + + /** + * Logging event constants for voice search. Below are the extra values for + * {@link LoggingEvents#EXTRA_EVENT}, clustered with keys to additional + * extras for some events that need to be included as additional fields in + * the event. Note that this is not representative of *all* voice search + * events - only the ones that need to be reported from outside the voice + * search app, such as from Browser. + */ + public class VoiceSearch { + // The app name to be used for logging VoiceSearch events. + public static final String APP_NAME = "googlemobile"; + + public static final int RETRY = 0; + + public static final int N_BEST_REVEAL = 1; + + public static final int N_BEST_CHOOSE = 2; + public static final String EXTRA_N_BEST_CHOOSE_INDEX = "index"; // value should be int + + public static final int QUERY_UPDATED = 3; + public static final String EXTRA_QUERY_UPDATED_VALUE = "value"; // value should be String + } + + /** + * Logging event constants for VoiceIME. Below are the extra values for + * {@link LoggingEvents#EXTRA_EVENT}, clustered with keys to additional + * extras for some events that need to be included as additional fields in + * the event. + */ + public class VoiceIme { + // The app name to be used for logging VoiceIME events. + public static final String APP_NAME = "voiceime"; + + public static final int KEYBOARD_WARNING_DIALOG_SHOWN = 0; + + public static final int KEYBOARD_WARNING_DIALOG_DISMISSED = 1; + + public static final int KEYBOARD_WARNING_DIALOG_OK = 2; + + public static final int KEYBOARD_WARNING_DIALOG_CANCEL = 3; + + public static final int SETTINGS_WARNING_DIALOG_SHOWN = 4; + + public static final int SETTINGS_WARNING_DIALOG_DISMISSED = 5; + + public static final int SETTINGS_WARNING_DIALOG_OK = 6; + + public static final int SETTINGS_WARNING_DIALOG_CANCEL = 7; + + public static final int SWIPE_HINT_DISPLAYED = 8; + + public static final int PUNCTUATION_HINT_DISPLAYED = 9; + + public static final int CANCEL_DURING_LISTENING = 10; + + public static final int CANCEL_DURING_WORKING = 11; + + public static final int CANCEL_DURING_ERROR = 12; + + public static final int ERROR = 13; + public static final String EXTRA_ERROR_CODE = "code"; // value should be int + + public static final int START = 14; + public static final String EXTRA_START_LOCALE = "locale"; // value should be String + public static final String EXTRA_START_SWIPE = "swipe"; // value should be boolean + + public static final int VOICE_INPUT_DELIVERED = 15; + + public static final int N_BEST_CHOOSE = 16; + public static final String EXTRA_N_BEST_CHOOSE_INDEX = "index"; // value should be int + + public static final int TEXT_MODIFIED = 17; + public static final String EXTRA_TEXT_MODIFIED_LENGTH = "length"; // value should be int + public static final String EXTRA_TEXT_MODIFIED_TYPE = "type"; // value should be int below + public static final int TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION = 1; + public static final int TEXT_MODIFIED_TYPE_TYPING_DELETION = 2; + public static final int TEXT_MODIFIED_TYPE_TYPING_INSERTION = 3; + public static final int TEXT_MODIFIED_TYPE_TYPING_INSERTION_PUNCTUATION = 4; + + public static final int INPUT_ENDED = 18; + + public static final int VOICE_INPUT_SETTING_ENABLED = 19; + + public static final int VOICE_INPUT_SETTING_DISABLED = 20; + + public static final int IME_TEXT_ACCEPTED = 21; + } + +} diff --git a/common/java/com/android/common/speech/Recognition.java b/common/java/com/android/common/speech/Recognition.java new file mode 100644 index 0000000..1970179 --- /dev/null +++ b/common/java/com/android/common/speech/Recognition.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +package com.android.common.speech; + +/** + * Utilities for voice recognition implementations. + * + * @see android.speech.RecognitionService + * @see android.speech.RecognizerIntent + */ +public class Recognition { + + /** + * The key to the extra in the Bundle returned by + * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS + * which is an ArrayList of CharSequences which are hints that can be shown to + * the user for voice actions currently supported by voice search for the user's current + * language preference for voice search (i.e., the one defined in the extra + * android.speech.RecognizerIntent#EXTRA_LANGUAGE_PREFERENCE). + * + * If this is paired with EXTRA_HINT_CONTEXT, should return a set of hints that are + * appropriate for the provided context. + * + * The CharSequences are SpannedStrings and will contain segments wrapped in + * <annotation action="true"></annotation>. This is to indicate the section of the text + * which represents the voice action, to be highlighted in the UI if so desired. + */ + public static final String EXTRA_HINT_STRINGS = "android.speech.extra.HINT_STRINGS"; + + /** + * The key to an extra to be included in the request intent for + * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS. + * Should be an int of one of the values defined below. If an + * unknown int value is provided, it should be ignored. + */ + public static final String EXTRA_HINT_CONTEXT = "android.speech.extra.HINT_CONTEXT"; + + /** + * A set of values for EXTRA_HINT_CONTEXT. + */ + public static final int HINT_CONTEXT_UNKNOWN = 0; + public static final int HINT_CONTEXT_VOICE_SEARCH_HELP = 1; + public static final int HINT_CONTEXT_CAR_HOME = 2; + public static final int HINT_CONTEXT_LAUNCHER = 3; + + private Recognition() { } // don't instantiate +} diff --git a/common/java/com/android/common/userhappiness/UserHappinessSignals.java b/common/java/com/android/common/userhappiness/UserHappinessSignals.java new file mode 100644 index 0000000..347bdaa --- /dev/null +++ b/common/java/com/android/common/userhappiness/UserHappinessSignals.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +package com.android.common.userhappiness; + +import android.content.Intent; +import android.content.Context; +import com.android.common.speech.LoggingEvents; + +/** + * Metrics for User Happiness are recorded here. Each app can define when to + * call these User Happiness metrics. + */ +public class UserHappinessSignals { + + /** + * Log when a user "accepted" IME text. Each application can define what + * it means to "accept" text. In the case of Gmail, pressing the "Send" + * button indicates text acceptance. We broadcast this information to + * VoiceSearch LoggingEvents and use it to aggregate VoiceIME Happiness Metrics + */ + public static void userAcceptedImeText(Context context) { + // Create a Voice IME Logging intent. + Intent i = new Intent(LoggingEvents.ACTION_LOG_EVENT); + i.putExtra(LoggingEvents.EXTRA_APP_NAME, LoggingEvents.VoiceIme.APP_NAME); + i.putExtra(LoggingEvents.EXTRA_EVENT, LoggingEvents.VoiceIme.IME_TEXT_ACCEPTED); + i.putExtra(LoggingEvents.EXTRA_CALLING_APP_NAME, context.getPackageName()); + i.putExtra(LoggingEvents.EXTRA_TIMESTAMP, System.currentTimeMillis()); + context.sendBroadcast(i); + } + +} diff --git a/common/tests/Android.mk b/common/tests/Android.mk new file mode 100644 index 0000000..7425552 --- /dev/null +++ b/common/tests/Android.mk @@ -0,0 +1,28 @@ +# Copyright (C) 2009 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. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_CERTIFICATE := platform +LOCAL_JAVA_LIBRARIES := android.test.runner +LOCAL_MODULE_TAGS := tests +LOCAL_PACKAGE_NAME := AndroidCommonTests +LOCAL_SDK_VERSION := current +LOCAL_SRC_FILES := $(call all-java-files-under, src) +LOCAL_STATIC_JAVA_LIBRARIES := android-common + +LOCAL_PROGUARD_ENABLED := disabled + +include $(BUILD_PACKAGE) diff --git a/common/tests/AndroidManifest.xml b/common/tests/AndroidManifest.xml new file mode 100644 index 0000000..151ec20 --- /dev/null +++ b/common/tests/AndroidManifest.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 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. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.common.tests" + android:sharedUserId="com.android.uid.test"> + + <application> + <uses-library android:name="android.test.runner" /> + </application> + + <!-- Run tests with "runtest common" --> + <instrumentation android:name="android.test.InstrumentationTestRunner" + android:targetPackage="com.android.common.tests" + android:label="Android Common Library Tests" /> + +</manifest> diff --git a/common/tests/src/com/android/common/OperationSchedulerTest.java b/common/tests/src/com/android/common/OperationSchedulerTest.java new file mode 100644 index 0000000..955508f --- /dev/null +++ b/common/tests/src/com/android/common/OperationSchedulerTest.java @@ -0,0 +1,219 @@ +/* + * Copyright (C) 2009 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. + */ + +package com.android.common; + +import android.content.SharedPreferences; +import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.MediumTest; +import android.test.suitebuilder.annotation.SmallTest; + +public class OperationSchedulerTest extends AndroidTestCase { + /** + * OperationScheduler subclass which uses an artificial time. + * Set {@link #timeMillis} to whatever value you like. + */ + private class TimeTravelScheduler extends OperationScheduler { + static final long DEFAULT_TIME = 1250146800000L; // 13-Aug-2009, 12:00:00 am + public long timeMillis = DEFAULT_TIME; + + @Override + protected long currentTimeMillis() { return timeMillis; } + public TimeTravelScheduler() { super(getFreshStorage()); } + } + + private SharedPreferences getFreshStorage() { + SharedPreferences sp = getContext().getSharedPreferences("OperationSchedulerTest", 0); + sp.edit().clear().commit(); + return sp; + } + + @MediumTest + public void testScheduler() throws Exception { + TimeTravelScheduler scheduler = new TimeTravelScheduler(); + OperationScheduler.Options options = new OperationScheduler.Options(); + assertEquals(Long.MAX_VALUE, scheduler.getNextTimeMillis(options)); + assertEquals(0, scheduler.getLastSuccessTimeMillis()); + assertEquals(0, scheduler.getLastAttemptTimeMillis()); + + long beforeTrigger = scheduler.timeMillis; + scheduler.setTriggerTimeMillis(beforeTrigger + 1000000); + assertEquals(beforeTrigger + 1000000, scheduler.getNextTimeMillis(options)); + + // It will schedule for the later of the trigger and the moratorium... + scheduler.setMoratoriumTimeMillis(beforeTrigger + 500000); + assertEquals(beforeTrigger + 1000000, scheduler.getNextTimeMillis(options)); + scheduler.setMoratoriumTimeMillis(beforeTrigger + 1500000); + assertEquals(beforeTrigger + 1500000, scheduler.getNextTimeMillis(options)); + + // Test enable/disable toggle + scheduler.setEnabledState(false); + assertEquals(Long.MAX_VALUE, scheduler.getNextTimeMillis(options)); + scheduler.setEnabledState(true); + assertEquals(beforeTrigger + 1500000, scheduler.getNextTimeMillis(options)); + + // Backoff interval after an error + long beforeError = (scheduler.timeMillis += 100); + scheduler.onTransientError(); + assertEquals(0, scheduler.getLastSuccessTimeMillis()); + assertEquals(beforeError, scheduler.getLastAttemptTimeMillis()); + assertEquals(beforeTrigger + 1500000, scheduler.getNextTimeMillis(options)); + options.backoffFixedMillis = 1000000; + options.backoffIncrementalMillis = 500000; + assertEquals(beforeError + 1500000, scheduler.getNextTimeMillis(options)); + + // Two errors: backoff interval increases + beforeError = (scheduler.timeMillis += 100); + scheduler.onTransientError(); + assertEquals(beforeError, scheduler.getLastAttemptTimeMillis()); + assertEquals(beforeError + 2000000, scheduler.getNextTimeMillis(options)); + + // Reset transient error: no backoff interval + scheduler.resetTransientError(); + assertEquals(0, scheduler.getLastSuccessTimeMillis()); + assertEquals(beforeTrigger + 1500000, scheduler.getNextTimeMillis(options)); + assertEquals(beforeError, scheduler.getLastAttemptTimeMillis()); + + // Permanent error holds true even if transient errors are reset + // However, we remember that the transient error was reset... + scheduler.onPermanentError(); + assertEquals(Long.MAX_VALUE, scheduler.getNextTimeMillis(options)); + scheduler.resetTransientError(); + assertEquals(Long.MAX_VALUE, scheduler.getNextTimeMillis(options)); + scheduler.resetPermanentError(); + assertEquals(beforeTrigger + 1500000, scheduler.getNextTimeMillis(options)); + + // Success resets the trigger + long beforeSuccess = (scheduler.timeMillis += 100); + scheduler.onSuccess(); + assertEquals(beforeSuccess, scheduler.getLastAttemptTimeMillis()); + assertEquals(beforeSuccess, scheduler.getLastSuccessTimeMillis()); + assertEquals(Long.MAX_VALUE, scheduler.getNextTimeMillis(options)); + + // The moratorium is not reset by success! + scheduler.setTriggerTimeMillis(0); + assertEquals(beforeTrigger + 1500000, scheduler.getNextTimeMillis(options)); + scheduler.setMoratoriumTimeMillis(0); + assertEquals(beforeSuccess, scheduler.getNextTimeMillis(options)); + + // Periodic interval after success + options.periodicIntervalMillis = 250000; + scheduler.setTriggerTimeMillis(Long.MAX_VALUE); + assertEquals(beforeSuccess + 250000, scheduler.getNextTimeMillis(options)); + + // Trigger minimum is also since the last success + options.minTriggerMillis = 1000000; + assertEquals(beforeSuccess + 1000000, scheduler.getNextTimeMillis(options)); + } + + @SmallTest + public void testParseOptions() throws Exception { + OperationScheduler.Options options = new OperationScheduler.Options(); + assertEquals( + "OperationScheduler.Options[backoff=0.0+5.0 max=86400.0 min=0.0 period=3600.0]", + OperationScheduler.parseOptions("3600", options).toString()); + + assertEquals( + "OperationScheduler.Options[backoff=0.0+2.5 max=86400.0 min=0.0 period=3700.0]", + OperationScheduler.parseOptions("backoff=+2.5 3700", options).toString()); + + assertEquals( + "OperationScheduler.Options[backoff=10.0+2.5 max=12345.6 min=7.0 period=3800.0]", + OperationScheduler.parseOptions("max=12345.6 min=7 backoff=10 period=3800", + options).toString()); + + assertEquals( + "OperationScheduler.Options[backoff=10.0+2.5 max=12345.6 min=7.0 period=3800.0]", + OperationScheduler.parseOptions("", options).toString()); + } + + @SmallTest + public void testMoratoriumWithHttpDate() throws Exception { + TimeTravelScheduler scheduler = new TimeTravelScheduler(); + OperationScheduler.Options options = new OperationScheduler.Options(); + + long beforeTrigger = scheduler.timeMillis; + scheduler.setTriggerTimeMillis(beforeTrigger + 1000000); + assertEquals(beforeTrigger + 1000000, scheduler.getNextTimeMillis(options)); + + scheduler.setMoratoriumTimeMillis(beforeTrigger + 2000000); + assertEquals(beforeTrigger + 2000000, scheduler.getNextTimeMillis(options)); + + long beforeMoratorium = scheduler.timeMillis; + assertTrue(scheduler.setMoratoriumTimeHttp("3000")); + long afterMoratorium = scheduler.timeMillis; + assertTrue(beforeMoratorium + 3000000 <= scheduler.getNextTimeMillis(options)); + assertTrue(afterMoratorium + 3000000 >= scheduler.getNextTimeMillis(options)); + + options.maxMoratoriumMillis = Long.MAX_VALUE / 2; + assertTrue(scheduler.setMoratoriumTimeHttp("Fri, 31 Dec 2030 23:59:59 GMT")); + assertEquals(1924991999000L, scheduler.getNextTimeMillis(options)); + + assertFalse(scheduler.setMoratoriumTimeHttp("not actually a date")); + } + + @SmallTest + public void testClockRollbackScenario() throws Exception { + TimeTravelScheduler scheduler = new TimeTravelScheduler(); + OperationScheduler.Options options = new OperationScheduler.Options(); + options.minTriggerMillis = 2000; + + // First, set up a scheduler with reasons to wait: a transient + // error with backoff and a moratorium for a few minutes. + + long beforeTrigger = scheduler.timeMillis; + long triggerTime = beforeTrigger - 10000000; + scheduler.setTriggerTimeMillis(triggerTime); + assertEquals(triggerTime, scheduler.getNextTimeMillis(options)); + assertEquals(0, scheduler.getLastAttemptTimeMillis()); + + long beforeSuccess = (scheduler.timeMillis += 100); + scheduler.onSuccess(); + scheduler.setTriggerTimeMillis(triggerTime); + assertEquals(beforeSuccess, scheduler.getLastAttemptTimeMillis()); + assertEquals(beforeSuccess + 2000, scheduler.getNextTimeMillis(options)); + + long beforeError = (scheduler.timeMillis += 100); + scheduler.onTransientError(); + assertEquals(beforeError, scheduler.getLastAttemptTimeMillis()); + assertEquals(beforeError + 5000, scheduler.getNextTimeMillis(options)); + + long beforeMoratorium = (scheduler.timeMillis += 100); + scheduler.setMoratoriumTimeMillis(beforeTrigger + 1000000); + assertEquals(beforeTrigger + 1000000, scheduler.getNextTimeMillis(options)); + + // Now set the time back a few seconds. + // The moratorium time should still be honored. + long beforeRollback = (scheduler.timeMillis = beforeTrigger - 10000); + assertEquals(beforeTrigger + 1000000, scheduler.getNextTimeMillis(options)); + + // The rollback also moved the last-attempt clock back to the rollback time. + assertEquals(scheduler.timeMillis, scheduler.getLastAttemptTimeMillis()); + + // But if we set the time back more than a day, the moratorium + // resets to the maximum moratorium (a day, by default), exposing + // the original trigger time. + beforeRollback = (scheduler.timeMillis = beforeTrigger - 100000000); + assertEquals(triggerTime, scheduler.getNextTimeMillis(options)); + assertEquals(beforeRollback, scheduler.getLastAttemptTimeMillis()); + + // If we roll forward until after the re-set moratorium, then it expires. + scheduler.timeMillis = triggerTime + 5000000; + assertEquals(triggerTime, scheduler.getNextTimeMillis(options)); + assertEquals(beforeRollback, scheduler.getLastAttemptTimeMillis()); + assertEquals(beforeRollback, scheduler.getLastSuccessTimeMillis()); + } +} diff --git a/common/tools/make-iana-tld-pattern.py b/common/tools/make-iana-tld-pattern.py new file mode 100755 index 0000000..de81c58 --- /dev/null +++ b/common/tools/make-iana-tld-pattern.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python + +from urllib2 import urlopen + +TLD_PREFIX = r""" + /** + * Regular expression to match all IANA top-level domains. + * List accurate as of 2010/02/05. List taken from: + * http://data.iana.org/TLD/tlds-alpha-by-domain.txt + * This pattern is auto-generated by frameworks/base/common/tools/make-iana-tld-pattern.py + */ + public static final String TOP_LEVEL_DOMAIN_STR = +""" +TLD_SUFFIX = '";' + +URL_PREFIX = r""" + /** + * Regular expression to match all IANA top-level domains for WEB_URL. + * List accurate as of 2010/02/05. List taken from: + * http://data.iana.org/TLD/tlds-alpha-by-domain.txt + * This pattern is auto-generated by frameworks/base/common/tools/make-iana-tld-pattern.py + */ + public static final String TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL = + "(?:" +""" + +URL_SUFFIX = ';' + +class Bucket: + def __init__(self, baseLetter): + self.base=baseLetter + self.words=[] + self.letters=[] + + def dump(self, isWebUrl=False, isFirst=False, isLast=False): + if (len(self.words) == 0) and (len(self.letters) == 0): + return '' + + self.words.sort() + self.letters.sort() + + output = ' '; + + if isFirst: + if isWebUrl: + output += '+ "' + else: + output += '"(' + else: + output += '+ "|' + + if len(self.words) != 0: + output += '(' + + if isWebUrl: + output += '?:' + + firstWord = 1 + for word in self.words: + if firstWord == 0: + output += '|' + firstWord = 0 + for letter in word: + if letter == '-': + output += '\\\\' # escape the '-' character. + output += letter + + if len(self.words) > 0 and len(self.letters) > 0: + output += '|' + + if len(self.letters) == 1: + output += '%c%c' % (self.base, self.letters[0]) + elif len(self.letters) > 0: + output += '%c[' % self.base + + for letter in self.letters: + output += letter + + output += ']' + + if len(self.words) != 0: + output += ')' + + if not isLast: + output += '"' + output += '\n' + + return output; + + def add(self, line): + length = len(line) + + if line.startswith('#') or (length == 0): + return; + + if length == 2: + self.letters.append(line[1:2]) + else: + self.words.append(line) + +def getBucket(buckets, line): + letter = line[0] + bucket = buckets.get(letter) + + if bucket is None: + bucket = Bucket(letter) + buckets[letter] = bucket + + return bucket + +def makePattern(prefix, suffix, buckets, isWebUrl=False): + output = prefix + + output += getBucket(buckets, 'a').dump(isFirst=True, isWebUrl=isWebUrl) + + for letter in range(ord('b'), ord('z')): + output += getBucket(buckets, chr(letter)).dump(isWebUrl=isWebUrl) + + output += getBucket(buckets, 'z').dump(isLast=True, isWebUrl=isWebUrl) + + if isWebUrl: + output += '))"' + else: + output += ')' + + output += suffix + + print output + +if __name__ == "__main__": + f = urlopen('http://data.iana.org/TLD/tlds-alpha-by-domain.txt') + domains = f.readlines() + f.close() + + buckets = {} + + for domain in domains: + domain = domain.lower() + + if len(domain) > 0: + getBucket(buckets, domain[0]).add(domain.strip()) + + makePattern(TLD_PREFIX, TLD_SUFFIX, buckets, isWebUrl=False) + makePattern(URL_PREFIX, URL_SUFFIX, buckets, isWebUrl=True) diff --git a/include/binder/IBinder.h b/include/binder/IBinder.h index 884b5c1..749a977 100644 --- a/include/binder/IBinder.h +++ b/include/binder/IBinder.h @@ -52,7 +52,7 @@ public: DUMP_TRANSACTION = B_PACK_CHARS('_','D','M','P'), INTERFACE_TRANSACTION = B_PACK_CHARS('_', 'N', 'T', 'F'), - // Corresponds to tfOneWay -- an asynchronous call. + // Corresponds to TF_ONE_WAY -- an asynchronous call. FLAG_ONEWAY = 0x00000001 }; diff --git a/include/binder/IMemory.h b/include/binder/IMemory.h index ae042cb..74d2cc7 100644 --- a/include/binder/IMemory.h +++ b/include/binder/IMemory.h @@ -36,8 +36,7 @@ public: // flags returned by getFlags() enum { - READ_ONLY = 0x00000001, - MAP_ONCE = 0x00000002 + READ_ONLY = 0x00000001 }; virtual int getHeapID() const = 0; diff --git a/include/binder/IPCThreadState.h b/include/binder/IPCThreadState.h index 78306b2..3ab985d 100644 --- a/include/binder/IPCThreadState.h +++ b/include/binder/IPCThreadState.h @@ -68,6 +68,13 @@ public: static void shutdown(); + // Call this to disable switching threads to background scheduling when + // receiving incoming IPC calls. This is specifically here for the + // Android system process, since it expects to have background apps calling + // in to it but doesn't want to acquire locks in its services while in + // the background. + static void disableBackgroundScheduling(bool disable); + private: IPCThreadState(); ~IPCThreadState(); @@ -93,9 +100,10 @@ private: void* cookie); const sp<ProcessState> mProcess; + const pid_t mMyThreadId; Vector<BBinder*> mPendingStrongDerefs; Vector<RefBase::weakref_type*> mPendingWeakDerefs; - + Parcel mIn; Parcel mOut; status_t mLastError; diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h index 03ac70a..170f20d 100644 --- a/include/binder/MemoryDealer.h +++ b/include/binder/MemoryDealer.h @@ -22,232 +22,35 @@ #include <sys/types.h> #include <binder/IMemory.h> -#include <utils/threads.h> #include <binder/MemoryHeapBase.h> namespace android { // ---------------------------------------------------------------------------- -class String8; -/* - * interface for implementing a "heap". A heap basically provides - * the IMemoryHeap interface for cross-process sharing and the - * ability to map/unmap pages within the heap. - */ -class HeapInterface : public virtual BnMemoryHeap -{ -public: - // all values must be page-aligned - virtual sp<IMemory> mapMemory(size_t offset, size_t size) = 0; - - HeapInterface(); -protected: - virtual ~HeapInterface(); -}; - -// ---------------------------------------------------------------------------- - -/* - * interface for implementing an allocator. An allocator provides - * methods for allocating and freeing memory blocks and dumping - * its state. - */ -class AllocatorInterface : public RefBase -{ -public: - enum { - PAGE_ALIGNED = 0x00000001 - }; - - virtual size_t allocate(size_t size, uint32_t flags = 0) = 0; - virtual status_t deallocate(size_t offset) = 0; - virtual size_t size() const = 0; - virtual void dump(const char* what, uint32_t flags = 0) const = 0; - virtual void dump(String8& res, - const char* what, uint32_t flags = 0) const = 0; - - AllocatorInterface(); -protected: - virtual ~AllocatorInterface(); -}; - -// ---------------------------------------------------------------------------- - -/* - * concrete implementation of HeapInterface on top of mmap() - */ -class SharedHeap : public HeapInterface, public MemoryHeapBase -{ -public: - SharedHeap(); - SharedHeap(size_t size, uint32_t flags = 0, char const * name = NULL); - virtual ~SharedHeap(); - virtual sp<IMemory> mapMemory(size_t offset, size_t size); -}; - -// ---------------------------------------------------------------------------- - -/* - * A simple templatized doubly linked-list implementation - */ - -template <typename NODE> -class LinkedList -{ - NODE* mFirst; - NODE* mLast; - -public: - LinkedList() : mFirst(0), mLast(0) { } - bool isEmpty() const { return mFirst == 0; } - NODE const* head() const { return mFirst; } - NODE* head() { return mFirst; } - NODE const* tail() const { return mLast; } - NODE* tail() { return mLast; } - - void insertAfter(NODE* node, NODE* newNode) { - newNode->prev = node; - newNode->next = node->next; - if (node->next == 0) mLast = newNode; - else node->next->prev = newNode; - node->next = newNode; - } - - void insertBefore(NODE* node, NODE* newNode) { - newNode->prev = node->prev; - newNode->next = node; - if (node->prev == 0) mFirst = newNode; - else node->prev->next = newNode; - node->prev = newNode; - } - - void insertHead(NODE* newNode) { - if (mFirst == 0) { - mFirst = mLast = newNode; - newNode->prev = newNode->next = 0; - } else { - newNode->prev = 0; - newNode->next = mFirst; - mFirst->prev = newNode; - mFirst = newNode; - } - } - - void insertTail(NODE* newNode) { - if (mLast == 0) { - insertHead(newNode); - } else { - newNode->prev = mLast; - newNode->next = 0; - mLast->next = newNode; - mLast = newNode; - } - } - - NODE* remove(NODE* node) { - if (node->prev == 0) mFirst = node->next; - else node->prev->next = node->next; - if (node->next == 0) mLast = node->prev; - else node->next->prev = node->prev; - return node; - } -}; - - -/* - * concrete implementation of AllocatorInterface using a simple - * best-fit allocation scheme - */ -class SimpleBestFitAllocator : public AllocatorInterface -{ -public: - - SimpleBestFitAllocator(size_t size); - virtual ~SimpleBestFitAllocator(); - - virtual size_t allocate(size_t size, uint32_t flags = 0); - virtual status_t deallocate(size_t offset); - virtual size_t size() const; - virtual void dump(const char* what, uint32_t flags = 0) const; - virtual void dump(String8& res, - const char* what, uint32_t flags = 0) const; - -private: - - struct chunk_t { - chunk_t(size_t start, size_t size) - : start(start), size(size), free(1), prev(0), next(0) { - } - size_t start; - size_t size : 28; - int free : 4; - mutable chunk_t* prev; - mutable chunk_t* next; - }; - - ssize_t alloc(size_t size, uint32_t flags); - chunk_t* dealloc(size_t start); - void dump_l(const char* what, uint32_t flags = 0) const; - void dump_l(String8& res, const char* what, uint32_t flags = 0) const; - - static const int kMemoryAlign; - mutable Mutex mLock; - LinkedList<chunk_t> mList; - size_t mHeapSize; -}; +class SimpleBestFitAllocator; // ---------------------------------------------------------------------------- class MemoryDealer : public RefBase { public: + MemoryDealer(size_t size, const char* name = 0); - enum { - READ_ONLY = MemoryHeapBase::READ_ONLY, - PAGE_ALIGNED = AllocatorInterface::PAGE_ALIGNED - }; - - // creates a memory dealer with the SharedHeap and SimpleBestFitAllocator - MemoryDealer(size_t size, uint32_t flags = 0, const char* name = 0); - - // provide a custom heap but use the SimpleBestFitAllocator - MemoryDealer(const sp<HeapInterface>& heap); - - // provide both custom heap and allocotar - MemoryDealer( - const sp<HeapInterface>& heap, - const sp<AllocatorInterface>& allocator); - - virtual sp<IMemory> allocate(size_t size, uint32_t flags = 0); + virtual sp<IMemory> allocate(size_t size); virtual void deallocate(size_t offset); - virtual void dump(const char* what, uint32_t flags = 0) const; - + virtual void dump(const char* what) const; sp<IMemoryHeap> getMemoryHeap() const { return heap(); } - sp<AllocatorInterface> getAllocator() const { return allocator(); } protected: virtual ~MemoryDealer(); -private: - const sp<HeapInterface>& heap() const; - const sp<AllocatorInterface>& allocator() const; - - class Allocation : public BnMemory { - public: - Allocation(const sp<MemoryDealer>& dealer, - ssize_t offset, size_t size, const sp<IMemory>& memory); - virtual ~Allocation(); - virtual sp<IMemoryHeap> getMemory(ssize_t* offset, size_t* size) const; - private: - sp<MemoryDealer> mDealer; - ssize_t mOffset; - size_t mSize; - sp<IMemory> mMemory; - }; +private: + const sp<IMemoryHeap>& heap() const; + SimpleBestFitAllocator* allocator() const; - sp<HeapInterface> mHeap; - sp<AllocatorInterface> mAllocator; + sp<IMemoryHeap> mHeap; + SimpleBestFitAllocator* mAllocator; }; diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h index d793c24..2f2e31b 100644 --- a/include/binder/MemoryHeapBase.h +++ b/include/binder/MemoryHeapBase.h @@ -32,7 +32,6 @@ class MemoryHeapBase : public virtual BnMemoryHeap public: enum { READ_ONLY = IMemoryHeap::READ_ONLY, - MAP_ONCE = IMemoryHeap::MAP_ONCE, // memory won't be mapped locally, but will be mapped in the remote // process. DONT_MAP_LOCALLY = 0x00000100, diff --git a/include/binder/MemoryHeapPmem.h b/include/binder/MemoryHeapPmem.h index dbf26ff..e1660c4 100644 --- a/include/binder/MemoryHeapPmem.h +++ b/include/binder/MemoryHeapPmem.h @@ -20,10 +20,10 @@ #include <stdlib.h> #include <stdint.h> -#include <binder/MemoryDealer.h> #include <binder/MemoryHeapBase.h> #include <binder/IMemory.h> #include <utils/SortedVector.h> +#include <utils/threads.h> namespace android { @@ -31,7 +31,7 @@ class MemoryHeapBase; // --------------------------------------------------------------------------- -class MemoryHeapPmem : public HeapInterface, public MemoryHeapBase +class MemoryHeapPmem : public MemoryHeapBase { public: class MemoryPmem : public BnMemory { @@ -46,8 +46,7 @@ public: sp<MemoryHeapPmem> mClientHeap; }; - MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap, - uint32_t flags = IMemoryHeap::MAP_ONCE); + MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap, uint32_t flags = 0); ~MemoryHeapPmem(); /* HeapInterface additions */ diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index ba6c711..66c34b2 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -30,6 +30,7 @@ class IBinder; class ProcessState; class String8; class TextOutput; +class Flattenable; struct flat_binder_object; // defined in support_p/binder_module.h @@ -81,6 +82,7 @@ public: status_t writeString16(const char16_t* str, size_t len); status_t writeStrongBinder(const sp<IBinder>& val); status_t writeWeakBinder(const wp<IBinder>& val); + status_t write(const Flattenable& val); // Place a native_handle into the parcel (the native_handle's file- // descriptors are dup'ed, so it is safe to delete the native_handle @@ -119,7 +121,7 @@ public: const char16_t* readString16Inplace(size_t* outLen) const; sp<IBinder> readStrongBinder() const; wp<IBinder> readWeakBinder() const; - + status_t read(Flattenable& val) const; // Retrieve native_handle from the parcel. This returns a copy of the // parcel's native_handle (the caller takes ownership). The caller diff --git a/include/private/opengles/gl_context.h b/include/private/opengles/gl_context.h index 26cde38..c7db9a6 100644 --- a/include/private/opengles/gl_context.h +++ b/include/private/opengles/gl_context.h @@ -36,7 +36,12 @@ struct android_native_buffer_t; namespace android { -const unsigned int OGLES_NUM_COMPRESSED_TEXTURE_FORMATS = 10; + +const unsigned int OGLES_NUM_COMPRESSED_TEXTURE_FORMATS = 10 +#ifdef GL_OES_compressed_ETC1_RGB8_texture + + 1 +#endif + ; class EGLTextureObject; class EGLSurfaceManager; @@ -289,7 +294,6 @@ struct light_t { vec4_t normalizedObjPosition; vec4_t spotDir; vec4_t normalizedSpotDir; - vec4_t objViewer; GLfixed spotExp; GLfixed spotCutoff; GLfixed spotCutoffCosine; @@ -322,9 +326,10 @@ struct lighting_t { material_t front; light_model_t lightModel; color_material_t colorMaterial; + vec4_t implicitSceneEmissionAndAmbient; + vec4_t objViewer; uint32_t enabledLights; GLboolean enable; - vec4_t implicitSceneEmissionAndAmbient; GLenum shadeModel; typedef void (*light_fct_t)(ogles_context_t*, vertex_t*); void (*lightVertex)(ogles_context_t* c, vertex_t* v); diff --git a/include/private/ui/LayerState.h b/include/private/surfaceflinger/LayerState.h index f1a2618..d7fe572 100644 --- a/include/private/ui/LayerState.h +++ b/include/private/surfaceflinger/LayerState.h @@ -14,17 +14,18 @@ * limitations under the License. */ -#ifndef ANDROID_COMPOSER_LAYER_STATE_H -#define ANDROID_COMPOSER_LAYER_STATE_H +#ifndef ANDROID_SF_LAYER_STATE_H +#define ANDROID_SF_LAYER_STATE_H #include <stdint.h> #include <sys/types.h> #include <utils/Errors.h> -#include <ui/ISurfaceFlingerClient.h> #include <ui/Region.h> +#include <surfaceflinger/ISurface.h> + namespace android { class Parcel; @@ -69,5 +70,5 @@ struct layer_state_t { }; // namespace android -#endif // ANDROID_COMPOSER_LAYER_STATE_H +#endif // ANDROID_SF_LAYER_STATE_H diff --git a/include/private/ui/SharedBufferStack.h b/include/private/surfaceflinger/SharedBufferStack.h index bbc1822..9b5a1e0 100644 --- a/include/private/ui/SharedBufferStack.h +++ b/include/private/surfaceflinger/SharedBufferStack.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ANDROID_UI_SHARED_BUFFER_STACK_H -#define ANDROID_UI_SHARED_BUFFER_STACK_H +#ifndef ANDROID_SF_SHARED_BUFFER_STACK_H +#define ANDROID_SF_SHARED_BUFFER_STACK_H #include <stdint.h> #include <sys/types.h> @@ -356,4 +356,4 @@ COMPILE_TIME_ASSERT(sizeof(surface_flinger_cblk_t) <= 4096) // --------------------------------------------------------------------------- }; // namespace android -#endif /* ANDROID_UI_SHARED_BUFFER_STACK_H */ +#endif /* ANDROID_SF_SHARED_BUFFER_STACK_H */ diff --git a/include/ui/ISurface.h b/include/surfaceflinger/ISurface.h index 2ca0026..472f759 100644 --- a/include/ui/ISurface.h +++ b/include/surfaceflinger/ISurface.h @@ -14,15 +14,17 @@ * limitations under the License. */ -#ifndef ANDROID_ISURFACE_H -#define ANDROID_ISURFACE_H +#ifndef ANDROID_SF_ISURFACE_H +#define ANDROID_SF_ISURFACE_H #include <stdint.h> #include <sys/types.h> #include <utils/Errors.h> -#include <binder/IInterface.h> #include <utils/RefBase.h> + +#include <binder/IInterface.h> + #include <ui/PixelFormat.h> #include <hardware/hardware.h> @@ -55,8 +57,11 @@ public: class BufferHeap { public: enum { - /* rotate source image 90 degrees */ + /* rotate source image */ + ROT_0 = 0, ROT_90 = HAL_TRANSFORM_ROT_90, + ROT_180 = HAL_TRANSFORM_ROT_180, + ROT_270 = HAL_TRANSFORM_ROT_270, }; BufferHeap(); @@ -86,7 +91,7 @@ public: virtual void unregisterBuffers() = 0; virtual sp<OverlayRef> createOverlay( - uint32_t w, uint32_t h, int32_t format) = 0; + uint32_t w, uint32_t h, int32_t format, int32_t orientation) = 0; }; // ---------------------------------------------------------------------------- @@ -104,4 +109,4 @@ public: }; // namespace android -#endif // ANDROID_ISURFACE_H +#endif // ANDROID_SF_ISURFACE_H diff --git a/include/ui/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h index 25d954c..d1e7785 100644 --- a/include/ui/ISurfaceComposer.h +++ b/include/surfaceflinger/ISurfaceComposer.h @@ -14,25 +14,24 @@ * limitations under the License. */ -#ifndef ANDROID_ISURFACE_COMPOSER_H -#define ANDROID_ISURFACE_COMPOSER_H +#ifndef ANDROID_SF_ISURFACE_COMPOSER_H +#define ANDROID_SF_ISURFACE_COMPOSER_H #include <stdint.h> #include <sys/types.h> #include <utils/RefBase.h> #include <utils/Errors.h> + #include <binder/IInterface.h> #include <ui/PixelFormat.h> -#include <ui/ISurfaceFlingerClient.h> -namespace android { +#include <surfaceflinger/ISurfaceFlingerClient.h> +namespace android { // ---------------------------------------------------------------------------- -class DisplayInfo; - class ISurfaceComposer : public IInterface { public: @@ -92,19 +91,19 @@ public: /* retrieve the control block */ virtual sp<IMemoryHeap> getCblk() const = 0; - /* open/close transactions. recquires ACCESS_SURFACE_FLINGER permission */ + /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */ virtual void openGlobalTransaction() = 0; virtual void closeGlobalTransaction() = 0; - /* [un]freeze display. recquires ACCESS_SURFACE_FLINGER permission */ + /* [un]freeze display. requires ACCESS_SURFACE_FLINGER permission */ virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags) = 0; virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0; - /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */ + /* Set display orientation. requires ACCESS_SURFACE_FLINGER permission */ virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0; /* signal that we're done booting. - * recquires ACCESS_SURFACE_FLINGER permission + * Requires ACCESS_SURFACE_FLINGER permission */ virtual void bootFinished() = 0; @@ -143,4 +142,4 @@ public: }; // namespace android -#endif // ANDROID_ISURFACE_COMPOSER_H +#endif // ANDROID_SF_ISURFACE_COMPOSER_H diff --git a/include/ui/ISurfaceFlingerClient.h b/include/surfaceflinger/ISurfaceFlingerClient.h index 5d231e6..d257645 100644 --- a/include/ui/ISurfaceFlingerClient.h +++ b/include/surfaceflinger/ISurfaceFlingerClient.h @@ -14,28 +14,26 @@ * limitations under the License. */ -#ifndef ANDROID_ISURFACE_FLINGER_CLIENT_H -#define ANDROID_ISURFACE_FLINGER_CLIENT_H +#ifndef ANDROID_SF_ISURFACE_FLINGER_CLIENT_H +#define ANDROID_SF_ISURFACE_FLINGER_CLIENT_H #include <stdint.h> #include <sys/types.h> #include <utils/Errors.h> -#include <binder/IInterface.h> #include <utils/RefBase.h> -#include <ui/ISurface.h> +#include <binder/IInterface.h> #include <ui/PixelFormat.h> +#include <surfaceflinger/ISurface.h> + namespace android { // ---------------------------------------------------------------------------- -class Rect; -class Point; -class IMemory; -class ISurface; +class IMemoryHeap; typedef int32_t ClientID; typedef int32_t DisplayID; @@ -63,6 +61,7 @@ public: virtual sp<ISurface> createSurface( surface_data_t* data, int pid, + const String8& name, DisplayID display, uint32_t w, uint32_t h, @@ -89,4 +88,4 @@ public: }; // namespace android -#endif // ANDROID_ISURFACE_FLINGER_CLIENT_H +#endif // ANDROID_SF_ISURFACE_FLINGER_CLIENT_H diff --git a/include/ui/Surface.h b/include/surfaceflinger/Surface.h index 008c297..0279d84 100644 --- a/include/ui/Surface.h +++ b/include/surfaceflinger/Surface.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ANDROID_UI_SURFACE_H -#define ANDROID_UI_SURFACE_H +#ifndef ANDROID_SF_SURFACE_H +#define ANDROID_SF_SURFACE_H #include <stdint.h> #include <sys/types.h> @@ -23,13 +23,13 @@ #include <utils/RefBase.h> #include <utils/threads.h> -#include <ui/ISurface.h> #include <ui/PixelFormat.h> #include <ui/Region.h> -#include <ui/ISurfaceFlingerClient.h> - #include <ui/egl/android_natives.h> +#include <surfaceflinger/ISurface.h> +#include <surfaceflinger/ISurfaceFlingerClient.h> + namespace android { // --------------------------------------------------------------------------- @@ -210,9 +210,16 @@ private: status_t dequeueBuffer(sp<GraphicBuffer>* buffer); + void dispatch_setUsage(va_list args); + int dispatch_connect(va_list args); + int dispatch_disconnect(va_list args); void setUsage(uint32_t reqUsage); + int connect(int api); + int disconnect(int api); + uint32_t getUsage() const; + int getConnectedApi() const; // constants sp<SurfaceComposerClient> mClient; @@ -227,6 +234,7 @@ private: // protected by mSurfaceLock Rect mSwapRectangle; uint32_t mUsage; + int mConnected; // protected by mSurfaceLock. These are also used from lock/unlock // but in that case, they must be called form the same thread. @@ -250,5 +258,5 @@ private: }; // namespace android -#endif // ANDROID_UI_SURFACE_H +#endif // ANDROID_SF_SURFACE_H diff --git a/include/ui/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h index 777b878..9d0f0cb 100644 --- a/include/ui/SurfaceComposerClient.h +++ b/include/surfaceflinger/SurfaceComposerClient.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ANDROID_SURFACE_COMPOSER_CLIENT_H -#define ANDROID_SURFACE_COMPOSER_CLIENT_H +#ifndef ANDROID_SF_SURFACE_COMPOSER_CLIENT_H +#define ANDROID_SF_SURFACE_COMPOSER_CLIENT_H #include <stdint.h> #include <sys/types.h> @@ -27,17 +27,18 @@ #include <utils/threads.h> #include <ui/PixelFormat.h> -#include <ui/ISurfaceComposer.h> #include <ui/Region.h> -#include <ui/Surface.h> + +#include <surfaceflinger/Surface.h> namespace android { // --------------------------------------------------------------------------- class Region; -class SurfaceFlingerSynchro; class SharedClient; +class ISurfaceComposer; +class DisplayInfo; class SurfaceComposerClient : virtual public RefBase { @@ -64,6 +65,7 @@ public: //! Create a surface sp<SurfaceControl> createSurface( int pid, // pid of the process the surface is for + const String8& name,// name of the surface DisplayID display, // Display to create this surface on uint32_t w, // width in pixel uint32_t h, // height in pixel @@ -71,6 +73,16 @@ public: uint32_t flags = 0 // usage flags ); + sp<SurfaceControl> createSurface( + int pid, // pid of the process the surface is for + DisplayID display, // Display to create this surface on + uint32_t w, // width in pixel + uint32_t h, // height in pixel + PixelFormat format, // pixel-format desired + uint32_t flags = 0 // usage flags + ); + + // ------------------------------------------------------------------------ // Composer parameters // All composer parameters must be changed within a transaction @@ -158,5 +170,5 @@ private: }; // namespace android -#endif // ANDROID_SURFACE_COMPOSER_CLIENT_H +#endif // ANDROID_SF_SURFACE_COMPOSER_CLIENT_H diff --git a/include/tts/TtsEngine.h b/include/tts/TtsEngine.h index 28b0d2f..998e353 100644 --- a/include/tts/TtsEngine.h +++ b/include/tts/TtsEngine.h @@ -26,6 +26,12 @@ namespace android { +#define ANDROID_TTS_ENGINE_PROPERTY_CONFIG "engineConfig" +#define ANDROID_TTS_ENGINE_PROPERTY_PITCH "pitch" +#define ANDROID_TTS_ENGINE_PROPERTY_RATE "rate" +#define ANDROID_TTS_ENGINE_PROPERTY_VOLUME "volume" + + enum tts_synth_status { TTS_SYNTH_DONE = 0, TTS_SYNTH_PENDING = 1 @@ -85,7 +91,7 @@ public: // Initialize the TTS engine and returns whether initialization succeeded. // @param synthDoneCBPtr synthesis callback function pointer // @return TTS_SUCCESS, or TTS_FAILURE - virtual tts_result init(synthDoneCB_t synthDoneCBPtr); + virtual tts_result init(synthDoneCB_t synthDoneCBPtr, const char *engineConfig); // Shut down the TTS engine and releases all associated resources. // @return TTS_SUCCESS, or TTS_FAILURE @@ -122,7 +128,7 @@ public: // @param variant pointer to the variant code // @return TTS_SUCCESS, or TTS_FAILURE virtual tts_result loadLanguage(const char *lang, const char *country, const char *variant); - + // Load the resources associated with the specified language, country and Locale variant. // The loaded language will only be used once a call to setLanguageFromLocale() with the same // language value is issued. Language and country values are coded according to the ISO three @@ -220,19 +226,6 @@ public: virtual tts_result synthesizeText(const char *text, int8_t *buffer, size_t bufferSize, void *userdata); - // Synthesize IPA text. - // As the synthesis is performed, the engine invokes the callback to notify - // the TTS framework that it has filled the given buffer, and indicates how - // many bytes it wrote. The callback is called repeatedly until the engine - // has generated all the audio data corresponding to the IPA data. - // @param ipa the IPA data to synthesize - // @param userdata pointer to be returned when the call is invoked - // @param buffer the location where the synthesized data must be written - // @param bufferSize the number of bytes that can be written in buffer - // @return TTS_FEATURE_UNSUPPORTED if IPA is not supported, - // otherwise TTS_SUCCESS or TTS_FAILURE - virtual tts_result synthesizeIpa(const char *ipa, int8_t *buffer, - size_t bufferSize, void *userdata); }; } // namespace android diff --git a/include/ui/Camera.h b/include/ui/Camera.h deleted file mode 100644 index 5219772..0000000 --- a/include/ui/Camera.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * Copyright (C) 2008 HTC Inc. - * - * 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. - */ - -#ifndef ANDROID_HARDWARE_CAMERA_H -#define ANDROID_HARDWARE_CAMERA_H - -#include <utils/Timers.h> -#include <ui/ICameraClient.h> - -namespace android { - -/* - * A set of bit masks for specifying how the received preview frames are - * handled before the previewCallback() call. - * - * The least significant 3 bits of an "int" value are used for this purpose: - * - * ..... 0 0 0 - * ^ ^ ^ - * | | |---------> determine whether the callback is enabled or not - * | |-----------> determine whether the callback is one-shot or not - * |-------------> determine whether the frame is copied out or not - * - * WARNING: - * When a frame is sent directly without copying, it is the frame receiver's - * responsiblity to make sure that the frame data won't get corrupted by - * subsequent preview frames filled by the camera. This flag is recommended - * only when copying out data brings significant performance price and the - * handling/processing of the received frame data is always faster than - * the preview frame rate so that data corruption won't occur. - * - * For instance, - * 1. 0x00 disables the callback. In this case, copy out and one shot bits - * are ignored. - * 2. 0x01 enables a callback without copying out the received frames. A - * typical use case is the Camcorder application to avoid making costly - * frame copies. - * 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical - * use case is the Camera application. - * 4. 0x07 is enabling a callback with frame copied out only once. A typical use - * case is the Barcode scanner application. - */ -#define FRAME_CALLBACK_FLAG_ENABLE_MASK 0x01 -#define FRAME_CALLBACK_FLAG_ONE_SHOT_MASK 0x02 -#define FRAME_CALLBACK_FLAG_COPY_OUT_MASK 0x04 - -// Typical use cases -#define FRAME_CALLBACK_FLAG_NOOP 0x00 -#define FRAME_CALLBACK_FLAG_CAMCORDER 0x01 -#define FRAME_CALLBACK_FLAG_CAMERA 0x05 -#define FRAME_CALLBACK_FLAG_BARCODE_SCANNER 0x07 - -// msgType in notifyCallback and dataCallback functions -enum { - CAMERA_MSG_ERROR = 0x001, - CAMERA_MSG_SHUTTER = 0x002, - CAMERA_MSG_FOCUS = 0x004, - CAMERA_MSG_ZOOM = 0x008, - CAMERA_MSG_PREVIEW_FRAME = 0x010, - CAMERA_MSG_VIDEO_FRAME = 0x020, - CAMERA_MSG_POSTVIEW_FRAME = 0x040, - CAMERA_MSG_RAW_IMAGE = 0x080, - CAMERA_MSG_COMPRESSED_IMAGE = 0x100, - CAMERA_MSG_ALL_MSGS = 0x1FF -}; - -// cmdType in sendCommand functions -enum { - CAMERA_CMD_START_SMOOTH_ZOOM = 1, - CAMERA_CMD_STOP_SMOOTH_ZOOM = 2, -}; - -// camera fatal errors -enum { - CAMERA_ERROR_UKNOWN = 1, - CAMERA_ERROR_SERVER_DIED = 100 -}; - -class ICameraService; -class ICamera; -class Surface; -class Mutex; -class String8; - -// ref-counted object for callbacks -class CameraListener: virtual public RefBase -{ -public: - virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2) = 0; - virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr) = 0; - virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr) = 0; -}; - -class Camera : public BnCameraClient, public IBinder::DeathRecipient -{ -public: - // construct a camera client from an existing remote - static sp<Camera> create(const sp<ICamera>& camera); - static sp<Camera> connect(); - ~Camera(); - void init(); - - status_t reconnect(); - void disconnect(); - status_t lock(); - status_t unlock(); - - status_t getStatus() { return mStatus; } - - // pass the buffered ISurface to the camera service - status_t setPreviewDisplay(const sp<Surface>& surface); - status_t setPreviewDisplay(const sp<ISurface>& surface); - - // start preview mode, must call setPreviewDisplay first - status_t startPreview(); - - // stop preview mode - void stopPreview(); - - // get preview state - bool previewEnabled(); - - // start recording mode, must call setPreviewDisplay first - status_t startRecording(); - - // stop recording mode - void stopRecording(); - - // get recording state - bool recordingEnabled(); - - // release a recording frame - void releaseRecordingFrame(const sp<IMemory>& mem); - - // autoFocus - status returned from callback - status_t autoFocus(); - - // cancel auto focus - status_t cancelAutoFocus(); - - // take a picture - picture returned from callback - status_t takePicture(); - - // set preview/capture parameters - key/value pairs - status_t setParameters(const String8& params); - - // get preview/capture parameters - key/value pairs - String8 getParameters() const; - - // send command to camera driver - status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2); - - void setListener(const sp<CameraListener>& listener); - void setPreviewCallbackFlags(int preview_callback_flag); - - // ICameraClient interface - virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2); - virtual void dataCallback(int32_t msgType, const sp<IMemory>& dataPtr); - virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr); - - sp<ICamera> remote(); - -private: - Camera(); - Camera(const Camera&); - Camera& operator=(const Camera); - virtual void binderDied(const wp<IBinder>& who); - - class DeathNotifier: public IBinder::DeathRecipient - { - public: - DeathNotifier() { - } - - virtual void binderDied(const wp<IBinder>& who); - }; - - static sp<DeathNotifier> mDeathNotifier; - - // helper function to obtain camera service handle - static const sp<ICameraService>& getCameraService(); - - sp<ICamera> mCamera; - status_t mStatus; - - sp<CameraListener> mListener; - - friend class DeathNotifier; - - static Mutex mLock; - static sp<ICameraService> mCameraService; - -}; - -}; // namespace android - -#endif - diff --git a/include/ui/CameraHardwareInterface.h b/include/ui/CameraHardwareInterface.h deleted file mode 100644 index 240c134..0000000 --- a/include/ui/CameraHardwareInterface.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H -#define ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H - -#include <binder/IMemory.h> -#include <utils/RefBase.h> -#include <ui/ISurface.h> -#include <ui/Camera.h> -#include <ui/CameraParameters.h> -#include <ui/Overlay.h> - -namespace android { -/** - * The size of image for display. - */ -typedef struct image_rect_struct -{ - uint32_t width; /* Image width */ - uint32_t height; /* Image height */ -} image_rect_type; - - -typedef void (*notify_callback)(int32_t msgType, - int32_t ext1, - int32_t ext2, - void* user); - -typedef void (*data_callback)(int32_t msgType, - const sp<IMemory>& dataPtr, - void* user); - -typedef void (*data_callback_timestamp)(nsecs_t timestamp, - int32_t msgType, - const sp<IMemory>& dataPtr, - void* user); - -/** - * CameraHardwareInterface.h defines the interface to the - * camera hardware abstraction layer, used for setting and getting - * parameters, live previewing, and taking pictures. - * - * It is a referenced counted interface with RefBase as its base class. - * CameraService calls openCameraHardware() to retrieve a strong pointer to the - * instance of this interface and may be called multiple times. The - * following steps describe a typical sequence: - * - * -# After CameraService calls openCameraHardware(), getParameters() and - * setParameters() are used to initialize the camera instance. - * CameraService calls getPreviewHeap() to establish access to the - * preview heap so it can be registered with SurfaceFlinger for - * efficient display updating while in preview mode. - * -# startPreview() is called. The camera instance then periodically - * sends the message CAMERA_MSG_PREVIEW_FRAME (if enabled) each time - * a new preview frame is available. If data callback code needs to use - * this memory after returning, it must copy the data. - * - * Prior to taking a picture, CameraService calls autofocus(). When auto - * focusing has completed, the camera instance sends a CAMERA_MSG_FOCUS notification, - * which informs the application whether focusing was successful. The camera instance - * only sends this message once and it is up to the application to call autoFocus() - * again if refocusing is desired. - * - * CameraService calls takePicture() to request the camera instance take a - * picture. At this point, if a shutter, postview, raw, and/or compressed callback - * is desired, the corresponding message must be enabled. As with CAMERA_MSG_PREVIEW_FRAME, - * any memory provided in a data callback must be copied if it's needed after returning. - */ -class CameraHardwareInterface : public virtual RefBase { -public: - virtual ~CameraHardwareInterface() { } - - /** Return the IMemoryHeap for the preview image heap */ - virtual sp<IMemoryHeap> getPreviewHeap() const = 0; - - /** Return the IMemoryHeap for the raw image heap */ - virtual sp<IMemoryHeap> getRawHeap() const = 0; - - /** Set the notification and data callbacks */ - virtual void setCallbacks(notify_callback notify_cb, - data_callback data_cb, - data_callback_timestamp data_cb_timestamp, - void* user) = 0; - - /** - * The following three functions all take a msgtype, - * which is a bitmask of the messages defined in - * include/ui/Camera.h - */ - - /** - * Enable a message, or set of messages. - */ - virtual void enableMsgType(int32_t msgType) = 0; - - /** - * Disable a message, or a set of messages. - */ - virtual void disableMsgType(int32_t msgType) = 0; - - /** - * Query whether a message, or a set of messages, is enabled. - * Note that this is operates as an AND, if any of the messages - * queried are off, this will return false. - */ - virtual bool msgTypeEnabled(int32_t msgType) = 0; - - /** - * Start preview mode. - */ - virtual status_t startPreview() = 0; - - /** - * Only used if overlays are used for camera preview. - */ - virtual bool useOverlay() {return false;} - virtual status_t setOverlay(const sp<Overlay> &overlay) {return BAD_VALUE;} - - /** - * Stop a previously started preview. - */ - virtual void stopPreview() = 0; - - /** - * Returns true if preview is enabled. - */ - virtual bool previewEnabled() = 0; - - /** - * Start record mode. When a record image is available a CAMERA_MSG_VIDEO_FRAME - * message is sent with the corresponding frame. Every record frame must be released - * by calling releaseRecordingFrame(). - */ - virtual status_t startRecording() = 0; - - /** - * Stop a previously started recording. - */ - virtual void stopRecording() = 0; - - /** - * Returns true if recording is enabled. - */ - virtual bool recordingEnabled() = 0; - - /** - * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME. - */ - virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0; - - /** - * Start auto focus, the notification callback routine is called - * with CAMERA_MSG_FOCUS once when focusing is complete. autoFocus() - * will be called again if another auto focus is needed. - */ - virtual status_t autoFocus() = 0; - - /** - * Cancels auto-focus function. If the auto-focus is still in progress, - * this function will cancel it. Whether the auto-focus is in progress - * or not, this function will return the focus position to the default. - * If the camera does not support auto-focus, this is a no-op. - */ - virtual status_t cancelAutoFocus() = 0; - - /** - * Take a picture. - */ - virtual status_t takePicture() = 0; - - /** - * Cancel a picture that was started with takePicture. Calling this - * method when no picture is being taken is a no-op. - */ - virtual status_t cancelPicture() = 0; - - /** Set the camera parameters. */ - virtual status_t setParameters(const CameraParameters& params) = 0; - - /** Return the camera parameters. */ - virtual CameraParameters getParameters() const = 0; - - /** - * Send command to camera driver. - */ - virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0; - - /** - * Release the hardware resources owned by this object. Note that this is - * *not* done in the destructor. - */ - virtual void release() = 0; - - /** - * Dump state of the camera hardware - */ - virtual status_t dump(int fd, const Vector<String16>& args) const = 0; -}; - -/** factory function to instantiate a camera hardware object */ -extern "C" sp<CameraHardwareInterface> openCameraHardware(); - -}; // namespace android - -#endif diff --git a/include/ui/CameraParameters.h b/include/ui/CameraParameters.h deleted file mode 100644 index 9e4e140..0000000 --- a/include/ui/CameraParameters.h +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef ANDROID_HARDWARE_CAMERA_PARAMETERS_H -#define ANDROID_HARDWARE_CAMERA_PARAMETERS_H - -#include <utils/KeyedVector.h> -#include <utils/String8.h> - -namespace android { - -class CameraParameters -{ -public: - CameraParameters(); - CameraParameters(const String8 ¶ms) { unflatten(params); } - ~CameraParameters(); - - enum { - CAMERA_ORIENTATION_UNKNOWN = 0, - CAMERA_ORIENTATION_PORTRAIT = 1, - CAMERA_ORIENTATION_LANDSCAPE = 2, - }; - - String8 flatten() const; - void unflatten(const String8 ¶ms); - - void set(const char *key, const char *value); - void set(const char *key, int value); - const char *get(const char *key) const; - int getInt(const char *key) const; - - /* preview-size=176x144 */ - void setPreviewSize(int width, int height); - void getPreviewSize(int *width, int *height) const; - - /* preview-fps=15 */ - void setPreviewFrameRate(int fps); - int getPreviewFrameRate() const; - - /* preview-format=rgb565|yuv422 */ - void setPreviewFormat(const char *format); - const char *getPreviewFormat() const; - - /* picture-size=1024x768 */ - void setPictureSize(int width, int height); - void getPictureSize(int *width, int *height) const; - - /* picture-format=yuv422|jpeg */ - void setPictureFormat(const char *format); - const char *getPictureFormat() const; - - int getOrientation() const; - void setOrientation(int orientation); - - void dump() const; - status_t dump(int fd, const Vector<String16>& args) const; - - // Parameter keys to communicate between camera application and driver. - // The access (read/write, read only, or write only) is viewed from the - // perspective of applications, not driver. - - // Preview frame size in pixels (width x height). - // Example value: "480x320". Read/Write. - static const char KEY_PREVIEW_SIZE[]; - // Supported preview frame sizes in pixels. - // Example value: "800x600,480x320". Read only. - static const char KEY_SUPPORTED_PREVIEW_SIZES[]; - // The image format for preview frames. - // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read/write. - static const char KEY_PREVIEW_FORMAT[]; - // Supported image formats for preview frames. - // Example value: "yuv420sp,yuv422i-yuyv". Read only. - static const char KEY_SUPPORTED_PREVIEW_FORMATS[]; - // Number of preview frames per second. - // Example value: "15". Read/write. - static const char KEY_PREVIEW_FRAME_RATE[]; - // Supported number of preview frames per second. - // Example value: "24,15,10". Read. - static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[]; - // The dimensions for captured pictures in pixels (width x height). - // Example value: "1024x768". Read/write. - static const char KEY_PICTURE_SIZE[]; - // Supported dimensions for captured pictures in pixels. - // Example value: "2048x1536,1024x768". Read only. - static const char KEY_SUPPORTED_PICTURE_SIZES[]; - // The image format for captured pictures. - // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write. - static const char KEY_PICTURE_FORMAT[]; - // Supported image formats for captured pictures. - // Example value: "jpeg,rgb565". Read only. - static const char KEY_SUPPORTED_PICTURE_FORMATS[]; - // The width (in pixels) of EXIF thumbnail in Jpeg picture. - // Example value: "512". Read/write. - static const char KEY_JPEG_THUMBNAIL_WIDTH[]; - // The height (in pixels) of EXIF thumbnail in Jpeg picture. - // Example value: "384". Read/write. - static const char KEY_JPEG_THUMBNAIL_HEIGHT[]; - // Supported EXIF thumbnail sizes (width x height). - // Example value: "512x384,320x240". Read only. - static const char KEY_SUPPORTED_THUMBNAIL_SIZES[]; - // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100, - // with 100 being the best. - // Example value: "90". Read/write. - static const char KEY_JPEG_THUMBNAIL_QUALITY[]; - // Jpeg quality of captured picture. The range is 1 to 100, with 100 being - // the best. - // Example value: "90". Read/write. - static const char KEY_JPEG_QUALITY[]; - // The orientation of the device in degrees. For example, suppose the - // natural position of the device is landscape. If the user takes a picture - // in landscape mode in 2048x1536 resolution, the rotation will be set to - // "0". If the user rotates the phone 90 degrees clockwise, the rotation - // should be set to "90". - // The camera driver can set orientation in the EXIF header without rotating - // the picture. Or the driver can rotate the picture and the EXIF thumbnail. - // If the Jpeg picture is rotated, the orientation in the EXIF header should - // be missing or 1 (row #0 is top and column #0 is left side). The driver - // should not set default value for this parameter. - // Example value: "0" or "90" or "180" or "270". Write only. - static const char KEY_ROTATION[]; - // GPS latitude coordinate. This will be stored in JPEG EXIF header. - // Example value: "25.032146". Write only. - static const char KEY_GPS_LATITUDE[]; - // GPS longitude coordinate. This will be stored in JPEG EXIF header. - // Example value: "121.564448". Write only. - static const char KEY_GPS_LONGITUDE[]; - // GPS altitude. This will be stored in JPEG EXIF header. - // Example value: "21.0". Write only. - static const char KEY_GPS_ALTITUDE[]; - // GPS timestamp (UTC in seconds since January 1, 1970). This should be - // stored in JPEG EXIF header. - // Example value: "1251192757". Write only. - static const char KEY_GPS_TIMESTAMP[]; - // Current white balance setting. - // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write. - static const char KEY_WHITE_BALANCE[]; - // Supported white balance settings. - // Example value: "auto,incandescent,daylight". Read only. - static const char KEY_SUPPORTED_WHITE_BALANCE[]; - // Current color effect setting. - // Example value: "none" or EFFECT_XXX constants. Read/write. - static const char KEY_EFFECT[]; - // Supported color effect settings. - // Example value: "none,mono,sepia". Read only. - static const char KEY_SUPPORTED_EFFECTS[]; - // Current antibanding setting. - // Example value: "auto" or ANTIBANDING_XXX constants. Read/write. - static const char KEY_ANTIBANDING[]; - // Supported antibanding settings. - // Example value: "auto,50hz,60hz,off". Read only. - static const char KEY_SUPPORTED_ANTIBANDING[]; - // Current scene mode. - // Example value: "auto" or SCENE_MODE_XXX constants. Read/write. - static const char KEY_SCENE_MODE[]; - // Supported scene mode settings. - // Example value: "auto,night,fireworks". Read only. - static const char KEY_SUPPORTED_SCENE_MODES[]; - // Current flash mode. - // Example value: "auto" or FLASH_MODE_XXX constants. Read/write. - static const char KEY_FLASH_MODE[]; - // Supported flash modes. - // Example value: "auto,on,off". Read only. - static const char KEY_SUPPORTED_FLASH_MODES[]; - // Current focus mode. If the camera does not support auto-focus, the value - // should be FOCUS_MODE_FIXED. If the focus mode is not FOCUS_MODE_FIXED or - // or FOCUS_MODE_INFINITY, applications should call - // CameraHardwareInterface.autoFocus to start the focus. - // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write. - static const char KEY_FOCUS_MODE[]; - // Supported focus modes. - // Example value: "auto,macro,fixed". Read only. - static const char KEY_SUPPORTED_FOCUS_MODES[]; - - // Values for white balance settings. - static const char WHITE_BALANCE_AUTO[]; - static const char WHITE_BALANCE_INCANDESCENT[]; - static const char WHITE_BALANCE_FLUORESCENT[]; - static const char WHITE_BALANCE_WARM_FLUORESCENT[]; - static const char WHITE_BALANCE_DAYLIGHT[]; - static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[]; - static const char WHITE_BALANCE_TWILIGHT[]; - static const char WHITE_BALANCE_SHADE[]; - - // Values for effect settings. - static const char EFFECT_NONE[]; - static const char EFFECT_MONO[]; - static const char EFFECT_NEGATIVE[]; - static const char EFFECT_SOLARIZE[]; - static const char EFFECT_SEPIA[]; - static const char EFFECT_POSTERIZE[]; - static const char EFFECT_WHITEBOARD[]; - static const char EFFECT_BLACKBOARD[]; - static const char EFFECT_AQUA[]; - - // Values for antibanding settings. - static const char ANTIBANDING_AUTO[]; - static const char ANTIBANDING_50HZ[]; - static const char ANTIBANDING_60HZ[]; - static const char ANTIBANDING_OFF[]; - - // Values for flash mode settings. - // Flash will not be fired. - static const char FLASH_MODE_OFF[]; - // Flash will be fired automatically when required. The flash may be fired - // during preview, auto-focus, or snapshot depending on the driver. - static const char FLASH_MODE_AUTO[]; - // Flash will always be fired during snapshot. The flash may also be - // fired during preview or auto-focus depending on the driver. - static const char FLASH_MODE_ON[]; - // Flash will be fired in red-eye reduction mode. - static const char FLASH_MODE_RED_EYE[]; - // Constant emission of light during preview, auto-focus and snapshot. - // This can also be used for video recording. - static const char FLASH_MODE_TORCH[]; - - // Values for scene mode settings. - static const char SCENE_MODE_AUTO[]; - static const char SCENE_MODE_ACTION[]; - static const char SCENE_MODE_PORTRAIT[]; - static const char SCENE_MODE_LANDSCAPE[]; - static const char SCENE_MODE_NIGHT[]; - static const char SCENE_MODE_NIGHT_PORTRAIT[]; - static const char SCENE_MODE_THEATRE[]; - static const char SCENE_MODE_BEACH[]; - static const char SCENE_MODE_SNOW[]; - static const char SCENE_MODE_SUNSET[]; - static const char SCENE_MODE_STEADYPHOTO[]; - static const char SCENE_MODE_FIREWORKS[]; - static const char SCENE_MODE_SPORTS[]; - static const char SCENE_MODE_PARTY[]; - static const char SCENE_MODE_CANDLELIGHT[]; - - // Formats for setPreviewFormat and setPictureFormat. - static const char PIXEL_FORMAT_YUV422SP[]; - static const char PIXEL_FORMAT_YUV420SP[]; // NV21 - static const char PIXEL_FORMAT_YUV422I[]; // YUY2 - static const char PIXEL_FORMAT_RGB565[]; - static const char PIXEL_FORMAT_JPEG[]; - - // Values for focus mode settings. - // Auto-focus mode. - static const char FOCUS_MODE_AUTO[]; - // Focus is set at infinity. Applications should not call - // CameraHardwareInterface.autoFocus in this mode. - static const char FOCUS_MODE_INFINITY[]; - static const char FOCUS_MODE_MACRO[]; - // Focus is fixed. The camera is always in this mode if the focus is not - // adjustable. If the camera has auto-focus, this mode can fix the - // focus, which is usually at hyperfocal distance. Applications should - // not call CameraHardwareInterface.autoFocus in this mode. - static const char FOCUS_MODE_FIXED[]; - -private: - DefaultKeyedVector<String8,String8> mMap; -}; - -}; // namespace android - -#endif diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h index b9c491b..e72b6b3 100644 --- a/include/ui/GraphicBuffer.h +++ b/include/ui/GraphicBuffer.h @@ -23,6 +23,7 @@ #include <ui/android_native_buffer.h> #include <ui/PixelFormat.h> #include <ui/Rect.h> +#include <utils/Flattenable.h> #include <pixelflinger/pixelflinger.h> struct android_native_buffer_t; @@ -30,7 +31,6 @@ struct android_native_buffer_t; namespace android { class GraphicBufferMapper; -class Parcel; // =========================================================================== // GraphicBuffer @@ -40,7 +40,7 @@ class GraphicBuffer : public EGLNativeBase< android_native_buffer_t, GraphicBuffer, - LightRefBase<GraphicBuffer> > + LightRefBase<GraphicBuffer> >, public Flattenable { public: @@ -97,7 +97,6 @@ public: uint32_t getVerticalStride() const; protected: - GraphicBuffer(const Parcel& reply); virtual ~GraphicBuffer(); enum { @@ -122,8 +121,16 @@ private: status_t initSize(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage); - static status_t writeToParcel(Parcel* reply, - android_native_buffer_t const* buffer); + void free_handle(); + + // Flattenable interface + size_t getFlattenedSize() const; + size_t getFdCount() const; + status_t flatten(void* buffer, size_t size, + int fds[], size_t count) const; + status_t unflatten(void const* buffer, size_t size, + int fds[], size_t count); + GraphicBufferMapper& mBufferMapper; ssize_t mInitCheck; diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h index be9c79b..741d763 100644 --- a/include/ui/GraphicBufferAllocator.h +++ b/include/ui/GraphicBufferAllocator.h @@ -86,7 +86,6 @@ private: GraphicBufferAllocator(); ~GraphicBufferAllocator(); - mutable Mutex mLock; alloc_device_t *mAllocDev; }; diff --git a/include/ui/ICamera.h b/include/ui/ICamera.h deleted file mode 100644 index 5642691..0000000 --- a/include/ui/ICamera.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef ANDROID_HARDWARE_ICAMERA_H -#define ANDROID_HARDWARE_ICAMERA_H - -#include <utils/RefBase.h> -#include <binder/IInterface.h> -#include <binder/Parcel.h> -#include <ui/ISurface.h> -#include <binder/IMemory.h> -#include <utils/String8.h> -#include <ui/Camera.h> - -namespace android { - -class ICameraClient; - -class ICamera: public IInterface -{ -public: - DECLARE_META_INTERFACE(Camera); - - virtual void disconnect() = 0; - - // connect new client with existing camera remote - virtual status_t connect(const sp<ICameraClient>& client) = 0; - - // prevent other processes from using this ICamera interface - virtual status_t lock() = 0; - - // allow other processes to use this ICamera interface - virtual status_t unlock() = 0; - - // pass the buffered ISurface to the camera service - virtual status_t setPreviewDisplay(const sp<ISurface>& surface) = 0; - - // set the preview callback flag to affect how the received frames from - // preview are handled. - virtual void setPreviewCallbackFlag(int flag) = 0; - - // start preview mode, must call setPreviewDisplay first - virtual status_t startPreview() = 0; - - // stop preview mode - virtual void stopPreview() = 0; - - // get preview state - virtual bool previewEnabled() = 0; - - // start recording mode - virtual status_t startRecording() = 0; - - // stop recording mode - virtual void stopRecording() = 0; - - // get recording state - virtual bool recordingEnabled() = 0; - - // release a recording frame - virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0; - - // auto focus - virtual status_t autoFocus() = 0; - - // cancel auto focus - virtual status_t cancelAutoFocus() = 0; - - // take a picture - virtual status_t takePicture() = 0; - - // set preview/capture parameters - key/value pairs - virtual status_t setParameters(const String8& params) = 0; - - // get preview/capture parameters - key/value pairs - virtual String8 getParameters() const = 0; - - // send command to camera driver - virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnCamera: public BnInterface<ICamera> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -}; // namespace android - -#endif diff --git a/include/ui/ICameraClient.h b/include/ui/ICameraClient.h deleted file mode 100644 index 236d0f6..0000000 --- a/include/ui/ICameraClient.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef ANDROID_HARDWARE_ICAMERA_APP_H -#define ANDROID_HARDWARE_ICAMERA_APP_H - -#include <utils/RefBase.h> -#include <binder/IInterface.h> -#include <binder/Parcel.h> -#include <binder/IMemory.h> -#include <utils/Timers.h> - -namespace android { - -class ICameraClient: public IInterface -{ -public: - DECLARE_META_INTERFACE(CameraClient); - - virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) = 0; - virtual void dataCallback(int32_t msgType, const sp<IMemory>& data) = 0; - virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& data) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnCameraClient: public BnInterface<ICameraClient> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -}; // namespace android - -#endif diff --git a/include/ui/ICameraService.h b/include/ui/ICameraService.h deleted file mode 100644 index 061681a..0000000 --- a/include/ui/ICameraService.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef ANDROID_HARDWARE_ICAMERASERVICE_H -#define ANDROID_HARDWARE_ICAMERASERVICE_H - -#include <utils/RefBase.h> -#include <binder/IInterface.h> -#include <binder/Parcel.h> - -#include <ui/ICameraClient.h> -#include <ui/ICamera.h> - -namespace android { - -class ICameraService : public IInterface -{ -public: - enum { - CONNECT = IBinder::FIRST_CALL_TRANSACTION, - }; - -public: - DECLARE_META_INTERFACE(CameraService); - - virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnCameraService: public BnInterface<ICameraService> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -}; // namespace android - -#endif diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h index 6d87321b..f46f25c 100644 --- a/include/ui/PixelFormat.h +++ b/include/ui/PixelFormat.h @@ -30,6 +30,7 @@ #include <sys/types.h> #include <utils/Errors.h> #include <pixelflinger/format.h> +#include <hardware/hardware.h> namespace android { @@ -57,25 +58,18 @@ enum { // real pixel formats supported for rendering ----------------------------- - PIXEL_FORMAT_RGBA_8888 = GGL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA - PIXEL_FORMAT_RGBX_8888 = GGL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0 - PIXEL_FORMAT_RGB_888 = GGL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB - PIXEL_FORMAT_RGB_565 = GGL_PIXEL_FORMAT_RGB_565, // 16-bit RGB - PIXEL_FORMAT_BGRA_8888 = GGL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA - PIXEL_FORMAT_RGBA_5551 = GGL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB - PIXEL_FORMAT_RGBA_4444 = GGL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB + PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA + PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0 + PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB + PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB + PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA + PIXEL_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB + PIXEL_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB PIXEL_FORMAT_A_8 = GGL_PIXEL_FORMAT_A_8, // 8-bit A PIXEL_FORMAT_L_8 = GGL_PIXEL_FORMAT_L_8, // 8-bit L (R=G=B=L) PIXEL_FORMAT_LA_88 = GGL_PIXEL_FORMAT_LA_88, // 16-bit LA PIXEL_FORMAT_RGB_332 = GGL_PIXEL_FORMAT_RGB_332, // 8-bit RGB - PIXEL_FORMAT_YCbCr_422_SP= GGL_PIXEL_FORMAT_YCbCr_422_SP, - PIXEL_FORMAT_YCbCr_420_SP= GGL_PIXEL_FORMAT_YCbCr_420_SP, - PIXEL_FORMAT_YCbCr_422_P = GGL_PIXEL_FORMAT_YCbCr_422_P, - PIXEL_FORMAT_YCbCr_420_P = GGL_PIXEL_FORMAT_YCbCr_420_P, - PIXEL_FORMAT_YCbCr_422_I = GGL_PIXEL_FORMAT_YCbCr_422_I, - PIXEL_FORMAT_YCbCr_420_I = GGL_PIXEL_FORMAT_YCbCr_420_I, - // New formats can be added if they're also defined in // pixelflinger/format.h }; @@ -97,9 +91,7 @@ struct PixelFormatInfo RGBA = 3, LUMINANCE = 4, LUMINANCE_ALPHA = 5, - Y_CB_CR_SP = 6, - Y_CB_CR_P = 7, - Y_CB_CR_I = 8, + OTHER = 0xFF }; struct szinfo { diff --git a/include/ui/Region.h b/include/ui/Region.h index 2bcad5b..925fd06 100644 --- a/include/ui/Region.h +++ b/include/ui/Region.h @@ -21,7 +21,6 @@ #include <sys/types.h> #include <utils/Vector.h> -#include <binder/Parcel.h> #include <ui/Rect.h> @@ -39,7 +38,6 @@ public: Region(); Region(const Region& rhs); explicit Region(const Rect& rhs); - explicit Region(const Parcel& parcel); explicit Region(const void* buffer); ~Region(); @@ -118,10 +116,6 @@ public: // be sorted in Y and X and must not make the region invalid. void addRectUnchecked(int l, int t, int r, int b); - // flatten/unflatten a region to/from a Parcel - status_t write(Parcel& parcel) const; - status_t read(const Parcel& parcel); - // flatten/unflatten a region to/from a raw buffer ssize_t write(void* buffer, size_t size) const; static ssize_t writeEmpty(void* buffer, size_t size); diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h index 3740db5..773fd93 100644 --- a/include/ui/egl/android_natives.h +++ b/include/ui/egl/android_natives.h @@ -69,7 +69,14 @@ enum { /* valid operations for the (*perform)() hook */ enum { - NATIVE_WINDOW_SET_USAGE = 0 + NATIVE_WINDOW_SET_USAGE = 0, + NATIVE_WINDOW_CONNECT = 1, + NATIVE_WINDOW_DISCONNECT = 2 +}; + +/* parameter for NATIVE_WINDOW_[DIS]CONNECT */ +enum { + NATIVE_WINDOW_API_EGL = 1 }; typedef struct android_native_window_t @@ -157,8 +164,13 @@ typedef struct android_native_window_t * This hook should not be called directly, instead use the helper functions * defined below. * + * (*perform)() returns -ENOENT if the 'what' parameter is not supported + * by the surface's implementation. + * * The valid operations are: * NATIVE_WINDOW_SET_USAGE + * NATIVE_WINDOW_CONNECT + * NATIVE_WINDOW_DISCONNECT * */ @@ -185,6 +197,30 @@ static inline int native_window_set_usage( return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage); } +/* + * native_window_connect(..., NATIVE_WINDOW_API_EGL) must be called + * by EGL when the window is made current. + * Returns -EINVAL if for some reason the window cannot be connected, which + * can happen if it's connected to some other API. + */ +static inline int native_window_connect( + android_native_window_t* window, int api) +{ + return window->perform(window, NATIVE_WINDOW_CONNECT, api); +} + +/* + * native_window_disconnect(..., NATIVE_WINDOW_API_EGL) must be called + * by EGL when the window is made not current. + * An error is returned if for instance the window wasn't connected in the + * first place. + */ +static inline int native_window_disconnect( + android_native_window_t* window, int api) +{ + return window->perform(window, NATIVE_WINDOW_DISCONNECT, api); +} + // --------------------------------------------------------------------------- diff --git a/include/utils/AndroidUnicode.h b/include/utils/AndroidUnicode.h deleted file mode 100644 index 563fcd0..0000000 --- a/include/utils/AndroidUnicode.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2006 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. - */ - -// - -#ifndef ANDROID_UNICODE_H -#define ANDROID_UNICODE_H - -#include <stdint.h> -#include <sys/types.h> - -#define REPLACEMENT_CHAR (0xFFFD) - -// this part of code is copied from umachine.h under ICU -/** - * Define UChar32 as a type for single Unicode code points. - * UChar32 is a signed 32-bit integer (same as int32_t). - * - * The Unicode code point range is 0..0x10ffff. - * All other values (negative or >=0x110000) are illegal as Unicode code points. - * They may be used as sentinel values to indicate "done", "error" - * or similar non-code point conditions. - * - * @stable ICU 2.4 - */ -typedef int32_t UChar32; - -namespace android { - - class Encoding; - /** - * \class Unicode - * - * Helper class for getting properties of Unicode characters. Characters - * can have one of the types listed in CharType and each character can have the - * directionality of Direction. - */ - class Unicode - { - public: - /** - * Directions specified in the Unicode standard. These directions map directly - * to java.lang.Character. - */ - enum Direction { - DIRECTIONALITY_UNDEFINED = -1, - DIRECTIONALITY_LEFT_TO_RIGHT, - DIRECTIONALITY_RIGHT_TO_LEFT, - DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC, - DIRECTIONALITY_EUROPEAN_NUMBER, - DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR, - DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, - DIRECTIONALITY_ARABIC_NUMBER, - DIRECTIONALITY_COMMON_NUMBER_SEPARATOR, - DIRECTIONALITY_NONSPACING_MARK, - DIRECTIONALITY_BOUNDARY_NEUTRAL, - DIRECTIONALITY_PARAGRAPH_SEPARATOR, - DIRECTIONALITY_SEGMENT_SEPARATOR, - DIRECTIONALITY_WHITESPACE, - DIRECTIONALITY_OTHER_NEUTRALS, - DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING, - DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE, - DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING, - DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE, - DIRECTIONALITY_POP_DIRECTIONAL_FORMAT - }; - - /** - * Character types as specified in the Unicode standard. These map directly to - * java.lang.Character. - */ - enum CharType { - CHARTYPE_UNASSIGNED = 0, - CHARTYPE_UPPERCASE_LETTER, - CHARTYPE_LOWERCASE_LETTER, - CHARTYPE_TITLECASE_LETTER, - CHARTYPE_MODIFIER_LETTER, - CHARTYPE_OTHER_LETTER, - CHARTYPE_NON_SPACING_MARK, - CHARTYPE_ENCLOSING_MARK, - CHARTYPE_COMBINING_SPACING_MARK, - CHARTYPE_DECIMAL_DIGIT_NUMBER, - CHARTYPE_LETTER_NUMBER, - CHARTYPE_OTHER_NUMBER, - CHARTYPE_SPACE_SEPARATOR, - CHARTYPE_LINE_SEPARATOR, - CHARTYPE_PARAGRAPH_SEPARATOR, - CHARTYPE_CONTROL, - CHARTYPE_FORMAT, - CHARTYPE_MISSING_VALUE_FOR_JAVA, /* This is the mysterious missing 17 value from the java constants */ - CHARTYPE_PRIVATE_USE, - CHARTYPE_SURROGATE, - CHARTYPE_DASH_PUNCTUATION, - CHARTYPE_START_PUNCTUATION, - CHARTYPE_END_PUNCTUATION, - CHARTYPE_CONNECTOR_PUNCTUATION, - CHARTYPE_OTHER_PUNCTUATION, - CHARTYPE_MATH_SYMBOL, - CHARTYPE_CURRENCY_SYMBOL, - CHARTYPE_MODIFIER_SYMBOL, - CHARTYPE_OTHER_SYMBOL, - CHARTYPE_INITIAL_QUOTE_PUNCTUATION, - CHARTYPE_FINAL_QUOTE_PUNCTUATION - }; - - /** - * Decomposition types as described by the unicode standard. These values map to - * the same values in uchar.h in ICU. - */ - enum DecompositionType { - DECOMPOSITION_NONE = 0, - DECOMPOSITION_CANONICAL, - DECOMPOSITION_COMPAT, - DECOMPOSITION_CIRCLE, - DECOMPOSITION_FINAL, - DECOMPOSITION_FONT, - DECOMPOSITION_FRACTION, - DECOMPOSITION_INITIAL, - DECOMPOSITION_ISOLATED, - DECOMPOSITION_MEDIAL, - DECOMPOSITION_NARROW, - DECOMPOSITION_NOBREAK, - DECOMPOSITION_SMALL, - DECOMPOSITION_SQUARE, - DECOMPOSITION_SUB, - DECOMPOSITION_SUPER, - DECOMPOSITION_VERTICAL, - DECOMPOSITION_WIDE - }; - - /** - * Returns the packed data for java calls - * @param c The unicode character. - * @return The packed data for the character. - * - * Copied from java.lang.Character implementation: - * 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - * F E D C B A 9 8 7 6 5 4 3 2 1 0 F E D C B A 9 8 7 6 5 4 3 2 1 0 - * - * 31 types --------- - * 18 directionalities --------- - * 2 mirroreds - - * ----------- 56 toupper diffs - * ----------- 48 tolower diffs - * --- 4 totitlecase diffs - * ------------- 84 numeric values - * --------- 24 mirror char diffs - */ - static uint32_t getPackedData(UChar32 c); - - /** - * Get the Character type. - * @param c The unicode character. - * @return The character's type or CHARTYPE_UNASSIGNED if the character is invalid - * or has an unassigned class. - */ - static CharType getType(UChar32 c); - - /** - * Get the Character's decomposition type. - * @param c The unicode character. - * @return The character's decomposition type or DECOMPOSITION_NONE is there - * is no decomposition. - */ - static DecompositionType getDecompositionType(UChar32 c); - - /** - * Returns the digit value of a character or -1 if the character - * is not within the specified radix. - * - * The digit value is computed for integer characters and letters - * within the given radix. This function does not handle Roman Numerals, - * fractions, or any other characters that may represent numbers. - * - * @param c The unicode character - * @param radix The intended radix. - * @return The digit value or -1 if there is no digit value or if the value is outside the radix. - */ - static int getDigitValue(UChar32 c, int radix = 10); - - /** - * Return the numeric value of a character - * - * @param c The unicode character. - * @return The numeric value of the character. -1 if the character has no numeric value, - * -2 if the character has a numeric value that is not representable by an integer. - */ - static int getNumericValue(UChar32 c); - - /** - * Convert the character to lowercase - * @param c The unicode character. - * @return The lowercase character equivalent of c. If c does not have a lowercase equivalent, - * the original character is returned. - */ - static UChar32 toLower(UChar32 c); - - /** - * Convert the character to uppercase - * @param c The unicode character. - * @return The uppercase character equivalent of c. If c does not have an uppercase equivalent, - * the original character is returned. - */ - static UChar32 toUpper(UChar32 c); - - /** - * Get the directionality of the character. - * @param c The unicode character. - * @return The direction of the character or DIRECTIONALITY_UNDEFINED. - */ - static Direction getDirectionality(UChar32 c); - - /** - * Check if the character is a mirrored character. This means that the character - * has an equivalent character that is the mirror image of itself. - * @param c The unicode character. - * @return True iff c has a mirror equivalent. - */ - static bool isMirrored(UChar32 c); - - /** - * Return the mirror of the given character. - * @param c The unicode character. - * @return The mirror equivalent of c. If c does not have a mirror equivalent, - * the original character is returned. - * @see isMirrored - */ - static UChar32 toMirror(UChar32 c); - - /** - * Convert the character to title case. - * @param c The unicode character. - * @return The titlecase equivalent of c. If c does not have a titlecase equivalent, - * the original character is returned. - */ - static UChar32 toTitle(UChar32 c); - - }; - -} - -#endif diff --git a/include/utils/Flattenable.h b/include/utils/Flattenable.h new file mode 100644 index 0000000..852be3b --- /dev/null +++ b/include/utils/Flattenable.h @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#ifndef ANDROID_UTILS_FLATTENABLE_H +#define ANDROID_UTILS_FLATTENABLE_H + + +#include <stdint.h> +#include <sys/types.h> +#include <utils/Errors.h> + +namespace android { + +class Flattenable +{ +public: + // size in bytes of the flattened object + virtual size_t getFlattenedSize() const = 0; + + // number of file descriptors to flatten + virtual size_t getFdCount() const = 0; + + // flattens the object into buffer. + // size should be at least of getFlattenedSize() + // file descriptors are written in the fds[] array but ownership is + // not transfered (ie: they must be dupped by the caller of + // flatten() if needed). + virtual status_t flatten(void* buffer, size_t size, + int fds[], size_t count) const = 0; + + // unflattens the object from buffer. + // size should be equal to the value of getFlattenedSize() when the + // object was flattened. + // unflattened file descriptors are found in the fds[] array and + // don't need to be dupped(). ie: the caller of unflatten doesn't + // keep ownership. If a fd is not retained by unflatten() it must be + // explicitly closed. + virtual status_t unflatten(void const* buffer, size_t size, + int fds[], size_t count) = 0; + +protected: + virtual ~Flattenable() = 0; + +}; + +}; // namespace android + + +#endif /* ANDROID_UTILS_FLATTENABLE_H */ diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h index 49145e8..b701ce7 100644 --- a/include/utils/ResourceTypes.h +++ b/include/utils/ResourceTypes.h @@ -393,7 +393,10 @@ struct ResStringPool_header enum { // If set, the string index is sorted by the string values (based // on strcmp16()). - SORTED_FLAG = 1<<0 + SORTED_FLAG = 1<<0, + + // String pool is encoded in UTF-8 + UTF8_FLAG = 1<<8 }; uint32_t flags; @@ -444,6 +447,8 @@ public: } const char16_t* stringAt(size_t idx, size_t* outLen) const; + const char* string8At(size_t idx, size_t* outLen) const; + const ResStringPool_span* styleAt(const ResStringPool_ref& ref) const; const ResStringPool_span* styleAt(size_t idx) const; @@ -451,14 +456,20 @@ public: size_t size() const; +#ifndef HAVE_ANDROID_OS + bool isUTF8() const; +#endif + private: status_t mError; void* mOwnedData; const ResStringPool_header* mHeader; size_t mSize; + mutable Mutex mDecodeLock; const uint32_t* mEntries; const uint32_t* mEntryStyles; - const char16_t* mStrings; + const void* mStrings; + char16_t** mCache; uint32_t mStringPoolSize; // number of uint16_t const uint32_t* mStyles; uint32_t mStylePoolSize; // number of uint32_t @@ -620,6 +631,8 @@ public: void restart(); + const ResStringPool& getStrings() const; + event_code_t getEventType() const; // Note, unlike XmlPullParser, the first call to next() will return // START_TAG of the first element. @@ -705,8 +718,6 @@ public: void uninit(); - const ResStringPool& getStrings() const; - private: friend class ResXMLParser; @@ -930,10 +941,25 @@ struct ResTable_config SCREENLONG_YES = 0x20, }; + enum { + // uiMode bits for the mode type. + MASK_UI_MODE_TYPE = 0x0f, + UI_MODE_TYPE_ANY = 0x00, + UI_MODE_TYPE_NORMAL = 0x01, + UI_MODE_TYPE_DESK = 0x02, + UI_MODE_TYPE_CAR = 0x03, + + // uiMode bits for the night switch. + MASK_UI_MODE_NIGHT = 0x30, + UI_MODE_NIGHT_ANY = 0x00, + UI_MODE_NIGHT_NO = 0x10, + UI_MODE_NIGHT_YES = 0x20, + }; + union { struct { uint8_t screenLayout; - uint8_t screenConfigPad0; + uint8_t uiMode; uint8_t screenConfigPad1; uint8_t screenConfigPad2; }; @@ -987,6 +1013,8 @@ struct ResTable_config diff = (int32_t)(version - o.version); if (diff != 0) return diff; diff = (int32_t)(screenLayout - o.screenLayout); + if (diff != 0) return diff; + diff = (int32_t)(uiMode - o.uiMode); return (int)diff; } @@ -1005,7 +1033,8 @@ struct ResTable_config CONFIG_DENSITY = 0x0100, CONFIG_SCREEN_SIZE = 0x0200, CONFIG_VERSION = 0x0400, - CONFIG_SCREEN_LAYOUT = 0x0800 + CONFIG_SCREEN_LAYOUT = 0x0800, + CONFIG_UI_MODE = 0x1000 }; // Compare two configuration, returning CONFIG_* flags set for each value @@ -1025,6 +1054,7 @@ struct ResTable_config if (screenSize != o.screenSize) diffs |= CONFIG_SCREEN_SIZE; if (version != o.version) diffs |= CONFIG_VERSION; if (screenLayout != o.screenLayout) diffs |= CONFIG_SCREEN_LAYOUT; + if (uiMode != o.uiMode) diffs |= CONFIG_UI_MODE; return diffs; } @@ -1058,7 +1088,7 @@ struct ResTable_config } } - if (screenConfig || o.screenConfig) { + if (screenLayout || o.screenLayout) { if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0) { if (!(screenLayout & MASK_SCREENSIZE)) return false; if (!(o.screenLayout & MASK_SCREENSIZE)) return true; @@ -1069,19 +1099,28 @@ struct ResTable_config } } - if (screenType || o.screenType) { - if (orientation != o.orientation) { - if (!orientation) return false; - if (!o.orientation) return true; + if (orientation != o.orientation) { + if (!orientation) return false; + if (!o.orientation) return true; + } + + if (uiMode || o.uiMode) { + if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0) { + if (!(uiMode & MASK_UI_MODE_TYPE)) return false; + if (!(o.uiMode & MASK_UI_MODE_TYPE)) return true; } + if (((uiMode^o.uiMode) & MASK_UI_MODE_NIGHT) != 0) { + if (!(uiMode & MASK_UI_MODE_NIGHT)) return false; + if (!(o.uiMode & MASK_UI_MODE_NIGHT)) return true; + } + } - // density is never 'more specific' - // as the default just equals 160 + // density is never 'more specific' + // as the default just equals 160 - if (touchscreen != o.touchscreen) { - if (!touchscreen) return false; - if (!o.touchscreen) return true; - } + if (touchscreen != o.touchscreen) { + if (!touchscreen) return false; + if (!o.touchscreen) return true; } if (input || o.input) { @@ -1166,7 +1205,7 @@ struct ResTable_config } } - if (screenConfig || o.screenConfig) { + if (screenLayout || o.screenLayout) { if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0 && (requested->screenLayout & MASK_SCREENSIZE)) { return (screenLayout & MASK_SCREENSIZE); @@ -1177,11 +1216,22 @@ struct ResTable_config } } - if (screenType || o.screenType) { - if ((orientation != o.orientation) && requested->orientation) { - return (orientation); + if ((orientation != o.orientation) && requested->orientation) { + return (orientation); + } + + if (uiMode || o.uiMode) { + if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0 + && (requested->uiMode & MASK_UI_MODE_TYPE)) { + return (uiMode & MASK_UI_MODE_TYPE); } + if (((uiMode^o.uiMode) & MASK_UI_MODE_NIGHT) != 0 + && (requested->uiMode & MASK_UI_MODE_NIGHT)) { + return (uiMode & MASK_UI_MODE_NIGHT); + } + } + if (screenType || o.screenType) { if (density != o.density) { // density is tough. Any density is potentially useful // because the system will scale it. Scaling down @@ -1331,6 +1381,20 @@ struct ResTable_config && screenLong != setScreenLong) { return false; } + + const int uiModeType = uiMode&MASK_UI_MODE_TYPE; + const int setUiModeType = settings.uiMode&MASK_UI_MODE_TYPE; + if (setUiModeType != 0 && uiModeType != 0 + && uiModeType != setUiModeType) { + return false; + } + + const int uiModeNight = uiMode&MASK_UI_MODE_NIGHT; + const int setUiModeNight = settings.uiMode&MASK_UI_MODE_NIGHT; + if (setUiModeNight != 0 && uiModeNight != 0 + && uiModeNight != setUiModeNight) { + return false; + } } if (screenType != 0) { if (settings.orientation != 0 && orientation != 0 @@ -1411,13 +1475,15 @@ struct ResTable_config String8 toString() const { char buf[200]; sprintf(buf, "imsi=%d/%d lang=%c%c reg=%c%c orient=%d touch=%d dens=%d " - "kbd=%d nav=%d input=%d scrnW=%d scrnH=%d sz=%d long=%d vers=%d.%d", + "kbd=%d nav=%d input=%d scrnW=%d scrnH=%d sz=%d long=%d " + "ui=%d night=%d vers=%d.%d", mcc, mnc, language[0] ? language[0] : '-', language[1] ? language[1] : '-', country[0] ? country[0] : '-', country[1] ? country[1] : '-', orientation, touchscreen, density, keyboard, navigation, inputFlags, screenWidth, screenHeight, screenLayout&MASK_SCREENSIZE, screenLayout&MASK_SCREENLONG, + uiMode&MASK_UI_MODE_TYPE, uiMode&MASK_UI_MODE_NIGHT, sdkVersion, minorVersion); return String8(buf); } diff --git a/include/utils/String16.h b/include/utils/String16.h index a2d22ee..07a0c11 100644 --- a/include/utils/String16.h +++ b/include/utils/String16.h @@ -49,12 +49,17 @@ int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2); // Version of strzcmp16 for comparing strings in different endianness. int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2); +// Convert UTF-8 to UTF-16 including surrogate pairs +void utf8_to_utf16(const uint8_t *src, size_t srcLen, char16_t* dst, const size_t dstLen); + } // --------------------------------------------------------------------------- namespace android { +// --------------------------------------------------------------------------- + class String8; class TextOutput; diff --git a/include/utils/String8.h b/include/utils/String8.h index ecc5774..c4b18a4 100644 --- a/include/utils/String8.h +++ b/include/utils/String8.h @@ -60,6 +60,11 @@ size_t utf32_length(const char *src, size_t src_len); /* * Returns the UTF-8 length of "src". */ +size_t utf8_length_from_utf16(const char16_t *src, size_t src_len); + +/* + * Returns the UTF-8 length of "src". + */ size_t utf8_length_from_utf32(const char32_t *src, size_t src_len); /* @@ -120,6 +125,9 @@ size_t utf8_to_utf32(const char* src, size_t src_len, size_t utf32_to_utf8(const char32_t* src, size_t src_len, char* dst, size_t dst_len); +size_t utf16_to_utf8(const char16_t* src, size_t src_len, + char* dst, size_t dst_len); + } // --------------------------------------------------------------------------- diff --git a/include/utils/threads.h b/include/utils/threads.h index 0fc533f..5ac0c5e 100644 --- a/include/utils/threads.h +++ b/include/utils/threads.h @@ -124,6 +124,24 @@ typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction, extern void androidSetCreateThreadFunc(android_create_thread_fn func); +// ------------------------------------------------------------------ +// Extra functions working with raw pids. + +// Get pid for the current thread. +extern pid_t androidGetTid(); + +// Change the scheduling group of a particular thread. The group +// should be one of the ANDROID_TGROUP constants. Returns BAD_VALUE if +// grp is out of range, else another non-zero value with errno set if +// the operation failed. +extern int androidSetThreadSchedulingGroup(pid_t tid, int grp); + +// Change the priority AND scheduling group of a particular thread. The priority +// should be one of the ANDROID_PRIORITY constants. Returns INVALID_OPERATION +// if the priority set failed, else another value if just the group set failed; +// in either case errno is set. +extern int androidSetThreadPriority(pid_t tid, int prio); + #ifdef __cplusplus } #endif @@ -191,7 +209,7 @@ inline thread_id_t getThreadId() { class Mutex { public: enum { - NORMAL = 0, + PRIVATE = 0, SHARED = 1 }; @@ -287,7 +305,13 @@ typedef Mutex::Autolock AutoMutex; */ class Condition { public: + enum { + PRIVATE = 0, + SHARED = 1 + }; + Condition(); + Condition(int type); ~Condition(); // Wait on the condition variable. Lock the mutex before calling. status_t wait(Mutex& mutex); @@ -311,6 +335,17 @@ private: inline Condition::Condition() { pthread_cond_init(&mCond, NULL); } +inline Condition::Condition(int type) { + if (type == SHARED) { + pthread_condattr_t attr; + pthread_condattr_init(&attr); + pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_cond_init(&mCond, &attr); + pthread_condattr_destroy(&attr); + } else { + pthread_cond_init(&mCond, NULL); + } +} inline Condition::~Condition() { pthread_cond_destroy(&mCond); } diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/libs/audioflinger/A2dpAudioInterface.cpp index 351815b..995e31c 100644 --- a/libs/audioflinger/A2dpAudioInterface.cpp +++ b/libs/audioflinger/A2dpAudioInterface.cpp @@ -185,7 +185,9 @@ String8 A2dpAudioInterface::getParameters(const String8& keys) String8 keyValuePairs = a2dpParam.toString(); if (param.size()) { - keyValuePairs += ";"; + if (keyValuePairs != "") { + keyValuePairs += ";"; + } keyValuePairs += mHardwareInterface->getParameters(param.toString()); } @@ -300,7 +302,7 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t Error: // Simulate audio output timing in case of error - usleep(bytes * 1000000 / frameSize() / sampleRate()); + usleep(((bytes * 1000 )/ frameSize() / sampleRate()) * 1000); return status; } @@ -455,4 +457,10 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::dump(int fd, const Vector<Strin return NO_ERROR; } +status_t A2dpAudioInterface::A2dpAudioStreamOut::getRenderPosition(uint32_t *driverFrames) +{ + //TODO: enable when supported by driver + return INVALID_OPERATION; +} + }; // namespace android diff --git a/libs/audioflinger/A2dpAudioInterface.h b/libs/audioflinger/A2dpAudioInterface.h index 530e432..48154f9 100644 --- a/libs/audioflinger/A2dpAudioInterface.h +++ b/libs/audioflinger/A2dpAudioInterface.h @@ -93,6 +93,7 @@ private: virtual status_t dump(int fd, const Vector<String16>& args); virtual status_t setParameters(const String8& keyValuePairs); virtual String8 getParameters(const String8& keys); + virtual status_t getRenderPosition(uint32_t *dspFrames); private: friend class A2dpAudioInterface; diff --git a/libs/audioflinger/Android.mk b/libs/audioflinger/Android.mk index f5c03bb..870c0b8 100644 --- a/libs/audioflinger/Android.mk +++ b/libs/audioflinger/Android.mk @@ -24,7 +24,7 @@ endif LOCAL_SHARED_LIBRARIES := \ libcutils \ libutils \ - libbinder \ + libbinder \ libmedia \ libhardware_legacy @@ -47,7 +47,7 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - AudioPolicyManagerGeneric.cpp + AudioPolicyManagerBase.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ @@ -60,7 +60,7 @@ else LOCAL_SHARED_LIBRARIES += libdl endif -LOCAL_MODULE:= libaudiopolicygeneric +LOCAL_MODULE:= libaudiopolicybase ifeq ($(BOARD_HAVE_BLUETOOTH),true) LOCAL_CFLAGS += -DWITH_A2DP @@ -70,7 +70,7 @@ ifeq ($(AUDIO_POLICY_TEST),true) LOCAL_CFLAGS += -DAUDIO_POLICY_TEST endif -include $(BUILD_SHARED_LIBRARY) +include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) @@ -85,13 +85,12 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ libutils \ - libbinder \ + libbinder \ libmedia \ - libhardware_legacy \ - libaudiopolicygeneric + libhardware_legacy ifeq ($(strip $(BOARD_USES_GENERIC_AUDIO)),true) - LOCAL_STATIC_LIBRARIES += libaudiointerface + LOCAL_STATIC_LIBRARIES += libaudiointerface libaudiopolicybase LOCAL_CFLAGS += -DGENERIC_AUDIO else LOCAL_SHARED_LIBRARIES += libaudio libaudiopolicy @@ -115,9 +114,17 @@ ifeq ($(AUDIO_POLICY_TEST),true) endif ifeq ($(TARGET_SIMULATOR),true) - ifeq ($(HOST_OS),linux) - LOCAL_LDLIBS += -lrt -lpthread - endif + ifeq ($(HOST_OS),linux) + LOCAL_LDLIBS += -lrt -lpthread + endif +endif + +ifeq ($(BOARD_USE_LVMX),true) + LOCAL_CFLAGS += -DLVMX + LOCAL_C_INCLUDES += vendor/nxp + LOCAL_STATIC_LIBRARIES += liblifevibes + LOCAL_SHARED_LIBRARIES += liblvmxservice +# LOCAL_SHARED_LIBRARIES += liblvmxipc endif include $(BUILD_SHARED_LIBRARY) diff --git a/libs/audioflinger/AudioDumpInterface.cpp b/libs/audioflinger/AudioDumpInterface.cpp index 858e5aa..a018b4c 100644 --- a/libs/audioflinger/AudioDumpInterface.cpp +++ b/libs/audioflinger/AudioDumpInterface.cpp @@ -379,6 +379,12 @@ void AudioStreamOutDump::Close() } } +status_t AudioStreamOutDump::getRenderPosition(uint32_t *dspFrames) +{ + if (mFinalStream != 0 ) return mFinalStream->getRenderPosition(dspFrames); + return INVALID_OPERATION; +} + // ---------------------------------------------------------------------------- AudioStreamInDump::AudioStreamInDump(AudioDumpInterface *interface, @@ -503,6 +509,12 @@ String8 AudioStreamInDump::getParameters(const String8& keys) return param.toString(); } +unsigned int AudioStreamInDump::getInputFramesLost() const +{ + if (mFinalStream != 0 ) return mFinalStream->getInputFramesLost(); + return 0; +} + status_t AudioStreamInDump::dump(int fd, const Vector<String16>& args) { if (mFinalStream != 0 ) return mFinalStream->dump(fd, args); diff --git a/libs/audioflinger/AudioDumpInterface.h b/libs/audioflinger/AudioDumpInterface.h index 1136ce1..4c62b3e 100644 --- a/libs/audioflinger/AudioDumpInterface.h +++ b/libs/audioflinger/AudioDumpInterface.h @@ -56,8 +56,9 @@ public: void Close(void); AudioStreamOut* finalStream() { return mFinalStream; } uint32_t device() { return mDevice; } - int getId() { return mId; } + virtual status_t getRenderPosition(uint32_t *dspFrames); + private: AudioDumpInterface *mInterface; int mId; @@ -93,6 +94,7 @@ public: virtual status_t standby(); virtual status_t setParameters(const String8& keyValuePairs); virtual String8 getParameters(const String8& keys); + virtual unsigned int getInputFramesLost() const; virtual status_t dump(int fd, const Vector<String16>& args); void Close(void); AudioStreamIn* finalStream() { return mFinalStream; } diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index ecfe1e0..2414e8d 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -47,6 +47,10 @@ #include "A2dpAudioInterface.h" #endif +#ifdef LVMX +#include "lifevibes.h" +#endif + // ---------------------------------------------------------------------------- // the sim build doesn't have gettid @@ -68,6 +72,10 @@ static const float MAX_GAIN = 4096.0f; // 50 * ~20msecs = 1 second static const int8_t kMaxTrackRetries = 50; static const int8_t kMaxTrackStartupRetries = 50; +// allow less retry attempts on direct output thread. +// direct outputs can be a scarce resource in audio hardware and should +// be released as quickly as possible. +static const int8_t kMaxTrackRetriesDirect = 2; static const int kDumpLockRetries = 50; static const int kDumpLockSleep = 20000; @@ -132,6 +140,9 @@ AudioFlinger::AudioFlinger() } else { LOGE("Couldn't even initialize the stubbed audio hardware!"); } +#ifdef LVMX + LifeVibes::init(); +#endif } AudioFlinger::~AudioFlinger() @@ -411,6 +422,11 @@ status_t AudioFlinger::setMode(int mode) AutoMutex lock(mHardwareLock); mHardwareStatus = AUDIO_HW_SET_MODE; status_t ret = mAudioHardware->setMode(mode); +#ifdef LVMX + if (NO_ERROR == ret) { + LifeVibes::setMode(mode); + } +#endif mHardwareStatus = AUDIO_HW_IDLE; return ret; } @@ -544,11 +560,11 @@ bool AudioFlinger::streamMute(int stream) const return mStreamTypes[stream].mute; } -bool AudioFlinger::isMusicActive() const +bool AudioFlinger::isStreamActive(int stream) const { Mutex::Autolock _l(mLock); for (uint32_t i = 0; i < mPlaybackThreads.size(); i++) { - if (mPlaybackThreads.valueAt(i)->isMusicActive()) { + if (mPlaybackThreads.valueAt(i)->isStreamActive(stream)) { return true; } } @@ -566,11 +582,37 @@ status_t AudioFlinger::setParameters(int ioHandle, const String8& keyValuePairs) return PERMISSION_DENIED; } +#ifdef LVMX + AudioParameter param = AudioParameter(keyValuePairs); + LifeVibes::setParameters(ioHandle,keyValuePairs); + String8 key = String8(AudioParameter::keyRouting); + int device; + if (NO_ERROR != param.getInt(key, device)) { + device = -1; + } + + key = String8(LifevibesTag); + String8 value; + int musicEnabled = -1; + if (NO_ERROR == param.get(key, value)) { + if (value == LifevibesEnable) { + musicEnabled = 1; + } else if (value == LifevibesDisable) { + musicEnabled = 0; + } + } +#endif + // ioHandle == 0 means the parameters are global to the audio hardware interface if (ioHandle == 0) { AutoMutex lock(mHardwareLock); mHardwareStatus = AUDIO_SET_PARAMETER; result = mAudioHardware->setParameters(keyValuePairs); +#ifdef LVMX + if ((NO_ERROR == result) && (musicEnabled != -1)) { + LifeVibes::enableMusic((bool) musicEnabled); + } +#endif mHardwareStatus = AUDIO_HW_IDLE; return result; } @@ -586,7 +628,13 @@ status_t AudioFlinger::setParameters(int ioHandle, const String8& keyValuePairs) } } if (thread != NULL) { - return thread->setParameters(keyValuePairs); + result = thread->setParameters(keyValuePairs); +#ifdef LVMX + if ((NO_ERROR == result) && (device != -1)) { + LifeVibes::setDevice(LifeVibes::threadIdToAudioOutputType(thread->id()), device); + } +#endif + return result; } return BAD_VALUE; } @@ -618,6 +666,21 @@ size_t AudioFlinger::getInputBufferSize(uint32_t sampleRate, int format, int cha return mAudioHardware->getInputBufferSize(sampleRate, format, channelCount); } +unsigned int AudioFlinger::getInputFramesLost(int ioHandle) +{ + if (ioHandle == 0) { + return 0; + } + + Mutex::Autolock _l(mLock); + + RecordThread *recordThread = checkRecordThread_l(ioHandle); + if (recordThread != NULL) { + return recordThread->getInputFramesLost(); + } + return 0; +} + status_t AudioFlinger::setVoiceVolume(float value) { // check calling permissions @@ -633,6 +696,20 @@ status_t AudioFlinger::setVoiceVolume(float value) return ret; } +status_t AudioFlinger::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) +{ + status_t status; + + Mutex::Autolock _l(mLock); + + PlaybackThread *playbackThread = checkPlaybackThread_l(output); + if (playbackThread != NULL) { + return playbackThread->getRenderPosition(halFrames, dspFrames); + } + + return BAD_VALUE; +} + void AudioFlinger::registerClient(const sp<IAudioFlingerClient>& client) { @@ -1029,12 +1106,24 @@ uint32_t AudioFlinger::PlaybackThread::latency() const status_t AudioFlinger::PlaybackThread::setMasterVolume(float value) { +#ifdef LVMX + int audioOutputType = LifeVibes::getMixerType(mId, mType); + if (LifeVibes::audioOutputTypeIsLifeVibes(audioOutputType)) { + LifeVibes::setMasterVolume(audioOutputType, value); + } +#endif mMasterVolume = value; return NO_ERROR; } status_t AudioFlinger::PlaybackThread::setMasterMute(bool muted) { +#ifdef LVMX + int audioOutputType = LifeVibes::getMixerType(mId, mType); + if (LifeVibes::audioOutputTypeIsLifeVibes(audioOutputType)) { + LifeVibes::setMasterMute(audioOutputType, muted); + } +#endif mMasterMute = muted; return NO_ERROR; } @@ -1051,12 +1140,24 @@ bool AudioFlinger::PlaybackThread::masterMute() const status_t AudioFlinger::PlaybackThread::setStreamVolume(int stream, float value) { +#ifdef LVMX + int audioOutputType = LifeVibes::getMixerType(mId, mType); + if (LifeVibes::audioOutputTypeIsLifeVibes(audioOutputType)) { + LifeVibes::setStreamVolume(audioOutputType, stream, value); + } +#endif mStreamTypes[stream].volume = value; return NO_ERROR; } status_t AudioFlinger::PlaybackThread::setStreamMute(int stream, bool muted) { +#ifdef LVMX + int audioOutputType = LifeVibes::getMixerType(mId, mType); + if (LifeVibes::audioOutputTypeIsLifeVibes(audioOutputType)) { + LifeVibes::setStreamMute(audioOutputType, stream, muted); + } +#endif mStreamTypes[stream].mute = muted; return NO_ERROR; } @@ -1071,7 +1172,7 @@ bool AudioFlinger::PlaybackThread::streamMute(int stream) const return mStreamTypes[stream].mute; } -bool AudioFlinger::PlaybackThread::isMusicActive() const +bool AudioFlinger::PlaybackThread::isStreamActive(int stream) const { Mutex::Autolock _l(mLock); size_t count = mActiveTracks.size(); @@ -1079,7 +1180,7 @@ bool AudioFlinger::PlaybackThread::isMusicActive() const sp<Track> t = mActiveTracks[i].promote(); if (t == 0) continue; Track* const track = t.get(); - if (t->type() == AudioSystem::MUSIC) + if (t->type() == stream) return true; } return false; @@ -1166,6 +1267,19 @@ void AudioFlinger::PlaybackThread::readOutputParameters() memset(mMixBuffer, 0, mFrameCount * 2 * sizeof(int16_t)); } +status_t AudioFlinger::PlaybackThread::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames) +{ + if (halFrames == 0 || dspFrames == 0) { + return BAD_VALUE; + } + if (mOutput == 0) { + return INVALID_OPERATION; + } + *halFrames = mBytesWritten/mOutput->frameSize(); + + return mOutput->getRenderPosition(dspFrames); +} + // ---------------------------------------------------------------------------- AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id) @@ -1290,8 +1404,15 @@ bool AudioFlinger::MixerThread::threadLoop() if (sleepTime == 0) { mLastWriteTime = systemTime(); mInWrite = true; + mBytesWritten += mixBufferSize; +#ifdef LVMX + int audioOutputType = LifeVibes::getMixerType(mId, mType); + if (LifeVibes::audioOutputTypeIsLifeVibes(audioOutputType)) { + LifeVibes::process(audioOutputType, curBuf, mixBufferSize); + } +#endif int bytesWritten = (int)mOutput->write(curBuf, mixBufferSize); - if (bytesWritten > 0) mBytesWritten += bytesWritten; + if (bytesWritten < 0) mBytesWritten -= mixBufferSize; mNumWrites++; mInWrite = false; nsecs_t now = systemTime(); @@ -1333,6 +1454,29 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track uint32_t mixerStatus = MIXER_IDLE; // find out which tracks need to be processed size_t count = activeTracks.size(); + + float masterVolume = mMasterVolume; + bool masterMute = mMasterMute; + +#ifdef LVMX + bool tracksConnectedChanged = false; + bool stateChanged = false; + + int audioOutputType = LifeVibes::getMixerType(mId, mType); + if (LifeVibes::audioOutputTypeIsLifeVibes(audioOutputType)) + { + int activeTypes = 0; + for (size_t i=0 ; i<count ; i++) { + sp<Track> t = activeTracks[i].promote(); + if (t == 0) continue; + Track* const track = t.get(); + int iTracktype=track->type(); + activeTypes |= 1<<track->type(); + } + LifeVibes::computeVolumes(audioOutputType, activeTypes, tracksConnectedChanged, stateChanged, masterVolume, masterMute); + } +#endif + for (size_t i=0 ; i<count ; i++) { sp<Track> t = activeTracks[i].promote(); if (t == 0) continue; @@ -1344,21 +1488,33 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track // for all its buffers to be filled before processing it mAudioMixer->setActiveTrack(track->name()); if (cblk->framesReady() && (track->isReady() || track->isStopped()) && - !track->isPaused()) + !track->isPaused() && !track->isTerminated()) { //LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this); // compute volume for this track int16_t left, right; - if (track->isMuted() || mMasterMute || track->isPausing() || + if (track->isMuted() || masterMute || track->isPausing() || mStreamTypes[track->type()].mute) { left = right = 0; if (track->isPausing()) { track->setPaused(); } } else { + // read original volumes with volume control float typeVolume = mStreamTypes[track->type()].volume; - float v = mMasterVolume * typeVolume; +#ifdef LVMX + bool streamMute=false; + // read the volume from the LivesVibes audio engine. + if (LifeVibes::audioOutputTypeIsLifeVibes(audioOutputType)) + { + LifeVibes::getStreamVolumes(audioOutputType, track->type(), &typeVolume, &streamMute); + if (streamMute) { + typeVolume = 0; + } + } +#endif + float v = masterVolume * typeVolume; float v_clamped = v * cblk->volume[0]; if (v_clamped > MAX_GAIN) v_clamped = MAX_GAIN; left = int16_t(v_clamped); @@ -1384,7 +1540,13 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track // do not apply ramp param = AudioMixer::RAMP_VOLUME; } - +#ifdef LVMX + if ( tracksConnectedChanged || stateChanged ) + { + // only do the ramp when the volume is changed by the user / application + param = AudioMixer::VOLUME; + } +#endif mAudioMixer->setParameter(param, AudioMixer::VOLUME0, left); mAudioMixer->setParameter(param, AudioMixer::VOLUME1, right); mAudioMixer->setParameter( @@ -1636,6 +1798,9 @@ bool AudioFlinger::DirectOutputThread::threadLoop() uint32_t activeSleepTime = activeSleepTimeUs(); uint32_t idleSleepTime = idleSleepTimeUs(); uint32_t sleepTime = idleSleepTime; + // use shorter standby delay as on normal output to release + // hardware resources as soon as possible + nsecs_t standbyDelay = microseconds(activeSleepTime*2); while (!exitPending()) @@ -1652,6 +1817,7 @@ bool AudioFlinger::DirectOutputThread::threadLoop() mixBufferSize = mFrameCount*mFrameSize; activeSleepTime = activeSleepTimeUs(); idleSleepTime = idleSleepTimeUs(); + standbyDelay = microseconds(activeSleepTime*2); } // put audio hardware into standby after short delay @@ -1684,7 +1850,7 @@ bool AudioFlinger::DirectOutputThread::threadLoop() } } - standbyTime = systemTime() + kStandbyTimeInNsecs; + standbyTime = systemTime() + standbyDelay; sleepTime = idleSleepTime; continue; } @@ -1701,7 +1867,7 @@ bool AudioFlinger::DirectOutputThread::threadLoop() // The first time a track is added we wait // for all its buffers to be filled before processing it if (cblk->framesReady() && (track->isReady() || track->isStopped()) && - !track->isPaused()) + !track->isPaused() && !track->isTerminated()) { //LOGV("track %d u=%08x, s=%08x [OK]", track->name(), cblk->user, cblk->server); @@ -1738,7 +1904,7 @@ bool AudioFlinger::DirectOutputThread::threadLoop() } // reset retry count - track->mRetryCount = kMaxTrackRetries; + track->mRetryCount = kMaxTrackRetriesDirect; activeTrack = t; mixerStatus = MIXER_TRACKS_READY; } else { @@ -1791,7 +1957,7 @@ bool AudioFlinger::DirectOutputThread::threadLoop() activeTrack->releaseBuffer(&buffer); } sleepTime = 0; - standbyTime = systemTime() + kStandbyTimeInNsecs; + standbyTime = systemTime() + standbyDelay; } else { if (sleepTime == 0) { if (mixerStatus == MIXER_TRACKS_ENABLED) { @@ -1812,8 +1978,9 @@ bool AudioFlinger::DirectOutputThread::threadLoop() if (sleepTime == 0) { mLastWriteTime = systemTime(); mInWrite = true; + mBytesWritten += mixBufferSize; int bytesWritten = (int)mOutput->write(mMixBuffer, mixBufferSize); - if (bytesWritten) mBytesWritten += bytesWritten; + if (bytesWritten < 0) mBytesWritten -= mixBufferSize; mNumWrites++; mInWrite = false; mStandby = false; @@ -2900,7 +3067,7 @@ void AudioFlinger::PlaybackThread::OutputTrack::clearBufferQueue() AudioFlinger::Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid) : RefBase(), mAudioFlinger(audioFlinger), - mMemoryDealer(new MemoryDealer(1024*1024)), + mMemoryDealer(new MemoryDealer(1024*1024, "AudioFlinger::Client")), mPid(pid) { // 1 MB of address space is good for 32 tracks, 8 buffers each, 4 KB/buffer @@ -3203,7 +3370,10 @@ bool AudioFlinger::RecordThread::threadLoop() if (mBytesRead < 0) { LOGE("Error reading audio input"); if (mActiveTrack->mState == TrackBase::ACTIVE) { - sleep(1); + // Force input into standby so that it tries to + // recover at next read attempt + mInput->standby(); + usleep(5000); } mRsmpInIndex = mFrameCount; framesOut = 0; @@ -3385,7 +3555,10 @@ status_t AudioFlinger::RecordThread::getNextBuffer(AudioBufferProvider::Buffer* if (mBytesRead < 0) { LOGE("RecordThread::getNextBuffer() Error reading audio input"); if (mActiveTrack->mState == TrackBase::ACTIVE) { - sleep(1); + // Force input into standby so that it tries to + // recover at next read attempt + mInput->standby(); + usleep(5000); } buffer->raw = 0; buffer->frameCount = 0; @@ -3546,6 +3719,11 @@ void AudioFlinger::RecordThread::readInputParameters() mRsmpInIndex = mFrameCount; } +unsigned int AudioFlinger::RecordThread::getInputFramesLost() +{ + return mInput->getInputFramesLost(); +} + // ---------------------------------------------------------------------------- int AudioFlinger::openOutput(uint32_t *pDevices, @@ -3597,6 +3775,18 @@ int AudioFlinger::openOutput(uint32_t *pDevices, } else { thread = new MixerThread(this, output, ++mNextThreadId); LOGV("openOutput() created mixer output: ID %d thread %p", mNextThreadId, thread); + +#ifdef LVMX + unsigned bitsPerSample = + (format == AudioSystem::PCM_16_BIT) ? 16 : + ((format == AudioSystem::PCM_8_BIT) ? 8 : 0); + unsigned channelCount = (channels == AudioSystem::CHANNEL_OUT_STEREO) ? 2 : 1; + int audioOutputType = LifeVibes::threadIdToAudioOutputType(thread->id()); + + LifeVibes::init_aot(audioOutputType, samplingRate, bitsPerSample, channelCount); + LifeVibes::setDevice(audioOutputType, *pDevices); +#endif + } mPlaybackThreads.add(mNextThreadId, thread); diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h index 12c90eb..739ec33 100644 --- a/libs/audioflinger/AudioFlinger.h +++ b/libs/audioflinger/AudioFlinger.h @@ -100,7 +100,7 @@ public: virtual status_t setMicMute(bool state); virtual bool getMicMute() const; - virtual bool isMusicActive() const; + virtual bool isStreamActive(int stream) const; virtual status_t setParameters(int ioHandle, const String8& keyValuePairs); virtual String8 getParameters(int ioHandle, const String8& keys); @@ -108,6 +108,7 @@ public: virtual void registerClient(const sp<IAudioFlingerClient>& client); virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount); + virtual unsigned int getInputFramesLost(int ioHandle); virtual int openOutput(uint32_t *pDevices, uint32_t *pSamplingRate, @@ -136,6 +137,8 @@ public: virtual status_t setVoiceVolume(float volume); + virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output); + // IBinder::DeathRecipient virtual void binderDied(const wp<IBinder>& who); @@ -506,7 +509,7 @@ private: virtual float streamVolume(int stream) const; virtual bool streamMute(int stream) const; - bool isMusicActive() const; + bool isStreamActive(int stream) const; sp<Track> createTrack_l( const sp<AudioFlinger::Client>& client, @@ -526,6 +529,7 @@ private: bool isSuspended() { return (mSuspended != 0); } virtual String8 getParameters(const String8& keys); virtual void audioConfigChanged(int event, int param = 0); + virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames); struct stream_type_t { stream_type_t() @@ -742,6 +746,7 @@ private: virtual String8 getParameters(const String8& keys); virtual void audioConfigChanged(int event, int param = 0); void readInputParameters(); + virtual unsigned int getInputFramesLost(); private: RecordThread(); diff --git a/libs/audioflinger/AudioHardwareGeneric.cpp b/libs/audioflinger/AudioHardwareGeneric.cpp index 57874f3..d63c031 100644 --- a/libs/audioflinger/AudioHardwareGeneric.cpp +++ b/libs/audioflinger/AudioHardwareGeneric.cpp @@ -298,6 +298,11 @@ String8 AudioStreamOutGeneric::getParameters(const String8& keys) return param.toString(); } +status_t AudioStreamOutGeneric::getRenderPosition(uint32_t *dspFrames) +{ + return INVALID_OPERATION; +} + // ---------------------------------------------------------------------------- // record functions @@ -310,9 +315,8 @@ status_t AudioStreamInGeneric::set( uint32_t *pRate, AudioSystem::audio_in_acoustics acoustics) { - // FIXME: remove logging if (pFormat == 0 || pChannels == 0 || pRate == 0) return BAD_VALUE; - LOGD("AudioStreamInGeneric::set(%p, %d, %d, %d, %u)", hw, fd, *pFormat, *pChannels, *pRate); + LOGV("AudioStreamInGeneric::set(%p, %d, %d, %d, %u)", hw, fd, *pFormat, *pChannels, *pRate); // check values if ((*pFormat != format()) || (*pChannels != channels()) || @@ -332,14 +336,10 @@ status_t AudioStreamInGeneric::set( AudioStreamInGeneric::~AudioStreamInGeneric() { - // FIXME: remove logging - LOGD("AudioStreamInGeneric destructor"); } ssize_t AudioStreamInGeneric::read(void* buffer, ssize_t bytes) { - // FIXME: remove logging - LOGD("AudioStreamInGeneric::read(%p, %d) from fd %d", buffer, (int)bytes, mFd); AutoMutex lock(mLock); if (mFd < 0) { LOGE("Attempt to read from unopened device"); diff --git a/libs/audioflinger/AudioHardwareGeneric.h b/libs/audioflinger/AudioHardwareGeneric.h index 42da413..aa4e78d 100644 --- a/libs/audioflinger/AudioHardwareGeneric.h +++ b/libs/audioflinger/AudioHardwareGeneric.h @@ -55,6 +55,7 @@ public: virtual status_t dump(int fd, const Vector<String16>& args); virtual status_t setParameters(const String8& keyValuePairs); virtual String8 getParameters(const String8& keys); + virtual status_t getRenderPosition(uint32_t *dspFrames); private: AudioHardwareGeneric *mAudioHardware; @@ -87,6 +88,7 @@ public: virtual status_t standby() { return NO_ERROR; } virtual status_t setParameters(const String8& keyValuePairs); virtual String8 getParameters(const String8& keys); + virtual unsigned int getInputFramesLost() const { return 0; } private: AudioHardwareGeneric *mAudioHardware; diff --git a/libs/audioflinger/AudioHardwareStub.cpp b/libs/audioflinger/AudioHardwareStub.cpp index ae391ee..d481150 100644 --- a/libs/audioflinger/AudioHardwareStub.cpp +++ b/libs/audioflinger/AudioHardwareStub.cpp @@ -158,10 +158,15 @@ String8 AudioStreamOutStub::getParameters(const String8& keys) return param.toString(); } +status_t AudioStreamOutStub::getRenderPosition(uint32_t *dspFrames) +{ + return INVALID_OPERATION; +} + // ---------------------------------------------------------------------------- status_t AudioStreamInStub::set(int *pFormat, uint32_t *pChannels, uint32_t *pRate, - AudioSystem::audio_in_acoustics acoustics) + AudioSystem::audio_in_acoustics acoustics) { return NO_ERROR; } diff --git a/libs/audioflinger/AudioHardwareStub.h b/libs/audioflinger/AudioHardwareStub.h index 583f852..06a29de 100644 --- a/libs/audioflinger/AudioHardwareStub.h +++ b/libs/audioflinger/AudioHardwareStub.h @@ -41,6 +41,7 @@ public: virtual status_t dump(int fd, const Vector<String16>& args); virtual status_t setParameters(const String8& keyValuePairs) { return NO_ERROR;} virtual String8 getParameters(const String8& keys); + virtual status_t getRenderPosition(uint32_t *dspFrames); }; class AudioStreamInStub : public AudioStreamIn { @@ -56,6 +57,7 @@ public: virtual status_t standby() { return NO_ERROR; } virtual status_t setParameters(const String8& keyValuePairs) { return NO_ERROR;} virtual String8 getParameters(const String8& keys); + virtual unsigned int getInputFramesLost() const { return 0; } }; class AudioHardwareStub : public AudioHardwareBase diff --git a/libs/audioflinger/AudioPolicyManagerBase.cpp b/libs/audioflinger/AudioPolicyManagerBase.cpp new file mode 100644 index 0000000..c8b3f48 --- /dev/null +++ b/libs/audioflinger/AudioPolicyManagerBase.cpp @@ -0,0 +1,1972 @@ +/* + * Copyright (C) 2009 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. + */ + +#define LOG_TAG "AudioPolicyManagerBase" +//#define LOG_NDEBUG 0 +#include <utils/Log.h> +#include <hardware_legacy/AudioPolicyManagerBase.h> +#include <media/mediarecorder.h> + +namespace android { + + +// ---------------------------------------------------------------------------- +// AudioPolicyInterface implementation +// ---------------------------------------------------------------------------- + + +status_t AudioPolicyManagerBase::setDeviceConnectionState(AudioSystem::audio_devices device, + AudioSystem::device_connection_state state, + const char *device_address) +{ + + LOGV("setDeviceConnectionState() device: %x, state %d, address %s", device, state, device_address); + + // connect/disconnect only 1 device at a time + if (AudioSystem::popCount(device) != 1) return BAD_VALUE; + + if (strlen(device_address) >= MAX_DEVICE_ADDRESS_LEN) { + LOGE("setDeviceConnectionState() invalid address: %s", device_address); + return BAD_VALUE; + } + + // handle output devices + if (AudioSystem::isOutputDevice(device)) { + +#ifndef WITH_A2DP + if (AudioSystem::isA2dpDevice(device)) { + LOGE("setDeviceConnectionState() invalid device: %x", device); + return BAD_VALUE; + } +#endif + + switch (state) + { + // handle output device connection + case AudioSystem::DEVICE_STATE_AVAILABLE: + if (mAvailableOutputDevices & device) { + LOGW("setDeviceConnectionState() device already connected: %x", device); + return INVALID_OPERATION; + } + LOGV("setDeviceConnectionState() connecting device %x", device); + + // register new device as available + mAvailableOutputDevices |= device; + +#ifdef WITH_A2DP + // handle A2DP device connection + if (AudioSystem::isA2dpDevice(device)) { + status_t status = handleA2dpConnection(device, device_address); + if (status != NO_ERROR) { + mAvailableOutputDevices &= ~device; + return status; + } + } else +#endif + { + if (AudioSystem::isBluetoothScoDevice(device)) { + LOGV("setDeviceConnectionState() BT SCO device, address %s", device_address); + // keep track of SCO device address + mScoDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN); +#ifdef WITH_A2DP + if (mA2dpOutput != 0 && + mPhoneState != AudioSystem::MODE_NORMAL) { + mpClientInterface->suspendOutput(mA2dpOutput); + } +#endif + } + } + break; + // handle output device disconnection + case AudioSystem::DEVICE_STATE_UNAVAILABLE: { + if (!(mAvailableOutputDevices & device)) { + LOGW("setDeviceConnectionState() device not connected: %x", device); + return INVALID_OPERATION; + } + + + LOGV("setDeviceConnectionState() disconnecting device %x", device); + // remove device from available output devices + mAvailableOutputDevices &= ~device; + +#ifdef WITH_A2DP + // handle A2DP device disconnection + if (AudioSystem::isA2dpDevice(device)) { + status_t status = handleA2dpDisconnection(device, device_address); + if (status != NO_ERROR) { + mAvailableOutputDevices |= device; + return status; + } + } else +#endif + { + if (AudioSystem::isBluetoothScoDevice(device)) { + mScoDeviceAddress = ""; +#ifdef WITH_A2DP + if (mA2dpOutput != 0 && + mPhoneState != AudioSystem::MODE_NORMAL) { + mpClientInterface->restoreOutput(mA2dpOutput); + } +#endif + } + } + } break; + + default: + LOGE("setDeviceConnectionState() invalid state: %x", state); + return BAD_VALUE; + } + + // request routing change if necessary + uint32_t newDevice = getNewDevice(mHardwareOutput, false); +#ifdef WITH_A2DP + checkOutputForAllStrategies(newDevice); + // A2DP outputs must be closed after checkOutputForAllStrategies() is executed + if (state == AudioSystem::DEVICE_STATE_UNAVAILABLE && AudioSystem::isA2dpDevice(device)) { + closeA2dpOutputs(); + } +#endif + updateDeviceForStrategy(); + setOutputDevice(mHardwareOutput, newDevice); + + if (device == AudioSystem::DEVICE_OUT_WIRED_HEADSET) { + device = AudioSystem::DEVICE_IN_WIRED_HEADSET; + } else if (device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO || + device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET || + device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT) { + device = AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET; + } else { + return NO_ERROR; + } + } + // handle input devices + if (AudioSystem::isInputDevice(device)) { + + switch (state) + { + // handle input device connection + case AudioSystem::DEVICE_STATE_AVAILABLE: { + if (mAvailableInputDevices & device) { + LOGW("setDeviceConnectionState() device already connected: %d", device); + return INVALID_OPERATION; + } + mAvailableInputDevices |= device; + } + break; + + // handle input device disconnection + case AudioSystem::DEVICE_STATE_UNAVAILABLE: { + if (!(mAvailableInputDevices & device)) { + LOGW("setDeviceConnectionState() device not connected: %d", device); + return INVALID_OPERATION; + } + mAvailableInputDevices &= ~device; + } break; + + default: + LOGE("setDeviceConnectionState() invalid state: %x", state); + return BAD_VALUE; + } + + audio_io_handle_t activeInput = getActiveInput(); + if (activeInput != 0) { + AudioInputDescriptor *inputDesc = mInputs.valueFor(activeInput); + uint32_t newDevice = getDeviceForInputSource(inputDesc->mInputSource); + if (newDevice != inputDesc->mDevice) { + LOGV("setDeviceConnectionState() changing device from %x to %x for input %d", + inputDesc->mDevice, newDevice, activeInput); + inputDesc->mDevice = newDevice; + AudioParameter param = AudioParameter(); + param.addInt(String8(AudioParameter::keyRouting), (int)newDevice); + mpClientInterface->setParameters(activeInput, param.toString()); + } + } + + return NO_ERROR; + } + + LOGW("setDeviceConnectionState() invalid device: %x", device); + return BAD_VALUE; +} + +AudioSystem::device_connection_state AudioPolicyManagerBase::getDeviceConnectionState(AudioSystem::audio_devices device, + const char *device_address) +{ + AudioSystem::device_connection_state state = AudioSystem::DEVICE_STATE_UNAVAILABLE; + String8 address = String8(device_address); + if (AudioSystem::isOutputDevice(device)) { + if (device & mAvailableOutputDevices) { +#ifdef WITH_A2DP + if (AudioSystem::isA2dpDevice(device) && + address != "" && mA2dpDeviceAddress != address) { + return state; + } +#endif + if (AudioSystem::isBluetoothScoDevice(device) && + address != "" && mScoDeviceAddress != address) { + return state; + } + state = AudioSystem::DEVICE_STATE_AVAILABLE; + } + } else if (AudioSystem::isInputDevice(device)) { + if (device & mAvailableInputDevices) { + state = AudioSystem::DEVICE_STATE_AVAILABLE; + } + } + + return state; +} + +void AudioPolicyManagerBase::setPhoneState(int state) +{ + LOGV("setPhoneState() state %d", state); + uint32_t newDevice = 0; + if (state < 0 || state >= AudioSystem::NUM_MODES) { + LOGW("setPhoneState() invalid state %d", state); + return; + } + + if (state == mPhoneState ) { + LOGW("setPhoneState() setting same state %d", state); + return; + } + + // if leaving call state, handle special case of active streams + // pertaining to sonification strategy see handleIncallSonification() + if (mPhoneState == AudioSystem::MODE_IN_CALL) { + LOGV("setPhoneState() in call state management: new state is %d", state); + for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { + handleIncallSonification(stream, false, true); + } + } + + // store previous phone state for management of sonification strategy below + int oldState = mPhoneState; + mPhoneState = state; + bool force = false; + + // are we entering or starting a call + if ((oldState != AudioSystem::MODE_IN_CALL) && (state == AudioSystem::MODE_IN_CALL)) { + LOGV(" Entering call in setPhoneState()"); + // force routing command to audio hardware when starting a call + // even if no device change is needed + force = true; + } else if ((oldState == AudioSystem::MODE_IN_CALL) && (state != AudioSystem::MODE_IN_CALL)) { + LOGV(" Exiting call in setPhoneState()"); + // force routing command to audio hardware when exiting a call + // even if no device change is needed + force = true; + } + + // check for device and output changes triggered by new phone state + newDevice = getNewDevice(mHardwareOutput, false); +#ifdef WITH_A2DP + checkOutputForAllStrategies(newDevice); + // suspend A2DP output if a SCO device is present. + if (mA2dpOutput != 0 && mScoDeviceAddress != "") { + if (oldState == AudioSystem::MODE_NORMAL) { + mpClientInterface->suspendOutput(mA2dpOutput); + } else if (state == AudioSystem::MODE_NORMAL) { + mpClientInterface->restoreOutput(mA2dpOutput); + } + } +#endif + updateDeviceForStrategy(); + + AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput); + + // force routing command to audio hardware when ending call + // even if no device change is needed + if (oldState == AudioSystem::MODE_IN_CALL && newDevice == 0) { + newDevice = hwOutputDesc->device(); + } + + // when changing from ring tone to in call mode, mute the ringing tone + // immediately and delay the route change to avoid sending the ring tone + // tail into the earpiece or headset. + int delayMs = 0; + if (state == AudioSystem::MODE_IN_CALL && oldState == AudioSystem::MODE_RINGTONE) { + // delay the device change command by twice the output latency to have some margin + // and be sure that audio buffers not yet affected by the mute are out when + // we actually apply the route change + delayMs = hwOutputDesc->mLatency*2; + setStreamMute(AudioSystem::RING, true, mHardwareOutput); + } + + // change routing is necessary + setOutputDevice(mHardwareOutput, newDevice, force, delayMs); + + // if entering in call state, handle special case of active streams + // pertaining to sonification strategy see handleIncallSonification() + if (state == AudioSystem::MODE_IN_CALL) { + LOGV("setPhoneState() in call state management: new state is %d", state); + // unmute the ringing tone after a sufficient delay if it was muted before + // setting output device above + if (oldState == AudioSystem::MODE_RINGTONE) { + setStreamMute(AudioSystem::RING, false, mHardwareOutput, MUTE_TIME_MS); + } + for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { + handleIncallSonification(stream, true, true); + } + } + + // Flag that ringtone volume must be limited to music volume until we exit MODE_RINGTONE + if (state == AudioSystem::MODE_RINGTONE && + (hwOutputDesc->mRefCount[AudioSystem::MUSIC] || + (systemTime() - mMusicStopTime) < seconds(SONIFICATION_HEADSET_MUSIC_DELAY))) { + mLimitRingtoneVolume = true; + } else { + mLimitRingtoneVolume = false; + } +} + +void AudioPolicyManagerBase::setRingerMode(uint32_t mode, uint32_t mask) +{ + LOGV("setRingerMode() mode %x, mask %x", mode, mask); + + mRingerMode = mode; +} + +void AudioPolicyManagerBase::setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config) +{ + LOGV("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mPhoneState); + + bool forceVolumeReeval = false; + switch(usage) { + case AudioSystem::FOR_COMMUNICATION: + if (config != AudioSystem::FORCE_SPEAKER && config != AudioSystem::FORCE_BT_SCO && + config != AudioSystem::FORCE_NONE) { + LOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config); + return; + } + mForceUse[usage] = config; + break; + case AudioSystem::FOR_MEDIA: + if (config != AudioSystem::FORCE_HEADPHONES && config != AudioSystem::FORCE_BT_A2DP && + config != AudioSystem::FORCE_WIRED_ACCESSORY && config != AudioSystem::FORCE_NONE) { + LOGW("setForceUse() invalid config %d for FOR_MEDIA", config); + return; + } + mForceUse[usage] = config; + break; + case AudioSystem::FOR_RECORD: + if (config != AudioSystem::FORCE_BT_SCO && config != AudioSystem::FORCE_WIRED_ACCESSORY && + config != AudioSystem::FORCE_NONE) { + LOGW("setForceUse() invalid config %d for FOR_RECORD", config); + return; + } + mForceUse[usage] = config; + break; + case AudioSystem::FOR_DOCK: + if (config != AudioSystem::FORCE_NONE && config != AudioSystem::FORCE_BT_CAR_DOCK && + config != AudioSystem::FORCE_BT_DESK_DOCK && config != AudioSystem::FORCE_WIRED_ACCESSORY) { + LOGW("setForceUse() invalid config %d for FOR_DOCK", config); + } + forceVolumeReeval = true; + mForceUse[usage] = config; + break; + default: + LOGW("setForceUse() invalid usage %d", usage); + break; + } + + // check for device and output changes triggered by new phone state + uint32_t newDevice = getNewDevice(mHardwareOutput, false); +#ifdef WITH_A2DP + checkOutputForAllStrategies(newDevice); +#endif + updateDeviceForStrategy(); + setOutputDevice(mHardwareOutput, newDevice); + if (forceVolumeReeval) { + applyStreamVolumes(mHardwareOutput, newDevice); + } +} + +AudioSystem::forced_config AudioPolicyManagerBase::getForceUse(AudioSystem::force_use usage) +{ + return mForceUse[usage]; +} + +void AudioPolicyManagerBase::setSystemProperty(const char* property, const char* value) +{ + LOGV("setSystemProperty() property %s, value %s", property, value); + if (strcmp(property, "ro.camera.sound.forced") == 0) { + if (atoi(value)) { + LOGV("ENFORCED_AUDIBLE cannot be muted"); + mStreams[AudioSystem::ENFORCED_AUDIBLE].mCanBeMuted = false; + } else { + LOGV("ENFORCED_AUDIBLE can be muted"); + mStreams[AudioSystem::ENFORCED_AUDIBLE].mCanBeMuted = true; + } + } +} + +audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type stream, + uint32_t samplingRate, + uint32_t format, + uint32_t channels, + AudioSystem::output_flags flags) +{ + audio_io_handle_t output = 0; + uint32_t latency = 0; + routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream); + uint32_t device = getDeviceForStrategy(strategy); + LOGV("getOutput() stream %d, samplingRate %d, format %d, channels %x, flags %x", stream, samplingRate, format, channels, flags); + +#ifdef AUDIO_POLICY_TEST + if (mCurOutput != 0) { + LOGV("getOutput() test output mCurOutput %d, samplingRate %d, format %d, channels %x, mDirectOutput %d", + mCurOutput, mTestSamplingRate, mTestFormat, mTestChannels, mDirectOutput); + + if (mTestOutputs[mCurOutput] == 0) { + LOGV("getOutput() opening test output"); + AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(); + outputDesc->mDevice = mTestDevice; + outputDesc->mSamplingRate = mTestSamplingRate; + outputDesc->mFormat = mTestFormat; + outputDesc->mChannels = mTestChannels; + outputDesc->mLatency = mTestLatencyMs; + outputDesc->mFlags = (AudioSystem::output_flags)(mDirectOutput ? AudioSystem::OUTPUT_FLAG_DIRECT : 0); + outputDesc->mRefCount[stream] = 0; + mTestOutputs[mCurOutput] = mpClientInterface->openOutput(&outputDesc->mDevice, + &outputDesc->mSamplingRate, + &outputDesc->mFormat, + &outputDesc->mChannels, + &outputDesc->mLatency, + outputDesc->mFlags); + if (mTestOutputs[mCurOutput]) { + AudioParameter outputCmd = AudioParameter(); + outputCmd.addInt(String8("set_id"),mCurOutput); + mpClientInterface->setParameters(mTestOutputs[mCurOutput],outputCmd.toString()); + addOutput(mTestOutputs[mCurOutput], outputDesc); + } + } + return mTestOutputs[mCurOutput]; + } +#endif //AUDIO_POLICY_TEST + + // open a direct output if required by specified parameters + if (needsDirectOuput(stream, samplingRate, format, channels, flags, device)) { + + LOGV("getOutput() opening direct output device %x", device); + AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(); + outputDesc->mDevice = device; + outputDesc->mSamplingRate = samplingRate; + outputDesc->mFormat = format; + outputDesc->mChannels = channels; + outputDesc->mLatency = 0; + outputDesc->mFlags = (AudioSystem::output_flags)(flags | AudioSystem::OUTPUT_FLAG_DIRECT); + outputDesc->mRefCount[stream] = 0; + output = mpClientInterface->openOutput(&outputDesc->mDevice, + &outputDesc->mSamplingRate, + &outputDesc->mFormat, + &outputDesc->mChannels, + &outputDesc->mLatency, + outputDesc->mFlags); + + // only accept an output with the requeted parameters + if (output == 0 || + (samplingRate != 0 && samplingRate != outputDesc->mSamplingRate) || + (format != 0 && format != outputDesc->mFormat) || + (channels != 0 && channels != outputDesc->mChannels)) { + LOGV("getOutput() failed opening direct output: samplingRate %d, format %d, channels %d", + samplingRate, format, channels); + if (output != 0) { + mpClientInterface->closeOutput(output); + } + delete outputDesc; + return 0; + } + addOutput(output, outputDesc); + return output; + } + + if (channels != 0 && channels != AudioSystem::CHANNEL_OUT_MONO && + channels != AudioSystem::CHANNEL_OUT_STEREO) { + return 0; + } + // open a non direct output + + // get which output is suitable for the specified stream. The actual routing change will happen + // when startOutput() will be called + uint32_t a2dpDevice = device & AudioSystem::DEVICE_OUT_ALL_A2DP; + if (AudioSystem::popCount((AudioSystem::audio_devices)device) == 2) { +#ifdef WITH_A2DP + if (a2dpUsedForSonification() && a2dpDevice != 0) { + // if playing on 2 devices among which one is A2DP, use duplicated output + LOGV("getOutput() using duplicated output"); + LOGW_IF((mA2dpOutput == 0), "getOutput() A2DP device in multiple %x selected but A2DP output not opened", device); + output = mDuplicatedOutput; + } else +#endif + { + // if playing on 2 devices among which none is A2DP, use hardware output + output = mHardwareOutput; + } + LOGV("getOutput() using output %d for 2 devices %x", output, device); + } else { +#ifdef WITH_A2DP + if (a2dpDevice != 0) { + // if playing on A2DP device, use a2dp output + LOGW_IF((mA2dpOutput == 0), "getOutput() A2DP device %x selected but A2DP output not opened", device); + output = mA2dpOutput; + } else +#endif + { + // if playing on not A2DP device, use hardware output + output = mHardwareOutput; + } + } + + + LOGW_IF((output ==0), "getOutput() could not find output for stream %d, samplingRate %d, format %d, channels %x, flags %x", + stream, samplingRate, format, channels, flags); + + return output; +} + +status_t AudioPolicyManagerBase::startOutput(audio_io_handle_t output, AudioSystem::stream_type stream) +{ + LOGV("startOutput() output %d, stream %d", output, stream); + ssize_t index = mOutputs.indexOfKey(output); + if (index < 0) { + LOGW("startOutput() unknow output %d", output); + return BAD_VALUE; + } + + AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index); + routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream); + +#ifdef WITH_A2DP + if (mA2dpOutput != 0 && !a2dpUsedForSonification() && strategy == STRATEGY_SONIFICATION) { + setStrategyMute(STRATEGY_MEDIA, true, mA2dpOutput); + } +#endif + + // incremenent usage count for this stream on the requested output: + // NOTE that the usage count is the same for duplicated output and hardware output which is + // necassary for a correct control of hardware output routing by startOutput() and stopOutput() + outputDesc->changeRefCount(stream, 1); + + setOutputDevice(output, getNewDevice(output)); + + // handle special case for sonification while in call + if (mPhoneState == AudioSystem::MODE_IN_CALL) { + handleIncallSonification(stream, true, false); + } + + // apply volume rules for current stream and device if necessary + checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, outputDesc->device()); + + return NO_ERROR; +} + +status_t AudioPolicyManagerBase::stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream) +{ + LOGV("stopOutput() output %d, stream %d", output, stream); + ssize_t index = mOutputs.indexOfKey(output); + if (index < 0) { + LOGW("stopOutput() unknow output %d", output); + return BAD_VALUE; + } + + AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index); + routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream); + + // handle special case for sonification while in call + if (mPhoneState == AudioSystem::MODE_IN_CALL) { + handleIncallSonification(stream, false, false); + } + + if (outputDesc->mRefCount[stream] > 0) { + // decrement usage count of this stream on the output + outputDesc->changeRefCount(stream, -1); + // store time at which the last music track was stopped - see computeVolume() + if (stream == AudioSystem::MUSIC) { + mMusicStopTime = systemTime(); + } + + setOutputDevice(output, getNewDevice(output)); + +#ifdef WITH_A2DP + if (mA2dpOutput != 0 && !a2dpUsedForSonification() && strategy == STRATEGY_SONIFICATION) { + setStrategyMute(STRATEGY_MEDIA, false, mA2dpOutput, mOutputs.valueFor(mHardwareOutput)->mLatency*2); + } +#endif + if (output != mHardwareOutput) { + setOutputDevice(mHardwareOutput, getNewDevice(mHardwareOutput), true); + } + return NO_ERROR; + } else { + LOGW("stopOutput() refcount is already 0 for output %d", output); + return INVALID_OPERATION; + } +} + +void AudioPolicyManagerBase::releaseOutput(audio_io_handle_t output) +{ + LOGV("releaseOutput() %d", output); + ssize_t index = mOutputs.indexOfKey(output); + if (index < 0) { + LOGW("releaseOutput() releasing unknown output %d", output); + return; + } + +#ifdef AUDIO_POLICY_TEST + int testIndex = testOutputIndex(output); + if (testIndex != 0) { + AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index); + if (outputDesc->refCount() == 0) { + mpClientInterface->closeOutput(output); + delete mOutputs.valueAt(index); + mOutputs.removeItem(output); + mTestOutputs[testIndex] = 0; + } + return; + } +#endif //AUDIO_POLICY_TEST + + if (mOutputs.valueAt(index)->mFlags & AudioSystem::OUTPUT_FLAG_DIRECT) { + mpClientInterface->closeOutput(output); + delete mOutputs.valueAt(index); + mOutputs.removeItem(output); + } +} + +audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, + uint32_t samplingRate, + uint32_t format, + uint32_t channels, + AudioSystem::audio_in_acoustics acoustics) +{ + audio_io_handle_t input = 0; + uint32_t device = getDeviceForInputSource(inputSource); + + LOGV("getInput() inputSource %d, samplingRate %d, format %d, channels %x, acoustics %x", inputSource, samplingRate, format, channels, acoustics); + + if (device == 0) { + return 0; + } + + // adapt channel selection to input source + switch(inputSource) { + case AUDIO_SOURCE_VOICE_UPLINK: + channels = AudioSystem::CHANNEL_IN_VOICE_UPLINK; + break; + case AUDIO_SOURCE_VOICE_DOWNLINK: + channels = AudioSystem::CHANNEL_IN_VOICE_DNLINK; + break; + case AUDIO_SOURCE_VOICE_CALL: + channels = (AudioSystem::CHANNEL_IN_VOICE_UPLINK | AudioSystem::CHANNEL_IN_VOICE_DNLINK); + break; + default: + break; + } + + AudioInputDescriptor *inputDesc = new AudioInputDescriptor(); + + inputDesc->mInputSource = inputSource; + inputDesc->mDevice = device; + inputDesc->mSamplingRate = samplingRate; + inputDesc->mFormat = format; + inputDesc->mChannels = channels; + inputDesc->mAcoustics = acoustics; + inputDesc->mRefCount = 0; + input = mpClientInterface->openInput(&inputDesc->mDevice, + &inputDesc->mSamplingRate, + &inputDesc->mFormat, + &inputDesc->mChannels, + inputDesc->mAcoustics); + + // only accept input with the exact requested set of parameters + if (input == 0 || + (samplingRate != inputDesc->mSamplingRate) || + (format != inputDesc->mFormat) || + (channels != inputDesc->mChannels)) { + LOGV("getInput() failed opening input: samplingRate %d, format %d, channels %d", + samplingRate, format, channels); + if (input != 0) { + mpClientInterface->closeInput(input); + } + delete inputDesc; + return 0; + } + mInputs.add(input, inputDesc); + return input; +} + +status_t AudioPolicyManagerBase::startInput(audio_io_handle_t input) +{ + LOGV("startInput() input %d", input); + ssize_t index = mInputs.indexOfKey(input); + if (index < 0) { + LOGW("startInput() unknow input %d", input); + return BAD_VALUE; + } + AudioInputDescriptor *inputDesc = mInputs.valueAt(index); + +#ifdef AUDIO_POLICY_TEST + if (mTestInput == 0) +#endif //AUDIO_POLICY_TEST + { + // refuse 2 active AudioRecord clients at the same time + if (getActiveInput() != 0) { + LOGW("startInput() input %d failed: other input already started", input); + return INVALID_OPERATION; + } + } + + AudioParameter param = AudioParameter(); + param.addInt(String8(AudioParameter::keyRouting), (int)inputDesc->mDevice); + + // use Voice Recognition mode or not for this input based on input source + int vr_enabled = inputDesc->mInputSource == AUDIO_SOURCE_VOICE_RECOGNITION ? 1 : 0; + param.addInt(String8("vr_mode"), vr_enabled); + LOGV("AudioPolicyManager::startInput(%d), setting vr_mode to %d", inputDesc->mInputSource, vr_enabled); + + mpClientInterface->setParameters(input, param.toString()); + + inputDesc->mRefCount = 1; + return NO_ERROR; +} + +status_t AudioPolicyManagerBase::stopInput(audio_io_handle_t input) +{ + LOGV("stopInput() input %d", input); + ssize_t index = mInputs.indexOfKey(input); + if (index < 0) { + LOGW("stopInput() unknow input %d", input); + return BAD_VALUE; + } + AudioInputDescriptor *inputDesc = mInputs.valueAt(index); + + if (inputDesc->mRefCount == 0) { + LOGW("stopInput() input %d already stopped", input); + return INVALID_OPERATION; + } else { + AudioParameter param = AudioParameter(); + param.addInt(String8(AudioParameter::keyRouting), 0); + mpClientInterface->setParameters(input, param.toString()); + inputDesc->mRefCount = 0; + return NO_ERROR; + } +} + +void AudioPolicyManagerBase::releaseInput(audio_io_handle_t input) +{ + LOGV("releaseInput() %d", input); + ssize_t index = mInputs.indexOfKey(input); + if (index < 0) { + LOGW("releaseInput() releasing unknown input %d", input); + return; + } + mpClientInterface->closeInput(input); + delete mInputs.valueAt(index); + mInputs.removeItem(input); + LOGV("releaseInput() exit"); +} + +void AudioPolicyManagerBase::initStreamVolume(AudioSystem::stream_type stream, + int indexMin, + int indexMax) +{ + LOGV("initStreamVolume() stream %d, min %d, max %d", stream , indexMin, indexMax); + if (indexMin < 0 || indexMin >= indexMax) { + LOGW("initStreamVolume() invalid index limits for stream %d, min %d, max %d", stream , indexMin, indexMax); + return; + } + mStreams[stream].mIndexMin = indexMin; + mStreams[stream].mIndexMax = indexMax; +} + +status_t AudioPolicyManagerBase::setStreamVolumeIndex(AudioSystem::stream_type stream, int index) +{ + + if ((index < mStreams[stream].mIndexMin) || (index > mStreams[stream].mIndexMax)) { + return BAD_VALUE; + } + + // Force max volume if stream cannot be muted + if (!mStreams[stream].mCanBeMuted) index = mStreams[stream].mIndexMax; + + LOGV("setStreamVolumeIndex() stream %d, index %d", stream, index); + mStreams[stream].mIndexCur = index; + + // compute and apply stream volume on all outputs according to connected device + status_t status = NO_ERROR; + for (size_t i = 0; i < mOutputs.size(); i++) { + status_t volStatus = checkAndSetVolume(stream, index, mOutputs.keyAt(i), mOutputs.valueAt(i)->device()); + if (volStatus != NO_ERROR) { + status = volStatus; + } + } + return status; +} + +status_t AudioPolicyManagerBase::getStreamVolumeIndex(AudioSystem::stream_type stream, int *index) +{ + if (index == 0) { + return BAD_VALUE; + } + LOGV("getStreamVolumeIndex() stream %d", stream); + *index = mStreams[stream].mIndexCur; + return NO_ERROR; +} + +status_t AudioPolicyManagerBase::dump(int fd) +{ + const size_t SIZE = 256; + char buffer[SIZE]; + String8 result; + + snprintf(buffer, SIZE, "\nAudioPolicyManager Dump: %p\n", this); + result.append(buffer); + snprintf(buffer, SIZE, " Hardware Output: %d\n", mHardwareOutput); + result.append(buffer); +#ifdef WITH_A2DP + snprintf(buffer, SIZE, " A2DP Output: %d\n", mA2dpOutput); + result.append(buffer); + snprintf(buffer, SIZE, " Duplicated Output: %d\n", mDuplicatedOutput); + result.append(buffer); + snprintf(buffer, SIZE, " A2DP device address: %s\n", mA2dpDeviceAddress.string()); + result.append(buffer); +#endif + snprintf(buffer, SIZE, " SCO device address: %s\n", mScoDeviceAddress.string()); + result.append(buffer); + snprintf(buffer, SIZE, " Output devices: %08x\n", mAvailableOutputDevices); + result.append(buffer); + snprintf(buffer, SIZE, " Input devices: %08x\n", mAvailableInputDevices); + result.append(buffer); + snprintf(buffer, SIZE, " Phone state: %d\n", mPhoneState); + result.append(buffer); + snprintf(buffer, SIZE, " Ringer mode: %d\n", mRingerMode); + result.append(buffer); + snprintf(buffer, SIZE, " Force use for communications %d\n", mForceUse[AudioSystem::FOR_COMMUNICATION]); + result.append(buffer); + snprintf(buffer, SIZE, " Force use for media %d\n", mForceUse[AudioSystem::FOR_MEDIA]); + result.append(buffer); + snprintf(buffer, SIZE, " Force use for record %d\n", mForceUse[AudioSystem::FOR_RECORD]); + result.append(buffer); + snprintf(buffer, SIZE, " Force use for dock %d\n", mForceUse[AudioSystem::FOR_DOCK]); + result.append(buffer); + write(fd, result.string(), result.size()); + + snprintf(buffer, SIZE, "\nOutputs dump:\n"); + write(fd, buffer, strlen(buffer)); + for (size_t i = 0; i < mOutputs.size(); i++) { + snprintf(buffer, SIZE, "- Output %d dump:\n", mOutputs.keyAt(i)); + write(fd, buffer, strlen(buffer)); + mOutputs.valueAt(i)->dump(fd); + } + + snprintf(buffer, SIZE, "\nInputs dump:\n"); + write(fd, buffer, strlen(buffer)); + for (size_t i = 0; i < mInputs.size(); i++) { + snprintf(buffer, SIZE, "- Input %d dump:\n", mInputs.keyAt(i)); + write(fd, buffer, strlen(buffer)); + mInputs.valueAt(i)->dump(fd); + } + + snprintf(buffer, SIZE, "\nStreams dump:\n"); + write(fd, buffer, strlen(buffer)); + snprintf(buffer, SIZE, " Stream Index Min Index Max Index Cur Can be muted\n"); + write(fd, buffer, strlen(buffer)); + for (size_t i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { + snprintf(buffer, SIZE, " %02d", i); + mStreams[i].dump(buffer + 3, SIZE); + write(fd, buffer, strlen(buffer)); + } + + return NO_ERROR; +} + +// ---------------------------------------------------------------------------- +// AudioPolicyManagerBase +// ---------------------------------------------------------------------------- + +AudioPolicyManagerBase::AudioPolicyManagerBase(AudioPolicyClientInterface *clientInterface) + : +#ifdef AUDIO_POLICY_TEST + Thread(false), +#endif //AUDIO_POLICY_TEST + mPhoneState(AudioSystem::MODE_NORMAL), mRingerMode(0), mMusicStopTime(0), mLimitRingtoneVolume(false) +{ + mpClientInterface = clientInterface; + + for (int i = 0; i < AudioSystem::NUM_FORCE_USE; i++) { + mForceUse[i] = AudioSystem::FORCE_NONE; + } + + // devices available by default are speaker, ear piece and microphone + mAvailableOutputDevices = AudioSystem::DEVICE_OUT_EARPIECE | + AudioSystem::DEVICE_OUT_SPEAKER; + mAvailableInputDevices = AudioSystem::DEVICE_IN_BUILTIN_MIC; + +#ifdef WITH_A2DP + mA2dpOutput = 0; + mDuplicatedOutput = 0; + mA2dpDeviceAddress = String8(""); +#endif + mScoDeviceAddress = String8(""); + + // open hardware output + AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(); + outputDesc->mDevice = (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER; + mHardwareOutput = mpClientInterface->openOutput(&outputDesc->mDevice, + &outputDesc->mSamplingRate, + &outputDesc->mFormat, + &outputDesc->mChannels, + &outputDesc->mLatency, + outputDesc->mFlags); + + if (mHardwareOutput == 0) { + LOGE("Failed to initialize hardware output stream, samplingRate: %d, format %d, channels %d", + outputDesc->mSamplingRate, outputDesc->mFormat, outputDesc->mChannels); + } else { + addOutput(mHardwareOutput, outputDesc); + setOutputDevice(mHardwareOutput, (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER, true); + } + + updateDeviceForStrategy(); +#ifdef AUDIO_POLICY_TEST + AudioParameter outputCmd = AudioParameter(); + outputCmd.addInt(String8("set_id"), 0); + mpClientInterface->setParameters(mHardwareOutput, outputCmd.toString()); + + mTestDevice = AudioSystem::DEVICE_OUT_SPEAKER; + mTestSamplingRate = 44100; + mTestFormat = AudioSystem::PCM_16_BIT; + mTestChannels = AudioSystem::CHANNEL_OUT_STEREO; + mTestLatencyMs = 0; + mCurOutput = 0; + mDirectOutput = false; + for (int i = 0; i < NUM_TEST_OUTPUTS; i++) { + mTestOutputs[i] = 0; + } + + const size_t SIZE = 256; + char buffer[SIZE]; + snprintf(buffer, SIZE, "AudioPolicyManagerTest"); + run(buffer, ANDROID_PRIORITY_AUDIO); +#endif //AUDIO_POLICY_TEST +} + +AudioPolicyManagerBase::~AudioPolicyManagerBase() +{ +#ifdef AUDIO_POLICY_TEST + exit(); +#endif //AUDIO_POLICY_TEST + for (size_t i = 0; i < mOutputs.size(); i++) { + mpClientInterface->closeOutput(mOutputs.keyAt(i)); + delete mOutputs.valueAt(i); + } + mOutputs.clear(); + for (size_t i = 0; i < mInputs.size(); i++) { + mpClientInterface->closeInput(mInputs.keyAt(i)); + delete mInputs.valueAt(i); + } + mInputs.clear(); +} + +#ifdef AUDIO_POLICY_TEST +bool AudioPolicyManagerBase::threadLoop() +{ + LOGV("entering threadLoop()"); + while (!exitPending()) + { + String8 command; + int valueInt; + String8 value; + + Mutex::Autolock _l(mLock); + mWaitWorkCV.waitRelative(mLock, milliseconds(50)); + + command = mpClientInterface->getParameters(0, String8("test_cmd_policy")); + AudioParameter param = AudioParameter(command); + + if (param.getInt(String8("test_cmd_policy"), valueInt) == NO_ERROR && + valueInt != 0) { + LOGV("Test command %s received", command.string()); + String8 target; + if (param.get(String8("target"), target) != NO_ERROR) { + target = "Manager"; + } + if (param.getInt(String8("test_cmd_policy_output"), valueInt) == NO_ERROR) { + param.remove(String8("test_cmd_policy_output")); + mCurOutput = valueInt; + } + if (param.get(String8("test_cmd_policy_direct"), value) == NO_ERROR) { + param.remove(String8("test_cmd_policy_direct")); + if (value == "false") { + mDirectOutput = false; + } else if (value == "true") { + mDirectOutput = true; + } + } + if (param.getInt(String8("test_cmd_policy_input"), valueInt) == NO_ERROR) { + param.remove(String8("test_cmd_policy_input")); + mTestInput = valueInt; + } + + if (param.get(String8("test_cmd_policy_format"), value) == NO_ERROR) { + param.remove(String8("test_cmd_policy_format")); + int format = AudioSystem::INVALID_FORMAT; + if (value == "PCM 16 bits") { + format = AudioSystem::PCM_16_BIT; + } else if (value == "PCM 8 bits") { + format = AudioSystem::PCM_8_BIT; + } else if (value == "Compressed MP3") { + format = AudioSystem::MP3; + } + if (format != AudioSystem::INVALID_FORMAT) { + if (target == "Manager") { + mTestFormat = format; + } else if (mTestOutputs[mCurOutput] != 0) { + AudioParameter outputParam = AudioParameter(); + outputParam.addInt(String8("format"), format); + mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString()); + } + } + } + if (param.get(String8("test_cmd_policy_channels"), value) == NO_ERROR) { + param.remove(String8("test_cmd_policy_channels")); + int channels = 0; + + if (value == "Channels Stereo") { + channels = AudioSystem::CHANNEL_OUT_STEREO; + } else if (value == "Channels Mono") { + channels = AudioSystem::CHANNEL_OUT_MONO; + } + if (channels != 0) { + if (target == "Manager") { + mTestChannels = channels; + } else if (mTestOutputs[mCurOutput] != 0) { + AudioParameter outputParam = AudioParameter(); + outputParam.addInt(String8("channels"), channels); + mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString()); + } + } + } + if (param.getInt(String8("test_cmd_policy_sampleRate"), valueInt) == NO_ERROR) { + param.remove(String8("test_cmd_policy_sampleRate")); + if (valueInt >= 0 && valueInt <= 96000) { + int samplingRate = valueInt; + if (target == "Manager") { + mTestSamplingRate = samplingRate; + } else if (mTestOutputs[mCurOutput] != 0) { + AudioParameter outputParam = AudioParameter(); + outputParam.addInt(String8("sampling_rate"), samplingRate); + mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString()); + } + } + } + + if (param.get(String8("test_cmd_policy_reopen"), value) == NO_ERROR) { + param.remove(String8("test_cmd_policy_reopen")); + + mpClientInterface->closeOutput(mHardwareOutput); + delete mOutputs.valueFor(mHardwareOutput); + mOutputs.removeItem(mHardwareOutput); + + AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(); + outputDesc->mDevice = (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER; + mHardwareOutput = mpClientInterface->openOutput(&outputDesc->mDevice, + &outputDesc->mSamplingRate, + &outputDesc->mFormat, + &outputDesc->mChannels, + &outputDesc->mLatency, + outputDesc->mFlags); + if (mHardwareOutput == 0) { + LOGE("Failed to reopen hardware output stream, samplingRate: %d, format %d, channels %d", + outputDesc->mSamplingRate, outputDesc->mFormat, outputDesc->mChannels); + } else { + AudioParameter outputCmd = AudioParameter(); + outputCmd.addInt(String8("set_id"), 0); + mpClientInterface->setParameters(mHardwareOutput, outputCmd.toString()); + addOutput(mHardwareOutput, outputDesc); + } + } + + + mpClientInterface->setParameters(0, String8("test_cmd_policy=")); + } + } + return false; +} + +void AudioPolicyManagerBase::exit() +{ + { + AutoMutex _l(mLock); + requestExit(); + mWaitWorkCV.signal(); + } + requestExitAndWait(); +} + +int AudioPolicyManagerBase::testOutputIndex(audio_io_handle_t output) +{ + for (int i = 0; i < NUM_TEST_OUTPUTS; i++) { + if (output == mTestOutputs[i]) return i; + } + return 0; +} +#endif //AUDIO_POLICY_TEST + +// --- + +void AudioPolicyManagerBase::addOutput(audio_io_handle_t id, AudioOutputDescriptor *outputDesc) +{ + outputDesc->mId = id; + mOutputs.add(id, outputDesc); +} + + +#ifdef WITH_A2DP +status_t AudioPolicyManagerBase::handleA2dpConnection(AudioSystem::audio_devices device, + const char *device_address) +{ + // when an A2DP device is connected, open an A2DP and a duplicated output + LOGV("opening A2DP output for device %s", device_address); + AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(); + outputDesc->mDevice = device; + mA2dpOutput = mpClientInterface->openOutput(&outputDesc->mDevice, + &outputDesc->mSamplingRate, + &outputDesc->mFormat, + &outputDesc->mChannels, + &outputDesc->mLatency, + outputDesc->mFlags); + if (mA2dpOutput) { + // add A2DP output descriptor + addOutput(mA2dpOutput, outputDesc); + // set initial stream volume for A2DP device + applyStreamVolumes(mA2dpOutput, device); + if (a2dpUsedForSonification()) { + mDuplicatedOutput = mpClientInterface->openDuplicateOutput(mA2dpOutput, mHardwareOutput); + } + if (mDuplicatedOutput != 0 || + !a2dpUsedForSonification()) { + // If both A2DP and duplicated outputs are open, send device address to A2DP hardware + // interface + AudioParameter param; + param.add(String8("a2dp_sink_address"), String8(device_address)); + mpClientInterface->setParameters(mA2dpOutput, param.toString()); + mA2dpDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN); + + if (a2dpUsedForSonification()) { + // add duplicated output descriptor + AudioOutputDescriptor *dupOutputDesc = new AudioOutputDescriptor(); + dupOutputDesc->mOutput1 = mOutputs.valueFor(mHardwareOutput); + dupOutputDesc->mOutput2 = mOutputs.valueFor(mA2dpOutput); + dupOutputDesc->mSamplingRate = outputDesc->mSamplingRate; + dupOutputDesc->mFormat = outputDesc->mFormat; + dupOutputDesc->mChannels = outputDesc->mChannels; + dupOutputDesc->mLatency = outputDesc->mLatency; + addOutput(mDuplicatedOutput, dupOutputDesc); + applyStreamVolumes(mDuplicatedOutput, device); + } + } else { + LOGW("getOutput() could not open duplicated output for %d and %d", + mHardwareOutput, mA2dpOutput); + mpClientInterface->closeOutput(mA2dpOutput); + mOutputs.removeItem(mA2dpOutput); + mA2dpOutput = 0; + delete outputDesc; + return NO_INIT; + } + } else { + LOGW("setDeviceConnectionState() could not open A2DP output for device %x", device); + delete outputDesc; + return NO_INIT; + } + AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput); + + if (mScoDeviceAddress != "") { + // It is normal to suspend twice if we are both in call, + // and have the hardware audio output routed to BT SCO + if (mPhoneState != AudioSystem::MODE_NORMAL) { + mpClientInterface->suspendOutput(mA2dpOutput); + } + if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)hwOutputDesc->device())) { + mpClientInterface->suspendOutput(mA2dpOutput); + } + } + + if (!a2dpUsedForSonification()) { + // mute music on A2DP output if a notification or ringtone is playing + uint32_t refCount = hwOutputDesc->strategyRefCount(STRATEGY_SONIFICATION); + for (uint32_t i = 0; i < refCount; i++) { + setStrategyMute(STRATEGY_MEDIA, true, mA2dpOutput); + } + } + return NO_ERROR; +} + +status_t AudioPolicyManagerBase::handleA2dpDisconnection(AudioSystem::audio_devices device, + const char *device_address) +{ + if (mA2dpOutput == 0) { + LOGW("setDeviceConnectionState() disconnecting A2DP and no A2DP output!"); + return INVALID_OPERATION; + } + + if (mA2dpDeviceAddress != device_address) { + LOGW("setDeviceConnectionState() disconnecting unknow A2DP sink address %s", device_address); + return INVALID_OPERATION; + } + + // mute media strategy to avoid outputting sound on hardware output while music stream + // is switched from A2DP output and before music is paused by music application + setStrategyMute(STRATEGY_MEDIA, true, mHardwareOutput); + setStrategyMute(STRATEGY_MEDIA, false, mHardwareOutput, MUTE_TIME_MS); + + if (!a2dpUsedForSonification()) { + // unmute music on A2DP output if a notification or ringtone is playing + uint32_t refCount = mOutputs.valueFor(mHardwareOutput)->strategyRefCount(STRATEGY_SONIFICATION); + for (uint32_t i = 0; i < refCount; i++) { + setStrategyMute(STRATEGY_MEDIA, false, mA2dpOutput); + } + } + mA2dpDeviceAddress = ""; + return NO_ERROR; +} + +void AudioPolicyManagerBase::closeA2dpOutputs() +{ + LOGV("setDeviceConnectionState() closing A2DP and duplicated output!"); + + if (mDuplicatedOutput != 0) { + mpClientInterface->closeOutput(mDuplicatedOutput); + delete mOutputs.valueFor(mDuplicatedOutput); + mOutputs.removeItem(mDuplicatedOutput); + mDuplicatedOutput = 0; + } + if (mA2dpOutput != 0) { + AudioParameter param; + param.add(String8("closing"), String8("true")); + mpClientInterface->setParameters(mA2dpOutput, param.toString()); + mpClientInterface->closeOutput(mA2dpOutput); + delete mOutputs.valueFor(mA2dpOutput); + mOutputs.removeItem(mA2dpOutput); + mA2dpOutput = 0; + } +} + +void AudioPolicyManagerBase::checkOutputForStrategy(routing_strategy strategy, uint32_t &newDevice) +{ + uint32_t prevDevice = getDeviceForStrategy(strategy); + uint32_t curDevice = getDeviceForStrategy(strategy, false); + bool a2dpWasUsed = AudioSystem::isA2dpDevice((AudioSystem::audio_devices)(prevDevice & ~AudioSystem::DEVICE_OUT_SPEAKER)); + bool a2dpIsUsed = AudioSystem::isA2dpDevice((AudioSystem::audio_devices)(curDevice & ~AudioSystem::DEVICE_OUT_SPEAKER)); + AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput); + AudioOutputDescriptor *a2dpOutputDesc; + + if (a2dpWasUsed && !a2dpIsUsed) { + bool dupUsed = a2dpUsedForSonification() && a2dpWasUsed && (AudioSystem::popCount(prevDevice) == 2); + + if (dupUsed) { + LOGV("checkOutputForStrategy() moving strategy %d to duplicated", strategy); + a2dpOutputDesc = mOutputs.valueFor(mDuplicatedOutput); + } else { + LOGV("checkOutputForStrategy() moving strategy %d to a2dp", strategy); + a2dpOutputDesc = mOutputs.valueFor(mA2dpOutput); + } + + for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) { + if (getStrategy((AudioSystem::stream_type)i) == strategy) { + mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mHardwareOutput); + int refCount = a2dpOutputDesc->mRefCount[i]; + // in the case of duplicated output, the ref count is first incremented + // and then decremented on hardware output tus keeping its value + hwOutputDesc->changeRefCount((AudioSystem::stream_type)i, refCount); + a2dpOutputDesc->changeRefCount((AudioSystem::stream_type)i,-refCount); + } + } + // do not change newDevice if it was already set before this call by a previous call to + // getNewDevice() or checkOutputForStrategy() for a strategy with higher priority + if (newDevice == 0 && hwOutputDesc->isUsedByStrategy(strategy)) { + newDevice = getDeviceForStrategy(strategy, false); + } + } + if (a2dpIsUsed && !a2dpWasUsed) { + bool dupUsed = a2dpUsedForSonification() && a2dpIsUsed && (AudioSystem::popCount(curDevice) == 2); + audio_io_handle_t a2dpOutput; + + if (dupUsed) { + LOGV("checkOutputForStrategy() moving strategy %d from duplicated", strategy); + a2dpOutputDesc = mOutputs.valueFor(mDuplicatedOutput); + a2dpOutput = mDuplicatedOutput; + } else { + LOGV("checkOutputForStrategy() moving strategy %d from a2dp", strategy); + a2dpOutputDesc = mOutputs.valueFor(mA2dpOutput); + a2dpOutput = mA2dpOutput; + } + + for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) { + if (getStrategy((AudioSystem::stream_type)i) == strategy) { + mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, a2dpOutput); + int refCount = hwOutputDesc->mRefCount[i]; + // in the case of duplicated output, the ref count is first incremented + // and then decremented on hardware output tus keeping its value + a2dpOutputDesc->changeRefCount((AudioSystem::stream_type)i, refCount); + hwOutputDesc->changeRefCount((AudioSystem::stream_type)i,-refCount); + } + } + } +} + +void AudioPolicyManagerBase::checkOutputForAllStrategies(uint32_t &newDevice) +{ + // Check strategies in order of priority so that once newDevice is set + // for a given strategy it is not modified by subsequent calls to + // checkOutputForStrategy() + checkOutputForStrategy(STRATEGY_PHONE, newDevice); + checkOutputForStrategy(STRATEGY_SONIFICATION, newDevice); + checkOutputForStrategy(STRATEGY_MEDIA, newDevice); + checkOutputForStrategy(STRATEGY_DTMF, newDevice); +} + +#endif + +uint32_t AudioPolicyManagerBase::getNewDevice(audio_io_handle_t output, bool fromCache) +{ + uint32_t device = 0; + + AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); + // check the following by order of priority to request a routing change if necessary: + // 1: we are in call or the strategy phone is active on the hardware output: + // use device for strategy phone + // 2: the strategy sonification is active on the hardware output: + // use device for strategy sonification + // 3: the strategy media is active on the hardware output: + // use device for strategy media + // 4: the strategy DTMF is active on the hardware output: + // use device for strategy DTMF + if (mPhoneState == AudioSystem::MODE_IN_CALL || + outputDesc->isUsedByStrategy(STRATEGY_PHONE)) { + device = getDeviceForStrategy(STRATEGY_PHONE, fromCache); + } else if (outputDesc->isUsedByStrategy(STRATEGY_SONIFICATION)) { + device = getDeviceForStrategy(STRATEGY_SONIFICATION, fromCache); + } else if (outputDesc->isUsedByStrategy(STRATEGY_MEDIA)) { + device = getDeviceForStrategy(STRATEGY_MEDIA, fromCache); + } else if (outputDesc->isUsedByStrategy(STRATEGY_DTMF)) { + device = getDeviceForStrategy(STRATEGY_DTMF, fromCache); + } + + LOGV("getNewDevice() selected device %x", device); + return device; +} + +AudioPolicyManagerBase::routing_strategy AudioPolicyManagerBase::getStrategy(AudioSystem::stream_type stream) +{ + // stream to strategy mapping + switch (stream) { + case AudioSystem::VOICE_CALL: + case AudioSystem::BLUETOOTH_SCO: + return STRATEGY_PHONE; + case AudioSystem::RING: + case AudioSystem::NOTIFICATION: + case AudioSystem::ALARM: + case AudioSystem::ENFORCED_AUDIBLE: + return STRATEGY_SONIFICATION; + case AudioSystem::DTMF: + return STRATEGY_DTMF; + default: + LOGE("unknown stream type"); + case AudioSystem::SYSTEM: + // NOTE: SYSTEM stream uses MEDIA strategy because muting music and switching outputs + // while key clicks are played produces a poor result + case AudioSystem::TTS: + case AudioSystem::MUSIC: + return STRATEGY_MEDIA; + } +} + +uint32_t AudioPolicyManagerBase::getDeviceForStrategy(routing_strategy strategy, bool fromCache) +{ + uint32_t device = 0; + + if (fromCache) { + LOGV("getDeviceForStrategy() from cache strategy %d, device %x", strategy, mDeviceForStrategy[strategy]); + return mDeviceForStrategy[strategy]; + } + + switch (strategy) { + case STRATEGY_DTMF: + if (mPhoneState != AudioSystem::MODE_IN_CALL) { + // when off call, DTMF strategy follows the same rules as MEDIA strategy + device = getDeviceForStrategy(STRATEGY_MEDIA, false); + break; + } + // when in call, DTMF and PHONE strategies follow the same rules + // FALL THROUGH + + case STRATEGY_PHONE: + // for phone strategy, we first consider the forced use and then the available devices by order + // of priority + switch (mForceUse[AudioSystem::FOR_COMMUNICATION]) { + case AudioSystem::FORCE_BT_SCO: + if (mPhoneState != AudioSystem::MODE_IN_CALL || strategy != STRATEGY_DTMF) { + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT; + if (device) break; + } + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET; + if (device) break; + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO; + if (device) break; + // if SCO device is requested but no SCO device is available, fall back to default case + // FALL THROUGH + + default: // FORCE_NONE + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE; + if (device) break; + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET; + if (device) break; +#ifdef WITH_A2DP + // when not in a phone call, phone strategy should route STREAM_VOICE_CALL to A2DP + if (mPhoneState != AudioSystem::MODE_IN_CALL) { + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP; + if (device) break; + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES; + if (device) break; + } +#endif + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_EARPIECE; + if (device == 0) { + LOGE("getDeviceForStrategy() earpiece device not found"); + } + break; + + case AudioSystem::FORCE_SPEAKER: + if (mPhoneState != AudioSystem::MODE_IN_CALL || strategy != STRATEGY_DTMF) { + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT; + if (device) break; + } +#ifdef WITH_A2DP + // when not in a phone call, phone strategy should route STREAM_VOICE_CALL to + // A2DP speaker when forcing to speaker output + if (mPhoneState != AudioSystem::MODE_IN_CALL) { + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER; + if (device) break; + } +#endif + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER; + if (device == 0) { + LOGE("getDeviceForStrategy() speaker device not found"); + } + break; + } + break; + + case STRATEGY_SONIFICATION: + + // If incall, just select the STRATEGY_PHONE device: The rest of the behavior is handled by + // handleIncallSonification(). + if (mPhoneState == AudioSystem::MODE_IN_CALL) { + device = getDeviceForStrategy(STRATEGY_PHONE, false); + break; + } + device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER; + if (device == 0) { + LOGE("getDeviceForStrategy() speaker device not found"); + } + // The second device used for sonification is the same as the device used by media strategy + // FALL THROUGH + + case STRATEGY_MEDIA: { + uint32_t device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_AUX_DIGITAL; + if (device2 == 0) { + device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE; + } + if (device2 == 0) { + device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET; + } +#ifdef WITH_A2DP + if (mA2dpOutput != 0) { + if (strategy == STRATEGY_SONIFICATION && !a2dpUsedForSonification()) { + break; + } + if (device2 == 0) { + device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP; + } + if (device2 == 0) { + device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES; + } + if (device2 == 0) { + device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER; + } + } +#endif + if (device2 == 0) { + device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER; + } + + // device is DEVICE_OUT_SPEAKER if we come from case STRATEGY_SONIFICATION, 0 otherwise + device |= device2; + if (device == 0) { + LOGE("getDeviceForStrategy() speaker device not found"); + } + } break; + + default: + LOGW("getDeviceForStrategy() unknown strategy: %d", strategy); + break; + } + + LOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device); + return device; +} + +void AudioPolicyManagerBase::updateDeviceForStrategy() +{ + for (int i = 0; i < NUM_STRATEGIES; i++) { + mDeviceForStrategy[i] = getDeviceForStrategy((routing_strategy)i, false); + } +} + +void AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, uint32_t device, bool force, int delayMs) +{ + LOGV("setOutputDevice() output %d device %x delayMs %d", output, device, delayMs); + AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); + + + if (outputDesc->isDuplicated()) { + setOutputDevice(outputDesc->mOutput1->mId, device, force, delayMs); + setOutputDevice(outputDesc->mOutput2->mId, device, force, delayMs); + return; + } +#ifdef WITH_A2DP + // filter devices according to output selected + if (output == mA2dpOutput) { + device &= AudioSystem::DEVICE_OUT_ALL_A2DP; + } else { + device &= ~AudioSystem::DEVICE_OUT_ALL_A2DP; + } +#endif + + uint32_t prevDevice = (uint32_t)outputDesc->device(); + // Do not change the routing if: + // - the requestede device is 0 + // - the requested device is the same as current device and force is not specified. + // Doing this check here allows the caller to call setOutputDevice() without conditions + if ((device == 0 || device == prevDevice) && !force) { + LOGV("setOutputDevice() setting same device %x or null device for output %d", device, output); + return; + } + + outputDesc->mDevice = device; + // mute media streams if both speaker and headset are selected + if (output == mHardwareOutput && AudioSystem::popCount(device) == 2) { + setStrategyMute(STRATEGY_MEDIA, true, output); + // wait for the PCM output buffers to empty before proceeding with the rest of the command + usleep(outputDesc->mLatency*2*1000); + } +#ifdef WITH_A2DP + // suspend A2DP output if SCO device is selected + if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)device)) { + if (mA2dpOutput != 0) { + mpClientInterface->suspendOutput(mA2dpOutput); + } + } +#endif + // do the routing + AudioParameter param = AudioParameter(); + param.addInt(String8(AudioParameter::keyRouting), (int)device); + mpClientInterface->setParameters(mHardwareOutput, param.toString(), delayMs); + // update stream volumes according to new device + applyStreamVolumes(output, device, delayMs); + +#ifdef WITH_A2DP + // if disconnecting SCO device, restore A2DP output + if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)prevDevice)) { + if (mA2dpOutput != 0) { + LOGV("restore A2DP output"); + mpClientInterface->restoreOutput(mA2dpOutput); + } + } +#endif + // if changing from a combined headset + speaker route, unmute media streams + if (output == mHardwareOutput && AudioSystem::popCount(prevDevice) == 2) { + setStrategyMute(STRATEGY_MEDIA, false, output, delayMs); + } +} + +uint32_t AudioPolicyManagerBase::getDeviceForInputSource(int inputSource) +{ + uint32_t device; + + switch(inputSource) { + case AUDIO_SOURCE_DEFAULT: + case AUDIO_SOURCE_MIC: + case AUDIO_SOURCE_VOICE_RECOGNITION: + if (mForceUse[AudioSystem::FOR_RECORD] == AudioSystem::FORCE_BT_SCO && + mAvailableInputDevices & AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET) { + device = AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET; + } else if (mAvailableInputDevices & AudioSystem::DEVICE_IN_WIRED_HEADSET) { + device = AudioSystem::DEVICE_IN_WIRED_HEADSET; + } else { + device = AudioSystem::DEVICE_IN_BUILTIN_MIC; + } + break; + case AUDIO_SOURCE_CAMCORDER: + if (hasBackMicrophone()) { + device = AudioSystem::DEVICE_IN_BACK_MIC; + } else { + device = AudioSystem::DEVICE_IN_BUILTIN_MIC; + } + break; + case AUDIO_SOURCE_VOICE_UPLINK: + case AUDIO_SOURCE_VOICE_DOWNLINK: + case AUDIO_SOURCE_VOICE_CALL: + device = AudioSystem::DEVICE_IN_VOICE_CALL; + break; + default: + LOGW("getInput() invalid input source %d", inputSource); + device = 0; + break; + } + LOGV("getDeviceForInputSource()input source %d, device %08x", inputSource, device); + return device; +} + +audio_io_handle_t AudioPolicyManagerBase::getActiveInput() +{ + for (size_t i = 0; i < mInputs.size(); i++) { + if (mInputs.valueAt(i)->mRefCount > 0) { + return mInputs.keyAt(i); + } + } + return 0; +} + +float AudioPolicyManagerBase::computeVolume(int stream, int index, audio_io_handle_t output, uint32_t device) +{ + float volume = 1.0; + AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); + StreamDescriptor &streamDesc = mStreams[stream]; + + if (device == 0) { + device = outputDesc->device(); + } + + int volInt = (100 * (index - streamDesc.mIndexMin)) / (streamDesc.mIndexMax - streamDesc.mIndexMin); + volume = AudioSystem::linearToLog(volInt); + + // if a headset is connected, apply the following rules to ring tones and notifications + // to avoid sound level bursts in user's ears: + // - always attenuate ring tones and notifications volume by 6dB + // - if music is playing, always limit the volume to current music volume, + // with a minimum threshold at -36dB so that notification is always perceived. + if ((device & + (AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP | + AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | + AudioSystem::DEVICE_OUT_WIRED_HEADSET | + AudioSystem::DEVICE_OUT_WIRED_HEADPHONE)) && + (getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION) && + streamDesc.mCanBeMuted) { + volume *= SONIFICATION_HEADSET_VOLUME_FACTOR; + // when the phone is ringing we must consider that music could have been paused just before + // by the music application and behave as if music was active if the last music track was + // just stopped + if (outputDesc->mRefCount[AudioSystem::MUSIC] || mLimitRingtoneVolume) { + float musicVol = computeVolume(AudioSystem::MUSIC, mStreams[AudioSystem::MUSIC].mIndexCur, output, device); + float minVol = (musicVol > SONIFICATION_HEADSET_VOLUME_MIN) ? musicVol : SONIFICATION_HEADSET_VOLUME_MIN; + if (volume > minVol) { + volume = minVol; + LOGV("computeVolume limiting volume to %f musicVol %f", minVol, musicVol); + } + } + } + + return volume; +} + +status_t AudioPolicyManagerBase::checkAndSetVolume(int stream, int index, audio_io_handle_t output, uint32_t device, int delayMs, bool force) +{ + + // do not change actual stream volume if the stream is muted + if (mOutputs.valueFor(output)->mMuteCount[stream] != 0) { + LOGV("checkAndSetVolume() stream %d muted count %d", stream, mOutputs.valueFor(output)->mMuteCount[stream]); + return NO_ERROR; + } + + // do not change in call volume if bluetooth is connected and vice versa + if ((stream == AudioSystem::VOICE_CALL && mForceUse[AudioSystem::FOR_COMMUNICATION] == AudioSystem::FORCE_BT_SCO) || + (stream == AudioSystem::BLUETOOTH_SCO && mForceUse[AudioSystem::FOR_COMMUNICATION] != AudioSystem::FORCE_BT_SCO)) { + LOGV("checkAndSetVolume() cannot set stream %d volume with force use = %d for comm", + stream, mForceUse[AudioSystem::FOR_COMMUNICATION]); + return INVALID_OPERATION; + } + + float volume = computeVolume(stream, index, output, device); + // do not set volume if the float value did not change + if (volume != mOutputs.valueFor(output)->mCurVolume[stream] || force) { + mOutputs.valueFor(output)->mCurVolume[stream] = volume; + LOGV("setStreamVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs); + if (stream == AudioSystem::VOICE_CALL || + stream == AudioSystem::DTMF || + stream == AudioSystem::BLUETOOTH_SCO) { + float voiceVolume = -1.0; + // offset value to reflect actual hardware volume that never reaches 0 + // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java) + volume = 0.01 + 0.99 * volume; + if (stream == AudioSystem::VOICE_CALL) { + voiceVolume = (float)index/(float)mStreams[stream].mIndexMax; + } else if (stream == AudioSystem::BLUETOOTH_SCO) { + voiceVolume = 1.0; + } + if (voiceVolume >= 0 && output == mHardwareOutput) { + mpClientInterface->setVoiceVolume(voiceVolume, delayMs); + } + } + mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs); + } + + return NO_ERROR; +} + +void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs) +{ + LOGV("applyStreamVolumes() for output %d and device %x", output, device); + + for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { + checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, device, delayMs); + } +} + +void AudioPolicyManagerBase::setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, int delayMs) +{ + LOGV("setStrategyMute() strategy %d, mute %d, output %d", strategy, on, output); + for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { + if (getStrategy((AudioSystem::stream_type)stream) == strategy) { + setStreamMute(stream, on, output, delayMs); + } + } +} + +void AudioPolicyManagerBase::setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs) +{ + StreamDescriptor &streamDesc = mStreams[stream]; + AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); + + LOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d", stream, on, output, outputDesc->mMuteCount[stream]); + + if (on) { + if (outputDesc->mMuteCount[stream] == 0) { + if (streamDesc.mCanBeMuted) { + checkAndSetVolume(stream, 0, output, outputDesc->device(), delayMs); + } + } + // increment mMuteCount after calling checkAndSetVolume() so that volume change is not ignored + outputDesc->mMuteCount[stream]++; + } else { + if (outputDesc->mMuteCount[stream] == 0) { + LOGW("setStreamMute() unmuting non muted stream!"); + return; + } + if (--outputDesc->mMuteCount[stream] == 0) { + checkAndSetVolume(stream, streamDesc.mIndexCur, output, outputDesc->device(), delayMs); + } + } +} + +void AudioPolicyManagerBase::handleIncallSonification(int stream, bool starting, bool stateChange) +{ + // if the stream pertains to sonification strategy and we are in call we must + // mute the stream if it is low visibility. If it is high visibility, we must play a tone + // in the device used for phone strategy and play the tone if the selected device does not + // interfere with the device used for phone strategy + // if stateChange is true, we are called from setPhoneState() and we must mute or unmute as + // many times as there are active tracks on the output + + if (getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION) { + AudioOutputDescriptor *outputDesc = mOutputs.valueFor(mHardwareOutput); + LOGV("handleIncallSonification() stream %d starting %d device %x stateChange %d", + stream, starting, outputDesc->mDevice, stateChange); + if (outputDesc->mRefCount[stream]) { + int muteCount = 1; + if (stateChange) { + muteCount = outputDesc->mRefCount[stream]; + } + if (AudioSystem::isLowVisibility((AudioSystem::stream_type)stream)) { + LOGV("handleIncallSonification() low visibility, muteCount %d", muteCount); + for (int i = 0; i < muteCount; i++) { + setStreamMute(stream, starting, mHardwareOutput); + } + } else { + LOGV("handleIncallSonification() high visibility"); + if (outputDesc->device() & getDeviceForStrategy(STRATEGY_PHONE)) { + LOGV("handleIncallSonification() high visibility muted, muteCount %d", muteCount); + for (int i = 0; i < muteCount; i++) { + setStreamMute(stream, starting, mHardwareOutput); + } + } + if (starting) { + mpClientInterface->startTone(ToneGenerator::TONE_SUP_CALL_WAITING, AudioSystem::VOICE_CALL); + } else { + mpClientInterface->stopTone(); + } + } + } + } +} + +bool AudioPolicyManagerBase::needsDirectOuput(AudioSystem::stream_type stream, + uint32_t samplingRate, + uint32_t format, + uint32_t channels, + AudioSystem::output_flags flags, + uint32_t device) +{ + return ((flags & AudioSystem::OUTPUT_FLAG_DIRECT) || + (format !=0 && !AudioSystem::isLinearPCM(format))); +} + +// --- AudioOutputDescriptor class implementation + +AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor() + : mId(0), mSamplingRate(0), mFormat(0), mChannels(0), mLatency(0), + mFlags((AudioSystem::output_flags)0), mDevice(0), mOutput1(0), mOutput2(0) +{ + // clear usage count for all stream types + for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { + mRefCount[i] = 0; + mCurVolume[i] = -1.0; + mMuteCount[i] = 0; + } +} + +uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::device() +{ + uint32_t device = 0; + if (isDuplicated()) { + device = mOutput1->mDevice | mOutput2->mDevice; + } else { + device = mDevice; + } + return device; +} + +void AudioPolicyManagerBase::AudioOutputDescriptor::changeRefCount(AudioSystem::stream_type stream, int delta) +{ + // forward usage count change to attached outputs + if (isDuplicated()) { + mOutput1->changeRefCount(stream, delta); + mOutput2->changeRefCount(stream, delta); + } + if ((delta + (int)mRefCount[stream]) < 0) { + LOGW("changeRefCount() invalid delta %d for stream %d, refCount %d", delta, stream, mRefCount[stream]); + mRefCount[stream] = 0; + return; + } + mRefCount[stream] += delta; + LOGV("changeRefCount() stream %d, count %d", stream, mRefCount[stream]); +} + +uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::refCount() +{ + uint32_t refcount = 0; + for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) { + refcount += mRefCount[i]; + } + return refcount; +} + +uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::strategyRefCount(routing_strategy strategy) +{ + uint32_t refCount = 0; + for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) { + if (getStrategy((AudioSystem::stream_type)i) == strategy) { + refCount += mRefCount[i]; + } + } + return refCount; +} + + +status_t AudioPolicyManagerBase::AudioOutputDescriptor::dump(int fd) +{ + const size_t SIZE = 256; + char buffer[SIZE]; + String8 result; + + snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate); + result.append(buffer); + snprintf(buffer, SIZE, " Format: %d\n", mFormat); + result.append(buffer); + snprintf(buffer, SIZE, " Channels: %08x\n", mChannels); + result.append(buffer); + snprintf(buffer, SIZE, " Latency: %d\n", mLatency); + result.append(buffer); + snprintf(buffer, SIZE, " Flags %08x\n", mFlags); + result.append(buffer); + snprintf(buffer, SIZE, " Devices %08x\n", device()); + result.append(buffer); + snprintf(buffer, SIZE, " Stream volume refCount muteCount\n"); + result.append(buffer); + for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { + snprintf(buffer, SIZE, " %02d %.03f %02d %02d\n", i, mCurVolume[i], mRefCount[i], mMuteCount[i]); + result.append(buffer); + } + write(fd, result.string(), result.size()); + + return NO_ERROR; +} + +// --- AudioInputDescriptor class implementation + +AudioPolicyManagerBase::AudioInputDescriptor::AudioInputDescriptor() + : mSamplingRate(0), mFormat(0), mChannels(0), + mAcoustics((AudioSystem::audio_in_acoustics)0), mDevice(0), mRefCount(0) +{ +} + +status_t AudioPolicyManagerBase::AudioInputDescriptor::dump(int fd) +{ + const size_t SIZE = 256; + char buffer[SIZE]; + String8 result; + + snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate); + result.append(buffer); + snprintf(buffer, SIZE, " Format: %d\n", mFormat); + result.append(buffer); + snprintf(buffer, SIZE, " Channels: %08x\n", mChannels); + result.append(buffer); + snprintf(buffer, SIZE, " Acoustics %08x\n", mAcoustics); + result.append(buffer); + snprintf(buffer, SIZE, " Devices %08x\n", mDevice); + result.append(buffer); + snprintf(buffer, SIZE, " Ref Count %d\n", mRefCount); + result.append(buffer); + write(fd, result.string(), result.size()); + + return NO_ERROR; +} + +// --- StreamDescriptor class implementation + +void AudioPolicyManagerBase::StreamDescriptor::dump(char* buffer, size_t size) +{ + snprintf(buffer, size, " %02d %02d %02d %d\n", + mIndexMin, + mIndexMax, + mIndexCur, + mCanBeMuted); +} + + +}; // namespace android diff --git a/libs/audioflinger/AudioPolicyManagerGeneric.cpp b/libs/audioflinger/AudioPolicyManagerGeneric.cpp deleted file mode 100644 index 8cfc204..0000000 --- a/libs/audioflinger/AudioPolicyManagerGeneric.cpp +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -#define LOG_TAG "AudioPolicyManagerGeneric" -//#define LOG_NDEBUG 0 -#include <utils/Log.h> -#include "AudioPolicyManagerGeneric.h" -#include <media/mediarecorder.h> - -namespace android { - - -// ---------------------------------------------------------------------------- -// AudioPolicyInterface implementation -// ---------------------------------------------------------------------------- - - -status_t AudioPolicyManagerGeneric::setDeviceConnectionState(AudioSystem::audio_devices device, - AudioSystem::device_connection_state state, - const char *device_address) -{ - - LOGV("setDeviceConnectionState() device: %x, state %d, address %s", device, state, device_address); - - // connect/disconnect only 1 device at a time - if (AudioSystem::popCount(device) != 1) return BAD_VALUE; - - if (strlen(device_address) >= MAX_DEVICE_ADDRESS_LEN) { - LOGE("setDeviceConnectionState() invalid address: %s", device_address); - return BAD_VALUE; - } - - // handle output devices - if (AudioSystem::isOutputDevice(device)) { - switch (state) - { - // handle output device connection - case AudioSystem::DEVICE_STATE_AVAILABLE: - if (mAvailableOutputDevices & device) { - LOGW("setDeviceConnectionState() device already connected: %x", device); - return INVALID_OPERATION; - } - LOGV("setDeviceConnectionState() connecting device %x", device); - - // register new device as available - mAvailableOutputDevices |= device; - break; - // handle output device disconnection - case AudioSystem::DEVICE_STATE_UNAVAILABLE: - if (!(mAvailableOutputDevices & device)) { - LOGW("setDeviceConnectionState() device not connected: %x", device); - return INVALID_OPERATION; - } - LOGV("setDeviceConnectionState() disconnecting device %x", device); - // remove device from available output devices - mAvailableOutputDevices &= ~device; - break; - - default: - LOGE("setDeviceConnectionState() invalid state: %x", state); - return BAD_VALUE; - } - return NO_ERROR; - } - // handle input devices - if (AudioSystem::isInputDevice(device)) { - switch (state) - { - // handle input device connection - case AudioSystem::DEVICE_STATE_AVAILABLE: - if (mAvailableInputDevices & device) { - LOGW("setDeviceConnectionState() device already connected: %d", device); - return INVALID_OPERATION; - } - mAvailableInputDevices |= device; - break; - - // handle input device disconnection - case AudioSystem::DEVICE_STATE_UNAVAILABLE: - if (!(mAvailableInputDevices & device)) { - LOGW("setDeviceConnectionState() device not connected: %d", device); - return INVALID_OPERATION; - } - mAvailableInputDevices &= ~device; - break; - - default: - LOGE("setDeviceConnectionState() invalid state: %x", state); - return BAD_VALUE; - } - return NO_ERROR; - } - - LOGW("setDeviceConnectionState() invalid device: %x", device); - return BAD_VALUE; -} - -AudioSystem::device_connection_state AudioPolicyManagerGeneric::getDeviceConnectionState(AudioSystem::audio_devices device, - const char *device_address) -{ - AudioSystem::device_connection_state state = AudioSystem::DEVICE_STATE_UNAVAILABLE; - String8 address = String8(device_address); - if (AudioSystem::isOutputDevice(device)) { - if (device & mAvailableOutputDevices) { - state = AudioSystem::DEVICE_STATE_AVAILABLE; - } - } else if (AudioSystem::isInputDevice(device)) { - if (device & mAvailableInputDevices) { - state = AudioSystem::DEVICE_STATE_AVAILABLE; - } - } - - return state; -} - -void AudioPolicyManagerGeneric::setPhoneState(int state) -{ - LOGV("setPhoneState() state %d", state); - uint32_t newDevice = 0; - if (state < 0 || state >= AudioSystem::NUM_MODES) { - LOGW("setPhoneState() invalid state %d", state); - return; - } - - if (state == mPhoneState ) { - LOGW("setPhoneState() setting same state %d", state); - return; - } - // store previous phone state for management of sonification strategy below - int oldState = mPhoneState; - mPhoneState = state; - - // if leaving or entering in call state, handle special case of active streams - // pertaining to sonification strategy see handleIncallSonification() - if (state == AudioSystem::MODE_IN_CALL || - oldState == AudioSystem::MODE_IN_CALL) { - bool starting = (state == AudioSystem::MODE_IN_CALL) ? true : false; - LOGV("setPhoneState() in call state management: new state is %d", state); - for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { - handleIncallSonification(stream, starting); - } - } -} - -void AudioPolicyManagerGeneric::setRingerMode(uint32_t mode, uint32_t mask) -{ - LOGV("setRingerMode() mode %x, mask %x", mode, mask); - - mRingerMode = mode; -} - -void AudioPolicyManagerGeneric::setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config) -{ - LOGV("setForceUse) usage %d, config %d, mPhoneState %d", usage, config, mPhoneState); - mForceUse[usage] = config; -} - -AudioSystem::forced_config AudioPolicyManagerGeneric::getForceUse(AudioSystem::force_use usage) -{ - return mForceUse[usage]; -} - -void AudioPolicyManagerGeneric::setSystemProperty(const char* property, const char* value) -{ - LOGV("setSystemProperty() property %s, value %s", property, value); - if (strcmp(property, "ro.camera.sound.forced") == 0) { - if (atoi(value)) { - LOGV("ENFORCED_AUDIBLE cannot be muted"); - mStreams[AudioSystem::ENFORCED_AUDIBLE].mCanBeMuted = false; - } else { - LOGV("ENFORCED_AUDIBLE can be muted"); - mStreams[AudioSystem::ENFORCED_AUDIBLE].mCanBeMuted = true; - } - } -} - -audio_io_handle_t AudioPolicyManagerGeneric::getOutput(AudioSystem::stream_type stream, - uint32_t samplingRate, - uint32_t format, - uint32_t channels, - AudioSystem::output_flags flags) -{ - LOGV("getOutput() stream %d, samplingRate %d, format %d, channels %x, flags %x", stream, samplingRate, format, channels, flags); - -#ifdef AUDIO_POLICY_TEST - if (mCurOutput != 0) { - LOGV("getOutput() test output mCurOutput %d, samplingRate %d, format %d, channels %x, mDirectOutput %d", - mCurOutput, mTestSamplingRate, mTestFormat, mTestChannels, mDirectOutput); - - if (mTestOutputs[mCurOutput] == 0) { - LOGV("getOutput() opening test output"); - AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(); - outputDesc->mDevice = mTestDevice; - outputDesc->mSamplingRate = mTestSamplingRate; - outputDesc->mFormat = mTestFormat; - outputDesc->mChannels = mTestChannels; - outputDesc->mLatency = mTestLatencyMs; - outputDesc->mFlags = (AudioSystem::output_flags)(mDirectOutput ? AudioSystem::OUTPUT_FLAG_DIRECT : 0); - outputDesc->mRefCount[stream] = 0; - mTestOutputs[mCurOutput] = mpClientInterface->openOutput(&outputDesc->mDevice, - &outputDesc->mSamplingRate, - &outputDesc->mFormat, - &outputDesc->mChannels, - &outputDesc->mLatency, - outputDesc->mFlags); - if (mTestOutputs[mCurOutput]) { - AudioParameter outputCmd = AudioParameter(); - outputCmd.addInt(String8("set_id"),mCurOutput); - mpClientInterface->setParameters(mTestOutputs[mCurOutput],outputCmd.toString()); - mOutputs.add(mTestOutputs[mCurOutput], outputDesc); - } - } - return mTestOutputs[mCurOutput]; - } -#endif //AUDIO_POLICY_TEST - if ((flags & AudioSystem::OUTPUT_FLAG_DIRECT) || - (format != 0 && !AudioSystem::isLinearPCM(format)) || - (channels != 0 && channels != AudioSystem::CHANNEL_OUT_MONO && channels != AudioSystem::CHANNEL_OUT_STEREO)) { - return 0; - } - - return mHardwareOutput; -} - -status_t AudioPolicyManagerGeneric::startOutput(audio_io_handle_t output, AudioSystem::stream_type stream) -{ - LOGV("startOutput() output %d, stream %d", output, stream); - ssize_t index = mOutputs.indexOfKey(output); - if (index < 0) { - LOGW("startOutput() unknow output %d", output); - return BAD_VALUE; - } - - AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index); - - // handle special case for sonification while in call - if (mPhoneState == AudioSystem::MODE_IN_CALL) { - handleIncallSonification(stream, true); - } - - // incremenent usage count for this stream on the requested output: - outputDesc->changeRefCount(stream, 1); - return NO_ERROR; -} - -status_t AudioPolicyManagerGeneric::stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream) -{ - LOGV("stopOutput() output %d, stream %d", output, stream); - ssize_t index = mOutputs.indexOfKey(output); - if (index < 0) { - LOGW("stopOutput() unknow output %d", output); - return BAD_VALUE; - } - - AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index); - - // handle special case for sonification while in call - if (mPhoneState == AudioSystem::MODE_IN_CALL) { - handleIncallSonification(stream, false); - } - - if (outputDesc->isUsedByStream(stream)) { - // decrement usage count of this stream on the output - outputDesc->changeRefCount(stream, -1); - return NO_ERROR; - } else { - LOGW("stopOutput() refcount is already 0 for output %d", output); - return INVALID_OPERATION; - } -} - -void AudioPolicyManagerGeneric::releaseOutput(audio_io_handle_t output) -{ - LOGV("releaseOutput() %d", output); - ssize_t index = mOutputs.indexOfKey(output); - if (index < 0) { - LOGW("releaseOutput() releasing unknown output %d", output); - return; - } - -#ifdef AUDIO_POLICY_TEST - int testIndex = testOutputIndex(output); - if (testIndex != 0) { - AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index); - if (outputDesc->refCount() == 0) { - mpClientInterface->closeOutput(output); - delete mOutputs.valueAt(index); - mOutputs.removeItem(output); - mTestOutputs[testIndex] = 0; - } - } -#endif //AUDIO_POLICY_TEST -} - -audio_io_handle_t AudioPolicyManagerGeneric::getInput(int inputSource, - uint32_t samplingRate, - uint32_t format, - uint32_t channels, - AudioSystem::audio_in_acoustics acoustics) -{ - audio_io_handle_t input = 0; - uint32_t device; - - LOGV("getInput() inputSource %d, samplingRate %d, format %d, channels %x, acoustics %x", inputSource, samplingRate, format, channels, acoustics); - - AudioInputDescriptor *inputDesc = new AudioInputDescriptor(); - inputDesc->mDevice = AudioSystem::DEVICE_IN_BUILTIN_MIC; - inputDesc->mSamplingRate = samplingRate; - inputDesc->mFormat = format; - inputDesc->mChannels = channels; - inputDesc->mAcoustics = acoustics; - inputDesc->mRefCount = 0; - input = mpClientInterface->openInput(&inputDesc->mDevice, - &inputDesc->mSamplingRate, - &inputDesc->mFormat, - &inputDesc->mChannels, - inputDesc->mAcoustics); - - // only accept input with the exact requested set of parameters - if ((samplingRate != inputDesc->mSamplingRate) || - (format != inputDesc->mFormat) || - (channels != inputDesc->mChannels)) { - LOGV("getOutput() failed opening input: samplingRate %d, format %d, channels %d", - samplingRate, format, channels); - mpClientInterface->closeInput(input); - delete inputDesc; - return 0; - } - mInputs.add(input, inputDesc); - return input; -} - -status_t AudioPolicyManagerGeneric::startInput(audio_io_handle_t input) -{ - LOGV("startInput() input %d", input); - ssize_t index = mInputs.indexOfKey(input); - if (index < 0) { - LOGW("startInput() unknow input %d", input); - return BAD_VALUE; - } - AudioInputDescriptor *inputDesc = mInputs.valueAt(index); - -#ifdef AUDIO_POLICY_TEST - if (mTestInput == 0) -#endif //AUDIO_POLICY_TEST - { - // refuse 2 active AudioRecord clients at the same time - for (size_t i = 0; i < mInputs.size(); i++) { - if (mInputs.valueAt(i)->mRefCount > 0) { - LOGW("startInput() input %d, other input %d already started", input, mInputs.keyAt(i)); - return INVALID_OPERATION; - } - } - } - - inputDesc->mRefCount = 1; - return NO_ERROR; -} - -status_t AudioPolicyManagerGeneric::stopInput(audio_io_handle_t input) -{ - LOGV("stopInput() input %d", input); - ssize_t index = mInputs.indexOfKey(input); - if (index < 0) { - LOGW("stopInput() unknow input %d", input); - return BAD_VALUE; - } - AudioInputDescriptor *inputDesc = mInputs.valueAt(index); - - if (inputDesc->mRefCount == 0) { - LOGW("stopInput() input %d already stopped", input); - return INVALID_OPERATION; - } else { - inputDesc->mRefCount = 0; - return NO_ERROR; - } -} - -void AudioPolicyManagerGeneric::releaseInput(audio_io_handle_t input) -{ - LOGV("releaseInput() %d", input); - ssize_t index = mInputs.indexOfKey(input); - if (index < 0) { - LOGW("releaseInput() releasing unknown input %d", input); - return; - } - mpClientInterface->closeInput(input); - delete mInputs.valueAt(index); - mInputs.removeItem(input); -} - - - -void AudioPolicyManagerGeneric::initStreamVolume(AudioSystem::stream_type stream, - int indexMin, - int indexMax) -{ - LOGV("initStreamVolume() stream %d, min %d, max %d", stream , indexMin, indexMax); - mStreams[stream].mIndexMin = indexMin; - mStreams[stream].mIndexMax = indexMax; -} - -status_t AudioPolicyManagerGeneric::setStreamVolumeIndex(AudioSystem::stream_type stream, int index) -{ - - if ((index < mStreams[stream].mIndexMin) || (index > mStreams[stream].mIndexMax)) { - return BAD_VALUE; - } - - LOGV("setStreamVolumeIndex() stream %d, index %d", stream, index); - mStreams[stream].mIndexCur = index; - - // do not change actual stream volume if the stream is muted - if (mStreams[stream].mMuteCount != 0) { - return NO_ERROR; - } - - // Do not changed in call volume if bluetooth is connected and vice versa - if ((stream == AudioSystem::VOICE_CALL && mForceUse[AudioSystem::FOR_COMMUNICATION] == AudioSystem::FORCE_BT_SCO) || - (stream == AudioSystem::BLUETOOTH_SCO && mForceUse[AudioSystem::FOR_COMMUNICATION] != AudioSystem::FORCE_BT_SCO)) { - LOGV("setStreamVolumeIndex() cannot set stream %d volume with force use = %d for comm", - stream, mForceUse[AudioSystem::FOR_COMMUNICATION]); - return INVALID_OPERATION; - } - - // compute and apply stream volume on all outputs according to connected device - for (size_t i = 0; i < mOutputs.size(); i++) { - AudioOutputDescriptor *outputDesc = mOutputs.valueAt(i); - uint32_t device = outputDesc->device(); - - float volume = computeVolume((int)stream, index, device); - - LOGV("setStreamVolume() for output %d stream %d, volume %f", mOutputs.keyAt(i), stream, volume); - mpClientInterface->setStreamVolume(stream, volume, mOutputs.keyAt(i)); - } - return NO_ERROR; -} - -status_t AudioPolicyManagerGeneric::getStreamVolumeIndex(AudioSystem::stream_type stream, int *index) -{ - if (index == 0) { - return BAD_VALUE; - } - LOGV("getStreamVolumeIndex() stream %d", stream); - *index = mStreams[stream].mIndexCur; - return NO_ERROR; -} - -status_t AudioPolicyManagerGeneric::dump(int fd) -{ - const size_t SIZE = 256; - char buffer[SIZE]; - String8 result; - - snprintf(buffer, SIZE, "\nAudioPolicyManager Dump: %p\n", this); - result.append(buffer); - snprintf(buffer, SIZE, " Hardware Output: %d\n", mHardwareOutput); - result.append(buffer); - snprintf(buffer, SIZE, " Output devices: %08x\n", mAvailableOutputDevices); - result.append(buffer); - snprintf(buffer, SIZE, " Input devices: %08x\n", mAvailableInputDevices); - result.append(buffer); - snprintf(buffer, SIZE, " Phone state: %d\n", mPhoneState); - result.append(buffer); - snprintf(buffer, SIZE, " Ringer mode: %d\n", mRingerMode); - result.append(buffer); - snprintf(buffer, SIZE, " Force use for communications %d\n", mForceUse[AudioSystem::FOR_COMMUNICATION]); - result.append(buffer); - snprintf(buffer, SIZE, " Force use for media %d\n", mForceUse[AudioSystem::FOR_MEDIA]); - result.append(buffer); - snprintf(buffer, SIZE, " Force use for record %d\n", mForceUse[AudioSystem::FOR_RECORD]); - result.append(buffer); - write(fd, result.string(), result.size()); - - snprintf(buffer, SIZE, "\nOutputs dump:\n"); - write(fd, buffer, strlen(buffer)); - for (size_t i = 0; i < mOutputs.size(); i++) { - snprintf(buffer, SIZE, "- Output %d dump:\n", mOutputs.keyAt(i)); - write(fd, buffer, strlen(buffer)); - mOutputs.valueAt(i)->dump(fd); - } - - snprintf(buffer, SIZE, "\nInputs dump:\n"); - write(fd, buffer, strlen(buffer)); - for (size_t i = 0; i < mInputs.size(); i++) { - snprintf(buffer, SIZE, "- Input %d dump:\n", mInputs.keyAt(i)); - write(fd, buffer, strlen(buffer)); - mInputs.valueAt(i)->dump(fd); - } - - snprintf(buffer, SIZE, "\nStreams dump:\n"); - write(fd, buffer, strlen(buffer)); - snprintf(buffer, SIZE, " Stream Index Min Index Max Index Cur Mute Count Can be muted\n"); - write(fd, buffer, strlen(buffer)); - for (size_t i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { - snprintf(buffer, SIZE, " %02d", i); - mStreams[i].dump(buffer + 3, SIZE); - write(fd, buffer, strlen(buffer)); - } - - return NO_ERROR; -} - -// ---------------------------------------------------------------------------- -// AudioPolicyManagerGeneric -// ---------------------------------------------------------------------------- - -// --- class factory - -AudioPolicyManagerGeneric::AudioPolicyManagerGeneric(AudioPolicyClientInterface *clientInterface) - : -#ifdef AUDIO_POLICY_TEST - Thread(false), -#endif //AUDIO_POLICY_TEST - mPhoneState(AudioSystem::MODE_NORMAL), mRingerMode(0) -{ - mpClientInterface = clientInterface; - - for (int i = 0; i < AudioSystem::NUM_FORCE_USE; i++) { - mForceUse[i] = AudioSystem::FORCE_NONE; - } - - // devices available by default are speaker, ear piece and microphone - mAvailableOutputDevices = AudioSystem::DEVICE_OUT_SPEAKER; - mAvailableInputDevices = AudioSystem::DEVICE_IN_BUILTIN_MIC; - - // open hardware output - AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(); - outputDesc->mDevice = (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER; - mHardwareOutput = mpClientInterface->openOutput(&outputDesc->mDevice, - &outputDesc->mSamplingRate, - &outputDesc->mFormat, - &outputDesc->mChannels, - &outputDesc->mLatency, - outputDesc->mFlags); - - if (mHardwareOutput == 0) { - LOGE("Failed to initialize hardware output stream, samplingRate: %d, format %d, channels %d", - outputDesc->mSamplingRate, outputDesc->mFormat, outputDesc->mChannels); - } else { - mOutputs.add(mHardwareOutput, outputDesc); - } - -#ifdef AUDIO_POLICY_TEST - AudioParameter outputCmd = AudioParameter(); - outputCmd.addInt(String8("set_id"), 0); - mpClientInterface->setParameters(mHardwareOutput, outputCmd.toString()); - - mTestDevice = AudioSystem::DEVICE_OUT_SPEAKER; - mTestSamplingRate = 44100; - mTestFormat = AudioSystem::PCM_16_BIT; - mTestChannels = AudioSystem::CHANNEL_OUT_STEREO; - mTestLatencyMs = 0; - mCurOutput = 0; - mDirectOutput = false; - for (int i = 0; i < NUM_TEST_OUTPUTS; i++) { - mTestOutputs[i] = 0; - } - - const size_t SIZE = 256; - char buffer[SIZE]; - snprintf(buffer, SIZE, "AudioPolicyManagerTest"); - run(buffer, ANDROID_PRIORITY_AUDIO); -#endif //AUDIO_POLICY_TEST -} - -AudioPolicyManagerGeneric::~AudioPolicyManagerGeneric() -{ -#ifdef AUDIO_POLICY_TEST - exit(); -#endif //AUDIO_POLICY_TEST - - for (size_t i = 0; i < mOutputs.size(); i++) { - mpClientInterface->closeOutput(mOutputs.keyAt(i)); - delete mOutputs.valueAt(i); - } - mOutputs.clear(); - for (size_t i = 0; i < mInputs.size(); i++) { - mpClientInterface->closeInput(mInputs.keyAt(i)); - delete mInputs.valueAt(i); - } - mInputs.clear(); -} - -#ifdef AUDIO_POLICY_TEST -bool AudioPolicyManagerGeneric::threadLoop() -{ - LOGV("entering threadLoop()"); - while (!exitPending()) - { - String8 command; - int valueInt; - String8 value; - - Mutex::Autolock _l(mLock); - mWaitWorkCV.waitRelative(mLock, milliseconds(50)); - - command = mpClientInterface->getParameters(0, String8("test_cmd_policy")); - AudioParameter param = AudioParameter(command); - - if (param.getInt(String8("test_cmd_policy"), valueInt) == NO_ERROR && - valueInt != 0) { - LOGV("Test command %s received", command.string()); - String8 target; - if (param.get(String8("target"), target) != NO_ERROR) { - target = "Manager"; - } - if (param.getInt(String8("test_cmd_policy_output"), valueInt) == NO_ERROR) { - param.remove(String8("test_cmd_policy_output")); - mCurOutput = valueInt; - } - if (param.get(String8("test_cmd_policy_direct"), value) == NO_ERROR) { - param.remove(String8("test_cmd_policy_direct")); - if (value == "false") { - mDirectOutput = false; - } else if (value == "true") { - mDirectOutput = true; - } - } - if (param.getInt(String8("test_cmd_policy_input"), valueInt) == NO_ERROR) { - param.remove(String8("test_cmd_policy_input")); - mTestInput = valueInt; - } - - if (param.get(String8("test_cmd_policy_format"), value) == NO_ERROR) { - param.remove(String8("test_cmd_policy_format")); - int format = AudioSystem::INVALID_FORMAT; - if (value == "PCM 16 bits") { - format = AudioSystem::PCM_16_BIT; - } else if (value == "PCM 8 bits") { - format = AudioSystem::PCM_8_BIT; - } else if (value == "Compressed MP3") { - format = AudioSystem::MP3; - } - if (format != AudioSystem::INVALID_FORMAT) { - if (target == "Manager") { - mTestFormat = format; - } else if (mTestOutputs[mCurOutput] != 0) { - AudioParameter outputParam = AudioParameter(); - outputParam.addInt(String8("format"), format); - mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString()); - } - } - } - if (param.get(String8("test_cmd_policy_channels"), value) == NO_ERROR) { - param.remove(String8("test_cmd_policy_channels")); - int channels = 0; - - if (value == "Channels Stereo") { - channels = AudioSystem::CHANNEL_OUT_STEREO; - } else if (value == "Channels Mono") { - channels = AudioSystem::CHANNEL_OUT_MONO; - } - if (channels != 0) { - if (target == "Manager") { - mTestChannels = channels; - } else if (mTestOutputs[mCurOutput] != 0) { - AudioParameter outputParam = AudioParameter(); - outputParam.addInt(String8("channels"), channels); - mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString()); - } - } - } - if (param.getInt(String8("test_cmd_policy_sampleRate"), valueInt) == NO_ERROR) { - param.remove(String8("test_cmd_policy_sampleRate")); - if (valueInt >= 0 && valueInt <= 96000) { - int samplingRate = valueInt; - if (target == "Manager") { - mTestSamplingRate = samplingRate; - } else if (mTestOutputs[mCurOutput] != 0) { - AudioParameter outputParam = AudioParameter(); - outputParam.addInt(String8("sampling_rate"), samplingRate); - mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString()); - } - } - } - - if (param.get(String8("test_cmd_policy_reopen"), value) == NO_ERROR) { - param.remove(String8("test_cmd_policy_reopen")); - - mpClientInterface->closeOutput(mHardwareOutput); - delete mOutputs.valueFor(mHardwareOutput); - mOutputs.removeItem(mHardwareOutput); - - AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(); - outputDesc->mDevice = (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER; - mHardwareOutput = mpClientInterface->openOutput(&outputDesc->mDevice, - &outputDesc->mSamplingRate, - &outputDesc->mFormat, - &outputDesc->mChannels, - &outputDesc->mLatency, - outputDesc->mFlags); - if (mHardwareOutput == 0) { - LOGE("Failed to reopen hardware output stream, samplingRate: %d, format %d, channels %d", - outputDesc->mSamplingRate, outputDesc->mFormat, outputDesc->mChannels); - } else { - AudioParameter outputCmd = AudioParameter(); - outputCmd.addInt(String8("set_id"), 0); - mpClientInterface->setParameters(mHardwareOutput, outputCmd.toString()); - mOutputs.add(mHardwareOutput, outputDesc); - } - } - - - mpClientInterface->setParameters(0, String8("test_cmd_policy=")); - } - } - return false; -} - -void AudioPolicyManagerGeneric::exit() -{ - { - AutoMutex _l(mLock); - requestExit(); - mWaitWorkCV.signal(); - } - requestExitAndWait(); -} - -int AudioPolicyManagerGeneric::testOutputIndex(audio_io_handle_t output) -{ - for (int i = 0; i < NUM_TEST_OUTPUTS; i++) { - if (output == mTestOutputs[i]) return i; - } - return 0; -} -#endif //AUDIO_POLICY_TEST - -// --- - -AudioPolicyManagerGeneric::routing_strategy AudioPolicyManagerGeneric::getStrategy(AudioSystem::stream_type stream) -{ - // stream to strategy mapping - switch (stream) { - case AudioSystem::VOICE_CALL: - case AudioSystem::BLUETOOTH_SCO: - return STRATEGY_PHONE; - case AudioSystem::RING: - case AudioSystem::NOTIFICATION: - case AudioSystem::ALARM: - case AudioSystem::ENFORCED_AUDIBLE: - return STRATEGY_SONIFICATION; - case AudioSystem::DTMF: - return STRATEGY_DTMF; - default: - LOGE("unknown stream type"); - case AudioSystem::SYSTEM: - // NOTE: SYSTEM stream uses MEDIA strategy because muting music and switching outputs - // while key clicks are played produces a poor result - case AudioSystem::TTS: - case AudioSystem::MUSIC: - return STRATEGY_MEDIA; - } -} - - -float AudioPolicyManagerGeneric::computeVolume(int stream, int index, uint32_t device) -{ - float volume = 1.0; - - StreamDescriptor &streamDesc = mStreams[stream]; - - // Force max volume if stream cannot be muted - if (!streamDesc.mCanBeMuted) index = streamDesc.mIndexMax; - - int volInt = (100 * (index - streamDesc.mIndexMin)) / (streamDesc.mIndexMax - streamDesc.mIndexMin); - volume = AudioSystem::linearToLog(volInt); - - return volume; -} - -void AudioPolicyManagerGeneric::setStreamMute(int stream, bool on, audio_io_handle_t output) -{ - LOGV("setStreamMute() stream %d, mute %d, output %d", stream, on, output); - - StreamDescriptor &streamDesc = mStreams[stream]; - - if (on) { - if (streamDesc.mMuteCount++ == 0) { - if (streamDesc.mCanBeMuted) { - mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, 0, output); - } - } - } else { - if (streamDesc.mMuteCount == 0) { - LOGW("setStreamMute() unmuting non muted stream!"); - return; - } - if (--streamDesc.mMuteCount == 0) { - uint32_t device = mOutputs.valueFor(output)->mDevice; - float volume = computeVolume(stream, streamDesc.mIndexCur, device); - mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output); - } - } -} - -void AudioPolicyManagerGeneric::handleIncallSonification(int stream, bool starting) -{ - // if the stream pertains to sonification strategy and we are in call we must - // mute the stream if it is low visibility. If it is high visibility, we must play a tone - // in the device used for phone strategy and play the tone if the selected device does not - // interfere with the device used for phone strategy - if (getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION) { - AudioOutputDescriptor *outputDesc = mOutputs.valueFor(mHardwareOutput); - LOGV("handleIncallSonification() stream %d starting %d device %x", stream, starting, outputDesc->mDevice); - if (outputDesc->isUsedByStream((AudioSystem::stream_type)stream)) { - if (AudioSystem::isLowVisibility((AudioSystem::stream_type)stream)) { - LOGV("handleIncallSonification() low visibility"); - setStreamMute(stream, starting, mHardwareOutput); - } else { - if (starting) { - mpClientInterface->startTone(ToneGenerator::TONE_SUP_CALL_WAITING, AudioSystem::VOICE_CALL); - } else { - mpClientInterface->stopTone(); - } - } - } - } -} - - -// --- AudioOutputDescriptor class implementation - -AudioPolicyManagerGeneric::AudioOutputDescriptor::AudioOutputDescriptor() - : mSamplingRate(0), mFormat(0), mChannels(0), mLatency(0), - mFlags((AudioSystem::output_flags)0), mDevice(0) -{ - // clear usage count for all stream types - for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { - mRefCount[i] = 0; - } -} - -uint32_t AudioPolicyManagerGeneric::AudioOutputDescriptor::device() -{ - return mDevice; -} - -void AudioPolicyManagerGeneric::AudioOutputDescriptor::changeRefCount(AudioSystem::stream_type stream, int delta) -{ - if ((delta + (int)mRefCount[stream]) < 0) { - LOGW("changeRefCount() invalid delta %d for stream %d, refCount %d", delta, stream, mRefCount[stream]); - mRefCount[stream] = 0; - return; - } - mRefCount[stream] += delta; - LOGV("changeRefCount() stream %d, count %d", stream, mRefCount[stream]); -} - -uint32_t AudioPolicyManagerGeneric::AudioOutputDescriptor::refCount() -{ - uint32_t refcount = 0; - for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) { - refcount += mRefCount[i]; - } - return refcount; -} - -status_t AudioPolicyManagerGeneric::AudioOutputDescriptor::dump(int fd) -{ - const size_t SIZE = 256; - char buffer[SIZE]; - String8 result; - - snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate); - result.append(buffer); - snprintf(buffer, SIZE, " Format: %d\n", mFormat); - result.append(buffer); - snprintf(buffer, SIZE, " Channels: %08x\n", mChannels); - result.append(buffer); - snprintf(buffer, SIZE, " Latency: %d\n", mLatency); - result.append(buffer); - snprintf(buffer, SIZE, " Flags %08x\n", mFlags); - result.append(buffer); - snprintf(buffer, SIZE, " Devices %08x\n", mDevice); - result.append(buffer); - snprintf(buffer, SIZE, " Stream refCount\n"); - result.append(buffer); - for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { - snprintf(buffer, SIZE, " %02d %d\n", i, mRefCount[i]); - result.append(buffer); - } - write(fd, result.string(), result.size()); - - return NO_ERROR; -} - -// --- AudioInputDescriptor class implementation - -AudioPolicyManagerGeneric::AudioInputDescriptor::AudioInputDescriptor() - : mSamplingRate(0), mFormat(0), mChannels(0), - mAcoustics((AudioSystem::audio_in_acoustics)0), mDevice(0), mRefCount(0) -{ -} - -status_t AudioPolicyManagerGeneric::AudioInputDescriptor::dump(int fd) -{ - const size_t SIZE = 256; - char buffer[SIZE]; - String8 result; - - snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate); - result.append(buffer); - snprintf(buffer, SIZE, " Format: %d\n", mFormat); - result.append(buffer); - snprintf(buffer, SIZE, " Channels: %08x\n", mChannels); - result.append(buffer); - snprintf(buffer, SIZE, " Acoustics %08x\n", mAcoustics); - result.append(buffer); - snprintf(buffer, SIZE, " Devices %08x\n", mDevice); - result.append(buffer); - snprintf(buffer, SIZE, " Ref Count %d\n", mRefCount); - result.append(buffer); - write(fd, result.string(), result.size()); - - return NO_ERROR; -} - -// --- StreamDescriptor class implementation - -void AudioPolicyManagerGeneric::StreamDescriptor::dump(char* buffer, size_t size) -{ - snprintf(buffer, size, " %02d %02d %02d %02d %d\n", - mIndexMin, - mIndexMax, - mIndexCur, - mMuteCount, - mCanBeMuted); -} - -}; // namespace android diff --git a/libs/audioflinger/AudioPolicyManagerGeneric.h b/libs/audioflinger/AudioPolicyManagerGeneric.h deleted file mode 100644 index 4997cdf..0000000 --- a/libs/audioflinger/AudioPolicyManagerGeneric.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (C) 2009 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 <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/KeyedVector.h> -#include <hardware_legacy/AudioPolicyInterface.h> -#include <utils/threads.h> - - -namespace android { - -// ---------------------------------------------------------------------------- - -#define MAX_DEVICE_ADDRESS_LEN 20 -#define NUM_TEST_OUTPUTS 5 - -class AudioPolicyManagerGeneric: public AudioPolicyInterface -#ifdef AUDIO_POLICY_TEST - , public Thread -#endif //AUDIO_POLICY_TEST -{ - -public: - AudioPolicyManagerGeneric(AudioPolicyClientInterface *clientInterface); - virtual ~AudioPolicyManagerGeneric(); - - // AudioPolicyInterface - virtual status_t setDeviceConnectionState(AudioSystem::audio_devices device, - AudioSystem::device_connection_state state, - const char *device_address); - virtual AudioSystem::device_connection_state getDeviceConnectionState(AudioSystem::audio_devices device, - const char *device_address); - virtual void setPhoneState(int state); - virtual void setRingerMode(uint32_t mode, uint32_t mask); - virtual void setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config); - virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage); - virtual void setSystemProperty(const char* property, const char* value); - virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, - uint32_t samplingRate, - uint32_t format, - uint32_t channels, - AudioSystem::output_flags flags); - virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream); - virtual status_t stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream); - virtual void releaseOutput(audio_io_handle_t output); - virtual audio_io_handle_t getInput(int inputSource, - uint32_t samplingRate, - uint32_t format, - uint32_t channels, - AudioSystem::audio_in_acoustics acoustics); - // indicates to the audio policy manager that the input starts being used. - virtual status_t startInput(audio_io_handle_t input); - // indicates to the audio policy manager that the input stops being used. - virtual status_t stopInput(audio_io_handle_t input); - virtual void releaseInput(audio_io_handle_t input); - virtual void initStreamVolume(AudioSystem::stream_type stream, - int indexMin, - int indexMax); - virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index); - virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index); - - virtual status_t dump(int fd); - -private: - - enum routing_strategy { - STRATEGY_MEDIA, - STRATEGY_PHONE, - STRATEGY_SONIFICATION, - STRATEGY_DTMF, - NUM_STRATEGIES - }; - - // descriptor for audio outputs. Used to maintain current configuration of each opened audio output - // and keep track of the usage of this output by each audio stream type. - class AudioOutputDescriptor - { - public: - AudioOutputDescriptor(); - - status_t dump(int fd); - - uint32_t device(); - void changeRefCount(AudioSystem::stream_type, int delta); - bool isUsedByStream(AudioSystem::stream_type stream) { return mRefCount[stream] > 0 ? true : false; } - uint32_t refCount(); - - uint32_t mSamplingRate; // - uint32_t mFormat; // - uint32_t mChannels; // output configuration - uint32_t mLatency; // - AudioSystem::output_flags mFlags; // - uint32_t mDevice; // current device this output is routed to - uint32_t mRefCount[AudioSystem::NUM_STREAM_TYPES]; // number of streams of each type using this output - }; - - // descriptor for audio inputs. Used to maintain current configuration of each opened audio input - // and keep track of the usage of this input. - class AudioInputDescriptor - { - public: - AudioInputDescriptor(); - - status_t dump(int fd); - - uint32_t mSamplingRate; // - uint32_t mFormat; // input configuration - uint32_t mChannels; // - AudioSystem::audio_in_acoustics mAcoustics; // - uint32_t mDevice; // current device this input is routed to - uint32_t mRefCount; // number of AudioRecord clients using this output - }; - - // stream descriptor used for volume control - class StreamDescriptor - { - public: - StreamDescriptor() - : mIndexMin(0), mIndexMax(1), mIndexCur(1), mMuteCount(0), mCanBeMuted(true) {} - - void dump(char* buffer, size_t size); - - int mIndexMin; // min volume index - int mIndexMax; // max volume index - int mIndexCur; // current volume index - int mMuteCount; // mute request counter - bool mCanBeMuted; // true is the stream can be muted - }; - - // return the strategy corresponding to a given stream type - static routing_strategy getStrategy(AudioSystem::stream_type stream); - // return the output handle of an output routed to the specified device, 0 if no output - // is routed to the device - float computeVolume(int stream, int index, uint32_t device); - // Mute or unmute the stream on the specified output - void setStreamMute(int stream, bool on, audio_io_handle_t output); - // handle special cases for sonification strategy while in call: mute streams or replace by - // a special tone in the device used for communication - void handleIncallSonification(int stream, bool starting); - - -#ifdef AUDIO_POLICY_TEST - virtual bool threadLoop(); - void exit(); - int testOutputIndex(audio_io_handle_t output); -#endif //AUDIO_POLICY_TEST - - - AudioPolicyClientInterface *mpClientInterface; // audio policy client interface - audio_io_handle_t mHardwareOutput; // hardware output handler - - KeyedVector<audio_io_handle_t, AudioOutputDescriptor *> mOutputs; // list ot output descritors - KeyedVector<audio_io_handle_t, AudioInputDescriptor *> mInputs; // list of input descriptors - uint32_t mAvailableOutputDevices; // bit field of all available output devices - uint32_t mAvailableInputDevices; // bit field of all available input devices - int mPhoneState; // current phone state - uint32_t mRingerMode; // current ringer mode - AudioSystem::forced_config mForceUse[AudioSystem::NUM_FORCE_USE]; // current forced use configuration - - StreamDescriptor mStreams[AudioSystem::NUM_STREAM_TYPES]; // stream descriptors for volume control - -#ifdef AUDIO_POLICY_TEST - Mutex mLock; - Condition mWaitWorkCV; - - int mCurOutput; - bool mDirectOutput; - audio_io_handle_t mTestOutputs[NUM_TEST_OUTPUTS]; - int mTestInput; - uint32_t mTestDevice; - uint32_t mTestSamplingRate; - uint32_t mTestFormat; - uint32_t mTestChannels; - uint32_t mTestLatencyMs; -#endif //AUDIO_POLICY_TEST - -}; - -}; diff --git a/libs/audioflinger/AudioPolicyService.cpp b/libs/audioflinger/AudioPolicyService.cpp index aa48019..bb3905c 100644 --- a/libs/audioflinger/AudioPolicyService.cpp +++ b/libs/audioflinger/AudioPolicyService.cpp @@ -30,9 +30,10 @@ #include <utils/String16.h> #include <utils/threads.h> #include "AudioPolicyService.h" -#include "AudioPolicyManagerGeneric.h" +#include <hardware_legacy/AudioPolicyManagerBase.h> #include <cutils/properties.h> #include <dlfcn.h> +#include <hardware_legacy/power.h> // ---------------------------------------------------------------------------- // the sim build doesn't have gettid @@ -43,8 +44,9 @@ namespace android { -static const char* kDeadlockedString = "AudioPolicyService may be deadlocked\n"; -static const char* kCmdDeadlockedString = "AudioPolicyService command thread may be deadlocked\n"; + +static const char *kDeadlockedString = "AudioPolicyService may be deadlocked\n"; +static const char *kCmdDeadlockedString = "AudioPolicyService command thread may be deadlocked\n"; static const int kDumpLockRetries = 50; static const int kDumpLockSleep = 20000; @@ -67,18 +69,18 @@ AudioPolicyService::AudioPolicyService() char value[PROPERTY_VALUE_MAX]; // start tone playback thread - mTonePlaybackThread = new AudioCommandThread(); + mTonePlaybackThread = new AudioCommandThread(String8("")); // start audio commands thread - mAudioCommandThread = new AudioCommandThread(); + mAudioCommandThread = new AudioCommandThread(String8("ApmCommandThread")); #if (defined GENERIC_AUDIO) || (defined AUDIO_POLICY_TEST) - mpPolicyManager = new AudioPolicyManagerGeneric(this); + mpPolicyManager = new AudioPolicyManagerBase(this); LOGV("build for GENERIC_AUDIO - using generic audio policy"); #else // if running in emulation - use the emulator driver if (property_get("ro.kernel.qemu", value, 0)) { LOGV("Running in emulation - using generic audio policy"); - mpPolicyManager = new AudioPolicyManagerGeneric(this); + mpPolicyManager = new AudioPolicyManagerBase(this); } else { LOGV("Using hardware specific audio policy"); @@ -556,8 +558,8 @@ status_t AudioPolicyService::setVoiceVolume(float volume, int delayMs) // ----------- AudioPolicyService::AudioCommandThread implementation ---------- -AudioPolicyService::AudioCommandThread::AudioCommandThread() - : Thread(false) +AudioPolicyService::AudioCommandThread::AudioCommandThread(String8 name) + : Thread(false), mName(name) { mpToneGenerator = NULL; } @@ -565,18 +567,20 @@ AudioPolicyService::AudioCommandThread::AudioCommandThread() AudioPolicyService::AudioCommandThread::~AudioCommandThread() { + if (mName != "" && !mAudioCommands.isEmpty()) { + release_wake_lock(mName.string()); + } mAudioCommands.clear(); if (mpToneGenerator != NULL) delete mpToneGenerator; } void AudioPolicyService::AudioCommandThread::onFirstRef() { - const size_t SIZE = 256; - char buffer[SIZE]; - - snprintf(buffer, SIZE, "AudioCommandThread"); - - run(buffer, ANDROID_PRIORITY_AUDIO); + if (mName != "") { + run(mName.string(), ANDROID_PRIORITY_AUDIO); + } else { + run("AudioCommandThread", ANDROID_PRIORITY_AUDIO); + } } bool AudioPolicyService::AudioCommandThread::threadLoop() @@ -657,6 +661,10 @@ bool AudioPolicyService::AudioCommandThread::threadLoop() break; } } + // release delayed commands wake lock + if (mName != "" && mAudioCommands.isEmpty()) { + release_wake_lock(mName.string()); + } LOGV("AudioCommandThread() going to sleep"); mWaitWorkCV.waitRelative(mLock, waitTime); LOGV("AudioCommandThread() waking up"); @@ -815,6 +823,11 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(AudioCommand *comma command->mTime = systemTime() + milliseconds(delayMs); + // acquire wake lock to make sure delayed commands are processed + if (mName != "" && mAudioCommands.isEmpty()) { + acquire_wake_lock(PARTIAL_WAKE_LOCK, mName.string()); + } + // check same pending commands with later time stamps and eliminate them for (i = mAudioCommands.size()-1; i >= 0; i--) { AudioCommand *command2 = mAudioCommands[i]; @@ -883,7 +896,7 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(AudioCommand *comma removedCommands.clear(); // insert command at the right place according to its time stamp - LOGV("inserting command: %d at index %ld, num commands %d", command->mCommand, i+1, mAudioCommands.size()); + LOGV("inserting command: %d at index %d, num commands %d", command->mCommand, (int)i+1, mAudioCommands.size()); mAudioCommands.insertAt(command, i + 1); } diff --git a/libs/audioflinger/AudioPolicyService.h b/libs/audioflinger/AudioPolicyService.h index b9234ec..a13d0bd 100644 --- a/libs/audioflinger/AudioPolicyService.h +++ b/libs/audioflinger/AudioPolicyService.h @@ -132,7 +132,7 @@ private: SET_VOICE_VOLUME }; - AudioCommandThread (); + AudioCommandThread (String8 name); virtual ~AudioCommandThread(); status_t dump(int fd); @@ -195,7 +195,8 @@ private: Condition mWaitWorkCV; Vector <AudioCommand *> mAudioCommands; // list of pending commands ToneGenerator *mpToneGenerator; // the tone generator - AudioCommand mLastCommand; + AudioCommand mLastCommand; // last processed command (used by dump) + String8 mName; // string used by wake lock fo delayed commands }; // Internal dump utilities. diff --git a/libs/audioflinger/AudioResampler.h b/libs/audioflinger/AudioResampler.h index 39656c0..2dfac76 100644 --- a/libs/audioflinger/AudioResampler.h +++ b/libs/audioflinger/AudioResampler.h @@ -76,8 +76,8 @@ protected: int32_t mInSampleRate; AudioBufferProvider::Buffer mBuffer; union { - int16_t mVolume[2]; - uint32_t mVolumeRL; + int16_t mVolume[2]; + uint32_t mVolumeRL; }; int16_t mTargetVolume[2]; format mFormat; diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp index 6c1d225..bc8c412 100644 --- a/libs/binder/IMemory.cpp +++ b/libs/binder/IMemory.cpp @@ -46,7 +46,6 @@ public: virtual void binderDied(const wp<IBinder>& who); sp<IMemoryHeap> find_heap(const sp<IBinder>& binder); - void pin_heap(const sp<IBinder>& binder); void free_heap(const sp<IBinder>& binder); sp<IMemoryHeap> get_heap(const sp<IBinder>& binder); void dump_heaps(); @@ -100,13 +99,9 @@ private: static inline void dump_heaps() { gHeapCache->dump_heaps(); } - void inline pin_heap() const { - gHeapCache->pin_heap(const_cast<BpMemoryHeap*>(this)->asBinder()); - } void assertMapped() const; void assertReallyMapped() const; - void pinHeap() const; mutable volatile int32_t mHeapId; mutable void* mBase; @@ -320,11 +315,6 @@ void BpMemoryHeap::assertReallyMapped() const asBinder().get(), size, fd, strerror(errno)); close(fd); } else { - if (flags & MAP_ONCE) { - //LOGD("pinning heap (binder=%p, size=%d, fd=%d", - // asBinder().get(), size, fd); - pin_heap(); - } mSize = size; mFlags = flags; android_atomic_write(fd, &mHeapId); @@ -421,19 +411,6 @@ sp<IMemoryHeap> HeapCache::find_heap(const sp<IBinder>& binder) } } -void HeapCache::pin_heap(const sp<IBinder>& binder) -{ - Mutex::Autolock _l(mHeapCacheLock); - ssize_t i = mHeapCache.indexOfKey(binder); - if (i>=0) { - heap_info_t& info(mHeapCache.editValueAt(i)); - android_atomic_inc(&info.count); - binder->linkToDeath(this); - } else { - LOGE("pin_heap binder=%p not found!!!", binder.get()); - } -} - void HeapCache::free_heap(const sp<IBinder>& binder) { free_heap( wp<IBinder>(binder) ); } diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index b2a7db8..0016503 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -292,6 +292,7 @@ static pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER; static bool gHaveTLS = false; static pthread_key_t gTLS = 0; static bool gShutdown = false; +static bool gDisableBackgroundScheduling = false; IPCThreadState* IPCThreadState::self() { @@ -332,6 +333,11 @@ void IPCThreadState::shutdown() } } +void IPCThreadState::disableBackgroundScheduling(bool disable) +{ + gDisableBackgroundScheduling = disable; +} + sp<ProcessState> IPCThreadState::process() { return mProcess; @@ -386,6 +392,11 @@ void IPCThreadState::joinThreadPool(bool isMain) mOut.writeInt32(isMain ? BC_ENTER_LOOPER : BC_REGISTER_LOOPER); + // This thread may have been spawned by a thread that was in the background + // scheduling group, so first we will make sure it is in the default/foreground + // one to avoid performing an initial transaction in the background. + androidSetThreadSchedulingGroup(mMyThreadId, ANDROID_TGROUP_DEFAULT); + status_t result; do { int32_t cmd; @@ -427,19 +438,13 @@ void IPCThreadState::joinThreadPool(bool isMain) } // After executing the command, ensure that the thread is returned to the - // default cgroup and priority before rejoining the pool. This is a failsafe - // in case the command implementation failed to properly restore the thread's - // scheduling parameters upon completion. - int my_id; -#ifdef HAVE_GETTID - my_id = gettid(); -#else - my_id = getpid(); -#endif - if (!set_sched_policy(my_id, SP_FOREGROUND)) { - // success; reset the priority as well - setpriority(PRIO_PROCESS, my_id, ANDROID_PRIORITY_NORMAL); - } + // default cgroup before rejoining the pool. The driver takes care of + // restoring the priority, but doesn't do anything with cgroups so we + // need to take care of that here in userspace. Note that we do make + // sure to go in the foreground after executing a transaction, but + // there are other callbacks into user code that could have changed + // our group so we want to make absolutely sure it is put back. + androidSetThreadSchedulingGroup(mMyThreadId, ANDROID_TGROUP_DEFAULT); // Let this thread exit the thread pool if it is no longer // needed and it is not the main process thread. @@ -583,10 +588,10 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy) } IPCThreadState::IPCThreadState() - : mProcess(ProcessState::self()) + : mProcess(ProcessState::self()), mMyThreadId(androidGetTid()) { pthread_setspecific(gTLS, this); - clearCaller(); + clearCaller(); mIn.setDataCapacity(256); mOut.setDataCapacity(256); } @@ -930,6 +935,27 @@ status_t IPCThreadState::executeCommand(int32_t cmd) mCallingPid = tr.sender_pid; mCallingUid = tr.sender_euid; + int curPrio = getpriority(PRIO_PROCESS, mMyThreadId); + if (gDisableBackgroundScheduling) { + if (curPrio > ANDROID_PRIORITY_NORMAL) { + // We have inherited a reduced priority from the caller, but do not + // want to run in that state in this process. The driver set our + // priority already (though not our scheduling class), so bounce + // it back to the default before invoking the transaction. + setpriority(PRIO_PROCESS, mMyThreadId, ANDROID_PRIORITY_NORMAL); + } + } else { + if (curPrio >= ANDROID_PRIORITY_BACKGROUND) { + // We want to use the inherited priority from the caller. + // Ensure this thread is in the background scheduling class, + // since the driver won't modify scheduling classes for us. + // The scheduling group is reset to default by the caller + // once this method returns after the transaction is complete. + androidSetThreadSchedulingGroup(mMyThreadId, + ANDROID_TGROUP_BG_NONINTERACT); + } + } + //LOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid); Parcel reply; @@ -966,7 +992,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd) mCallingPid = origPid; mCallingUid = origUid; - + IF_LOG_TRANSACTIONS() { TextOutput::Bundle _b(alog); alog << "BC_REPLY thr " << (void*)pthread_self() << " / obj " diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp index d5ffe7f..18669f7 100644 --- a/libs/binder/MemoryDealer.cpp +++ b/libs/binder/MemoryDealer.cpp @@ -17,12 +17,13 @@ #define LOG_TAG "MemoryDealer" #include <binder/MemoryDealer.h> +#include <binder/IPCThreadState.h> +#include <binder/MemoryBase.h> #include <utils/Log.h> -#include <binder/IPCThreadState.h> #include <utils/SortedVector.h> #include <utils/String8.h> -#include <binder/MemoryBase.h> +#include <utils/threads.h> #include <stdint.h> #include <stdio.h> @@ -40,90 +41,203 @@ namespace android { // ---------------------------------------------------------------------------- -HeapInterface::HeapInterface() { } -HeapInterface::~HeapInterface() { } +/* + * A simple templatized doubly linked-list implementation + */ + +template <typename NODE> +class LinkedList +{ + NODE* mFirst; + NODE* mLast; -// ---------------------------------------------------------------------------- +public: + LinkedList() : mFirst(0), mLast(0) { } + bool isEmpty() const { return mFirst == 0; } + NODE const* head() const { return mFirst; } + NODE* head() { return mFirst; } + NODE const* tail() const { return mLast; } + NODE* tail() { return mLast; } + + void insertAfter(NODE* node, NODE* newNode) { + newNode->prev = node; + newNode->next = node->next; + if (node->next == 0) mLast = newNode; + else node->next->prev = newNode; + node->next = newNode; + } -AllocatorInterface::AllocatorInterface() { } -AllocatorInterface::~AllocatorInterface() { } + void insertBefore(NODE* node, NODE* newNode) { + newNode->prev = node->prev; + newNode->next = node; + if (node->prev == 0) mFirst = newNode; + else node->prev->next = newNode; + node->prev = newNode; + } + + void insertHead(NODE* newNode) { + if (mFirst == 0) { + mFirst = mLast = newNode; + newNode->prev = newNode->next = 0; + } else { + newNode->prev = 0; + newNode->next = mFirst; + mFirst->prev = newNode; + mFirst = newNode; + } + } + + void insertTail(NODE* newNode) { + if (mLast == 0) { + insertHead(newNode); + } else { + newNode->prev = mLast; + newNode->next = 0; + mLast->next = newNode; + mLast = newNode; + } + } + + NODE* remove(NODE* node) { + if (node->prev == 0) mFirst = node->next; + else node->prev->next = node->next; + if (node->next == 0) mLast = node->prev; + else node->next->prev = node->prev; + return node; + } +}; // ---------------------------------------------------------------------------- -class SimpleMemory : public MemoryBase { +class Allocation : public MemoryBase { public: - SimpleMemory(const sp<IMemoryHeap>& heap, ssize_t offset, size_t size); - virtual ~SimpleMemory(); + Allocation(const sp<MemoryDealer>& dealer, + const sp<IMemoryHeap>& heap, ssize_t offset, size_t size); + virtual ~Allocation(); +private: + sp<MemoryDealer> mDealer; }; +// ---------------------------------------------------------------------------- + +class SimpleBestFitAllocator +{ + enum { + PAGE_ALIGNED = 0x00000001 + }; +public: + SimpleBestFitAllocator(size_t size); + ~SimpleBestFitAllocator(); + + size_t allocate(size_t size, uint32_t flags = 0); + status_t deallocate(size_t offset); + size_t size() const; + void dump(const char* what) const; + void dump(String8& res, const char* what) const; + +private: + + struct chunk_t { + chunk_t(size_t start, size_t size) + : start(start), size(size), free(1), prev(0), next(0) { + } + size_t start; + size_t size : 28; + int free : 4; + mutable chunk_t* prev; + mutable chunk_t* next; + }; + + ssize_t alloc(size_t size, uint32_t flags); + chunk_t* dealloc(size_t start); + void dump_l(const char* what) const; + void dump_l(String8& res, const char* what) const; + + static const int kMemoryAlign; + mutable Mutex mLock; + LinkedList<chunk_t> mList; + size_t mHeapSize; +}; // ---------------------------------------------------------------------------- -MemoryDealer::Allocation::Allocation( - const sp<MemoryDealer>& dealer, ssize_t offset, size_t size, - const sp<IMemory>& memory) - : mDealer(dealer), mOffset(offset), mSize(size), mMemory(memory) +Allocation::Allocation( + const sp<MemoryDealer>& dealer, + const sp<IMemoryHeap>& heap, ssize_t offset, size_t size) + : MemoryBase(heap, offset, size), mDealer(dealer) { +#ifndef NDEBUG + void* const start_ptr = (void*)(intptr_t(heap->base()) + offset); + memset(start_ptr, 0xda, size); +#endif } -MemoryDealer::Allocation::~Allocation() +Allocation::~Allocation() { - if (mSize) { + size_t freedOffset = getOffset(); + size_t freedSize = getSize(); + if (freedSize) { /* NOTE: it's VERY important to not free allocations of size 0 because * they're special as they don't have any record in the allocator * and could alias some real allocation (their offset is zero). */ - mDealer->deallocate(mOffset); - } -} + mDealer->deallocate(freedOffset); + + // keep the size to unmap in excess + size_t pagesize = getpagesize(); + size_t start = freedOffset; + size_t end = start + freedSize; + start &= ~(pagesize-1); + end = (end + pagesize-1) & ~(pagesize-1); + + // give back to the kernel the pages we don't need + size_t free_start = freedOffset; + size_t free_end = free_start + freedSize; + if (start < free_start) + start = free_start; + if (end > free_end) + end = free_end; + start = (start + pagesize-1) & ~(pagesize-1); + end &= ~(pagesize-1); + + if (start < end) { + void* const start_ptr = (void*)(intptr_t(getHeap()->base()) + start); + size_t size = end-start; -sp<IMemoryHeap> MemoryDealer::Allocation::getMemory( - ssize_t* offset, size_t* size) const -{ - return mMemory->getMemory(offset, size); +#ifndef NDEBUG + memset(start_ptr, 0xdf, size); +#endif + + // MADV_REMOVE is not defined on Dapper based Goobuntu +#ifdef MADV_REMOVE + if (size) { + int err = madvise(start_ptr, size, MADV_REMOVE); + LOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s", + start_ptr, size, err<0 ? strerror(errno) : "Ok"); + } +#endif + } + } } // ---------------------------------------------------------------------------- -MemoryDealer::MemoryDealer(size_t size, uint32_t flags, const char* name) - : mHeap(new SharedHeap(size, flags, name)), +MemoryDealer::MemoryDealer(size_t size, const char* name) + : mHeap(new MemoryHeapBase(size, 0, name)), mAllocator(new SimpleBestFitAllocator(size)) { } -MemoryDealer::MemoryDealer(const sp<HeapInterface>& heap) - : mHeap(heap), - mAllocator(new SimpleBestFitAllocator(heap->virtualSize())) -{ -} - -MemoryDealer::MemoryDealer( const sp<HeapInterface>& heap, - const sp<AllocatorInterface>& allocator) - : mHeap(heap), mAllocator(allocator) -{ -} - MemoryDealer::~MemoryDealer() { + delete mAllocator; } -sp<IMemory> MemoryDealer::allocate(size_t size, uint32_t flags) +sp<IMemory> MemoryDealer::allocate(size_t size) { sp<IMemory> memory; - const ssize_t offset = allocator()->allocate(size, flags); + const ssize_t offset = allocator()->allocate(size); if (offset >= 0) { - sp<IMemory> new_memory = heap()->mapMemory(offset, size); - if (new_memory != 0) { - memory = new Allocation(this, offset, size, new_memory); - } else { - LOGE("couldn't map [%8lx, %u]", offset, size); - if (size) { - /* NOTE: it's VERY important to not free allocations of size 0 - * because they're special as they don't have any record in the - * allocator and could alias some real allocation - * (their offset is zero). */ - allocator()->deallocate(offset); - } - } + memory = new Allocation(this, heap(), offset, size); } return memory; } @@ -133,16 +247,16 @@ void MemoryDealer::deallocate(size_t offset) allocator()->deallocate(offset); } -void MemoryDealer::dump(const char* what, uint32_t flags) const +void MemoryDealer::dump(const char* what) const { - allocator()->dump(what, flags); + allocator()->dump(what); } -const sp<HeapInterface>& MemoryDealer::heap() const { +const sp<IMemoryHeap>& MemoryDealer::heap() const { return mHeap; } -const sp<AllocatorInterface>& MemoryDealer::allocator() const { +SimpleBestFitAllocator* MemoryDealer::allocator() const { return mAllocator; } @@ -287,28 +401,28 @@ SimpleBestFitAllocator::chunk_t* SimpleBestFitAllocator::dealloc(size_t start) return 0; } -void SimpleBestFitAllocator::dump(const char* what, uint32_t flags) const +void SimpleBestFitAllocator::dump(const char* what) const { Mutex::Autolock _l(mLock); - dump_l(what, flags); + dump_l(what); } -void SimpleBestFitAllocator::dump_l(const char* what, uint32_t flags) const +void SimpleBestFitAllocator::dump_l(const char* what) const { String8 result; - dump_l(result, what, flags); + dump_l(result, what); LOGD("%s", result.string()); } void SimpleBestFitAllocator::dump(String8& result, - const char* what, uint32_t flags) const + const char* what) const { Mutex::Autolock _l(mLock); - dump_l(result, what, flags); + dump_l(result, what); } void SimpleBestFitAllocator::dump_l(String8& result, - const char* what, uint32_t flags) const + const char* what) const { size_t size = 0; int32_t i = 0; @@ -341,81 +455,10 @@ void SimpleBestFitAllocator::dump_l(String8& result, i++; cur = cur->next; } - snprintf(buffer, SIZE, " size allocated: %u (%u KB)\n", int(size), int(size/1024)); + snprintf(buffer, SIZE, + " size allocated: %u (%u KB)\n", int(size), int(size/1024)); result.append(buffer); } - -// ---------------------------------------------------------------------------- - -SharedHeap::SharedHeap() - : HeapInterface(), MemoryHeapBase() -{ -} -SharedHeap::SharedHeap(size_t size, uint32_t flags, char const * name) - : MemoryHeapBase(size, flags, name) -{ -} - -SharedHeap::~SharedHeap() -{ -} - -sp<IMemory> SharedHeap::mapMemory(size_t offset, size_t size) -{ - return new SimpleMemory(this, offset, size); -} - - -SimpleMemory::SimpleMemory(const sp<IMemoryHeap>& heap, - ssize_t offset, size_t size) - : MemoryBase(heap, offset, size) -{ -#ifndef NDEBUG - void* const start_ptr = (void*)(intptr_t(heap->base()) + offset); - memset(start_ptr, 0xda, size); -#endif -} - -SimpleMemory::~SimpleMemory() -{ - size_t freedOffset = getOffset(); - size_t freedSize = getSize(); - - // keep the size to unmap in excess - size_t pagesize = getpagesize(); - size_t start = freedOffset; - size_t end = start + freedSize; - start &= ~(pagesize-1); - end = (end + pagesize-1) & ~(pagesize-1); - - // give back to the kernel the pages we don't need - size_t free_start = freedOffset; - size_t free_end = free_start + freedSize; - if (start < free_start) - start = free_start; - if (end > free_end) - end = free_end; - start = (start + pagesize-1) & ~(pagesize-1); - end &= ~(pagesize-1); - - if (start < end) { - void* const start_ptr = (void*)(intptr_t(getHeap()->base()) + start); - size_t size = end-start; - -#ifndef NDEBUG - memset(start_ptr, 0xdf, size); -#endif - - // MADV_REMOVE is not defined on Dapper based Goobuntu -#ifdef MADV_REMOVE - if (size) { - int err = madvise(start_ptr, size, MADV_REMOVE); - LOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s", - start_ptr, size, err<0 ? strerror(errno) : "Ok"); - } -#endif - } -} }; // namespace android diff --git a/libs/binder/MemoryHeapPmem.cpp b/libs/binder/MemoryHeapPmem.cpp index c660947..16e92f9 100644 --- a/libs/binder/MemoryHeapPmem.cpp +++ b/libs/binder/MemoryHeapPmem.cpp @@ -127,7 +127,7 @@ void SubRegionMemory::revoke() MemoryHeapPmem::MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap, uint32_t flags) - : HeapInterface(), MemoryHeapBase() + : MemoryHeapBase() { char const * const device = pmemHeap->getDevice(); #if HAVE_ANDROID_OS diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index e397bce..00d2210 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -28,6 +28,7 @@ #include <utils/String16.h> #include <utils/TextOutput.h> #include <utils/misc.h> +#include <utils/Flattenable.h> #include <private/binder/binder_module.h> @@ -675,6 +676,42 @@ status_t Parcel::writeDupFileDescriptor(int fd) return writeObject(obj, true); } +status_t Parcel::write(const Flattenable& val) +{ + status_t err; + + // size if needed + size_t len = val.getFlattenedSize(); + size_t fd_count = val.getFdCount(); + + err = this->writeInt32(len); + if (err) return err; + + err = this->writeInt32(fd_count); + if (err) return err; + + // payload + void* buf = this->writeInplace(PAD_SIZE(len)); + if (buf == NULL) + return BAD_VALUE; + + int* fds = NULL; + if (fd_count) { + fds = new int[fd_count]; + } + + err = val.flatten(buf, len, fds, fd_count); + for (size_t i=0 ; i<fd_count && err==NO_ERROR ; i++) { + err = this->writeDupFileDescriptor( fds[i] ); + } + + if (fd_count) { + delete [] fds; + } + + return err; +} + status_t Parcel::writeObject(const flat_binder_object& val, bool nullMetaData) { const bool enoughData = (mDataPos+sizeof(val)) <= mDataCapacity; @@ -713,7 +750,6 @@ restart_write: goto restart_write; } - void Parcel::remove(size_t start, size_t amt) { LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!"); @@ -940,6 +976,38 @@ int Parcel::readFileDescriptor() const return BAD_TYPE; } +status_t Parcel::read(Flattenable& val) const +{ + // size + const size_t len = this->readInt32(); + const size_t fd_count = this->readInt32(); + + // payload + void const* buf = this->readInplace(PAD_SIZE(len)); + if (buf == NULL) + return BAD_VALUE; + + int* fds = NULL; + if (fd_count) { + fds = new int[fd_count]; + } + + status_t err = NO_ERROR; + for (size_t i=0 ; i<fd_count && err==NO_ERROR ; i++) { + fds[i] = dup(this->readFileDescriptor()); + if (fds[i] < 0) err = BAD_VALUE; + } + + if (err == NO_ERROR) { + err = val.unflatten(buf, len, fds, fd_count); + } + + if (fd_count) { + delete [] fds; + } + + return err; +} const flat_binder_object* Parcel::readObject(bool nullMetaData) const { const size_t DPOS = mDataPos; diff --git a/libs/surfaceflinger/Android.mk b/libs/surfaceflinger/Android.mk index b3fed58..86eb78d 100644 --- a/libs/surfaceflinger/Android.mk +++ b/libs/surfaceflinger/Android.mk @@ -35,11 +35,11 @@ LOCAL_SHARED_LIBRARIES := \ libpixelflinger \ libhardware \ libutils \ - libskia \ libEGL \ libGLESv1_CM \ libbinder \ - libui + libui \ + libsurfaceflinger_client LOCAL_C_INCLUDES := \ $(call include-path-for, corecg graphics) diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp index d9d9bfe..ea68352 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp +++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp @@ -90,6 +90,8 @@ float DisplayHardware::getRefreshRate() const { return mRefreshRate; } int DisplayHardware::getWidth() const { return mWidth; } int DisplayHardware::getHeight() const { return mHeight; } PixelFormat DisplayHardware::getFormat() const { return mFormat; } +uint32_t DisplayHardware::getMaxTextureSize() const { return mMaxTextureSize; } +uint32_t DisplayHardware::getMaxViewportDims() const { return mMaxViewportDims; } void DisplayHardware::init(uint32_t dpy) { @@ -246,10 +248,20 @@ void DisplayHardware::init(uint32_t dpy) LOGI("version : %s", glGetString(GL_VERSION)); LOGI("extensions: %s", gl_extensions); - if (strstr(gl_renderer, "Adreno")) { + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &mMaxViewportDims); + LOGI("GL_MAX_TEXTURE_SIZE = %d", mMaxTextureSize); + LOGI("GL_MAX_VIEWPORT_DIMS = %d", mMaxViewportDims); + +#if 0 + // for drivers that don't have proper support for flushing cached buffers + // on gralloc unlock, uncomment this block and test for the specific + // renderer substring + if (strstr(gl_renderer, "<some vendor string>")) { LOGD("Assuming uncached graphics buffers."); mFlags &= ~CACHED_BUFFERS; } +#endif if (strstr(gl_extensions, "GL_ARB_texture_non_power_of_two")) { mFlags |= NPOT_EXTENSION; @@ -268,6 +280,7 @@ void DisplayHardware::init(uint32_t dpy) #warning "EGL_ANDROID_image_native_buffer not supported" #endif + // Unbind the context from this thread eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.h b/libs/surfaceflinger/DisplayHardware/DisplayHardware.h index 6914d0c..df046af 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.h +++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.h @@ -76,6 +76,8 @@ public: PixelFormat getFormat() const; uint32_t getFlags() const; void makeCurrent() const; + uint32_t getMaxTextureSize() const; + uint32_t getMaxViewportDims() const; uint32_t getPageFlipCount() const; EGLDisplay getEGLDisplay() const { return mDisplay; } @@ -104,6 +106,8 @@ private: PixelFormat mFormat; uint32_t mFlags; mutable uint32_t mPageFlipCount; + GLint mMaxViewportDims; + GLint mMaxTextureSize; sp<FramebufferNativeWindow> mNativeWindow; overlay_control_device_t* mOverlayEngine; diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 1870d3a..0a3254d 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -27,7 +27,8 @@ #include <ui/GraphicBuffer.h> #include <ui/PixelFormat.h> -#include <ui/Surface.h> + +#include <surfaceflinger/Surface.h> #include "clz.h" #include "Layer.h" @@ -40,6 +41,10 @@ namespace android { +template <typename T> inline T min(T a, T b) { + return a<b ? a : b; +} + // --------------------------------------------------------------------------- const uint32_t Layer::typeInfo = LayerBaseClient::typeInfo | 4; @@ -108,17 +113,26 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h, // the display's pixel format const DisplayHardware& hw(graphicPlane(0).displayHardware()); + uint32_t const maxSurfaceDims = min( + hw.getMaxTextureSize(), hw.getMaxViewportDims()); + + // never allow a surface larger than what our underlying GL implementation + // can handle. + if ((uint32_t(w)>maxSurfaceDims) || (uint32_t(h)>maxSurfaceDims)) { + return BAD_VALUE; + } + PixelFormatInfo displayInfo; getPixelFormatInfo(hw.getFormat(), &displayInfo); const uint32_t hwFlags = hw.getFlags(); mFormat = format; - mWidth = w; + mWidth = w; mHeight = h; mSecure = (flags & ISurfaceComposer::eSecure) ? true : false; mNeedsBlending = (info.h_alpha - info.l_alpha) > 0; mNoEGLImageForSwBuffers = !(hwFlags & DisplayHardware::CACHED_BUFFERS); - + // we use the red index int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED); int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED); @@ -155,7 +169,11 @@ void Layer::reloadTexture(const Region& dirty) if (mFlags & DisplayHardware::DIRECT_TEXTURE) { if (buffer->usage & GraphicBuffer::USAGE_HW_TEXTURE) { if (mTextures[index].dirty) { - initializeEglImage(buffer, &mTextures[index]); + if (initializeEglImage(buffer, &mTextures[index]) != NO_ERROR) { + // not sure what we can do here... + mFlags &= ~DisplayHardware::DIRECT_TEXTURE; + goto slowpath; + } } } else { if (mHybridBuffer==0 || (mHybridBuffer->width != buffer->width || @@ -165,8 +183,13 @@ void Layer::reloadTexture(const Region& dirty) buffer->width, buffer->height, buffer->format, GraphicBuffer::USAGE_SW_WRITE_OFTEN | GraphicBuffer::USAGE_HW_TEXTURE); - initializeEglImage( - mHybridBuffer, &mTextures[0]); + if (initializeEglImage( + mHybridBuffer, &mTextures[0]) != NO_ERROR) { + // not sure what we can do here... + mFlags &= ~DisplayHardware::DIRECT_TEXTURE; + mHybridBuffer.clear(); + goto slowpath; + } } GGLSurface t; @@ -184,20 +207,20 @@ void Layer::reloadTexture(const Region& dirty) if (res == NO_ERROR) { int bpp = 0; switch (t.format) { - case GGL_PIXEL_FORMAT_RGB_565: - case GGL_PIXEL_FORMAT_RGBA_4444: + case HAL_PIXEL_FORMAT_RGB_565: + case HAL_PIXEL_FORMAT_RGBA_4444: bpp = 2; break; - case GGL_PIXEL_FORMAT_RGBA_8888: - case GGL_PIXEL_FORMAT_RGBX_8888: + case HAL_PIXEL_FORMAT_RGBA_8888: + case HAL_PIXEL_FORMAT_RGBX_8888: bpp = 4; break; - case GGL_PIXEL_FORMAT_YCbCr_422_SP: - case GGL_PIXEL_FORMAT_YCbCr_420_SP: - // just show the Y plane of YUV buffers - bpp = 1; - break; default: + if (isSupportedYuvFormat(t.format)) { + // just show the Y plane of YUV buffers + bpp = 1; + break; + } // oops, we don't handle this format! LOGE("layer %p, texture=%d, using format %d, which is not " "supported by the GL", this, texture->name, t.format); @@ -235,6 +258,7 @@ void Layer::reloadTexture(const Region& dirty) } else #endif { +slowpath: for (size_t i=0 ; i<NUM_BUFFERS ; i++) { mTextures[i].image = EGL_NO_IMAGE_KHR; } @@ -454,44 +478,61 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) // for composition later in the loop return; } - + + // ouch, this really should never happen + if (uint32_t(buf)>=NUM_BUFFERS) { + LOGE("retireAndLock() buffer index (%d) out of range", buf); + mPostedDirtyRegion.clear(); + return; + } + // we retired a buffer, which becomes the new front buffer mFrontBufferIndex = buf; // get the dirty region sp<GraphicBuffer> newFrontBuffer(getBuffer(buf)); - const Region dirty(lcblk->getDirtyRegion(buf)); - mPostedDirtyRegion = dirty.intersect( newFrontBuffer->getBounds() ); - - const Layer::State& front(drawingState()); - if (newFrontBuffer->getWidth() == front.requested_w && - newFrontBuffer->getHeight() == front.requested_h) - { - if ((front.w != front.requested_w) || - (front.h != front.requested_h)) + if (newFrontBuffer != NULL) { + // compute the posted region + const Region dirty(lcblk->getDirtyRegion(buf)); + mPostedDirtyRegion = dirty.intersect( newFrontBuffer->getBounds() ); + + // update the layer size and release freeze-lock + const Layer::State& front(drawingState()); + if (newFrontBuffer->getWidth() == front.requested_w && + newFrontBuffer->getHeight() == front.requested_h) { - // Here we pretend the transaction happened by updating the - // current and drawing states. Drawing state is only accessed - // in this thread, no need to have it locked - Layer::State& editDraw(mDrawingState); - editDraw.w = editDraw.requested_w; - editDraw.h = editDraw.requested_h; - - // We also need to update the current state so that we don't - // end-up doing too much work during the next transaction. - // NOTE: We actually don't need hold the transaction lock here - // because State::w and State::h are only accessed from - // this thread - Layer::State& editTemp(currentState()); - editTemp.w = editDraw.w; - editTemp.h = editDraw.h; - - // recompute visible region - recomputeVisibleRegions = true; - } + if ((front.w != front.requested_w) || + (front.h != front.requested_h)) + { + // Here we pretend the transaction happened by updating the + // current and drawing states. Drawing state is only accessed + // in this thread, no need to have it locked + Layer::State& editDraw(mDrawingState); + editDraw.w = editDraw.requested_w; + editDraw.h = editDraw.requested_h; + + // We also need to update the current state so that we don't + // end-up doing too much work during the next transaction. + // NOTE: We actually don't need hold the transaction lock here + // because State::w and State::h are only accessed from + // this thread + Layer::State& editTemp(currentState()); + editTemp.w = editDraw.w; + editTemp.h = editDraw.h; + + // recompute visible region + recomputeVisibleRegions = true; + } - // we now have the correct size, unfreeze the screen - mFreezeLock.clear(); + // we now have the correct size, unfreeze the screen + mFreezeLock.clear(); + } + } else { + // this should not happen unless we ran out of memory while + // allocating the buffer. we're hoping that things will get back + // to normal the next time the app tries to draw into this buffer. + // meanwhile, pretend the screen didn't update. + mPostedDirtyRegion.clear(); } if (lcblk->getQueuedCount()) { diff --git a/libs/surfaceflinger/Layer.h b/libs/surfaceflinger/Layer.h index 1310ecc..743afb4 100644 --- a/libs/surfaceflinger/Layer.h +++ b/libs/surfaceflinger/Layer.h @@ -78,6 +78,8 @@ public: inline const sp<FreezeLock>& getFreezeLock() const { return mFreezeLock; } // only for debugging inline PixelFormat pixelFormat() const { return mFormat; } + // only for debugging + inline int getFrontBufferIndex() const { return mFrontBufferIndex; } private: inline sp<GraphicBuffer> getFrontBufferLocked() { diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp index 8003d22..a8b735e 100644 --- a/libs/surfaceflinger/LayerBase.cpp +++ b/libs/surfaceflinger/LayerBase.cpp @@ -52,8 +52,9 @@ LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display) mTransformed(false), mUseLinearFiltering(false), mOrientation(0), + mLeft(0), mTop(0), mTransactionFlags(0), - mPremultipliedAlpha(true), + mPremultipliedAlpha(true), mDebug(false), mInvalidate(0) { const DisplayHardware& hw(flinger->graphicPlane(0).displayHardware()); @@ -64,6 +65,14 @@ LayerBase::~LayerBase() { } +void LayerBase::setName(const String8& name) { + mName = name; +} + +String8 LayerBase::getName() const { + return mName; +} + const GraphicPlane& LayerBase::graphicPlane(int dpy) const { return mFlinger->graphicPlane(dpy); @@ -205,7 +214,6 @@ uint32_t LayerBase::doTransaction(uint32_t flags) if ((front.w != temp.w) || (front.h != temp.h)) { // invalidate and recompute the visible regions if needed flags |= Layer::eVisibleRegion; - this->contentDirty = true; } if (temp.sequence != front.sequence) { @@ -429,55 +437,49 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const Region::const_iterator it = clip.begin(); Region::const_iterator const end = clip.end(); - if (UNLIKELY(transformed() - || !(mFlags & DisplayHardware::DRAW_TEXTURE_EXTENSION) )) - { - //StopWatch watch("GL transformed"); - const GLfixed texCoords[4][2] = { - { 0, 0 }, - { 0, 0x10000 }, - { 0x10000, 0x10000 }, - { 0x10000, 0 } - }; - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - - // the texture's source is rotated - if (texture.transform == HAL_TRANSFORM_ROT_90) { - // TODO: handle the other orientations + + //StopWatch watch("GL transformed"); + const GLfixed texCoords[4][2] = { + { 0, 0 }, + { 0, 0x10000 }, + { 0x10000, 0x10000 }, + { 0x10000, 0 } + }; + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + + // the texture's source is rotated + switch (texture.transform) { + case HAL_TRANSFORM_ROT_90: glTranslatef(0, 1, 0); glRotatef(-90, 0, 0, 1); - } - - if (texture.NPOTAdjust) { - glScalef(texture.wScale, texture.hScale, 1.0f); - } + break; + case HAL_TRANSFORM_ROT_180: + glTranslatef(1, 1, 0); + glRotatef(-180, 0, 0, 1); + break; + case HAL_TRANSFORM_ROT_270: + glTranslatef(1, 0, 0); + glRotatef(-270, 0, 0, 1); + break; + } - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glVertexPointer(2, GL_FIXED, 0, mVertices); - glTexCoordPointer(2, GL_FIXED, 0, texCoords); + if (texture.NPOTAdjust) { + glScalef(texture.wScale, texture.hScale, 1.0f); + } - while (it != end) { - const Rect& r = *it++; - const GLint sy = fbHeight - (r.top + r.height()); - glScissor(r.left, sy, r.width(), r.height()); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - } - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - } else { - GLint crop[4] = { 0, height, width, -height }; - glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop); - int x = tx(); - int y = ty(); - y = fbHeight - (y + height); - while (it != end) { - const Rect& r = *it++; - const GLint sy = fbHeight - (r.top + r.height()); - glScissor(r.left, sy, r.width(), r.height()); - glDrawTexiOES(x, y, 0, width, height); - } + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(2, GL_FIXED, 0, mVertices); + glTexCoordPointer(2, GL_FIXED, 0, texCoords); + + while (it != end) { + const Rect& r = *it++; + const GLint sy = fbHeight - (r.top + r.height()); + glScissor(r.left, sy, r.width(), r.height()); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } + glDisableClientState(GL_TEXTURE_COORD_ARRAY); } void LayerBase::validateTexture(GLint textureName) const @@ -500,6 +502,21 @@ void LayerBase::validateTexture(GLint textureName) const } } +bool LayerBase::isSupportedYuvFormat(int format) const +{ + switch (format) { + case HAL_PIXEL_FORMAT_YCbCr_422_SP: + case HAL_PIXEL_FORMAT_YCbCr_420_SP: + case HAL_PIXEL_FORMAT_YCbCr_422_P: + case HAL_PIXEL_FORMAT_YCbCr_420_P: + case HAL_PIXEL_FORMAT_YCbCr_422_I: + case HAL_PIXEL_FORMAT_YCbCr_420_I: + case HAL_PIXEL_FORMAT_YCrCb_420_SP: + return true; + } + return false; +} + void LayerBase::loadTexture(Texture* texture, const Region& dirty, const GGLSurface& t) const { @@ -564,21 +581,20 @@ void LayerBase::loadTexture(Texture* texture, data = t.data; } - if (t.format == GGL_PIXEL_FORMAT_RGB_565) { + if (t.format == HAL_PIXEL_FORMAT_RGB_565) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texture->potWidth, texture->potHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, data); - } else if (t.format == GGL_PIXEL_FORMAT_RGBA_4444) { + } else if (t.format == HAL_PIXEL_FORMAT_RGBA_4444) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->potWidth, texture->potHeight, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, data); - } else if (t.format == GGL_PIXEL_FORMAT_RGBA_8888 || - t.format == GGL_PIXEL_FORMAT_RGBX_8888) { + } else if (t.format == HAL_PIXEL_FORMAT_RGBA_8888 || + t.format == HAL_PIXEL_FORMAT_RGBX_8888) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->potWidth, texture->potHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); - } else if ( t.format == GGL_PIXEL_FORMAT_YCbCr_422_SP || - t.format == GGL_PIXEL_FORMAT_YCbCr_420_SP) { + } else if (isSupportedYuvFormat(t.format)) { // just show the Y plane of YUV buffers glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, texture->potWidth, texture->potHeight, 0, @@ -590,24 +606,23 @@ void LayerBase::loadTexture(Texture* texture, } } if (!data) { - if (t.format == GGL_PIXEL_FORMAT_RGB_565) { + if (t.format == HAL_PIXEL_FORMAT_RGB_565) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, bounds.top, t.width, bounds.height(), GL_RGB, GL_UNSIGNED_SHORT_5_6_5, t.data + bounds.top*t.stride*2); - } else if (t.format == GGL_PIXEL_FORMAT_RGBA_4444) { + } else if (t.format == HAL_PIXEL_FORMAT_RGBA_4444) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, bounds.top, t.width, bounds.height(), GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, t.data + bounds.top*t.stride*2); - } else if (t.format == GGL_PIXEL_FORMAT_RGBA_8888 || - t.format == GGL_PIXEL_FORMAT_RGBX_8888) { + } else if (t.format == HAL_PIXEL_FORMAT_RGBA_8888 || + t.format == HAL_PIXEL_FORMAT_RGBX_8888) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, bounds.top, t.width, bounds.height(), GL_RGBA, GL_UNSIGNED_BYTE, t.data + bounds.top*t.stride*4); - } else if ( t.format == GGL_PIXEL_FORMAT_YCbCr_422_SP || - t.format == GGL_PIXEL_FORMAT_YCbCr_420_SP) { + } else if (isSupportedYuvFormat(t.format)) { // just show the Y plane of YUV buffers glTexSubImage2D(GL_TEXTURE_2D, 0, 0, bounds.top, t.width, bounds.height(), @@ -643,22 +658,15 @@ status_t LayerBase::initializeEglImage( dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, (EGLClientBuffer)clientBuf, attrs); - LOGE_IF(texture->image == EGL_NO_IMAGE_KHR, - "eglCreateImageKHR() failed. err=0x%4x", - eglGetError()); - if (texture->image != EGL_NO_IMAGE_KHR) { glBindTexture(GL_TEXTURE_2D, texture->name); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)texture->image); GLint error = glGetError(); if (UNLIKELY(error != GL_NO_ERROR)) { - // this failed, for instance, because we don't support NPOT. - // FIXME: do something! LOGE("layer=%p, glEGLImageTargetTexture2DOES(%p) " "failed err=0x%04x", this, texture->image, error); - mFlags &= ~DisplayHardware::DIRECT_TEXTURE; err = INVALID_OPERATION; } else { // Everything went okay! @@ -668,6 +676,8 @@ status_t LayerBase::initializeEglImage( texture->height = clientBuf->height; } } else { + LOGE("layer=%p, eglCreateImageKHR() failed. err=0x%4x", + this, eglGetError()); err = INVALID_OPERATION; } return err; @@ -680,8 +690,8 @@ int32_t LayerBaseClient::sIdentity = 0; LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display, const sp<Client>& client, int32_t i) - : LayerBase(flinger, display), lcblk(NULL), client(client), - mIndex(i), mIdentity(uint32_t(android_atomic_inc(&sIdentity))) + : LayerBase(flinger, display), lcblk(NULL), client(client), mIndex(i), + mIdentity(uint32_t(android_atomic_inc(&sIdentity))) { lcblk = new SharedBufferServer( client->ctrlblk, i, NUM_BUFFERS, @@ -809,7 +819,7 @@ void LayerBaseClient::Surface::unregisterBuffers() } sp<OverlayRef> LayerBaseClient::Surface::createOverlay( - uint32_t w, uint32_t h, int32_t format) + uint32_t w, uint32_t h, int32_t format, int32_t orientation) { return NULL; }; diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h index ed07b3f..62ec839 100644 --- a/libs/surfaceflinger/LayerBase.h +++ b/libs/surfaceflinger/LayerBase.h @@ -22,15 +22,17 @@ #include <EGL/egl.h> #include <EGL/eglext.h> - -#include <private/ui/SharedBufferStack.h> -#include <private/ui/LayerState.h> +#include <GLES/gl.h> #include <utils/RefBase.h> #include <ui/Region.h> #include <ui/Overlay.h> +#include <surfaceflinger/ISurfaceFlingerClient.h> +#include <private/surfaceflinger/SharedBufferStack.h> +#include <private/surfaceflinger/LayerState.h> + #include <pixelflinger/pixelflinger.h> #include "Transform.h" @@ -99,6 +101,9 @@ public: Region transparentRegion; }; + void setName(const String8& name); + String8 getName() const; + // modify current state bool setPosition(int32_t x, int32_t y); bool setLayer(uint32_t z); @@ -119,7 +124,7 @@ public: void drawRegion(const Region& reg) const; void invalidate(); - + /** * draw - performs some global clipping optimizations * and calls onDraw(). @@ -152,11 +157,11 @@ public: /** * setCoveredRegion - called when the covered region changes. The covered - * region correspond to any area of the surface that is covered + * region corresponds to any area of the surface that is covered * (transparently or not) by another surface. */ virtual void setCoveredRegion(const Region& coveredRegion); - + /** * validateVisibility - cache a bunch of things */ @@ -264,6 +269,7 @@ protected: status_t initializeEglImage( const sp<GraphicBuffer>& buffer, Texture* texture); + bool isSupportedYuvFormat(int format) const; sp<SurfaceFlinger> mFlinger; uint32_t mFlags; @@ -284,6 +290,9 @@ protected: // don't change, don't need a lock bool mPremultipliedAlpha; + String8 mName; + mutable bool mDebug; + // atomic volatile int32_t mInvalidate; @@ -330,6 +339,7 @@ public: virtual void onRemoved(); + class Surface : public BnSurface { public: @@ -351,7 +361,7 @@ public: virtual void postBuffer(ssize_t offset); virtual void unregisterBuffers(); virtual sp<OverlayRef> createOverlay(uint32_t w, uint32_t h, - int32_t format); + int32_t format, int32_t orientation); protected: friend class LayerBaseClient; diff --git a/libs/surfaceflinger/LayerBlur.h b/libs/surfaceflinger/LayerBlur.h index 2e9d7c6..5b63dec 100644 --- a/libs/surfaceflinger/LayerBlur.h +++ b/libs/surfaceflinger/LayerBlur.h @@ -20,8 +20,6 @@ #include <stdint.h> #include <sys/types.h> -#include <private/ui/LayerState.h> - #include <ui/Region.h> #include "LayerBase.h" diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp index 2ff6167..5c21593 100644 --- a/libs/surfaceflinger/LayerBuffer.cpp +++ b/libs/surfaceflinger/LayerBuffer.cpp @@ -182,14 +182,15 @@ status_t LayerBuffer::registerBuffers(const ISurface::BufferHeap& buffers) /** * This creates an "overlay" source for this surface */ -sp<OverlayRef> LayerBuffer::createOverlay(uint32_t w, uint32_t h, int32_t f) +sp<OverlayRef> LayerBuffer::createOverlay(uint32_t w, uint32_t h, int32_t f, + int32_t orientation) { sp<OverlayRef> result; Mutex::Autolock _l(mLock); if (mSource != 0) return result; - sp<OverlaySource> source = new OverlaySource(*this, &result, w, h, f); + sp<OverlaySource> source = new OverlaySource(*this, &result, w, h, f, orientation); if (result != 0) { mSource = source; } @@ -248,11 +249,11 @@ void LayerBuffer::SurfaceLayerBuffer::unregisterBuffers() } sp<OverlayRef> LayerBuffer::SurfaceLayerBuffer::createOverlay( - uint32_t w, uint32_t h, int32_t format) { + uint32_t w, uint32_t h, int32_t format, int32_t orientation) { sp<OverlayRef> result; sp<LayerBuffer> owner(getOwner()); if (owner != 0) - result = owner->createOverlay(w, h, format); + result = owner->createOverlay(w, h, format, orientation); return result; } @@ -260,8 +261,9 @@ sp<OverlayRef> LayerBuffer::SurfaceLayerBuffer::createOverlay( // LayerBuffer::Buffer // ============================================================================ -LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) - : mBufferHeap(buffers) +LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, + ssize_t offset, size_t bufferSize) + : mBufferHeap(buffers), mSupportsCopybit(false) { NativeBuffer& src(mNativeBuffer); src.crop.l = 0; @@ -279,14 +281,12 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) if (module && module->perform) { int err = module->perform(module, GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER, - buffers.heap->heapID(), buffers.heap->getSize(), + buffers.heap->heapID(), bufferSize, offset, buffers.heap->base(), &src.img.handle); - LOGE_IF(err, "CREATE_HANDLE_FROM_BUFFER (heapId=%d, size=%d, " - "offset=%ld, base=%p) failed (%s)", - buffers.heap->heapID(), buffers.heap->getSize(), - offset, buffers.heap->base(), strerror(-err)); + // we can fail here is the passed buffer is purely software + mSupportsCopybit = (err == NO_ERROR); } } @@ -329,7 +329,8 @@ bool LayerBuffer::Source::transformed() const { LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer, const ISurface::BufferHeap& buffers) - : Source(layer), mStatus(NO_ERROR), mBufferSize(0) + : Source(layer), mStatus(NO_ERROR), mBufferSize(0), + mUseEGLImageDirectly(true) { if (buffers.heap == NULL) { // this is allowed, but in this case, it is illegal to receive @@ -372,8 +373,23 @@ LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer, LayerBuffer::BufferSource::~BufferSource() { + class MessageDestroyTexture : public MessageBase { + SurfaceFlinger* flinger; + GLuint name; + public: + MessageDestroyTexture( + SurfaceFlinger* flinger, GLuint name) + : flinger(flinger), name(name) { } + virtual bool handler() { + glDeleteTextures(1, &name); + return true; + } + }; + if (mTexture.name != -1U) { - glDeleteTextures(1, &mTexture.name); + // GL textures can only be destroyed from the GL thread + mLayer.mFlinger->mEventQueue.postMessage( + new MessageDestroyTexture(mLayer.mFlinger.get(), mTexture.name) ); } if (mTexture.image != EGL_NO_IMAGE_KHR) { EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay()); @@ -400,7 +416,7 @@ void LayerBuffer::BufferSource::postBuffer(ssize_t offset) sp<Buffer> buffer; if (buffers.heap != 0) { - buffer = new LayerBuffer::Buffer(buffers, offset); + buffer = new LayerBuffer::Buffer(buffers, offset, mBufferSize); if (buffer->getStatus() != NO_ERROR) buffer.clear(); setBuffer(buffer); @@ -452,23 +468,47 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const #if defined(EGL_ANDROID_image_native_buffer) if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) { - copybit_device_t* copybit = mLayer.mBlitEngine; - if (copybit) { - // create our EGLImageKHR the first time - err = initTempBuffer(); - if (err == NO_ERROR) { + err = INVALID_OPERATION; + if (ourBuffer->supportsCopybit()) { + + // there are constraints on buffers used by the GPU and these may not + // be honored here. We need to change the API so the buffers + // are allocated with gralloc. For now disable this code-path +#if 0 + // First, try to use the buffer as an EGLImage directly + if (mUseEGLImageDirectly) { // NOTE: Assume the buffer is allocated with the proper USAGE flags - const NativeBuffer& dst(mTempBuffer); - region_iterator clip(Region(Rect(dst.crop.r, dst.crop.b))); - copybit->set_parameter(copybit, COPYBIT_TRANSFORM, 0); - copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 0xFF); - copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_ENABLE); - err = copybit->stretch(copybit, &dst.img, &src.img, - &dst.crop, &src.crop, &clip); + sp<GraphicBuffer> buffer = new GraphicBuffer( + src.img.w, src.img.h, src.img.format, + GraphicBuffer::USAGE_HW_TEXTURE, + src.img.w, src.img.handle, false); + + err = mLayer.initializeEglImage(buffer, &mTexture); + if (err != NO_ERROR) { + mUseEGLImageDirectly = false; + } + } +#endif + + copybit_device_t* copybit = mLayer.mBlitEngine; + if (copybit && err != NO_ERROR) { + // create our EGLImageKHR the first time + err = initTempBuffer(); + if (err == NO_ERROR) { + // NOTE: Assume the buffer is allocated with the proper USAGE flags + const NativeBuffer& dst(mTempBuffer); + region_iterator clip(Region(Rect(dst.crop.r, dst.crop.b))); + copybit->set_parameter(copybit, COPYBIT_TRANSFORM, 0); + copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 0xFF); + copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_ENABLE); + err = copybit->stretch(copybit, &dst.img, &src.img, + &dst.crop, &src.crop, &clip); + if (err != NO_ERROR) { + clearTempBufferImage(); + } + } } - } else { - err = INVALID_OPERATION; } } #endif @@ -504,16 +544,21 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const int t = w; w = h; h = t; } + // we're in the copybit case, so make sure we can handle this blit + // we don't have to keep the aspect ratio here + copybit_device_t* copybit = mLayer.mBlitEngine; + const int down = copybit->get(copybit, COPYBIT_MINIFICATION_LIMIT); + const int up = copybit->get(copybit, COPYBIT_MAGNIFICATION_LIMIT); + if (buffers.w > w*down) w = buffers.w / down; + else if (w > buffers.w*up) w = buffers.w*up; + if (buffers.h > h*down) h = buffers.h / down; + else if (h > buffers.h*up) h = buffers.h*up; + if (mTexture.image != EGL_NO_IMAGE_KHR) { // we have an EGLImage, make sure the needed size didn't change if (w!=mTexture.width || h!= mTexture.height) { // delete the EGLImage and texture - EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay()); - glDeleteTextures(1, &mTexture.name); - eglDestroyImageKHR(dpy, mTexture.image); - Texture defaultTexture; - mTexture = defaultTexture; - mTempGraphicBuffer.clear(); + clearTempBufferImage(); } else { // we're good, we have an EGLImageKHR and it's (still) the // right size @@ -528,45 +573,52 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const } // Allocate a temporary buffer and create the corresponding EGLImageKHR - - status_t err; - mTempGraphicBuffer.clear(); - mTempGraphicBuffer = new GraphicBuffer( + // once the EGLImage has been created we don't need the + // graphic buffer reference anymore. + sp<GraphicBuffer> buffer = new GraphicBuffer( w, h, HAL_PIXEL_FORMAT_RGB_565, GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_HW_2D); - err = mTempGraphicBuffer->initCheck(); + status_t err = buffer->initCheck(); if (err == NO_ERROR) { NativeBuffer& dst(mTempBuffer); - dst.img.w = mTempGraphicBuffer->getStride(); + dst.img.w = buffer->getStride(); dst.img.h = h; - dst.img.format = mTempGraphicBuffer->getPixelFormat(); - dst.img.handle = (native_handle_t *)mTempGraphicBuffer->handle; + dst.img.format = buffer->getPixelFormat(); + dst.img.handle = (native_handle_t *)buffer->handle; dst.img.base = 0; dst.crop.l = 0; dst.crop.t = 0; dst.crop.r = w; dst.crop.b = h; - err = mLayer.initializeEglImage( - mTempGraphicBuffer, &mTexture); - // once the EGLImage has been created (whether it fails - // or not) we don't need the graphic buffer reference - // anymore. - mTempGraphicBuffer.clear(); + err = mLayer.initializeEglImage(buffer, &mTexture); } return err; } +void LayerBuffer::BufferSource::clearTempBufferImage() const +{ + // delete the image + EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay()); + eglDestroyImageKHR(dpy, mTexture.image); + + // and the associated texture (recreate a name) + glDeleteTextures(1, &mTexture.name); + Texture defaultTexture; + mTexture = defaultTexture; + mTexture.name = mLayer.createTexture(); +} + // --------------------------------------------------------------------------- LayerBuffer::OverlaySource::OverlaySource(LayerBuffer& layer, sp<OverlayRef>* overlayRef, - uint32_t w, uint32_t h, int32_t format) + uint32_t w, uint32_t h, int32_t format, int32_t orientation) : Source(layer), mVisibilityChanged(false), - mOverlay(0), mOverlayHandle(0), mOverlayDevice(0) + mOverlay(0), mOverlayHandle(0), mOverlayDevice(0), mOrientation(orientation) { overlay_control_device_t* overlay_dev = mLayer.mFlinger->getOverlayEngine(); if (overlay_dev == NULL) { @@ -648,8 +700,12 @@ void LayerBuffer::OverlaySource::onVisibilityResolved( if (mOverlay) { overlay_control_device_t* overlay_dev = mOverlayDevice; overlay_dev->setPosition(overlay_dev, mOverlay, x,y,w,h); + // we need to combine the layer orientation and the + // user-requested orientation. + Transform finalTransform = Transform(mOrientation) * + Transform(mLayer.getOrientation()); overlay_dev->setParameter(overlay_dev, mOverlay, - OVERLAY_TRANSFORM, mLayer.getOrientation()); + OVERLAY_TRANSFORM, finalTransform.getOrientation()); overlay_dev->commit(overlay_dev, mOverlay); } } diff --git a/libs/surfaceflinger/LayerBuffer.h b/libs/surfaceflinger/LayerBuffer.h index 2ca63ac..b176623 100644 --- a/libs/surfaceflinger/LayerBuffer.h +++ b/libs/surfaceflinger/LayerBuffer.h @@ -74,7 +74,8 @@ public: status_t registerBuffers(const ISurface::BufferHeap& buffers); void postBuffer(ssize_t offset); void unregisterBuffers(); - sp<OverlayRef> createOverlay(uint32_t w, uint32_t h, int32_t format); + sp<OverlayRef> createOverlay(uint32_t w, uint32_t h, int32_t format, + int32_t orientation); sp<Source> getSource() const; sp<Source> clearSource(); @@ -98,7 +99,11 @@ private: class Buffer : public LightRefBase<Buffer> { public: - Buffer(const ISurface::BufferHeap& buffers, ssize_t offset); + Buffer(const ISurface::BufferHeap& buffers, + ssize_t offset, size_t bufferSize); + inline bool supportsCopybit() const { + return mSupportsCopybit; + } inline status_t getStatus() const { return mBufferHeap.heap!=0 ? NO_ERROR : NO_INIT; } @@ -113,6 +118,7 @@ private: private: ISurface::BufferHeap mBufferHeap; NativeBuffer mNativeBuffer; + bool mSupportsCopybit; }; class BufferSource : public Source { @@ -131,6 +137,7 @@ private: virtual void destroy() { } private: status_t initTempBuffer() const; + void clearTempBufferImage() const; mutable Mutex mBufferSourceLock; sp<Buffer> mBuffer; status_t mStatus; @@ -138,14 +145,14 @@ private: size_t mBufferSize; mutable LayerBase::Texture mTexture; mutable NativeBuffer mTempBuffer; - mutable sp<GraphicBuffer> mTempGraphicBuffer; + mutable bool mUseEGLImageDirectly; }; class OverlaySource : public Source { public: OverlaySource(LayerBuffer& layer, sp<OverlayRef>* overlayRef, - uint32_t w, uint32_t h, int32_t format); + uint32_t w, uint32_t h, int32_t format, int32_t orientation); virtual ~OverlaySource(); virtual void onDraw(const Region& clip) const; virtual void onTransaction(uint32_t flags); @@ -178,6 +185,7 @@ private: int32_t mFormat; int32_t mWidthStride; int32_t mHeightStride; + int32_t mOrientation; mutable Mutex mOverlaySourceLock; bool mInitialized; }; @@ -195,7 +203,7 @@ private: virtual void unregisterBuffers(); virtual sp<OverlayRef> createOverlay( - uint32_t w, uint32_t h, int32_t format); + uint32_t w, uint32_t h, int32_t format, int32_t orientation); private: sp<LayerBuffer> getOwner() const { return static_cast<LayerBuffer*>(Surface::getOwner().get()); diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index 965b7dd..0722fda 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -39,7 +39,6 @@ #include <ui/GraphicBufferAllocator.h> #include <ui/PixelFormat.h> -#include <ui/DisplayInfo.h> #include <pixelflinger/pixelflinger.h> #include <GLES/gl.h> @@ -350,8 +349,8 @@ status_t SurfaceFlinger::readyToRun() mServerCblk->connected |= 1<<dpy; display_cblk_t* dcblk = mServerCblk->displays + dpy; memset(dcblk, 0, sizeof(display_cblk_t)); - dcblk->w = w; - dcblk->h = h; + dcblk->w = plane.getWidth(); + dcblk->h = plane.getHeight(); dcblk->format = f; dcblk->orientation = ISurfaceComposer::eOrientationDefault; dcblk->xdpi = hw.getDpiX(); @@ -621,23 +620,18 @@ void SurfaceFlinger::handleTransactionLocked( const DisplayHardware& hw(plane.displayHardware()); volatile display_cblk_t* dcblk = mServerCblk->displays + dpy; dcblk->orientation = orientation; - if (orientation & eOrientationSwapMask) { - // 90 or 270 degrees orientation - dcblk->w = hw.getHeight(); - dcblk->h = hw.getWidth(); - } else { - dcblk->w = hw.getWidth(); - dcblk->h = hw.getHeight(); - } + dcblk->w = plane.getWidth(); + dcblk->h = plane.getHeight(); mVisibleRegionsDirty = true; mDirtyRegion.set(hw.bounds()); - mFreezeDisplayTime = 0; } if (mCurrentState.freezeDisplay != mDrawingState.freezeDisplay) { // freezing or unfreezing the display -> trigger animation if needed mFreezeDisplay = mCurrentState.freezeDisplay; + if (mFreezeDisplay) + mFreezeDisplayTime = 0; } if (currentLayers.size() > mDrawingState.layersSortedByZ.size()) { @@ -680,6 +674,8 @@ void SurfaceFlinger::computeVisibleRegions( { const GraphicPlane& plane(graphicPlane(0)); const Transform& planeTransform(plane.transform()); + const DisplayHardware& hw(plane.displayHardware()); + const Region screenRegion(hw.bounds()); Region aboveOpaqueLayers; Region aboveCoveredLayers; @@ -695,31 +691,56 @@ void SurfaceFlinger::computeVisibleRegions( // start with the whole surface at its current location const Layer::State& s(layer->drawingState()); - // handle hidden surfaces by setting the visible region to empty + /* + * opaqueRegion: area of a surface that is fully opaque. + */ Region opaqueRegion; + + /* + * visibleRegion: area of a surface that is visible on screen + * and not fully transparent. This is essentially the layer's + * footprint minus the opaque regions above it. + * Areas covered by a translucent surface are considered visible. + */ Region visibleRegion; + + /* + * coveredRegion: area of a surface that is covered by all + * visible regions above it (which includes the translucent areas). + */ Region coveredRegion; + + + // handle hidden surfaces by setting the visible region to empty if (LIKELY(!(s.flags & ISurfaceComposer::eLayerHidden) && s.alpha)) { const bool translucent = layer->needsBlending(); const Rect bounds(layer->visibleBounds()); visibleRegion.set(bounds); - coveredRegion = visibleRegion; - - // Remove the transparent area from the visible region - if (translucent) { - visibleRegion.subtractSelf(layer->transparentRegionScreen); - } + visibleRegion.andSelf(screenRegion); + if (!visibleRegion.isEmpty()) { + // Remove the transparent area from the visible region + if (translucent) { + visibleRegion.subtractSelf(layer->transparentRegionScreen); + } - // compute the opaque region - if (s.alpha==255 && !translucent && layer->getOrientation()>=0) { - // the opaque region is the visible region - opaqueRegion = visibleRegion; + // compute the opaque region + const int32_t layerOrientation = layer->getOrientation(); + if (s.alpha==255 && !translucent && + ((layerOrientation & Transform::ROT_INVALID) == false)) { + // the opaque region is the layer's footprint + opaqueRegion = visibleRegion; + } } } + // Clip the covered region to the visible region + coveredRegion = aboveCoveredLayers.intersect(visibleRegion); + + // Update aboveCoveredLayers for next (lower) layer + aboveCoveredLayers.orSelf(visibleRegion); + // subtract the opaque region covered by the layers above us visibleRegion.subtractSelf(aboveOpaqueLayers); - coveredRegion.andSelf(aboveCoveredLayers); // compute this layer's dirty region if (layer->contentDirty) { @@ -730,19 +751,30 @@ void SurfaceFlinger::computeVisibleRegions( layer->contentDirty = false; } else { /* compute the exposed region: - * exposed = what's VISIBLE and NOT COVERED now - * but was COVERED before + * the exposed region consists of two components: + * 1) what's VISIBLE now and was COVERED before + * 2) what's EXPOSED now less what was EXPOSED before + * + * note that (1) is conservative, we start with the whole + * visible region but only keep what used to be covered by + * something -- which mean it may have been exposed. + * + * (2) handles areas that were not covered by anything but got + * exposed because of a resize. */ - dirty = (visibleRegion - coveredRegion) & layer->coveredRegionScreen; + const Region newExposed = visibleRegion - coveredRegion; + const Region oldVisibleRegion = layer->visibleRegionScreen; + const Region oldCoveredRegion = layer->coveredRegionScreen; + const Region oldExposed = oldVisibleRegion - oldCoveredRegion; + dirty = (visibleRegion&oldCoveredRegion) | (newExposed-oldExposed); } dirty.subtractSelf(aboveOpaqueLayers); // accumulate to the screen dirty region dirtyRegion.orSelf(dirty); - // Update aboveOpaqueLayers/aboveCoveredLayers for next (lower) layer + // Update aboveOpaqueLayers for next (lower) layer aboveOpaqueLayers.orSelf(opaqueRegion); - aboveCoveredLayers.orSelf(visibleRegion); // Store the visible region is screen space layer->setVisibleRegion(visibleRegion); @@ -1193,7 +1225,7 @@ int SurfaceFlinger::setOrientation(DisplayID dpy, } sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid, - ISurfaceFlingerClient::surface_data_t* params, + const String8& name, ISurfaceFlingerClient::surface_data_t* params, DisplayID d, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) { @@ -1239,6 +1271,7 @@ sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid, } if (layer != 0) { + layer->setName(name); setTransactionFlags(eTransactionNeeded); surfaceHandle = layer->getSurface(); if (surfaceHandle != 0) { @@ -1503,8 +1536,8 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) layer->needsBlending(), layer->needsDithering(), layer->contentDirty, s.alpha, s.flags, - s.transform[0], s.transform[1], - s.transform[2], s.transform[3]); + s.transform[0][0], s.transform[0][1], + s.transform[1][0], s.transform[1][1]); result.append(buffer); buffer[0] = 0; /*** LayerBaseClient ***/ @@ -1513,8 +1546,10 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) if (lbc != 0) { sp<Client> client(lbc->client.promote()); snprintf(buffer, SIZE, - " " - "id=0x%08x, client=0x%08x, identity=%u\n", + " name=%s\n", lbc->getName().string()); + result.append(buffer); + snprintf(buffer, SIZE, + " id=0x%08x, client=0x%08x, identity=%u\n", lbc->clientIndex(), client.get() ? client->cid : 0, lbc->getIdentity()); @@ -1763,10 +1798,12 @@ sp<IMemoryHeap> BClient::getControlBlock() const { sp<ISurface> BClient::createSurface( ISurfaceFlingerClient::surface_data_t* params, int pid, + const String8& name, DisplayID display, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) { - return mFlinger->createSurface(mId, pid, params, display, w, h, format, flags); + return mFlinger->createSurface(mId, pid, name, params, display, w, h, + format, flags); } status_t BClient::destroySurface(SurfaceID sid) @@ -1795,72 +1832,94 @@ bool GraphicPlane::initialized() const { return mHw ? true : false; } -void GraphicPlane::setDisplayHardware(DisplayHardware *hw) { - mHw = hw; +int GraphicPlane::getWidth() const { + return mWidth; } -void GraphicPlane::setTransform(const Transform& tr) { - mTransform = tr; - mGlobalTransform = mOrientationTransform * mTransform; +int GraphicPlane::getHeight() const { + return mHeight; +} + +void GraphicPlane::setDisplayHardware(DisplayHardware *hw) +{ + mHw = hw; + + // initialize the display orientation transform. + // it's a constant that should come from the display driver. + int displayOrientation = ISurfaceComposer::eOrientationDefault; + char property[PROPERTY_VALUE_MAX]; + if (property_get("ro.sf.hwrotation", property, NULL) > 0) { + //displayOrientation + switch (atoi(property)) { + case 90: + displayOrientation = ISurfaceComposer::eOrientation90; + break; + case 270: + displayOrientation = ISurfaceComposer::eOrientation270; + break; + } + } + + const float w = hw->getWidth(); + const float h = hw->getHeight(); + GraphicPlane::orientationToTransfrom(displayOrientation, w, h, + &mDisplayTransform); + if (displayOrientation & ISurfaceComposer::eOrientationSwapMask) { + mDisplayWidth = h; + mDisplayHeight = w; + } else { + mDisplayWidth = w; + mDisplayHeight = h; + } + + setOrientation(ISurfaceComposer::eOrientationDefault); } status_t GraphicPlane::orientationToTransfrom( int orientation, int w, int h, Transform* tr) -{ - float a, b, c, d, x, y; +{ + uint32_t flags = 0; switch (orientation) { case ISurfaceComposer::eOrientationDefault: - a=1; b=0; c=0; d=1; x=0; y=0; + flags = Transform::ROT_0; break; case ISurfaceComposer::eOrientation90: - a=0; b=-1; c=1; d=0; x=w; y=0; + flags = Transform::ROT_90; break; case ISurfaceComposer::eOrientation180: - a=-1; b=0; c=0; d=-1; x=w; y=h; + flags = Transform::ROT_180; break; case ISurfaceComposer::eOrientation270: - a=0; b=1; c=-1; d=0; x=0; y=h; + flags = Transform::ROT_270; break; default: return BAD_VALUE; } - tr->set(a, b, c, d); - tr->set(x, y); + tr->set(flags, w, h); return NO_ERROR; } status_t GraphicPlane::setOrientation(int orientation) { - const DisplayHardware& hw(displayHardware()); - const float w = hw.getWidth(); - const float h = hw.getHeight(); - - if (orientation == ISurfaceComposer::eOrientationDefault) { - // make sure the default orientation is optimal - mOrientationTransform.reset(); - mOrientation = orientation; - mGlobalTransform = mTransform; - return NO_ERROR; - } - // If the rotation can be handled in hardware, this is where // the magic should happen. - if (UNLIKELY(orientation == 42)) { - float a, b, c, d, x, y; - const float r = (3.14159265f / 180.0f) * 42.0f; - const float si = sinf(r); - const float co = cosf(r); - a=co; b=-si; c=si; d=co; - x = si*(h*0.5f) + (1-co)*(w*0.5f); - y =-si*(w*0.5f) + (1-co)*(h*0.5f); - mOrientationTransform.set(a, b, c, d); - mOrientationTransform.set(x, y); - } else { - GraphicPlane::orientationToTransfrom(orientation, w, h, - &mOrientationTransform); + + const DisplayHardware& hw(displayHardware()); + const float w = mDisplayWidth; + const float h = mDisplayHeight; + mWidth = int(w); + mHeight = int(h); + + Transform orientationTransform; + GraphicPlane::orientationToTransfrom(orientation, w, h, + &orientationTransform); + if (orientation & ISurfaceComposer::eOrientationSwapMask) { + mWidth = int(h); + mHeight = int(w); } + mOrientation = orientation; - mGlobalTransform = mOrientationTransform * mTransform; + mGlobalTransform = mDisplayTransform * orientationTransform; return NO_ERROR; } diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h index c0ab73d..d75dc15 100644 --- a/libs/surfaceflinger/SurfaceFlinger.h +++ b/libs/surfaceflinger/SurfaceFlinger.h @@ -31,11 +31,8 @@ #include <binder/Permission.h> #include <ui/PixelFormat.h> -#include <ui/ISurfaceComposer.h> -#include <ui/ISurfaceFlingerClient.h> - -#include <private/ui/SharedBufferStack.h> -#include <private/ui/LayerState.h> +#include <surfaceflinger/ISurfaceComposer.h> +#include <surfaceflinger/ISurfaceFlingerClient.h> #include "Barrier.h" #include "Layer.h" @@ -116,9 +113,10 @@ public: bool initialized() const; void setDisplayHardware(DisplayHardware *); - void setTransform(const Transform& tr); status_t setOrientation(int orientation); int getOrientation() const { return mOrientation; } + int getWidth() const; + int getHeight() const; const DisplayHardware& displayHardware() const; const Transform& transform() const; @@ -129,10 +127,13 @@ private: GraphicPlane operator = (const GraphicPlane&); DisplayHardware* mHw; - Transform mTransform; - Transform mOrientationTransform; Transform mGlobalTransform; + Transform mDisplayTransform; int mOrientation; + float mDisplayWidth; + float mDisplayHeight; + int mWidth; + int mHeight; }; // --------------------------------------------------------------------------- @@ -188,7 +189,7 @@ private: friend class LayerBlur; friend class LayerDim; - sp<ISurface> createSurface(ClientID client, int pid, + sp<ISurface> createSurface(ClientID client, int pid, const String8& name, ISurfaceFlingerClient::surface_data_t* params, DisplayID display, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags); @@ -400,7 +401,7 @@ public: virtual sp<IMemoryHeap> getControlBlock() const; virtual sp<ISurface> createSurface( - surface_data_t* params, int pid, + surface_data_t* params, int pid, const String8& name, DisplayID display, uint32_t w, uint32_t h,PixelFormat format, uint32_t flags); diff --git a/libs/surfaceflinger/Transform.cpp b/libs/surfaceflinger/Transform.cpp index 1501536..175f989 100644 --- a/libs/surfaceflinger/Transform.cpp +++ b/libs/surfaceflinger/Transform.cpp @@ -14,169 +14,262 @@ * limitations under the License. */ -#include <ui/Region.h> +#include <math.h> -#include <private/pixelflinger/ggl_fixed.h> +#include <cutils/compiler.h> +#include <utils/String8.h> +#include <ui/Region.h> #include "Transform.h" // --------------------------------------------------------------------------- -#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) -#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) +namespace android { // --------------------------------------------------------------------------- -namespace android { +template <typename T> inline T min(T a, T b) { + return a<b ? a : b; +} +template <typename T> inline T min(T a, T b, T c) { + return min(a, min(b, c)); +} +template <typename T> inline T min(T a, T b, T c, T d) { + return min(a, b, min(c, d)); +} + +template <typename T> inline T max(T a, T b) { + return a>b ? a : b; +} +template <typename T> inline T max(T a, T b, T c) { + return max(a, max(b, c)); +} +template <typename T> inline T max(T a, T b, T c, T d) { + return max(a, b, max(c, d)); +} // --------------------------------------------------------------------------- -Transform::Transform() - : mType(0) -{ - mTransform.reset(); +Transform::Transform() { + reset(); } Transform::Transform(const Transform& other) - : mTransform(other.mTransform), mType(other.mType) -{ + : mMatrix(other.mMatrix), mType(other.mType) { +} + +Transform::Transform(uint32_t orientation) { + set(orientation, 0, 0); } Transform::~Transform() { } +static const float EPSILON = 0.0f; + +bool Transform::isZero(float f) { + return fabs(f) <= EPSILON; +} + +bool Transform::absIsOne(float f) { + return isZero(fabs(f) - 1.0f); +} + Transform Transform::operator * (const Transform& rhs) const { - if (LIKELY(mType == 0)) + if (CC_LIKELY(mType == IDENTITY)) return rhs; Transform r(*this); - r.mTransform.preConcat(rhs.mTransform); - r.mType |= rhs.mType; - return r; -} + if (rhs.mType == IDENTITY) + return r; -float Transform::operator [] (int i) const -{ - float r = 0; - switch(i) { - case 0: r = SkScalarToFloat( mTransform[SkMatrix::kMScaleX] ); break; - case 1: r = SkScalarToFloat( mTransform[SkMatrix::kMSkewX] ); break; - case 2: r = SkScalarToFloat( mTransform[SkMatrix::kMSkewY] ); break; - case 3: r = SkScalarToFloat( mTransform[SkMatrix::kMScaleY] ); break; + // TODO: we could use mType to optimize the matrix multiply + const mat33& A(mMatrix); + const mat33& B(rhs.mMatrix); + mat33& D(r.mMatrix); + for (int i=0 ; i<3 ; i++) { + const float v0 = A[0][i]; + const float v1 = A[1][i]; + const float v2 = A[2][i]; + D[0][i] = v0*B[0][0] + v1*B[0][1] + v2*B[0][2]; + D[1][i] = v0*B[1][0] + v1*B[1][1] + v2*B[1][2]; + D[2][i] = v0*B[2][0] + v1*B[2][1] + v2*B[2][2]; } + r.mType |= rhs.mType; + + // TODO: we could recompute this value from r and rhs + r.mType &= 0xFF; + r.mType |= UNKNOWN_TYPE; return r; } -uint8_t Transform::type() const -{ - if (UNLIKELY(mType & 0x80000000)) { - mType = mTransform.getType(); - } - return uint8_t(mType & 0xFF); +float const* Transform::operator [] (int i) const { + return mMatrix[i].v; } bool Transform::transformed() const { - return type() > SkMatrix::kTranslate_Mask; + return type() > TRANSLATE; } int Transform::tx() const { - return SkScalarRound( mTransform[SkMatrix::kMTransX] ); + return floorf(mMatrix[2][0] + 0.5f); } int Transform::ty() const { - return SkScalarRound( mTransform[SkMatrix::kMTransY] ); + return floorf(mMatrix[2][1] + 0.5f); } void Transform::reset() { - mTransform.reset(); - mType = 0; + mType = IDENTITY; + for(int i=0 ; i<3 ; i++) { + vec3& v(mMatrix[i]); + for (int j=0 ; j<3 ; j++) + v[j] = ((i==j) ? 1.0f : 0.0f); + } } -void Transform::set( float xx, float xy, - float yx, float yy) +void Transform::set(float tx, float ty) { - mTransform.set(SkMatrix::kMScaleX, SkFloatToScalar(xx)); - mTransform.set(SkMatrix::kMSkewX, SkFloatToScalar(xy)); - mTransform.set(SkMatrix::kMSkewY, SkFloatToScalar(yx)); - mTransform.set(SkMatrix::kMScaleY, SkFloatToScalar(yy)); - mType |= 0x80000000; + mMatrix[2][0] = tx; + mMatrix[2][1] = ty; + mMatrix[2][2] = 1.0f; + + if (isZero(tx) && isZero(ty)) { + mType &= ~TRANSLATE; + } else { + mType |= TRANSLATE; + } } -void Transform::set(float radian, float x, float y) +void Transform::set(float a, float b, float c, float d) { - float r00 = cosf(radian); float r01 = -sinf(radian); - float r10 = sinf(radian); float r11 = cosf(radian); - mTransform.set(SkMatrix::kMScaleX, SkFloatToScalar(r00)); - mTransform.set(SkMatrix::kMSkewX, SkFloatToScalar(r01)); - mTransform.set(SkMatrix::kMSkewY, SkFloatToScalar(r10)); - mTransform.set(SkMatrix::kMScaleY, SkFloatToScalar(r11)); - mTransform.set(SkMatrix::kMTransX, SkIntToScalar(x - r00*x - r01*y)); - mTransform.set(SkMatrix::kMTransY, SkIntToScalar(y - r10*x - r11*y)); - mType |= 0x80000000 | SkMatrix::kTranslate_Mask; -} - -void Transform::scale(float s, float x, float y) -{ - mTransform.postScale(s, s, x, y); - mType |= 0x80000000; + mat33& M(mMatrix); + M[0][0] = a; M[1][0] = b; + M[0][1] = c; M[1][1] = d; + M[0][2] = 0; M[1][2] = 0; + mType = UNKNOWN_TYPE; } -void Transform::set(int tx, int ty) +status_t Transform::set(uint32_t flags, float w, float h) { - if (tx | ty) { - mTransform.set(SkMatrix::kMTransX, SkIntToScalar(tx)); - mTransform.set(SkMatrix::kMTransY, SkIntToScalar(ty)); - mType |= SkMatrix::kTranslate_Mask; + if (flags & ROT_INVALID) { + // that's not allowed! + reset(); + return BAD_VALUE; + } + + mType = flags << 8; + float sx = (flags & FLIP_H) ? -1 : 1; + float sy = (flags & FLIP_V) ? -1 : 1; + float a=0, b=0, c=0, d=0, x=0, y=0; + int xmask = 0; + + // computation of x,y + // x y + // 0 0 0 + // w 0 ROT90 + // w h FLIPH|FLIPV + // 0 h FLIPH|FLIPV|ROT90 + + if (flags & ROT_90) { + mType |= ROTATE; + b = -sy; + c = sx; + xmask = 1; } else { - mTransform.set(SkMatrix::kMTransX, 0); - mTransform.set(SkMatrix::kMTransY, 0); - mType &= ~SkMatrix::kTranslate_Mask; + a = sx; + d = sy; + } + + if (flags & FLIP_H) { + mType ^= SCALE; + xmask ^= 1; + } + + if (flags & FLIP_V) { + mType ^= SCALE; + y = h; + } + + if ((flags & ROT_180) == ROT_180) { + mType |= ROTATE; + } + + if (xmask) { + x = w; } + + if (!isZero(x) || !isZero(y)) { + mType |= TRANSLATE; + } + + mat33& M(mMatrix); + M[0][0] = a; M[1][0] = b; M[2][0] = x; + M[0][1] = c; M[1][1] = d; M[2][1] = y; + M[0][2] = 0; M[1][2] = 0; M[2][2] = 1; + + return NO_ERROR; } -void Transform::transform(GLfixed* point, int x, int y) const +Transform::vec2 Transform::transform(const vec2& v) const { + vec2 r; + const mat33& M(mMatrix); + r[0] = M[0][0]*v[0] + M[1][0]*v[1] + M[2][0]; + r[1] = M[0][1]*v[0] + M[1][1]*v[1] + M[2][1]; + return r; +} + +Transform::vec3 Transform::transform(const vec3& v) const { + vec3 r; + const mat33& M(mMatrix); + r[0] = M[0][0]*v[0] + M[1][0]*v[1] + M[2][0]*v[2]; + r[1] = M[0][1]*v[0] + M[1][1]*v[1] + M[2][1]*v[2]; + r[2] = M[0][2]*v[0] + M[1][2]*v[1] + M[2][2]*v[2]; + return r; +} + +void Transform::transform(fixed1616* point, int x, int y) const { - SkPoint s; - mTransform.mapXY(SkIntToScalar(x), SkIntToScalar(y), &s); - point[0] = SkScalarToFixed(s.fX); - point[1] = SkScalarToFixed(s.fY); + const float toFixed = 65536.0f; + const mat33& M(mMatrix); + vec2 v(x, y); + v = transform(v); + point[0] = v[0] * toFixed; + point[1] = v[1] * toFixed; } Rect Transform::makeBounds(int w, int h) const { - Rect r; - SkRect d, s; - s.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); - mTransform.mapRect(&d, s); - r.left = SkScalarRound( d.fLeft ); - r.top = SkScalarRound( d.fTop ); - r.right = SkScalarRound( d.fRight ); - r.bottom = SkScalarRound( d.fBottom ); - return r; + return transform( Rect(w, h) ); } Rect Transform::transform(const Rect& bounds) const { Rect r; - SkRect d, s; - s.set( SkIntToScalar( bounds.left ), - SkIntToScalar( bounds.top ), - SkIntToScalar( bounds.right ), - SkIntToScalar( bounds.bottom )); - mTransform.mapRect(&d, s); - r.left = SkScalarRound( d.fLeft ); - r.top = SkScalarRound( d.fTop ); - r.right = SkScalarRound( d.fRight ); - r.bottom = SkScalarRound( d.fBottom ); + vec2 lt( bounds.left, bounds.top ); + vec2 rt( bounds.right, bounds.top ); + vec2 lb( bounds.left, bounds.bottom ); + vec2 rb( bounds.right, bounds.bottom ); + + lt = transform(lt); + rt = transform(rt); + lb = transform(lb); + rb = transform(rb); + + r.left = floorf(min(lt[0], rt[0], lb[0], rb[0]) + 0.5f); + r.top = floorf(min(lt[1], rt[1], lb[1], rb[1]) + 0.5f); + r.right = floorf(max(lt[0], rt[0], lb[0], rb[0]) + 0.5f); + r.bottom = floorf(max(lt[1], rt[1], lb[1], rb[1]) + 0.5f); + return r; } Region Transform::transform(const Region& reg) const { Region out; - if (UNLIKELY(transformed())) { - if (LIKELY(preserveRects())) { + if (CC_UNLIKELY(transformed())) { + if (CC_LIKELY(preserveRects())) { Region::const_iterator it = reg.begin(); Region::const_iterator const end = reg.end(); while (it != end) { @@ -191,31 +284,107 @@ Region Transform::transform(const Region& reg) const return out; } -int32_t Transform::getOrientation() const +uint32_t Transform::type() const { - uint32_t flags = 0; - if (UNLIKELY(transformed())) { - SkScalar a = mTransform[SkMatrix::kMScaleX]; - SkScalar b = mTransform[SkMatrix::kMSkewX]; - SkScalar c = mTransform[SkMatrix::kMSkewY]; - SkScalar d = mTransform[SkMatrix::kMScaleY]; - if (b==0 && c==0 && a && d) { + if (mType & UNKNOWN_TYPE) { + // recompute what this transform is + + const mat33& M(mMatrix); + const float a = M[0][0]; + const float b = M[1][0]; + const float c = M[0][1]; + const float d = M[1][1]; + const float x = M[2][0]; + const float y = M[2][1]; + + bool scale = false; + uint32_t flags = ROT_0; + if (isZero(b) && isZero(c)) { if (a<0) flags |= FLIP_H; if (d<0) flags |= FLIP_V; - } else if (b && c && a==0 && d==0) { + if (!absIsOne(a) || !absIsOne(d)) { + scale = true; + } + } else if (isZero(a) && isZero(d)) { flags |= ROT_90; if (b>0) flags |= FLIP_H; if (c<0) flags |= FLIP_V; + if (!absIsOne(b) || !absIsOne(c)) { + scale = true; + } + } else { + flags = ROT_INVALID; + } + + mType = flags << 8; + if (flags & ROT_INVALID) { + mType |= UNKNOWN; } else { - flags = 0x80000000; + if ((flags & ROT_90) || ((flags & ROT_180) == ROT_180)) + mType |= ROTATE; + if (flags & FLIP_H) + mType ^= SCALE; + if (flags & FLIP_V) + mType ^= SCALE; + if (scale) + mType |= SCALE; } + + if (!isZero(x) || !isZero(y)) + mType |= TRANSLATE; } - return flags; + return mType; +} + +uint32_t Transform::getType() const { + return type() & 0xFF; +} + +uint32_t Transform::getOrientation() const +{ + return (type() >> 8) & 0xFF; } bool Transform::preserveRects() const { - return mTransform.rectStaysRect(); + return (type() & ROT_INVALID) ? false : true; +} + +void Transform::dump(const char* name) const +{ + type(); // updates the type + + String8 flags, type; + const mat33& m(mMatrix); + uint32_t orient = mType >> 8; + + if (orient&ROT_INVALID) { + flags.append("ROT_INVALID "); + } else { + if (orient&ROT_90) { + flags.append("ROT_90 "); + } else { + flags.append("ROT_0 "); + } + if (orient&FLIP_V) + flags.append("FLIP_V "); + if (orient&FLIP_H) + flags.append("FLIP_H "); + } + + if (!(mType&(SCALE|ROTATE|TRANSLATE))) + type.append("IDENTITY "); + if (mType&SCALE) + type.append("SCALE "); + if (mType&ROTATE) + type.append("ROTATE "); + if (mType&TRANSLATE) + type.append("TRANSLATE "); + + LOGD("%s 0x%08x (%s, %s)", name, mType, flags.string(), type.string()); + LOGD("%.4f %.4f %.4f", m[0][0], m[1][0], m[2][0]); + LOGD("%.4f %.4f %.4f", m[0][1], m[1][1], m[2][1]); + LOGD("%.4f %.4f %.4f", m[0][2], m[1][2], m[2][2]); } // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/Transform.h b/libs/surfaceflinger/Transform.h index 78f5c19..2e5b893 100644 --- a/libs/surfaceflinger/Transform.h +++ b/libs/surfaceflinger/Transform.h @@ -23,10 +23,6 @@ #include <ui/Point.h> #include <ui/Rect.h> -#include <GLES/gl.h> - -#include <core/SkMatrix.h> - namespace android { class Region; @@ -38,8 +34,12 @@ class Transform public: Transform(); Transform(const Transform& other); + explicit Transform(uint32_t orientation); ~Transform(); + typedef int32_t fixed1616; + + // FIXME: must match OVERLAY_TRANSFORM_*, pull from hardware.h enum orientation_flags { ROT_0 = 0x00000000, FLIP_H = 0x00000001, @@ -47,48 +47,79 @@ public: ROT_90 = 0x00000004, ROT_180 = FLIP_H|FLIP_V, ROT_270 = ROT_180|ROT_90, - ROT_INVALID = 0x80000000 + ROT_INVALID = 0x80 }; enum type_mask { IDENTITY = 0, TRANSLATE = 0x1, - SCALE = 0x2, - AFFINE = 0x4, - PERSPECTIVE = 0x8 + ROTATE = 0x2, + SCALE = 0x4, + UNKNOWN = 0x8 }; - bool transformed() const; - int32_t getOrientation() const; - bool preserveRects() const; - + // query the transform + bool transformed() const; + bool preserveRects() const; + uint32_t getType() const; + uint32_t getOrientation() const; + + float const* operator [] (int i) const; // returns column i int tx() const; int ty() const; - - void reset(); - void set(float xx, float xy, float yx, float yy); - void set(int tx, int ty); - void set(float radian, float x, float y); - void scale(float s, float x, float y); - + + // modify the transform + void reset(); + void set(float tx, float ty); + void set(float a, float b, float c, float d); + status_t set(uint32_t flags, float w, float h); + + // transform data Rect makeBounds(int w, int h) const; - void transform(GLfixed* point, int x, int y) const; + void transform(fixed1616* point, int x, int y) const; Region transform(const Region& reg) const; - Rect transform(const Rect& bounds) const; - Transform operator * (const Transform& rhs) const; - float operator [] (int i) const; - inline uint32_t getType() const { return type(); } - - inline Transform(bool) : mType(0xFF) { }; - -private: - uint8_t type() const; + // for debugging + void dump(const char* name) const; private: - SkMatrix mTransform; - mutable uint32_t mType; + struct vec3 { + float v[3]; + inline vec3() { } + inline vec3(float a, float b, float c) { + v[0] = a; v[1] = b; v[2] = c; + } + inline float operator [] (int i) const { return v[i]; } + inline float& operator [] (int i) { return v[i]; } + }; + struct vec2 { + float v[2]; + inline vec2() { } + inline vec2(float a, float b) { + v[0] = a; v[1] = b; + } + inline float operator [] (int i) const { return v[i]; } + inline float& operator [] (int i) { return v[i]; } + }; + struct mat33 { + vec3 v[3]; + inline const vec3& operator [] (int i) const { return v[i]; } + inline vec3& operator [] (int i) { return v[i]; } + }; + + enum { UNKNOWN_TYPE = 0x80000000 }; + + // assumes the last row is < 0 , 0 , 1 > + vec2 transform(const vec2& v) const; + vec3 transform(const vec3& v) const; + Rect transform(const Rect& bounds) const; + uint32_t type() const; + static bool absIsOne(float f); + static bool isZero(float f); + + mat33 mMatrix; + mutable uint32_t mType; }; // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/tests/overlays/Android.mk b/libs/surfaceflinger/tests/overlays/Android.mk index dc47e45..592b601 100644 --- a/libs/surfaceflinger/tests/overlays/Android.mk +++ b/libs/surfaceflinger/tests/overlays/Android.mk @@ -7,7 +7,8 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ libutils \ - libui + libui \ + libsurfaceflinger_client LOCAL_MODULE:= test-overlays diff --git a/libs/surfaceflinger/tests/overlays/overlays.cpp b/libs/surfaceflinger/tests/overlays/overlays.cpp index 0b9322e..c248a615 100644 --- a/libs/surfaceflinger/tests/overlays/overlays.cpp +++ b/libs/surfaceflinger/tests/overlays/overlays.cpp @@ -3,10 +3,11 @@ #include <binder/IServiceManager.h> #include <utils/Log.h> -#include <ui/Surface.h> -#include <ui/ISurface.h> #include <ui/Overlay.h> -#include <ui/SurfaceComposerClient.h> + +#include <surfaceflinger/Surface.h> +#include <surfaceflinger/ISurface.h> +#include <surfaceflinger/SurfaceComposerClient.h> using namespace android; diff --git a/libs/surfaceflinger/tests/resize/Android.mk b/libs/surfaceflinger/tests/resize/Android.mk index ef1532f..24c2d01 100644 --- a/libs/surfaceflinger/tests/resize/Android.mk +++ b/libs/surfaceflinger/tests/resize/Android.mk @@ -7,7 +7,8 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ libutils \ - libui + libui \ + libsurfaceflinger_client LOCAL_MODULE:= test-resize diff --git a/libs/surfaceflinger/tests/resize/resize.cpp b/libs/surfaceflinger/tests/resize/resize.cpp index 21c6ab6..127cca3 100644 --- a/libs/surfaceflinger/tests/resize/resize.cpp +++ b/libs/surfaceflinger/tests/resize/resize.cpp @@ -1,14 +1,16 @@ #include <cutils/memory.h> -#include <utils/IPCThreadState.h> -#include <utils/ProcessState.h> -#include <utils/IServiceManager.h> #include <utils/Log.h> -#include <ui/Surface.h> -#include <ui/ISurface.h> +#include <binder/IPCThreadState.h> +#include <binder/ProcessState.h> +#include <binder/IServiceManager.h> + +#include <surfaceflinger/Surface.h> +#include <surfaceflinger/ISurface.h> +#include <surfaceflinger/SurfaceComposerClient.h> + #include <ui/Overlay.h> -#include <ui/SurfaceComposerClient.h> using namespace android; diff --git a/libs/surfaceflinger_client/Android.mk b/libs/surfaceflinger_client/Android.mk new file mode 100644 index 0000000..fe85b34 --- /dev/null +++ b/libs/surfaceflinger_client/Android.mk @@ -0,0 +1,26 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + ISurfaceComposer.cpp \ + ISurface.cpp \ + ISurfaceFlingerClient.cpp \ + LayerState.cpp \ + SharedBufferStack.cpp \ + Surface.cpp \ + SurfaceComposerClient.cpp + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ + libbinder \ + libhardware \ + libui + +LOCAL_MODULE:= libsurfaceflinger_client + +ifeq ($(TARGET_SIMULATOR),true) + LOCAL_LDLIBS += -lpthread +endif + +include $(BUILD_SHARED_LIBRARY) diff --git a/libs/ui/ISurface.cpp b/libs/surfaceflinger_client/ISurface.cpp index 4fb38ed..bb86199 100644 --- a/libs/ui/ISurface.cpp +++ b/libs/surfaceflinger_client/ISurface.cpp @@ -23,12 +23,12 @@ #include <binder/Parcel.h> #include <binder/IMemory.h> -#include <ui/ISurface.h> #include <ui/Overlay.h> -#include <ui/Surface.h> - #include <ui/GraphicBuffer.h> +#include <surfaceflinger/Surface.h> +#include <surfaceflinger/ISurface.h> + namespace android { // ---------------------------------------------------------------------- @@ -78,7 +78,8 @@ public: data.writeInt32(bufferIdx); data.writeInt32(usage); remote()->transact(REQUEST_BUFFER, data, &reply); - sp<GraphicBuffer> buffer = new GraphicBuffer(reply); + sp<GraphicBuffer> buffer = new GraphicBuffer(); + reply.read(*buffer); return buffer; } @@ -115,13 +116,14 @@ public: } virtual sp<OverlayRef> createOverlay( - uint32_t w, uint32_t h, int32_t format) + uint32_t w, uint32_t h, int32_t format, int32_t orientation) { Parcel data, reply; data.writeInterfaceToken(ISurface::getInterfaceDescriptor()); data.writeInt32(w); data.writeInt32(h); data.writeInt32(format); + data.writeInt32(orientation); remote()->transact(CREATE_OVERLAY, data, &reply); return OverlayRef::readFromParcel(reply); } @@ -140,7 +142,9 @@ status_t BnSurface::onTransact( int bufferIdx = data.readInt32(); int usage = data.readInt32(); sp<GraphicBuffer> buffer(requestBuffer(bufferIdx, usage)); - return GraphicBuffer::writeToParcel(reply, buffer.get()); + if (buffer == NULL) + return BAD_VALUE; + return reply->write(*buffer); } case REGISTER_BUFFERS: { CHECK_INTERFACE(ISurface, data, reply); @@ -173,7 +177,8 @@ status_t BnSurface::onTransact( int w = data.readInt32(); int h = data.readInt32(); int f = data.readInt32(); - sp<OverlayRef> o = createOverlay(w, h, f); + int orientation = data.readInt32(); + sp<OverlayRef> o = createOverlay(w, h, f, orientation); return OverlayRef::writeToParcel(reply, o); } break; default: diff --git a/libs/ui/ISurfaceComposer.cpp b/libs/surfaceflinger_client/ISurfaceComposer.cpp index fd2a590..b6f4e24 100644 --- a/libs/ui/ISurfaceComposer.cpp +++ b/libs/surfaceflinger_client/ISurfaceComposer.cpp @@ -25,9 +25,10 @@ #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> -#include <ui/ISurfaceComposer.h> #include <ui/DisplayInfo.h> +#include <surfaceflinger/ISurfaceComposer.h> + // --------------------------------------------------------------------------- #define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) diff --git a/libs/ui/ISurfaceFlingerClient.cpp b/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp index 4a6a1d7..def96d7 100644 --- a/libs/ui/ISurfaceFlingerClient.cpp +++ b/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp @@ -26,12 +26,12 @@ #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> -#include <ui/ISurface.h> -#include <ui/ISurfaceFlingerClient.h> #include <ui/Point.h> #include <ui/Rect.h> -#include <private/ui/LayerState.h> +#include <surfaceflinger/ISurface.h> +#include <surfaceflinger/ISurfaceFlingerClient.h> +#include <private/surfaceflinger/LayerState.h> // --------------------------------------------------------------------------- @@ -74,6 +74,7 @@ public: virtual sp<ISurface> createSurface( surface_data_t* params, int pid, + const String8& name, DisplayID display, uint32_t w, uint32_t h, @@ -83,6 +84,7 @@ public: Parcel data, reply; data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor()); data.writeInt32(pid); + data.writeString8(name); data.writeInt32(display); data.writeInt32(w); data.writeInt32(h); @@ -154,12 +156,14 @@ status_t BnSurfaceFlingerClient::onTransact( CHECK_INTERFACE(ISurfaceFlingerClient, data, reply); surface_data_t params; int32_t pid = data.readInt32(); + String8 name = data.readString8(); DisplayID display = data.readInt32(); uint32_t w = data.readInt32(); uint32_t h = data.readInt32(); PixelFormat format = data.readInt32(); uint32_t flags = data.readInt32(); - sp<ISurface> s = createSurface(¶ms, pid, display, w, h, format, flags); + sp<ISurface> s = createSurface(¶ms, pid, name, display, w, h, + format, flags); params.writeToParcel(reply); reply->writeStrongBinder(s->asBinder()); return NO_ERROR; diff --git a/libs/ui/LayerState.cpp b/libs/surfaceflinger_client/LayerState.cpp index a53ffb7..01c4c7e 100644 --- a/libs/ui/LayerState.cpp +++ b/libs/surfaceflinger_client/LayerState.cpp @@ -16,37 +16,45 @@ #include <utils/Errors.h> #include <binder/Parcel.h> -#include <private/ui/LayerState.h> +#include <private/surfaceflinger/LayerState.h> namespace android { status_t layer_state_t::write(Parcel& output) const { - size_t size = sizeof(layer_state_t); + status_t err; + + size_t len = transparentRegion.write(NULL, 0); + err = output.writeInt32(len); + if (err < NO_ERROR) return err; - //output.writeStrongBinder(surface->asBinder()); - //size -= sizeof(surface); + void* buf = output.writeInplace(len); + if (buf == NULL) return NO_MEMORY; - transparentRegion.write(output); + err = transparentRegion.write(buf, len); + if (err < NO_ERROR) return err; + + // NOTE: regions are at the end of the structure + size_t size = sizeof(layer_state_t); size -= sizeof(transparentRegion); - - output.write(this, size); - - return NO_ERROR; + err = output.write(this, size); + return err; } status_t layer_state_t::read(const Parcel& input) { - size_t size = sizeof(layer_state_t); + status_t err; + size_t len = input.readInt32(); + void const* buf = input.readInplace(len); + if (buf == NULL) return NO_MEMORY; - //surface = interface_cast<ISurface>(input.readStrongBinder()); - //size -= sizeof(surface); + err = transparentRegion.read(buf); + if (err < NO_ERROR) return err; - transparentRegion.read(input); + // NOTE: regions are at the end of the structure + size_t size = sizeof(layer_state_t); size -= sizeof(transparentRegion); - input.read(this, size); - return NO_ERROR; } diff --git a/libs/ui/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp index 46b6766..a17e8ac 100644 --- a/libs/ui/SharedBufferStack.cpp +++ b/libs/surfaceflinger_client/SharedBufferStack.cpp @@ -23,7 +23,7 @@ #include <utils/Log.h> #include <utils/threads.h> -#include <private/ui/SharedBufferStack.h> +#include <private/surfaceflinger/SharedBufferStack.h> #include <ui/Rect.h> #include <ui/Region.h> @@ -34,7 +34,7 @@ namespace android { // ---------------------------------------------------------------------------- SharedClient::SharedClient() - : lock(Mutex::SHARED) + : lock(Mutex::SHARED), cv(Condition::SHARED) { } @@ -132,10 +132,11 @@ String8 SharedBufferBase::dump(char const* prefix) const char buffer[SIZE]; String8 result; SharedBufferStack& stack( *mSharedStack ); + int tail = (mNumBuffers + stack.head - stack.available + 1) % mNumBuffers; snprintf(buffer, SIZE, - "%s[ head=%2d, available=%2d, queued=%2d ] " + "%s[ head=%2d, available=%2d, queued=%2d, tail=%2d ] " "reallocMask=%08x, inUse=%2d, identity=%d, status=%d\n", - prefix, stack.head, stack.available, stack.queued, + prefix, stack.head, stack.available, stack.queued, tail, stack.reallocMask, stack.inUse, stack.identity, stack.status); result.append(buffer); return result; @@ -269,6 +270,8 @@ int32_t SharedBufferClient::computeTail() const newTail = head - avail + 1; if (newTail < 0) { newTail += mNumBuffers; + } else if (newTail >= mNumBuffers) { + newTail -= mNumBuffers; } return newTail; } diff --git a/libs/ui/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp index 24ae27f..5dd75c3 100644 --- a/libs/ui/Surface.cpp +++ b/libs/surfaceflinger_client/Surface.cpp @@ -26,22 +26,25 @@ #include <utils/Errors.h> #include <utils/threads.h> #include <utils/CallStack.h> +#include <utils/Log.h> + +#include <pixelflinger/pixelflinger.h> + #include <binder/IPCThreadState.h> #include <binder/IMemory.h> -#include <utils/Log.h> #include <ui/DisplayInfo.h> #include <ui/GraphicBuffer.h> #include <ui/GraphicBufferMapper.h> -#include <ui/ISurface.h> -#include <ui/Surface.h> -#include <ui/SurfaceComposerClient.h> #include <ui/Rect.h> -#include <pixelflinger/pixelflinger.h> +#include <surfaceflinger/Surface.h> +#include <surfaceflinger/ISurface.h> +#include <surfaceflinger/ISurfaceComposer.h> +#include <surfaceflinger/SurfaceComposerClient.h> -#include <private/ui/SharedBufferStack.h> -#include <private/ui/LayerState.h> +#include <private/surfaceflinger/SharedBufferStack.h> +#include <private/surfaceflinger/LayerState.h> namespace android { @@ -350,6 +353,7 @@ void Surface::init() const_cast<uint32_t&>(android_native_window_t::flags) = 0; // be default we request a hardware surface mUsage = GRALLOC_USAGE_HW_RENDER; + mConnected = 0; mNeedFullUpdate = false; } @@ -576,28 +580,93 @@ int Surface::perform(int operation, va_list args) { int res = NO_ERROR; switch (operation) { - case NATIVE_WINDOW_SET_USAGE: - setUsage( va_arg(args, int) ); - break; - default: - res = NAME_NOT_FOUND; - break; + case NATIVE_WINDOW_SET_USAGE: + dispatch_setUsage( args ); + break; + case NATIVE_WINDOW_CONNECT: + res = dispatch_connect( args ); + break; + case NATIVE_WINDOW_DISCONNECT: + res = dispatch_disconnect( args ); + break; + default: + res = NAME_NOT_FOUND; + break; } return res; } +void Surface::dispatch_setUsage(va_list args) { + int usage = va_arg(args, int); + setUsage( usage ); +} +int Surface::dispatch_connect(va_list args) { + int api = va_arg(args, int); + return connect( api ); +} +int Surface::dispatch_disconnect(va_list args) { + int api = va_arg(args, int); + return disconnect( api ); +} + + void Surface::setUsage(uint32_t reqUsage) { Mutex::Autolock _l(mSurfaceLock); mUsage = reqUsage; } +int Surface::connect(int api) +{ + Mutex::Autolock _l(mSurfaceLock); + int err = NO_ERROR; + switch (api) { + case NATIVE_WINDOW_API_EGL: + if (mConnected) { + err = -EINVAL; + } else { + mConnected = api; + } + break; + default: + err = -EINVAL; + break; + } + return err; +} + +int Surface::disconnect(int api) +{ + Mutex::Autolock _l(mSurfaceLock); + int err = NO_ERROR; + switch (api) { + case NATIVE_WINDOW_API_EGL: + if (mConnected == api) { + mConnected = 0; + } else { + err = -EINVAL; + } + break; + default: + err = -EINVAL; + break; + } + return err; +} + uint32_t Surface::getUsage() const { Mutex::Autolock _l(mSurfaceLock); return mUsage; } +int Surface::getConnectedApi() const +{ + Mutex::Autolock _l(mSurfaceLock); + return mConnected; +} + + // ---------------------------------------------------------------------------- status_t Surface::lock(SurfaceInfo* info, bool blocking) { @@ -606,14 +675,31 @@ status_t Surface::lock(SurfaceInfo* info, bool blocking) { status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn, bool blocking) { + if (getConnectedApi()) { + LOGE("Surface::lock(%p) failed. Already connected to another API", + (android_native_window_t*)this); + CallStack stack; + stack.update(); + stack.dump(""); + return INVALID_OPERATION; + } + if (mApiLock.tryLock() != NO_ERROR) { - LOGE("calling Surface::lock() from different threads!"); + LOGE("calling Surface::lock from different threads!"); CallStack stack; stack.update(); - stack.dump("Surface::lock called from different threads"); + stack.dump(""); return WOULD_BLOCK; } + + /* Here we're holding mApiLock */ + if (mLockedBuffer != 0) { + LOGE("Surface::lock failed, already locked"); + mApiLock.unlock(); + return INVALID_OPERATION; + } + // we're intending to do software rendering from this point setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN); @@ -682,8 +768,8 @@ status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn, bool blocking) status_t Surface::unlockAndPost() { if (mLockedBuffer == 0) { - LOGE("unlockAndPost failed, no locked buffer"); - return BAD_VALUE; + LOGE("Surface::unlockAndPost failed, no locked buffer"); + return INVALID_OPERATION; } status_t err = mLockedBuffer->unlock(); diff --git a/libs/ui/SurfaceComposerClient.cpp b/libs/surfaceflinger_client/SurfaceComposerClient.cpp index eda84ef..3117495 100644 --- a/libs/ui/SurfaceComposerClient.cpp +++ b/libs/surfaceflinger_client/SurfaceComposerClient.cpp @@ -29,19 +29,21 @@ #include <utils/Errors.h> #include <utils/threads.h> #include <utils/KeyedVector.h> +#include <utils/Log.h> + #include <binder/IServiceManager.h> #include <binder/IMemory.h> -#include <utils/Log.h> #include <ui/DisplayInfo.h> -#include <ui/ISurfaceComposer.h> -#include <ui/ISurfaceFlingerClient.h> -#include <ui/ISurface.h> -#include <ui/SurfaceComposerClient.h> #include <ui/Rect.h> -#include <private/ui/LayerState.h> -#include <private/ui/SharedBufferStack.h> +#include <surfaceflinger/ISurfaceComposer.h> +#include <surfaceflinger/ISurfaceFlingerClient.h> +#include <surfaceflinger/ISurface.h> +#include <surfaceflinger/SurfaceComposerClient.h> + +#include <private/surfaceflinger/LayerState.h> +#include <private/surfaceflinger/SharedBufferStack.h> #define VERBOSE(...) ((void)0) //#define VERBOSE LOGD @@ -317,10 +319,30 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface( PixelFormat format, uint32_t flags) { + String8 name; + const size_t SIZE = 128; + char buffer[SIZE]; + snprintf(buffer, SIZE, "<pid_%d>", getpid()); + name.append(buffer); + + return SurfaceComposerClient::createSurface(pid, name, display, + w, h, format, flags); + +} + +sp<SurfaceControl> SurfaceComposerClient::createSurface( + int pid, + const String8& name, + DisplayID display, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags) +{ sp<SurfaceControl> result; if (mStatus == NO_ERROR) { ISurfaceFlingerClient::surface_data_t data; - sp<ISurface> surface = mClient->createSurface(&data, pid, + sp<ISurface> surface = mClient->createSurface(&data, pid, name, display, w, h, format, flags); if (surface != 0) { if (uint32_t(data.token) < NUM_LAYERS_MAX) { diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk index 84aec61..f7acd97 100644 --- a/libs/ui/Android.mk +++ b/libs/ui/Android.mk @@ -2,8 +2,6 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - Camera.cpp \ - CameraParameters.cpp \ EGLUtils.cpp \ EventHub.cpp \ EventRecurrence.cpp \ @@ -13,21 +11,11 @@ LOCAL_SRC_FILES:= \ GraphicBufferMapper.cpp \ KeyLayoutMap.cpp \ KeyCharacterMap.cpp \ - ICamera.cpp \ - ICameraClient.cpp \ - ICameraService.cpp \ IOverlay.cpp \ - ISurfaceComposer.cpp \ - ISurface.cpp \ - ISurfaceFlingerClient.cpp \ - LayerState.cpp \ Overlay.cpp \ PixelFormat.cpp \ Rect.cpp \ - Region.cpp \ - SharedBufferStack.cpp \ - Surface.cpp \ - SurfaceComposerClient.cpp + Region.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp deleted file mode 100644 index 09a36f1..0000000 --- a/libs/ui/Camera.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* -** -** Copyright (C) 2008, The Android Open Source Project -** Copyright (C) 2008 HTC Inc. -** -** 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. -*/ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "Camera" -#include <utils/Log.h> -#include <binder/IServiceManager.h> -#include <utils/threads.h> -#include <binder/IMemory.h> -#include <ui/Surface.h> -#include <ui/Camera.h> -#include <ui/ICameraService.h> - -namespace android { - -// client singleton for camera service binder interface -Mutex Camera::mLock; -sp<ICameraService> Camera::mCameraService; -sp<Camera::DeathNotifier> Camera::mDeathNotifier; - -// establish binder interface to camera service -const sp<ICameraService>& Camera::getCameraService() -{ - Mutex::Autolock _l(mLock); - if (mCameraService.get() == 0) { - sp<IServiceManager> sm = defaultServiceManager(); - sp<IBinder> binder; - do { - binder = sm->getService(String16("media.camera")); - if (binder != 0) - break; - LOGW("CameraService not published, waiting..."); - usleep(500000); // 0.5 s - } while(true); - if (mDeathNotifier == NULL) { - mDeathNotifier = new DeathNotifier(); - } - binder->linkToDeath(mDeathNotifier); - mCameraService = interface_cast<ICameraService>(binder); - } - LOGE_IF(mCameraService==0, "no CameraService!?"); - return mCameraService; -} - -// --------------------------------------------------------------------------- - -Camera::Camera() -{ - init(); -} - -// construct a camera client from an existing camera remote -sp<Camera> Camera::create(const sp<ICamera>& camera) -{ - LOGV("create"); - if (camera == 0) { - LOGE("camera remote is a NULL pointer"); - return 0; - } - - sp<Camera> c = new Camera(); - if (camera->connect(c) == NO_ERROR) { - c->mStatus = NO_ERROR; - c->mCamera = camera; - camera->asBinder()->linkToDeath(c); - } - return c; -} - -void Camera::init() -{ - mStatus = UNKNOWN_ERROR; -} - -Camera::~Camera() -{ - disconnect(); -} - -sp<Camera> Camera::connect() -{ - LOGV("connect"); - sp<Camera> c = new Camera(); - const sp<ICameraService>& cs = getCameraService(); - if (cs != 0) { - c->mCamera = cs->connect(c); - } - if (c->mCamera != 0) { - c->mCamera->asBinder()->linkToDeath(c); - c->mStatus = NO_ERROR; - } else { - c.clear(); - } - return c; -} - -void Camera::disconnect() -{ - LOGV("disconnect"); - if (mCamera != 0) { - mCamera->disconnect(); - mCamera = 0; - } -} - -status_t Camera::reconnect() -{ - LOGV("reconnect"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->connect(this); -} - -sp<ICamera> Camera::remote() -{ - return mCamera; -} - -status_t Camera::lock() -{ - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->lock(); -} - -status_t Camera::unlock() -{ - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->unlock(); -} - -// pass the buffered ISurface to the camera service -status_t Camera::setPreviewDisplay(const sp<Surface>& surface) -{ - LOGV("setPreviewDisplay"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - if (surface != 0) { - return c->setPreviewDisplay(surface->getISurface()); - } else { - LOGD("app passed NULL surface"); - return c->setPreviewDisplay(0); - } -} - -status_t Camera::setPreviewDisplay(const sp<ISurface>& surface) -{ - LOGV("setPreviewDisplay"); - if (surface == 0) { - LOGD("app passed NULL surface"); - } - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->setPreviewDisplay(surface); -} - - -// start preview mode -status_t Camera::startPreview() -{ - LOGV("startPreview"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->startPreview(); -} - -// start recording mode, must call setPreviewDisplay first -status_t Camera::startRecording() -{ - LOGV("startRecording"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->startRecording(); -} - -// stop preview mode -void Camera::stopPreview() -{ - LOGV("stopPreview"); - sp <ICamera> c = mCamera; - if (c == 0) return; - c->stopPreview(); -} - -// stop recording mode -void Camera::stopRecording() -{ - LOGV("stopRecording"); - sp <ICamera> c = mCamera; - if (c == 0) return; - c->stopRecording(); -} - -// release a recording frame -void Camera::releaseRecordingFrame(const sp<IMemory>& mem) -{ - LOGV("releaseRecordingFrame"); - sp <ICamera> c = mCamera; - if (c == 0) return; - c->releaseRecordingFrame(mem); -} - -// get preview state -bool Camera::previewEnabled() -{ - LOGV("previewEnabled"); - sp <ICamera> c = mCamera; - if (c == 0) return false; - return c->previewEnabled(); -} - -// get recording state -bool Camera::recordingEnabled() -{ - LOGV("recordingEnabled"); - sp <ICamera> c = mCamera; - if (c == 0) return false; - return c->recordingEnabled(); -} - -status_t Camera::autoFocus() -{ - LOGV("autoFocus"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->autoFocus(); -} - -status_t Camera::cancelAutoFocus() -{ - LOGV("cancelAutoFocus"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->cancelAutoFocus(); -} - -// take a picture -status_t Camera::takePicture() -{ - LOGV("takePicture"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->takePicture(); -} - -// set preview/capture parameters - key/value pairs -status_t Camera::setParameters(const String8& params) -{ - LOGV("setParameters"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->setParameters(params); -} - -// get preview/capture parameters - key/value pairs -String8 Camera::getParameters() const -{ - LOGV("getParameters"); - String8 params; - sp <ICamera> c = mCamera; - if (c != 0) params = mCamera->getParameters(); - return params; -} - -// send command to camera driver -status_t Camera::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) -{ - LOGD("sendCommand"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->sendCommand(cmd, arg1, arg2); -} - -void Camera::setListener(const sp<CameraListener>& listener) -{ - Mutex::Autolock _l(mLock); - mListener = listener; -} - -void Camera::setPreviewCallbackFlags(int flag) -{ - LOGV("setPreviewCallbackFlags"); - sp <ICamera> c = mCamera; - if (c == 0) return; - mCamera->setPreviewCallbackFlag(flag); -} - -// callback from camera service -void Camera::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) -{ - sp<CameraListener> listener; - { - Mutex::Autolock _l(mLock); - listener = mListener; - } - if (listener != NULL) { - listener->notify(msgType, ext1, ext2); - } -} - -// callback from camera service when frame or image is ready -void Camera::dataCallback(int32_t msgType, const sp<IMemory>& dataPtr) -{ - sp<CameraListener> listener; - { - Mutex::Autolock _l(mLock); - listener = mListener; - } - if (listener != NULL) { - listener->postData(msgType, dataPtr); - } -} - -// callback from camera service when timestamped frame is ready -void Camera::dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr) -{ - sp<CameraListener> listener; - { - Mutex::Autolock _l(mLock); - listener = mListener; - } - if (listener != NULL) { - listener->postDataTimestamp(timestamp, msgType, dataPtr); - } -} - -void Camera::binderDied(const wp<IBinder>& who) { - LOGW("ICamera died"); - notifyCallback(CAMERA_MSG_ERROR, CAMERA_ERROR_SERVER_DIED, 0); -} - -void Camera::DeathNotifier::binderDied(const wp<IBinder>& who) { - LOGV("binderDied"); - Mutex::Autolock _l(Camera::mLock); - Camera::mCameraService.clear(); - LOGW("Camera server died!"); -} - -}; // namespace android - diff --git a/libs/ui/CameraParameters.cpp b/libs/ui/CameraParameters.cpp deleted file mode 100644 index 8f1749d..0000000 --- a/libs/ui/CameraParameters.cpp +++ /dev/null @@ -1,370 +0,0 @@ -/* -** -** Copyright 2008, 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. -*/ - -#define LOG_TAG "CameraParams" -#include <utils/Log.h> - -#include <string.h> -#include <stdlib.h> -#include <ui/CameraParameters.h> - -namespace android { -// Parameter keys to communicate between camera application and driver. -const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size"; -const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values"; -const char CameraParameters::KEY_PREVIEW_FORMAT[] = "preview-format"; -const char CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS[] = "preview-format-values"; -const char CameraParameters::KEY_PREVIEW_FRAME_RATE[] = "preview-frame-rate"; -const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES[] = "preview-frame-rate-values"; -const char CameraParameters::KEY_PICTURE_SIZE[] = "picture-size"; -const char CameraParameters::KEY_SUPPORTED_PICTURE_SIZES[] = "picture-size-values"; -const char CameraParameters::KEY_PICTURE_FORMAT[] = "picture-format"; -const char CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS[] = "picture-format-values"; -const char CameraParameters::KEY_JPEG_THUMBNAIL_WIDTH[] = "jpeg-thumbnail-width"; -const char CameraParameters::KEY_JPEG_THUMBNAIL_HEIGHT[] = "jpeg-thumbnail-height"; -const char CameraParameters::KEY_SUPPORTED_THUMBNAIL_SIZES[] = "jpeg-thumbnail-size-values"; -const char CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY[] = "jpeg-thumbnail-quality"; -const char CameraParameters::KEY_JPEG_QUALITY[] = "jpeg-quality"; -const char CameraParameters::KEY_ROTATION[] = "rotation"; -const char CameraParameters::KEY_GPS_LATITUDE[] = "gps-latitude"; -const char CameraParameters::KEY_GPS_LONGITUDE[] = "gps-longitude"; -const char CameraParameters::KEY_GPS_ALTITUDE[] = "gps-altitude"; -const char CameraParameters::KEY_GPS_TIMESTAMP[] = "gps-timestamp"; -const char CameraParameters::KEY_WHITE_BALANCE[] = "whitebalance"; -const char CameraParameters::KEY_SUPPORTED_WHITE_BALANCE[] = "whitebalance-values"; -const char CameraParameters::KEY_EFFECT[] = "effect"; -const char CameraParameters::KEY_SUPPORTED_EFFECTS[] = "effect-values"; -const char CameraParameters::KEY_ANTIBANDING[] = "antibanding"; -const char CameraParameters::KEY_SUPPORTED_ANTIBANDING[] = "antibanding-values"; -const char CameraParameters::KEY_SCENE_MODE[] = "scene-mode"; -const char CameraParameters::KEY_SUPPORTED_SCENE_MODES[] = "scene-mode-values"; -const char CameraParameters::KEY_FLASH_MODE[] = "flash-mode"; -const char CameraParameters::KEY_SUPPORTED_FLASH_MODES[] = "flash-mode-values"; -const char CameraParameters::KEY_FOCUS_MODE[] = "focus-mode"; -const char CameraParameters::KEY_SUPPORTED_FOCUS_MODES[] = "focus-mode-values"; - -// Values for white balance settings. -const char CameraParameters::WHITE_BALANCE_AUTO[] = "auto"; -const char CameraParameters::WHITE_BALANCE_INCANDESCENT[] = "incandescent"; -const char CameraParameters::WHITE_BALANCE_FLUORESCENT[] = "fluorescent"; -const char CameraParameters::WHITE_BALANCE_WARM_FLUORESCENT[] = "warm-fluorescent"; -const char CameraParameters::WHITE_BALANCE_DAYLIGHT[] = "daylight"; -const char CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT[] = "cloudy-daylight"; -const char CameraParameters::WHITE_BALANCE_TWILIGHT[] = "twilight"; -const char CameraParameters::WHITE_BALANCE_SHADE[] = "shade"; - -// Values for effect settings. -const char CameraParameters::EFFECT_NONE[] = "none"; -const char CameraParameters::EFFECT_MONO[] = "mono"; -const char CameraParameters::EFFECT_NEGATIVE[] = "negative"; -const char CameraParameters::EFFECT_SOLARIZE[] = "solarize"; -const char CameraParameters::EFFECT_SEPIA[] = "sepia"; -const char CameraParameters::EFFECT_POSTERIZE[] = "posterize"; -const char CameraParameters::EFFECT_WHITEBOARD[] = "whiteboard"; -const char CameraParameters::EFFECT_BLACKBOARD[] = "blackboard"; -const char CameraParameters::EFFECT_AQUA[] = "aqua"; - -// Values for antibanding settings. -const char CameraParameters::ANTIBANDING_AUTO[] = "auto"; -const char CameraParameters::ANTIBANDING_50HZ[] = "50hz"; -const char CameraParameters::ANTIBANDING_60HZ[] = "60hz"; -const char CameraParameters::ANTIBANDING_OFF[] = "off"; - -// Values for flash mode settings. -const char CameraParameters::FLASH_MODE_OFF[] = "off"; -const char CameraParameters::FLASH_MODE_AUTO[] = "auto"; -const char CameraParameters::FLASH_MODE_ON[] = "on"; -const char CameraParameters::FLASH_MODE_RED_EYE[] = "red-eye"; -const char CameraParameters::FLASH_MODE_TORCH[] = "torch"; - -// Values for scene mode settings. -const char CameraParameters::SCENE_MODE_AUTO[] = "auto"; -const char CameraParameters::SCENE_MODE_ACTION[] = "action"; -const char CameraParameters::SCENE_MODE_PORTRAIT[] = "portrait"; -const char CameraParameters::SCENE_MODE_LANDSCAPE[] = "landscape"; -const char CameraParameters::SCENE_MODE_NIGHT[] = "night"; -const char CameraParameters::SCENE_MODE_NIGHT_PORTRAIT[] = "night-portrait"; -const char CameraParameters::SCENE_MODE_THEATRE[] = "theatre"; -const char CameraParameters::SCENE_MODE_BEACH[] = "beach"; -const char CameraParameters::SCENE_MODE_SNOW[] = "snow"; -const char CameraParameters::SCENE_MODE_SUNSET[] = "sunset"; -const char CameraParameters::SCENE_MODE_STEADYPHOTO[] = "steadyphoto"; -const char CameraParameters::SCENE_MODE_FIREWORKS[] = "fireworks"; -const char CameraParameters::SCENE_MODE_SPORTS[] = "sports"; -const char CameraParameters::SCENE_MODE_PARTY[] = "party"; -const char CameraParameters::SCENE_MODE_CANDLELIGHT[] = "candlelight"; - -// Formats for setPreviewFormat and setPictureFormat. -const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp"; -const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp"; -const char CameraParameters::PIXEL_FORMAT_YUV422I[] = "yuv422i-yuyv"; -const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565"; -const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg"; - -// Values for focus mode settings. -const char CameraParameters::FOCUS_MODE_AUTO[] = "auto"; -const char CameraParameters::FOCUS_MODE_INFINITY[] = "infinity"; -const char CameraParameters::FOCUS_MODE_MACRO[] = "macro"; -const char CameraParameters::FOCUS_MODE_FIXED[] = "fixed"; - -static const char* portrait = "portrait"; -static const char* landscape = "landscape"; - -CameraParameters::CameraParameters() - : mMap() -{ -} - -CameraParameters::~CameraParameters() -{ -} - -String8 CameraParameters::flatten() const -{ - String8 flattened(""); - size_t size = mMap.size(); - - for (size_t i = 0; i < size; i++) { - String8 k, v; - k = mMap.keyAt(i); - v = mMap.valueAt(i); - - flattened += k; - flattened += "="; - flattened += v; - if (i != size-1) - flattened += ";"; - } - - return flattened; -} - -void CameraParameters::unflatten(const String8 ¶ms) -{ - const char *a = params.string(); - const char *b; - - mMap.clear(); - - for (;;) { - // Find the bounds of the key name. - b = strchr(a, '='); - if (b == 0) - break; - - // Create the key string. - String8 k(a, (size_t)(b-a)); - - // Find the value. - a = b+1; - b = strchr(a, ';'); - if (b == 0) { - // If there's no semicolon, this is the last item. - String8 v(a); - mMap.add(k, v); - break; - } - - String8 v(a, (size_t)(b-a)); - mMap.add(k, v); - a = b+1; - } -} - - -void CameraParameters::set(const char *key, const char *value) -{ - // XXX i think i can do this with strspn() - if (strchr(key, '=') || strchr(key, ';')) { - //XXX LOGE("Key \"%s\"contains invalid character (= or ;)", key); - return; - } - - if (strchr(value, '=') || strchr(key, ';')) { - //XXX LOGE("Value \"%s\"contains invalid character (= or ;)", value); - return; - } - - mMap.replaceValueFor(String8(key), String8(value)); -} - -void CameraParameters::set(const char *key, int value) -{ - char str[16]; - sprintf(str, "%d", value); - set(key, str); -} - -const char *CameraParameters::get(const char *key) const -{ - String8 v = mMap.valueFor(String8(key)); - if (v.length() == 0) - return 0; - return v.string(); -} - -int CameraParameters::getInt(const char *key) const -{ - const char *v = get(key); - if (v == 0) - return -1; - return strtol(v, 0, 0); -} - -static int parse_size(const char *str, int &width, int &height) -{ - // Find the width. - char *end; - int w = (int)strtol(str, &end, 10); - // If an 'x' does not immediately follow, give up. - if (*end != 'x') - return -1; - - // Find the height, immediately after the 'x'. - int h = (int)strtol(end+1, 0, 10); - - width = w; - height = h; - - return 0; -} - -void CameraParameters::setPreviewSize(int width, int height) -{ - char str[32]; - sprintf(str, "%dx%d", width, height); - set(KEY_PREVIEW_SIZE, str); -} - -void CameraParameters::getPreviewSize(int *width, int *height) const -{ - *width = -1; - *height = -1; - - // Get the current string, if it doesn't exist, leave the -1x-1 - const char *p = get(KEY_PREVIEW_SIZE); - if (p == 0) - return; - - int w, h; - if (parse_size(p, w, h) == 0) { - *width = w; - *height = h; - } -} - -void CameraParameters::setPreviewFrameRate(int fps) -{ - set(KEY_PREVIEW_FRAME_RATE, fps); -} - -int CameraParameters::getPreviewFrameRate() const -{ - return getInt(KEY_PREVIEW_FRAME_RATE); -} - -void CameraParameters::setPreviewFormat(const char *format) -{ - set(KEY_PREVIEW_FORMAT, format); -} - -int CameraParameters::getOrientation() const -{ - const char* orientation = get("orientation"); - if (orientation && !strcmp(orientation, portrait)) - return CAMERA_ORIENTATION_PORTRAIT; - return CAMERA_ORIENTATION_LANDSCAPE; -} - -void CameraParameters::setOrientation(int orientation) -{ - if (orientation == CAMERA_ORIENTATION_PORTRAIT) { - set("orientation", portrait); - } else { - set("orientation", landscape); - } -} - -const char *CameraParameters::getPreviewFormat() const -{ - return get(KEY_PREVIEW_FORMAT); -} - -void CameraParameters::setPictureSize(int width, int height) -{ - char str[32]; - sprintf(str, "%dx%d", width, height); - set(KEY_PICTURE_SIZE, str); -} - -void CameraParameters::getPictureSize(int *width, int *height) const -{ - *width = -1; - *height = -1; - - // Get the current string, if it doesn't exist, leave the -1x-1 - const char *p = get(KEY_PICTURE_SIZE); - if (p == 0) - return; - - int w, h; - if (parse_size(p, w, h) == 0) { - *width = w; - *height = h; - } -} - -void CameraParameters::setPictureFormat(const char *format) -{ - set(KEY_PICTURE_FORMAT, format); -} - -const char *CameraParameters::getPictureFormat() const -{ - return get(KEY_PICTURE_FORMAT); -} - -void CameraParameters::dump() const -{ - LOGD("dump: mMap.size = %d", mMap.size()); - for (size_t i = 0; i < mMap.size(); i++) { - String8 k, v; - k = mMap.keyAt(i); - v = mMap.valueAt(i); - LOGD("%s: %s\n", k.string(), v.string()); - } -} - -status_t CameraParameters::dump(int fd, const Vector<String16>& args) const -{ - const size_t SIZE = 256; - char buffer[SIZE]; - String8 result; - snprintf(buffer, 255, "CameraParameters::dump: mMap.size = %d\n", mMap.size()); - result.append(buffer); - for (size_t i = 0; i < mMap.size(); i++) { - String8 k, v; - k = mMap.keyAt(i); - v = mMap.valueAt(i); - snprintf(buffer, 255, "\t%s: %s\n", k.string(), v.string()); - result.append(buffer); - } - write(fd, result.string(), result.size()); - return NO_ERROR; -} - -}; // namespace android diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp index 4aac455..d45eaf0 100644 --- a/libs/ui/EventHub.cpp +++ b/libs/ui/EventHub.cpp @@ -176,7 +176,7 @@ int EventHub::getSwitchState(int32_t deviceId, int sw) const if (device == NULL) return -1; if (sw >= 0 && sw <= SW_MAX) { - uint8_t sw_bitmask[(SW_MAX+1)/8]; + uint8_t sw_bitmask[(SW_MAX+7)/8]; memset(sw_bitmask, 0, sizeof(sw_bitmask)); if (ioctl(mFDs[id_to_index(device->id)].fd, EVIOCGSW(sizeof(sw_bitmask)), sw_bitmask) >= 0) { @@ -200,7 +200,7 @@ int EventHub::getScancodeState(int32_t deviceId, int code) const if (device == NULL) return -1; if (code >= 0 && code <= KEY_MAX) { - uint8_t key_bitmask[(KEY_MAX+1)/8]; + uint8_t key_bitmask[(KEY_MAX+7)/8]; memset(key_bitmask, 0, sizeof(key_bitmask)); if (ioctl(mFDs[id_to_index(device->id)].fd, EVIOCGKEY(sizeof(key_bitmask)), key_bitmask) >= 0) { @@ -225,7 +225,7 @@ int EventHub::getKeycodeState(int32_t deviceId, int code) const Vector<int32_t> scanCodes; device->layoutMap->findScancodes(code, &scanCodes); - uint8_t key_bitmask[(KEY_MAX+1)/8]; + uint8_t key_bitmask[(KEY_MAX+7)/8]; memset(key_bitmask, 0, sizeof(key_bitmask)); if (ioctl(mFDs[id_to_index(device->id)].fd, EVIOCGKEY(sizeof(key_bitmask)), key_bitmask) >= 0) { @@ -489,7 +489,6 @@ int EventHub::open_device(const char *deviceName) { int version; int fd; - int attempt; struct pollfd *new_mFDs; device_t **new_devices; char **new_device_names; @@ -502,16 +501,11 @@ int EventHub::open_device(const char *deviceName) AutoMutex _l(mLock); - for (attempt = 0; attempt < 10; attempt++) { - fd = open(deviceName, O_RDWR); - if (fd >= 0) break; - usleep(100); - } + fd = open(deviceName, O_RDWR); if(fd < 0) { LOGE("could not open %s, %s\n", deviceName, strerror(errno)); return -1; } - LOGV("Opened device: %s (%d failures)", deviceName, attempt); if(ioctl(fd, EVIOCGVERSION, &version)) { LOGE("could not get driver version for %s, %s\n", deviceName, strerror(errno)); @@ -610,13 +604,16 @@ int EventHub::open_device(const char *deviceName) // figure out the kinds of events the device reports - // See if this is a keyboard, and classify it. - uint8_t key_bitmask[(KEY_MAX+1)/8]; + // See if this is a keyboard, and classify it. Note that we only + // consider up through the function keys; we don't want to include + // ones after that (play cd etc) so we don't mistakenly consider a + // controller to be a keyboard. + uint8_t key_bitmask[(KEY_MAX+7)/8]; memset(key_bitmask, 0, sizeof(key_bitmask)); LOGV("Getting keys..."); if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask) >= 0) { //LOGI("MAP\n"); - //for (int i=0; i<((KEY_MAX+1)/8); i++) { + //for (int i=0; i<((KEY_MAX+7)/8); i++) { // LOGI("%d: 0x%02x\n", i, key_bitmask[i]); //} for (int i=0; i<((BTN_MISC+7)/8); i++) { @@ -639,7 +636,7 @@ int EventHub::open_device(const char *deviceName) // See if this is a trackball. if (test_bit(BTN_MOUSE, key_bitmask)) { - uint8_t rel_bitmask[(REL_MAX+1)/8]; + uint8_t rel_bitmask[(REL_MAX+7)/8]; memset(rel_bitmask, 0, sizeof(rel_bitmask)); LOGV("Getting relative controllers..."); if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask) >= 0) @@ -650,7 +647,7 @@ int EventHub::open_device(const char *deviceName) } } - uint8_t abs_bitmask[(ABS_MAX+1)/8]; + uint8_t abs_bitmask[(ABS_MAX+7)/8]; memset(abs_bitmask, 0, sizeof(abs_bitmask)); LOGV("Getting absolute controllers..."); ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask); @@ -669,7 +666,7 @@ int EventHub::open_device(const char *deviceName) #ifdef EV_SW // figure out the switches this device reports - uint8_t sw_bitmask[(SW_MAX+1)/8]; + uint8_t sw_bitmask[(SW_MAX+7)/8]; memset(sw_bitmask, 0, sizeof(sw_bitmask)); if (ioctl(fd, EVIOCGBIT(EV_SW, sizeof(sw_bitmask)), sw_bitmask) >= 0) { for (int i=0; i<EV_SW; i++) { @@ -708,22 +705,20 @@ int EventHub::open_device(const char *deviceName) device->layoutMap->load(keylayoutFilename); // tell the world about the devname (the descriptive name) - int32_t publicID; - if (!mHaveFirstKeyboard && !defaultKeymap) { - publicID = 0; + if (!mHaveFirstKeyboard && !defaultKeymap && strstr(name, "-keypad")) { // the built-in keyboard has a well-known device ID of 0, // this device better not go away. mHaveFirstKeyboard = true; mFirstKeyboardId = device->id; + property_set("hw.keyboards.0.devname", name); } else { - publicID = device->id; // ensure mFirstKeyboardId is set to -something-. if (mFirstKeyboardId == 0) { mFirstKeyboardId = device->id; } } char propName[100]; - sprintf(propName, "hw.keyboards.%u.devname", publicID); + sprintf(propName, "hw.keyboards.%u.devname", device->id); property_set(propName, name); // 'Q' key support = cheap test of whether this is an alpha-capable kbd @@ -740,8 +735,8 @@ int EventHub::open_device(const char *deviceName) device->classes |= CLASS_DPAD; } - LOGI("New keyboard: publicID=%d device->id=0x%x devname='%s' propName='%s' keylayout='%s'\n", - publicID, device->id, name, propName, keylayoutFilename); + LOGI("New keyboard: device->id=0x%x devname='%s' propName='%s' keylayout='%s'\n", + device->id, name, propName, keylayoutFilename); } LOGI("New device: path=%s name=%s id=0x%x (of 0x%x) index=%d fd=%d classes=0x%x\n", @@ -814,18 +809,15 @@ int EventHub::close_device(const char *deviceName) device->next = mClosingDevices; mClosingDevices = device; - uint32_t publicID; if (device->id == mFirstKeyboardId) { LOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this", device->path.string(), mFirstKeyboardId); mFirstKeyboardId = 0; - publicID = 0; - } else { - publicID = device->id; + property_set("hw.keyboards.0.devname", NULL); } // clear the property char propName[100]; - sprintf(propName, "hw.keyboards.%u.devname", publicID); + sprintf(propName, "hw.keyboards.%u.devname", device->id); property_set(propName, NULL); return 0; } diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index c5e22e5..52380a0 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -27,7 +27,6 @@ #include <utils/threads.h> #include <utils/RefBase.h> -#include <ui/SurfaceComposerClient.h> #include <ui/Rect.h> #include <ui/FramebufferNativeWindow.h> @@ -251,6 +250,8 @@ int FramebufferNativeWindow::perform(android_native_window_t* window, { switch (operation) { case NATIVE_WINDOW_SET_USAGE: + case NATIVE_WINDOW_CONNECT: + case NATIVE_WINDOW_DISCONNECT: break; default: return NAME_NOT_FOUND; diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index 6a5c8a9..ba1fd9c 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ +#define LOG_TAG "GraphicBuffer" + #include <stdlib.h> #include <stdint.h> #include <sys/types.h> -#include <binder/Parcel.h> - #include <utils/Errors.h> #include <utils/Log.h> @@ -77,34 +77,21 @@ GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h, handle = inHandle; } -GraphicBuffer::GraphicBuffer(const Parcel& data) - : BASE(), mOwner(ownHandle), mBufferMapper(GraphicBufferMapper::get()), - mInitCheck(NO_ERROR), mVStride(0), mIndex(-1) +GraphicBuffer::~GraphicBuffer() { - // we own the handle in this case - width = data.readInt32(); - if (width < 0) { - width = height = stride = format = usage = 0; - handle = 0; - } else { - height = data.readInt32(); - stride = data.readInt32(); - format = data.readInt32(); - usage = data.readInt32(); - handle = data.readNativeHandle(); + if (handle) { + free_handle(); } } -GraphicBuffer::~GraphicBuffer() +void GraphicBuffer::free_handle() { - if (handle) { - if (mOwner == ownHandle) { - native_handle_close(handle); - native_handle_delete(const_cast<native_handle*>(handle)); - } else if (mOwner == ownData) { - GraphicBufferAllocator& allocator(GraphicBufferAllocator::get()); - allocator.free(handle); - } + if (mOwner == ownHandle) { + native_handle_close(handle); + native_handle_delete(const_cast<native_handle*>(handle)); + } else if (mOwner == ownData) { + GraphicBufferAllocator& allocator(GraphicBufferAllocator::get()); + allocator.free(handle); } } @@ -192,29 +179,83 @@ status_t GraphicBuffer::lock(GGLSurface* sur, uint32_t usage) return res; } +size_t GraphicBuffer::getFlattenedSize() const { + return (8 + (handle ? handle->numInts : 0))*sizeof(int); +} + +size_t GraphicBuffer::getFdCount() const { + return handle ? handle->numFds : 0; +} -status_t GraphicBuffer::writeToParcel(Parcel* reply, - android_native_buffer_t const* buffer) +status_t GraphicBuffer::flatten(void* buffer, size_t size, + int fds[], size_t count) const { - if (buffer == NULL) - return BAD_VALUE; + size_t sizeNeeded = GraphicBuffer::getFlattenedSize(); + if (size < sizeNeeded) return NO_MEMORY; + + size_t fdCountNeeded = GraphicBuffer::getFdCount(); + if (count < fdCountNeeded) return NO_MEMORY; + + int* buf = static_cast<int*>(buffer); + buf[0] = 'GBFR'; + buf[1] = width; + buf[2] = height; + buf[3] = stride; + buf[4] = format; + buf[5] = usage; + buf[6] = 0; + buf[7] = 0; - if (buffer->width < 0 || buffer->height < 0) - return BAD_VALUE; + if (handle) { + buf[6] = handle->numFds; + buf[7] = handle->numInts; + native_handle_t const* const h = handle; + memcpy(fds, h->data, h->numFds*sizeof(int)); + memcpy(&buf[8], h->data + h->numFds, h->numInts*sizeof(int)); + } + + return NO_ERROR; +} + +status_t GraphicBuffer::unflatten(void const* buffer, size_t size, + int fds[], size_t count) +{ + if (size < 8*sizeof(int)) return NO_MEMORY; + + int const* buf = static_cast<int const*>(buffer); + if (buf[0] != 'GBFR') return BAD_TYPE; + + const size_t numFds = buf[6]; + const size_t numInts = buf[7]; - status_t err = NO_ERROR; - if (buffer->handle == NULL) { - // this buffer doesn't have a handle - reply->writeInt32(NO_MEMORY); + const size_t sizeNeeded = (8 + numInts) * sizeof(int); + if (size < sizeNeeded) return NO_MEMORY; + + size_t fdCountNeeded = 0; + if (count < fdCountNeeded) return NO_MEMORY; + + if (handle) { + // free previous handle if any + free_handle(); + } + + if (numFds || numInts) { + width = buf[1]; + height = buf[2]; + stride = buf[3]; + format = buf[4]; + usage = buf[5]; + native_handle* h = native_handle_create(numFds, numInts); + memcpy(h->data, fds, numFds*sizeof(int)); + memcpy(h->data + numFds, &buf[8], numInts*sizeof(int)); + handle = h; } else { - reply->writeInt32(buffer->width); - reply->writeInt32(buffer->height); - reply->writeInt32(buffer->stride); - reply->writeInt32(buffer->format); - reply->writeInt32(buffer->usage); - err = reply->writeNativeHandle(buffer->handle); + width = height = stride = format = usage = 0; + handle = NULL; } - return err; + + mOwner = ownHandle; + return NO_ERROR; } diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp index 57d5fc3..6ae7e74 100644 --- a/libs/ui/GraphicBufferAllocator.cpp +++ b/libs/ui/GraphicBufferAllocator.cpp @@ -78,8 +78,6 @@ static inline uint32_t clamp(uint32_t c) { status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format, int usage, buffer_handle_t* handle, int32_t* stride) { - Mutex::Autolock _l(mLock); - // make sure to not allocate a 0 x 0 buffer w = clamp(w); h = clamp(h); @@ -118,8 +116,6 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma status_t GraphicBufferAllocator::free(buffer_handle_t handle) { - Mutex::Autolock _l(mLock); - status_t err; if (sw_gralloc_handle_t::validate(handle) < 0) { err = mAllocDev->free(mAllocDev, handle); diff --git a/libs/ui/ICamera.cpp b/libs/ui/ICamera.cpp deleted file mode 100644 index e1b3ec7..0000000 --- a/libs/ui/ICamera.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/* -** -** Copyright 2008, 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. -*/ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "ICamera" -#include <utils/Log.h> -#include <stdint.h> -#include <sys/types.h> -#include <binder/Parcel.h> -#include <ui/ICamera.h> - -namespace android { - -enum { - DISCONNECT = IBinder::FIRST_CALL_TRANSACTION, - SET_PREVIEW_DISPLAY, - SET_PREVIEW_CALLBACK_FLAG, - START_PREVIEW, - STOP_PREVIEW, - AUTO_FOCUS, - CANCEL_AUTO_FOCUS, - TAKE_PICTURE, - SET_PARAMETERS, - GET_PARAMETERS, - SEND_COMMAND, - CONNECT, - LOCK, - UNLOCK, - PREVIEW_ENABLED, - START_RECORDING, - STOP_RECORDING, - RECORDING_ENABLED, - RELEASE_RECORDING_FRAME, -}; - -class BpCamera: public BpInterface<ICamera> -{ -public: - BpCamera(const sp<IBinder>& impl) - : BpInterface<ICamera>(impl) - { - } - - // disconnect from camera service - void disconnect() - { - LOGV("disconnect"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(DISCONNECT, data, &reply); - } - - // pass the buffered ISurface to the camera service - status_t setPreviewDisplay(const sp<ISurface>& surface) - { - LOGV("setPreviewDisplay"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeStrongBinder(surface->asBinder()); - remote()->transact(SET_PREVIEW_DISPLAY, data, &reply); - return reply.readInt32(); - } - - // set the preview callback flag to affect how the received frames from - // preview are handled. See Camera.h for details. - void setPreviewCallbackFlag(int flag) - { - LOGV("setPreviewCallbackFlag(%d)", flag); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeInt32(flag); - remote()->transact(SET_PREVIEW_CALLBACK_FLAG, data, &reply); - } - - // start preview mode, must call setPreviewDisplay first - status_t startPreview() - { - LOGV("startPreview"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(START_PREVIEW, data, &reply); - return reply.readInt32(); - } - - // start recording mode, must call setPreviewDisplay first - status_t startRecording() - { - LOGV("startRecording"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(START_RECORDING, data, &reply); - return reply.readInt32(); - } - - // stop preview mode - void stopPreview() - { - LOGV("stopPreview"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(STOP_PREVIEW, data, &reply); - } - - // stop recording mode - void stopRecording() - { - LOGV("stopRecording"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(STOP_RECORDING, data, &reply); - } - - void releaseRecordingFrame(const sp<IMemory>& mem) - { - LOGV("releaseRecordingFrame"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeStrongBinder(mem->asBinder()); - remote()->transact(RELEASE_RECORDING_FRAME, data, &reply); - } - - // check preview state - bool previewEnabled() - { - LOGV("previewEnabled"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(PREVIEW_ENABLED, data, &reply); - return reply.readInt32(); - } - - // check recording state - bool recordingEnabled() - { - LOGV("recordingEnabled"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(RECORDING_ENABLED, data, &reply); - return reply.readInt32(); - } - - // auto focus - status_t autoFocus() - { - LOGV("autoFocus"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(AUTO_FOCUS, data, &reply); - status_t ret = reply.readInt32(); - return ret; - } - - // cancel focus - status_t cancelAutoFocus() - { - LOGV("cancelAutoFocus"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(CANCEL_AUTO_FOCUS, data, &reply); - status_t ret = reply.readInt32(); - return ret; - } - - // take a picture - returns an IMemory (ref-counted mmap) - status_t takePicture() - { - LOGV("takePicture"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(TAKE_PICTURE, data, &reply); - status_t ret = reply.readInt32(); - return ret; - } - - // set preview/capture parameters - key/value pairs - status_t setParameters(const String8& params) - { - LOGV("setParameters"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeString8(params); - remote()->transact(SET_PARAMETERS, data, &reply); - return reply.readInt32(); - } - - // get preview/capture parameters - key/value pairs - String8 getParameters() const - { - LOGV("getParameters"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(GET_PARAMETERS, data, &reply); - return reply.readString8(); - } - virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) - { - LOGD("sendCommand"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeInt32(cmd); - data.writeInt32(arg1); - data.writeInt32(arg2); - remote()->transact(SEND_COMMAND, data, &reply); - return reply.readInt32(); - } - virtual status_t connect(const sp<ICameraClient>& cameraClient) - { - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeStrongBinder(cameraClient->asBinder()); - remote()->transact(CONNECT, data, &reply); - return reply.readInt32(); - } - virtual status_t lock() - { - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(LOCK, data, &reply); - return reply.readInt32(); - } - virtual status_t unlock() - { - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(UNLOCK, data, &reply); - return reply.readInt32(); - } -}; - -IMPLEMENT_META_INTERFACE(Camera, "android.hardware.ICamera"); - -// ---------------------------------------------------------------------- - -status_t BnCamera::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case DISCONNECT: { - LOGV("DISCONNECT"); - CHECK_INTERFACE(ICamera, data, reply); - disconnect(); - return NO_ERROR; - } break; - case SET_PREVIEW_DISPLAY: { - LOGV("SET_PREVIEW_DISPLAY"); - CHECK_INTERFACE(ICamera, data, reply); - sp<ISurface> surface = interface_cast<ISurface>(data.readStrongBinder()); - reply->writeInt32(setPreviewDisplay(surface)); - return NO_ERROR; - } break; - case SET_PREVIEW_CALLBACK_FLAG: { - LOGV("SET_PREVIEW_CALLBACK_TYPE"); - CHECK_INTERFACE(ICamera, data, reply); - int callback_flag = data.readInt32(); - setPreviewCallbackFlag(callback_flag); - return NO_ERROR; - } break; - case START_PREVIEW: { - LOGV("START_PREVIEW"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(startPreview()); - return NO_ERROR; - } break; - case START_RECORDING: { - LOGV("START_RECORDING"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(startRecording()); - return NO_ERROR; - } break; - case STOP_PREVIEW: { - LOGV("STOP_PREVIEW"); - CHECK_INTERFACE(ICamera, data, reply); - stopPreview(); - return NO_ERROR; - } break; - case STOP_RECORDING: { - LOGV("STOP_RECORDING"); - CHECK_INTERFACE(ICamera, data, reply); - stopRecording(); - return NO_ERROR; - } break; - case RELEASE_RECORDING_FRAME: { - LOGV("RELEASE_RECORDING_FRAME"); - CHECK_INTERFACE(ICamera, data, reply); - sp<IMemory> mem = interface_cast<IMemory>(data.readStrongBinder()); - releaseRecordingFrame(mem); - return NO_ERROR; - } break; - case PREVIEW_ENABLED: { - LOGV("PREVIEW_ENABLED"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(previewEnabled()); - return NO_ERROR; - } break; - case RECORDING_ENABLED: { - LOGV("RECORDING_ENABLED"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(recordingEnabled()); - return NO_ERROR; - } break; - case AUTO_FOCUS: { - LOGV("AUTO_FOCUS"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(autoFocus()); - return NO_ERROR; - } break; - case CANCEL_AUTO_FOCUS: { - LOGV("CANCEL_AUTO_FOCUS"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(cancelAutoFocus()); - return NO_ERROR; - } break; - case TAKE_PICTURE: { - LOGV("TAKE_PICTURE"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(takePicture()); - return NO_ERROR; - } break; - case SET_PARAMETERS: { - LOGV("SET_PARAMETERS"); - CHECK_INTERFACE(ICamera, data, reply); - String8 params(data.readString8()); - reply->writeInt32(setParameters(params)); - return NO_ERROR; - } break; - case GET_PARAMETERS: { - LOGV("GET_PARAMETERS"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeString8(getParameters()); - return NO_ERROR; - } break; - case SEND_COMMAND: { - LOGD("SEND_COMMAND"); - CHECK_INTERFACE(ICamera, data, reply); - int command = data.readInt32(); - int arg1 = data.readInt32(); - int arg2 = data.readInt32(); - reply->writeInt32(sendCommand(command, arg1, arg2)); - return NO_ERROR; - } break; - case CONNECT: { - CHECK_INTERFACE(ICamera, data, reply); - sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder()); - reply->writeInt32(connect(cameraClient)); - return NO_ERROR; - } break; - case LOCK: { - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(lock()); - return NO_ERROR; - } break; - case UNLOCK: { - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(unlock()); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - -// ---------------------------------------------------------------------------- - -}; // namespace android - diff --git a/libs/ui/ICameraClient.cpp b/libs/ui/ICameraClient.cpp deleted file mode 100644 index 42b4da4..0000000 --- a/libs/ui/ICameraClient.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* -** -** Copyright 2008, 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. -*/ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "ICameraClient" -#include <utils/Log.h> -#include <stdint.h> -#include <sys/types.h> -#include <ui/ICameraClient.h> - -namespace android { - -enum { - NOTIFY_CALLBACK = IBinder::FIRST_CALL_TRANSACTION, - DATA_CALLBACK, - DATA_CALLBACK_TIMESTAMP, -}; - -class BpCameraClient: public BpInterface<ICameraClient> -{ -public: - BpCameraClient(const sp<IBinder>& impl) - : BpInterface<ICameraClient>(impl) - { - } - - // generic callback from camera service to app - void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) - { - LOGV("notifyCallback"); - Parcel data, reply; - data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor()); - data.writeInt32(msgType); - data.writeInt32(ext1); - data.writeInt32(ext2); - remote()->transact(NOTIFY_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY); - } - - // generic data callback from camera service to app with image data - void dataCallback(int32_t msgType, const sp<IMemory>& imageData) - { - LOGV("dataCallback"); - Parcel data, reply; - data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor()); - data.writeInt32(msgType); - data.writeStrongBinder(imageData->asBinder()); - remote()->transact(DATA_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY); - } - - // generic data callback from camera service to app with image data - void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData) - { - LOGV("dataCallback"); - Parcel data, reply; - data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor()); - data.writeInt64(timestamp); - data.writeInt32(msgType); - data.writeStrongBinder(imageData->asBinder()); - remote()->transact(DATA_CALLBACK_TIMESTAMP, data, &reply, IBinder::FLAG_ONEWAY); - } -}; - -IMPLEMENT_META_INTERFACE(CameraClient, "android.hardware.ICameraClient"); - -// ---------------------------------------------------------------------- - -status_t BnCameraClient::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case NOTIFY_CALLBACK: { - LOGV("NOTIFY_CALLBACK"); - CHECK_INTERFACE(ICameraClient, data, reply); - int32_t msgType = data.readInt32(); - int32_t ext1 = data.readInt32(); - int32_t ext2 = data.readInt32(); - notifyCallback(msgType, ext1, ext2); - return NO_ERROR; - } break; - case DATA_CALLBACK: { - LOGV("DATA_CALLBACK"); - CHECK_INTERFACE(ICameraClient, data, reply); - int32_t msgType = data.readInt32(); - sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder()); - dataCallback(msgType, imageData); - return NO_ERROR; - } break; - case DATA_CALLBACK_TIMESTAMP: { - LOGV("DATA_CALLBACK_TIMESTAMP"); - CHECK_INTERFACE(ICameraClient, data, reply); - nsecs_t timestamp = data.readInt64(); - int32_t msgType = data.readInt32(); - sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder()); - dataCallbackTimestamp(timestamp, msgType, imageData); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - -// ---------------------------------------------------------------------------- - -}; // namespace android - diff --git a/libs/ui/ICameraService.cpp b/libs/ui/ICameraService.cpp deleted file mode 100644 index 84986c6..0000000 --- a/libs/ui/ICameraService.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* -** -** Copyright 2008, 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 <stdint.h> -#include <sys/types.h> - -#include <binder/Parcel.h> -#include <binder/IPCThreadState.h> -#include <binder/IServiceManager.h> - -#include <ui/ICameraService.h> - -namespace android { - -class BpCameraService: public BpInterface<ICameraService> -{ -public: - BpCameraService(const sp<IBinder>& impl) - : BpInterface<ICameraService>(impl) - { - } - - // connect to camera service - virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient) - { - Parcel data, reply; - data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); - data.writeStrongBinder(cameraClient->asBinder()); - remote()->transact(BnCameraService::CONNECT, data, &reply); - return interface_cast<ICamera>(reply.readStrongBinder()); - } -}; - -IMPLEMENT_META_INTERFACE(CameraService, "android.hardware.ICameraService"); - -// ---------------------------------------------------------------------- - -status_t BnCameraService::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case CONNECT: { - CHECK_INTERFACE(ICameraService, data, reply); - sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder()); - sp<ICamera> camera = connect(cameraClient); - reply->writeStrongBinder(camera->asBinder()); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - -// ---------------------------------------------------------------------------- - -}; // namespace android - diff --git a/libs/ui/PixelFormat.cpp b/libs/ui/PixelFormat.cpp index b65ed97..9b41804 100644 --- a/libs/ui/PixelFormat.cpp +++ b/libs/ui/PixelFormat.cpp @@ -16,14 +16,17 @@ #include <ui/PixelFormat.h> #include <pixelflinger/format.h> +#include <hardware/hardware.h> namespace android { +static const int COMPONENT_YUV = 0xFF; + size_t PixelFormatInfo::getScanlineSize(unsigned int width) const { size_t size; - if ((components >= 6) && (components <= 8)) { - // YCbCr formats are differents. + if (components == COMPONENT_YUV) { + // YCbCr formats are different. size = (width * bitsPerPixel)>>3; } else { size = width * bytesPerPixel; @@ -53,14 +56,42 @@ status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info) if (info->version != sizeof(PixelFormatInfo)) return INVALID_OPERATION; + // YUV format from the HAL are handled here + switch (format) { + case HAL_PIXEL_FORMAT_YCbCr_422_SP: + case HAL_PIXEL_FORMAT_YCrCb_422_SP: + case HAL_PIXEL_FORMAT_YCbCr_422_P: + case HAL_PIXEL_FORMAT_YCbCr_422_I: + case HAL_PIXEL_FORMAT_CbYCrY_422_I: + info->bitsPerPixel = 16; + goto done; + case HAL_PIXEL_FORMAT_YCbCr_420_SP: + case HAL_PIXEL_FORMAT_YCrCb_420_SP: + case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED: + case HAL_PIXEL_FORMAT_YCrCb_420_SP_TILED: + case HAL_PIXEL_FORMAT_YCbCr_420_P: + case HAL_PIXEL_FORMAT_YCbCr_420_I: + case HAL_PIXEL_FORMAT_CbYCrY_420_I: + info->bitsPerPixel = 12; + done: + info->format = format; + info->components = COMPONENT_YUV; + info->bytesPerPixel = 1; + info->h_alpha = 0; + info->l_alpha = 0; + info->h_red = info->h_green = info->h_blue = 8; + info->l_red = info->l_green = info->l_blue = 0; + return NO_ERROR; + } + size_t numEntries; const GGLFormat *i = gglGetPixelFormatTable(&numEntries) + format; bool valid = uint32_t(format) < numEntries; if (!valid) { return BAD_INDEX; } - - #define COMPONENT(name) \ + + #define COMPONENT(name) \ case GGL_##name: info->components = PixelFormatInfo::name; break; switch (i->components) { @@ -69,9 +100,6 @@ status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info) COMPONENT(RGBA) COMPONENT(LUMINANCE) COMPONENT(LUMINANCE_ALPHA) - COMPONENT(Y_CB_CR_SP) - COMPONENT(Y_CB_CR_P) - COMPONENT(Y_CB_CR_I) default: return BAD_INDEX; } diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp index d21ed57..12db908 100644 --- a/libs/ui/Region.cpp +++ b/libs/ui/Region.cpp @@ -63,16 +63,10 @@ Region::Region(const Rect& rhs) { } -Region::Region(const Parcel& parcel) -{ - status_t err = read(parcel); - LOGE_IF(err<0, "error %s reading Region from parcel", strerror(err)); -} - Region::Region(const void* buffer) { status_t err = read(buffer); - LOGE_IF(err<0, "error %s reading Region from parcel", strerror(err)); + LOGE_IF(err<0, "error %s reading Region from buffer", strerror(err)); } Region::~Region() @@ -532,37 +526,6 @@ void Region::translate(Region& dst, const Region& reg, int dx, int dy) // ---------------------------------------------------------------------------- -status_t Region::write(Parcel& parcel) const -{ -#if VALIDATE_REGIONS - validate(*this, "write(Parcel)"); -#endif - status_t err; - const size_t count = mStorage.size(); - const size_t sizeNeeded = sizeof(int32_t) + (1+count)*sizeof(Rect); - void* buffer = parcel.writeInplace(sizeNeeded); - if (!buffer) return NO_MEMORY; - ssize_t written = Region::write(buffer, sizeNeeded); - if (written < 0) return status_t(written); - return NO_ERROR; -} - -status_t Region::read(const Parcel& parcel) -{ - void const* buffer = parcel.readInplace(sizeof(int32_t)); - if (!buffer) return NO_MEMORY; - const size_t count = *static_cast<int32_t const *>(buffer); - void const* dummy = parcel.readInplace((1+count)*sizeof(Rect)); - if (!dummy) return NO_MEMORY; - const size_t sizeNeeded = sizeof(int32_t) + (1+count)*sizeof(Rect); - const ssize_t read = Region::read(buffer); - if (read < 0) return status_t(read); -#if VALIDATE_REGIONS - validate(*this, "read(Parcel)"); -#endif - return NO_ERROR; -} - ssize_t Region::write(void* buffer, size_t size) const { #if VALIDATE_REGIONS @@ -570,12 +533,14 @@ ssize_t Region::write(void* buffer, size_t size) const #endif const size_t count = mStorage.size(); const size_t sizeNeeded = sizeof(int32_t) + (1+count)*sizeof(Rect); - if (sizeNeeded > size) return NO_MEMORY; - int32_t* const p = static_cast<int32_t*>(buffer); - *p = count; - memcpy(p+1, &mBounds, sizeof(Rect)); - if (count) { - memcpy(p+5, mStorage.array(), count*sizeof(Rect)); + if (buffer != NULL) { + if (sizeNeeded > size) return NO_MEMORY; + int32_t* const p = static_cast<int32_t*>(buffer); + *p = count; + memcpy(p+1, &mBounds, sizeof(Rect)); + if (count) { + memcpy(p+5, mStorage.array(), count*sizeof(Rect)); + } } return ssize_t(sizeNeeded); } diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk index 59409a2..d0eedb4 100644 --- a/libs/utils/Android.mk +++ b/libs/utils/Android.mk @@ -25,6 +25,7 @@ commonSources:= \ CallStack.cpp \ Debug.cpp \ FileMap.cpp \ + Flattenable.cpp \ RefBase.cpp \ ResourceTypes.cpp \ SharedBuffer.cpp \ @@ -75,7 +76,6 @@ include $(CLEAR_VARS) # we have the common sources, plus some device-specific stuff LOCAL_SRC_FILES:= \ $(commonSources) \ - Unicode.cpp \ BackupData.cpp \ BackupHelpers.cpp diff --git a/libs/utils/CharacterData.h b/libs/utils/CharacterData.h deleted file mode 100644 index e931d99..0000000 --- a/libs/utils/CharacterData.h +++ /dev/null @@ -1,730 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -// Automatically generated on 07-11-2006 by make-CharacterDataC -// DO NOT EDIT DIRECTLY -namespace CharacterData { - - // Structure containing an array of ranges - struct Range { - int length; - const uint32_t* array; - }; - - // For Latin1 characters just index into this array to get the index and decomposition - static const uint16_t LATIN1_DATA[] = { - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0002, 0x0003, 0x0002, 0x0004, 0x0003, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0003, 0x0003, 0x0002, - 0x0005, 0x0006, 0x0006, 0x0007, 0x0008, 0x0007, 0x0006, 0x0006, - 0x0009, 0x000A, 0x0006, 0x000B, 0x000C, 0x000D, 0x000C, 0x000C, - 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, - 0x0016, 0x0017, 0x000C, 0x0006, 0x0018, 0x0019, 0x001A, 0x0006, - 0x0006, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, - 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, - 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, - 0x0032, 0x0033, 0x0034, 0x0035, 0x0006, 0x0036, 0x0037, 0x0038, - 0x0037, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0035, 0x0019, 0x0036, 0x0019, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x5853, 0x0006, 0x0008, 0x0008, 0x0008, 0x0008, 0x0054, 0x0054, - 0x1037, 0x0054, 0x7855, 0x0056, 0x0019, 0x0057, 0x0054, 0x1037, - 0x0058, 0x0059, 0x785A, 0x785B, 0x1037, 0x105C, 0x0054, 0x0006, - 0x1037, 0x785D, 0x7855, 0x005E, 0x305F, 0x305F, 0x305F, 0x0006, - 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0060, 0x0860, - 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, - 0x0060, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0019, - 0x0060, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0060, 0x0055, - 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0061, 0x0861, - 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, - 0x0061, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0019, - 0x0061, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0061, 0x0862 - }; - - // Each of these arrays is stripped into ranges. In order to build the arrays, each - // codepoint was bit-shifted so that even and odd characters were separated into different - // arrays. The identifier of each array is the top byte after bit-shifting. - // The numbers stored in the array are the bit-shifted codepoint, the decomposition, and an - // index into another array of all possible packed data values. The top 16 bits are the - // codepoint and the bottom 16 are the decomposition and index. The top 5 bits for the decomposition - // and the rest for the index. - static const uint32_t a0[] = { - 0x00800863, 0x00880063, 0x00890863, 0x00930063, 0x00940863, 0x00980864, 0x00991063, 0x009A0863, - 0x009C0055, 0x009D0865, 0x00A01065, 0x00A10065, 0x00A20865, 0x00A50063, 0x00A60863, 0x00A90063, - 0x00AA0863, 0x00B30063, 0x00B40863, 0x00BC0866, 0x00BD0865, 0x00C00055, 0x00C10063, 0x00C30067, - 0x00C40065, 0x00C50068, 0x00C60065, 0x00C70069, 0x00C8006A, 0x00C90065, 0x00CA006B, 0x00CB006C, - 0x00CC0063, 0x00CD006D, 0x00CE006C, 0x00CF006E, 0x00D00863, 0x00D10063, 0x00D3006F, 0x00D40065, - 0x00D50055, 0x00D60063, 0x00D7006F, 0x00D80865, 0x00D90070, 0x00DA0065, 0x00DC0063, 0x00DD0055, - 0x00DE0063, 0x00DF0055, 0x00E00071, 0x00E21072, 0x00E31073, 0x00E41074, 0x00E51072, 0x00E61073, - 0x00E70865, 0x00EF0863, 0x00F20063, 0x00F30863, 0x00F80855, 0x00F91074, 0x00FA0863, 0x00FB0075, - 0x00FC0863, 0x010E0063, 0x010F0863, 0x01100076, 0x01110063, 0x01130863, 0x011A0055, 0x011D0077, - 0x011E0065, 0x011F0077, 0x01200055, 0x01210078, 0x01280055, 0x012A0079, 0x012B007A, 0x012C0055, - 0x0130007A, 0x01310055, 0x0134007B, 0x01350055, 0x0139007C, 0x013A0055, 0x0140007D, 0x01410055, - 0x0144007D, 0x0145007E, 0x01460055, 0x0149007F, 0x014A0080, 0x014B0055, 0x01587881, 0x015D0082, - 0x015E0081, 0x01610037, 0x01630082, 0x01680081, 0x01690037, 0x016C1037, 0x016F0037, 0x01707881, - 0x01730037, 0x01770081, 0x01780037, 0x01800083, 0x01A00883, 0x01A10083, 0x01A20883, 0x01A30083, - 0x01B80078, 0x01BA0837, 0x01BB0078, 0x01BD1081, 0x01BE0078, 0x01BF0806, 0x01C00078, 0x01C21037, - 0x01C30884, 0x01C40885, 0x01C60886, 0x01C70887, 0x01C80855, 0x01C90060, 0x01D10078, 0x01D20060, - 0x01D50860, 0x01D60888, 0x01D70889, 0x01D80855, 0x01D90061, 0x01E1008A, 0x01E20061, 0x01E50861, - 0x01E6088B, 0x01E7088C, 0x01E8108D, 0x01E91077, 0x01EA0877, 0x01EB108E, 0x01EC0063, 0x01F8108F, - 0x01F91090, 0x01FA1091, 0x01FB0019, 0x01FC0065, 0x01FD0063, 0x01FE0055, 0x01FF0077, 0x02000892, - 0x02010092, 0x02060892, 0x02080060, 0x02180061, 0x02280893, 0x02290093, 0x022E0893, 0x02300063, - 0x023B0863, 0x023C0063, 0x02410094, 0x02420083, 0x02440095, 0x02450063, 0x02600077, 0x02610865, - 0x02620065, 0x02680863, 0x026A0063, 0x026B0863, 0x026C0063, 0x026D0863, 0x02700063, 0x02710863, - 0x02740063, 0x02750863, 0x027B0063, 0x027C0863, 0x027D0078, 0x02800063, 0x02880078, 0x02990096, - 0x02AC0078, 0x02AD0097, 0x02B00078, 0x02B10098, 0x02C40078, 0x02C50099, 0x02C60078, 0x02C90083, - 0x02DD0078, 0x02DE0083, 0x02DF009A, 0x02E10083, 0x02E3009A, 0x02E40078, 0x02E8009B, 0x02F60078, - 0x02F8009B, 0x02FA009A, 0x02FB0078, 0x0300009C, 0x03020078, 0x0306000C, 0x03070054, 0x03080083, - 0x030B0078, 0x030F009D, 0x03100078, 0x0311089E, 0x0314009E, 0x031E0078, 0x0320009F, 0x0321009E, - 0x03260083, 0x033000A0, 0x033100A1, 0x033200A2, 0x033300A3, 0x033400A4, 0x03350007, 0x033600A5, - 0x0337009E, 0x03380083, 0x0339009E, 0x033B109E, 0x033D009E, 0x0360089E, 0x0362009E, 0x036A009D, - 0x036B0083, 0x036F0095, 0x03700083, 0x0373009F, 0x03740083, 0x0377009E, 0x0378000E, 0x03790010, - 0x037A0012, 0x037B0014, 0x037C0016, 0x037D009E, 0x037F00A6, 0x0380009D, 0x03870078, 0x0388009E, - 0x03980083, 0x03A60078, 0x03A7009E, 0x03B70078, 0x03C0009E, 0x03D30083, 0x03D90078, 0x04810083, - 0x04820071, 0x049A0871, 0x049B0071, 0x049D0078, 0x049E0083, 0x049F00A7, 0x04A10083, 0x04A500A7, - 0x04A70078, 0x04A80071, 0x04A90083, 0x04AB0078, 0x04AC0871, 0x04B00071, 0x04B10083, 0x04B20097, - 0x04B300A8, 0x04B400A9, 0x04B500AA, 0x04B600AB, 0x04B700AC, 0x04B80097, 0x04B90078, 0x04C100A7, - 0x04C20078, 0x04C30071, 0x04C70078, 0x04C80071, 0x04C90078, 0x04CA0071, 0x04DA0078, 0x04DB0071, - 0x04DD0078, 0x04DE0083, 0x04DF00A7, 0x04E10083, 0x04E30078, 0x04E400A7, 0x04E50078, 0x04E608A7, - 0x04E70071, 0x04E80078, 0x04EE0871, 0x04EF0078, 0x04F00071, 0x04F10083, 0x04F20078, 0x04F300A8, - 0x04F400A9, 0x04F500AA, 0x04F600AB, 0x04F700AC, 0x04F80071, 0x04F90008, 0x04FA00AD, 0x04FB00AE, - 0x04FC00AF, 0x04FD0094, 0x04FE0078, 0x05010083, 0x05020078, 0x05030071, 0x05060078, 0x05080071, - 0x05090078, 0x050A0071, 0x051A0078, 0x051B0871, 0x051C0071, 0x051D0078, 0x051E0083, 0x051F00A7, - 0x05210083, 0x05220078, 0x05240083, 0x05250078, 0x05260083, 0x05270078, 0x052D0871, 0x052E0071, - 0x052F0871, 0x05300078, 0x053300A8, 0x053400A9, 0x053500AA, 0x053600AB, 0x053700AC, 0x05380083, - 0x05390071, 0x053B0078, 0x05410083, 0x05420078, 0x05430071, 0x05470078, 0x05480071, 0x05490078, - 0x054A0071, 0x055A0078, 0x055B0071, 0x055D0078, 0x055E0083, 0x055F00A7, 0x05610083, 0x05630078, - 0x05640083, 0x05650078, 0x056600A7, 0x05670078, 0x05680071, 0x05690078, 0x05700071, 0x05710083, - 0x05720078, 0x057300A8, 0x057400A9, 0x057500AA, 0x057600AB, 0x057700AC, 0x05780078, 0x058100A7, - 0x05820078, 0x05830071, 0x05870078, 0x05880071, 0x05890078, 0x058A0071, 0x059A0078, 0x059B0071, - 0x059D0078, 0x059E0083, 0x059F00A7, 0x05A10083, 0x05A20078, 0x05A408A7, 0x05A50078, 0x05A608A7, - 0x05A70078, 0x05AB0083, 0x05AC0078, 0x05AE0871, 0x05AF0078, 0x05B00071, 0x05B10078, 0x05B300A8, - 0x05B400A9, 0x05B500AA, 0x05B600AB, 0x05B700AC, 0x05B80094, 0x05B90078, 0x05C10083, 0x05C20078, - 0x05C30071, 0x05C60078, 0x05C70071, 0x05CA0871, 0x05CB0078, 0x05CD0071, 0x05D00078, 0x05D20071, - 0x05D30078, 0x05D40071, 0x05D60078, 0x05D70071, 0x05DD0078, 0x05DF00A7, 0x05E00083, 0x05E100A7, - 0x05E20078, 0x05E300A7, 0x05E508A7, 0x05E70078, 0x05F300A8, 0x05F400A9, 0x05F500AA, 0x05F600AB, - 0x05F700AC, 0x05F800B0, 0x05F900B1, 0x05FA0054, 0x05FE0078, 0x060100A7, 0x06020078, 0x06030071, - 0x061A0078, 0x061B0071, 0x061D0078, 0x061F0083, 0x062100A7, 0x06230083, 0x06240883, 0x06250083, - 0x06270078, 0x062B0083, 0x062C0078, 0x06300071, 0x06310078, 0x063300A8, 0x063400A9, 0x063500AA, - 0x063600AB, 0x063700AC, 0x06380078, 0x064100A7, 0x06420078, 0x06430071, 0x065A0078, 0x065B0071, - 0x065D0078, 0x065E0083, 0x065F00A7, 0x066008A7, 0x066100A7, 0x066300B2, 0x066408A7, 0x06660083, - 0x06670078, 0x066B00A7, 0x066C0078, 0x066F0071, 0x06710078, 0x067300A8, 0x067400A9, 0x067500AA, - 0x067600AB, 0x067700AC, 0x06780078, 0x068100A7, 0x06820078, 0x06830071, 0x069D0078, 0x069F00A7, - 0x06A10083, 0x06A20078, 0x06A300A7, 0x06A508A7, 0x06A70078, 0x06B00071, 0x06B10078, 0x06B300A8, - 0x06B400A9, 0x06B500AA, 0x06B600AB, 0x06B700AC, 0x06B80078, 0x06C100A7, 0x06C20078, 0x06C30071, - 0x06CC0078, 0x06CD0071, 0x06D90078, 0x06DA0071, 0x06DE0078, 0x06E00071, 0x06E40078, 0x06E50083, - 0x06E60078, 0x06E800A7, 0x06E90083, 0x06EC00A7, 0x06ED08A7, 0x06F00078, 0x06F900A7, 0x06FA0097, - 0x06FB0078, 0x07010071, 0x071A0083, 0x071E0078, 0x07200071, 0x07230081, 0x07240083, 0x072800A8, - 0x072900A9, 0x072A00AA, 0x072B00AB, 0x072C00AC, 0x072D0097, 0x072E0078, 0x07410071, 0x07430078, - 0x07440071, 0x07460078, 0x074A0071, 0x074C0078, 0x074D0071, 0x07500078, 0x07510071, 0x07520078, - 0x07550071, 0x07560078, 0x07570071, 0x075A0083, 0x075D0078, 0x075E0083, 0x075F0078, 0x07600071, - 0x07630081, 0x07640083, 0x07670078, 0x076800A8, 0x076900A9, 0x076A00AA, 0x076B00AB, 0x076C00AC, - 0x076D0078, 0x076E1071, 0x076F0078, 0x07800071, 0x07810094, 0x07820097, 0x07865897, 0x07870097, - 0x078A0094, 0x078C0083, 0x078D0094, 0x079000A8, 0x079100A9, 0x079200AA, 0x079300AB, 0x079400AC, - 0x079500B3, 0x079A0094, 0x079D00B4, 0x079F00A7, 0x07A00071, 0x07A40078, 0x07A50071, 0x07A90871, - 0x07AA0071, 0x07AE0871, 0x07AF0071, 0x07B60078, 0x07B90083, 0x07BB0883, 0x07BD0083, 0x07C40071, - 0x07C60078, 0x07C80083, 0x07CC0078, 0x07CD0083, 0x07D10883, 0x07D20083, 0x07D60883, 0x07D70083, - 0x07DF0094, 0x07E30083, 0x07E40094, 0x07E70078, 0x07E80097, 0x07E90078, 0x08000071, 0x08110078, - 0x08120071, 0x08130871, 0x08140078, 0x08150071, 0x081600A7, 0x08170083, 0x081A0078, 0x081B0083, - 0x081C00A7, 0x081D0078, 0x082000A8, 0x082100A9, 0x082200AA, 0x082300AB, 0x082400AC, 0x08250097, - 0x08280071, 0x082B00A7, 0x082C0083, 0x082D0078, 0x085000B5, 0x08630078, 0x08680071, 0x087E7881, - 0x087F0078, 0x08800071, 0x08AD0078, 0x08B00071, 0x08D20078, 0x08D40071, 0x08FD0078, 0x09000071, - 0x09270078, 0x09280071, 0x092F0078, 0x09300071, 0x09470078, 0x09480071, 0x095B0078, 0x095C0071, - 0x09630078, 0x09640071, 0x098B0078, 0x098C0071, 0x09AE0078, 0x09B00094, 0x09B10097, 0x09B500B6, - 0x09B600B7, 0x09B700B8, 0x09B800B9, 0x09B900B0, 0x09BA00BA, 0x09BB00BB, 0x09BC00BC, 0x09BD00BD, - 0x09BE00BE, 0x09BF0078, 0x09C00071, 0x09C80054, 0x09CD0078, 0x09D00071, 0x09FB0078, 0x0A010071, - 0x0B370097, 0x0B380071, 0x0B3C0078, 0x0B400005, 0x0B410071, 0x0B4E00BF, 0x0B4F0078, 0x0B500071, - 0x0B760097, 0x0B7700C0, 0x0B7800C1, 0x0B790078, 0x0B800071, 0x0B890083, 0x0B8B0078, 0x0B900071, - 0x0B990083, 0x0B9B0097, 0x0B9C0078, 0x0BA00071, 0x0BA90083, 0x0BAA0078, 0x0BB00071, 0x0BB90083, - 0x0BBA0078, 0x0BC00071, 0x0BDA00C2, 0x0BDB00A7, 0x0BDC0083, 0x0BDF00A7, 0x0BE30083, 0x0BE400A7, - 0x0BE50083, 0x0BEA0097, 0x0BEE0071, 0x0BEF0078, 0x0BF000A8, 0x0BF100A9, 0x0BF200AA, 0x0BF300AB, - 0x0BF400AC, 0x0BF50078, 0x0BF800C3, 0x0BF900C4, 0x0BFA00C5, 0x0BFB00C6, 0x0BFC00C7, 0x0BFD0078, - 0x0C000006, 0x0C030099, 0x0C040006, 0x0C060083, 0x0C070005, 0x0C0800A8, 0x0C0900A9, 0x0C0A00AA, - 0x0C0B00AB, 0x0C0C00AC, 0x0C0D0078, 0x0C100071, 0x0C3C0078, 0x0C400071, 0x0C550078, 0x0C800071, - 0x0C8F0078, 0x0C900083, 0x0C9200A7, 0x0C940083, 0x0C9500C8, 0x0C960078, 0x0C9800A7, 0x0C990083, - 0x0C9A00A7, 0x0C9D0083, 0x0C9E0078, 0x0CA00054, 0x0CA10078, 0x0CA20006, 0x0CA300A8, 0x0CA400A9, - 0x0CA500AA, 0x0CA600AB, 0x0CA700AC, 0x0CA80071, 0x0CB70078, 0x0CB80071, 0x0CBB0078, 0x0CC00071, - 0x0CD50078, 0x0CD800A7, 0x0CE10071, 0x0CE400A7, 0x0CE50078, 0x0CE800A8, 0x0CE900A9, 0x0CEA00AA, - 0x0CEB00AB, 0x0CEC00AC, 0x0CED0078, 0x0CEF0006, 0x0CF00054, 0x0D000071, 0x0D0C0083, 0x0D0D00A7, - 0x0D0E0078, 0x0D0F0097, 0x0D100078, 0x0E800055, 0x0E967881, 0x0EA70081, 0x0EA87881, 0x0EB17055, - 0x0EB60055, 0x0EBC7881, 0x0EBD0055, 0x0ECE7881, 0x0EE00083, 0x0EE20078, 0x0F000863, 0x0F4B0855, - 0x0F4D1055, 0x0F4E0078, 0x0F500863, 0x0F7D0078, 0x0F8008C9, 0x0F8408CA, 0x0F8808C9, 0x0F8B0078, - 0x0F8C08CA, 0x0F8F0078, 0x0F9008C9, 0x0F9408CA, 0x0F9808C9, 0x0F9C08CA, 0x0FA008C9, 0x0FA30078, - 0x0FA408CA, 0x0FA70078, 0x0FA80855, 0x0FAC0078, 0x0FB008C9, 0x0FB408CA, 0x0FB808CB, 0x0FB908CC, - 0x0FBB08CD, 0x0FBC08CE, 0x0FBD08CF, 0x0FBE08D0, 0x0FBF0078, 0x0FC008C9, 0x0FC408D1, 0x0FC808C9, - 0x0FCC08D1, 0x0FD008C9, 0x0FD408D1, 0x0FD808C9, 0x0FD90855, 0x0FDC08CA, 0x0FDD08D2, 0x0FDE08D3, - 0x0FDF08D4, 0x0FE01037, 0x0FE10855, 0x0FE408D5, 0x0FE608D3, 0x0FE70837, 0x0FE808C9, 0x0FE90855, - 0x0FEA0078, 0x0FEB0855, 0x0FEC08CA, 0x0FED08D6, 0x0FEE0078, 0x0FEF0837, 0x0FF008C9, 0x0FF10855, - 0x0FF408CA, 0x0FF508D7, 0x0FF608D8, 0x0FF70837, 0x0FF80078, 0x0FF90855, 0x0FFC08D9, 0x0FFD08DA, - 0x0FFE08D3, 0x0FFF1037, 0x10000805, 0x10011005, 0x10060057, 0x100700C2, 0x10080099, 0x100B0006, - 0x100C00DB, 0x100D00B4, 0x100E00DB, 0x100F00B4, 0x10100006, 0x10121006, 0x101400DC, 0x101500DD, - 0x101600DE, 0x101700DF, 0x10180007, 0x101A1007, 0x101B1006, 0x101C0006, 0x101D00E0, 0x101E1006, - 0x10200038, 0x10210006, 0x102200E1, 0x1023000A, 0x10241006, 0x10250006, 0x10290019, 0x102A0038, - 0x102B0006, 0x10300057, 0x10320078, 0x10350057, 0x103878E2, 0x10390078, 0x103A78E3, 0x103B78E4, - 0x103C78E5, 0x103D780B, 0x103E7819, 0x103F780A, 0x104070E2, 0x1041705A, 0x104270E3, 0x104370E4, - 0x104470E5, 0x1045700B, 0x10467019, 0x1047700A, 0x10487081, 0x104B0078, 0x10500008, 0x10541008, - 0x10550008, 0x105B0078, 0x10680083, 0x106F0095, 0x10730083, 0x10760078, 0x10801054, 0x10812877, - 0x10820054, 0x10831054, 0x10840054, 0x10852855, 0x10862877, 0x10872855, 0x10882877, 0x108A0054, - 0x108B1054, 0x108C0054, 0x108D2877, 0x108F0054, 0x10907854, 0x10922877, 0x109308E6, 0x10942877, - 0x109508E7, 0x10962877, 0x10970058, 0x10982877, 0x10990054, 0x109A2855, 0x109B1071, 0x109D0054, - 0x109E2855, 0x109F2877, 0x10A028E8, 0x10A10019, 0x10A32855, 0x10A50054, 0x10A70078, 0x10AA305F, - 0x10B010E9, 0x10B110EA, 0x10B210EB, 0x10B310EC, 0x10B410ED, 0x10B510EE, 0x10B610EF, 0x10B710F0, - 0x10B810F1, 0x10B910F2, 0x10BA10F3, 0x10BB10F4, 0x10BC10F5, 0x10BD10F6, 0x10BE10F7, 0x10BF10F8, - 0x10C000F9, 0x10C100FA, 0x10C20078, 0x10C80019, 0x10CB0054, 0x10CD0819, 0x10CE0054, 0x10D00019, - 0x10D10054, 0x10D30019, 0x10D40054, 0x10D70819, 0x10D80054, 0x10E70819, 0x10E80054, 0x10E90019, - 0x10EB0054, 0x10FA0019, 0x110100E8, 0x110208E8, 0x11030019, 0x110400FB, 0x110608FC, 0x11070019, - 0x1109000B, 0x110A0019, 0x110B00E8, 0x110C0019, 0x110D00E8, 0x110F0019, 0x111000E8, 0x111208E8, - 0x11140019, 0x111610E8, 0x111700E8, 0x111810E8, 0x111900E8, 0x111A0019, 0x111E00FD, 0x111F00E8, - 0x112208E8, 0x112300E8, 0x11270019, 0x112900FD, 0x112B0019, 0x113008E8, 0x113200FD, 0x11360019, - 0x113708FD, 0x113900FD, 0x113A08FD, 0x113B00FD, 0x113C08FD, 0x113D00FD, 0x114008FD, 0x114100FD, - 0x114208FD, 0x114300FD, 0x114408FD, 0x114500FD, 0x114600E8, 0x11470019, 0x114800FE, 0x114A0019, - 0x114C00FF, 0x114D0019, 0x115100FD, 0x11520019, 0x11530100, 0x11540101, 0x115500E8, 0x115608E8, - 0x115800FD, 0x115C00E8, 0x115D0019, 0x115F00E8, 0x11600019, 0x116500FE, 0x11670019, 0x116800FD, - 0x11690019, 0x116B00FD, 0x117008FD, 0x117200FD, 0x117508FD, 0x11770019, 0x117800FD, 0x11790102, - 0x117B0103, 0x117C00E8, 0x117D0104, 0x117F0105, 0x11800054, 0x118400FD, 0x11860054, 0x119000E8, - 0x11910054, 0x1195080A, 0x11960054, 0x119B0094, 0x11BE0019, 0x11BF0054, 0x11CE0019, 0x11DA00B4, - 0x11DB0006, 0x11DC0054, 0x11EE0078, 0x12000054, 0x12140078, 0x12200054, 0x12260078, 0x12301906, - 0x12311907, 0x12321908, 0x12331909, 0x1234190A, 0x1235190B, 0x1236190C, 0x1237190D, 0x1238190E, - 0x1239190F, 0x123A1106, 0x123B1107, 0x123C1108, 0x123D1109, 0x123E110A, 0x123F110B, 0x1240110C, - 0x1241110D, 0x1242110E, 0x1243110F, 0x1244105D, 0x1245105B, 0x12461110, 0x12471111, 0x12481112, - 0x12491113, 0x124A1114, 0x124B1115, 0x124C1116, 0x124D1117, 0x124E1094, 0x125B1918, 0x12681919, - 0x127518C3, 0x1276011A, 0x1277011B, 0x1278011C, 0x1279011D, 0x127A011E, 0x127B00C4, 0x127C00C5, - 0x127D00C6, 0x127E00C7, 0x127F011F, 0x12800054, 0x12FC0019, 0x13000054, 0x134F0078, 0x13500054, - 0x13560094, 0x13570054, 0x13590078, 0x13810054, 0x13850078, 0x13860054, 0x13940078, 0x13950054, - 0x13A60078, 0x13A80054, 0x13AA0078, 0x13AB0054, 0x13B00078, 0x13B10054, 0x13B40009, 0x13BB0106, - 0x13BC0107, 0x13BD0108, 0x13BE0109, 0x13BF010A, 0x13C00106, 0x13C10107, 0x13C20108, 0x13C30109, - 0x13C4010A, 0x13C50106, 0x13C60107, 0x13C70108, 0x13C80109, 0x13C9010A, 0x13CA0054, 0x13CB0078, - 0x13CC0054, 0x13D80078, 0x13D90054, 0x13E000E8, 0x13E10019, 0x13E200FE, 0x13E3000A, 0x13E40078, - 0x13E80019, 0x13EA00E8, 0x13EB00FE, 0x13EC0019, 0x13EE00E8, 0x13EF00FE, 0x13F00019, 0x13F100FD, - 0x13F30009, 0x13F60078, 0x13F80019, 0x14000094, 0x14800019, 0x14C2000A, 0x14C70120, 0x14C80121, - 0x14C9000A, 0x14CD0019, 0x14CE00E8, 0x14D80019, 0x14DC0122, 0x14DD0019, 0x14E000FD, 0x14E100E8, - 0x14E200FD, 0x14E30019, 0x14E700E8, 0x14E800FE, 0x14EA00FD, 0x14EB0019, 0x14EC0009, 0x14EE00E8, - 0x14EF0019, 0x14F200E8, 0x14F30019, 0x14F400E8, 0x14F50019, 0x14FA00E8, 0x14FC00FD, 0x14FD0019, - 0x14FE0009, 0x14FF0019, 0x150500E8, 0x150610E8, 0x150700E8, 0x15110019, 0x151200E8, 0x15140019, - 0x151600FE, 0x15180019, 0x151A00FD, 0x151B0019, 0x151E00FD, 0x151F00E8, 0x15200019, 0x152C00E8, - 0x152D0019, 0x153200FD, 0x15330019, 0x153500E8, 0x15370019, 0x153800E8, 0x15390019, 0x153A10E8, - 0x153B1019, 0x153C0019, 0x153D00FE, 0x153E00E8, 0x153F00FE, 0x154300E8, 0x154600FE, 0x154700E8, - 0x154900FE, 0x154F00E8, 0x155100FE, 0x15520019, 0x155300FD, 0x15570019, 0x155800FE, 0x155900E8, - 0x155A00FE, 0x155B00E8, 0x155E00FE, 0x156400E8, 0x156700FE, 0x156C0019, 0x156E08E8, 0x156F0123, - 0x15700019, 0x157100E8, 0x15720124, 0x157300E8, 0x15740019, 0x157600FD, 0x157700E8, 0x15780019, - 0x157C00FE, 0x157E0019, 0x15800054, 0x158A0078, 0x16000096, 0x16180098, 0x16300078, 0x16400063, - 0x16720055, 0x16730054, 0x16760078, 0x167D0006, 0x16800125, 0x16930078, 0x16980071, 0x16B30078, - 0x16C00071, 0x16CC0078, 0x16D00071, 0x16F00078, 0x17000006, 0x17010126, 0x17030006, 0x170500E0, - 0x17060126, 0x17070006, 0x170C0078, 0x170E0126, 0x170F0078, 0x17400054, 0x174D0078, 0x174E0054, - 0x177A0078, 0x17801054, 0x17EB0078, 0x17F80054, 0x17FE0078, 0x18008805, 0x18010006, 0x18020054, - 0x18030071, 0x18040009, 0x18090054, 0x180A0009, 0x180E0099, 0x180F00BF, 0x18100054, 0x18110127, - 0x18120128, 0x18130129, 0x1814012A, 0x18150083, 0x18180099, 0x18190081, 0x181B1054, 0x181C112B, - 0x181D112C, 0x181E0071, 0x181F0054, 0x18200078, 0x18210071, 0x18260871, 0x18320071, 0x18380871, - 0x18390071, 0x183A0871, 0x183C0071, 0x183D0871, 0x183F0071, 0x184A0871, 0x184B0071, 0x184C0078, - 0x184D0083, 0x184E1037, 0x184F0881, 0x18500099, 0x18510071, 0x18560871, 0x18620071, 0x18680871, - 0x18690071, 0x186A0871, 0x186C0071, 0x186D0871, 0x186F0071, 0x187A0871, 0x187B0071, 0x187C0871, - 0x187E0081, 0x187F0881, 0x18800078, 0x18830071, 0x18970078, 0x18991071, 0x18C80094, 0x18C978AD, - 0x18CA78AE, 0x18CB7894, 0x18D00071, 0x18DC0078, 0x18E00054, 0x18E80078, 0x18F80071, 0x19001094, - 0x190F1054, 0x191010AD, 0x191110AE, 0x1912112D, 0x1913112E, 0x1914112F, 0x19151094, 0x19220078, - 0x19286854, 0x19291930, 0x192A1931, 0x192B1932, 0x192C1933, 0x192D1934, 0x192E1935, 0x192F1936, - 0x19301894, 0x193E1854, 0x194018AD, 0x194118AE, 0x1942192D, 0x1943192E, 0x1944192F, 0x19451894, - 0x19591937, 0x195A1938, 0x195B1939, 0x195C193A, 0x195D193B, 0x195E193C, 0x195F193D, 0x19601094, - 0x19666854, 0x19681894, 0x19806894, 0x19AC1094, 0x19B96894, 0x19BC6854, 0x19BE6894, 0x19EF6854, - 0x19F01094, 0x1A000071, 0x26DB0078, 0x26E00054, 0x27000071, 0x4FDE0078, 0x50000071, 0x52470078, - 0x52480054, 0x52640078, 0x53800037, 0x538C0078, 0x54000071, 0x540100C8, 0x54020071, 0x54030083, - 0x54040071, 0x541200A7, 0x54130083, 0x54140054, 0x54160078, 0x56000071, 0x6BD20078, 0x6C00013E, - 0x7000013F, 0x7C800871, 0x7D070071, 0x7D080871, 0x7D0A0071, 0x7D0B0871, 0x7D120071, 0x7D130871, - 0x7D140071, 0x7D150871, 0x7D170078, 0x7D180871, 0x7D360078, 0x7D380871, 0x7D6D0078, 0x7D801055, - 0x7D840078, 0x7D8A1055, 0x7D8C0078, 0x7D8F0083, 0x7D90289B, 0x7D95089B, 0x7DA10078, 0x7DA2089B, - 0x7DA8409E, 0x7DAA389E, 0x7DAB409E, 0x7DAC389E, 0x7DAD409E, 0x7DAE389E, 0x7DAF409E, 0x7DB0389E, - 0x7DB1409E, 0x7DB2389E, 0x7DB3409E, 0x7DB4389E, 0x7DB5409E, 0x7DB6389E, 0x7DB7409E, 0x7DB8389E, - 0x7DB9409E, 0x7DBA389E, 0x7DBB409E, 0x7DBC389E, 0x7DBD409E, 0x7DBE389E, 0x7DBF409E, 0x7DC0389E, - 0x7DC1409E, 0x7DC8389E, 0x7DC9409E, 0x7DCA389E, 0x7DCB409E, 0x7DCC389E, 0x7DCD409E, 0x7DCE389E, - 0x7DCF409E, 0x7DD1389E, 0x7DD2409E, 0x7DD4389E, 0x7DD5409E, 0x7DD6389E, 0x7DD7409E, 0x7DD90078, - 0x7DEA209E, 0x7DEB489E, 0x7DEC209E, 0x7DEF409E, 0x7DF3389E, 0x7DF5409E, 0x7DFC389E, 0x7DFD209E, - 0x7DFE409E, 0x7DFF389E, 0x7E00409E, 0x7E32209E, 0x7E4C389E, 0x7E70489E, 0x7E7B409E, 0x7E89209E, - 0x7E97389E, 0x7E9A489E, 0x7E9E209E, 0x7E9F00B4, 0x7EA00078, 0x7EA8389E, 0x7EAC209E, 0x7EAE389E, - 0x7EAF209E, 0x7EB0389E, 0x7EB1209E, 0x7EB4389E, 0x7EB5209E, 0x7EB8389E, 0x7EBA209E, 0x7EC3389E, - 0x7EC80078, 0x7EC9389E, 0x7ECB209E, 0x7ECC389E, 0x7ECD209E, 0x7EDA389E, 0x7EDB209E, 0x7EDC389E, - 0x7EDE209E, 0x7EE2389E, 0x7EE3209E, 0x7EE40078, 0x7EF8409E, 0x7EFE4140, 0x7EFF0078, 0x7F000083, - 0x7F088006, 0x7F0C80BF, 0x7F0D0078, 0x7F100083, 0x7F120078, 0x7F188006, 0x7F198099, 0x7F1A8038, - 0x7F1B80BF, 0x7F230006, 0x7F2480BF, 0x7F251006, 0x7F271038, 0x7F28600C, 0x7F2A6006, 0x7F2C6099, - 0x7F2D60BF, 0x7F306006, 0x7F31600B, 0x7F326019, 0x7F346006, 0x7F356007, 0x7F360078, 0x7F38409E, - 0x7F41209E, 0x7F46489E, 0x7F47209E, 0x7F49489E, 0x7F4A209E, 0x7F4C489E, 0x7F4D209E, 0x7F4E489E, - 0x7F4F209E, 0x7F50489E, 0x7F51209E, 0x7F52489E, 0x7F53209E, 0x7F54489E, 0x7F55209E, 0x7F5A489E, - 0x7F5B209E, 0x7F5C489E, 0x7F5D209E, 0x7F5E489E, 0x7F5F209E, 0x7F60489E, 0x7F61209E, 0x7F62489E, - 0x7F63209E, 0x7F64489E, 0x7F65209E, 0x7F66489E, 0x7F67209E, 0x7F68489E, 0x7F69209E, 0x7F6A489E, - 0x7F6B209E, 0x7F6C489E, 0x7F6D209E, 0x7F6E489E, 0x7F6F209E, 0x7F70489E, 0x7F71209E, 0x7F72489E, - 0x7F73209E, 0x7F74489E, 0x7F75209E, 0x7F76489E, 0x7F77209E, 0x7F7A489E, 0x7F7B209E, 0x7F7F0078, - 0x7F818806, 0x7F828808, 0x7F838806, 0x7F848809, 0x7F858806, 0x7F86880C, 0x7F88880E, 0x7F898810, - 0x7F8A8812, 0x7F8B8814, 0x7F8C8816, 0x7F8D880C, 0x7F8E8818, 0x7F8F881A, 0x7F908806, 0x7F918860, - 0x7F9E8806, 0x7F9F8837, 0x7FA18861, 0x7FAE8819, 0x7FB0880A, 0x7FB15009, 0x7FB25006, 0x7FB35071, - 0x7FB85081, 0x7FB95071, 0x7FCF5081, 0x7FD05071, 0x7FE00078, 0x7FE15071, 0x7FE40078, 0x7FE55071, - 0x7FE80078, 0x7FE95071, 0x7FEC0078, 0x7FED5071, 0x7FEF0078, 0x7FF08808, 0x7FF18819, 0x7FF28854, - 0x7FF38808, 0x7FF45054, 0x7FF55019, 0x7FF75054, 0x7FF80078, 0x7FFD0141, 0x7FFE0054, 0x7FFF0078, - 0x80000071, 0x80060078, 0x80070071, 0x801F0078, 0x80200071, 0x80270078, 0x80280071, 0x802F0078, - 0x80400071, 0x807E0078, 0x80800097, 0x80810094, 0x80820078, 0x808400B6, 0x808500B7, 0x808600B8, - 0x808700B9, 0x808800B0, 0x808900BA, 0x808A00BB, 0x808B00BC, 0x808C00BD, 0x808D0142, 0x808E0143, - 0x808F0144, 0x80900145, 0x809100B1, 0x80920146, 0x80930147, 0x80940148, 0x80950149, 0x8096014A, - 0x8097014B, 0x8098014C, 0x8099014D, 0x809A0078, 0x809C0094, 0x80A0014E, 0x80A1014F, 0x80A20150, - 0x80A30151, 0x80A40152, 0x80A50150, 0x80A60153, 0x80A70151, 0x80A80154, 0x80A90155, 0x80AA0156, - 0x80AB0157, 0x80AC014F, 0x80AE0158, 0x80B00154, 0x80B30150, 0x80B50155, 0x80B60153, 0x80B90151, - 0x80BA0150, 0x80BB005F, 0x80BD0054, 0x80C500C3, 0x80C60078, 0x81800071, 0x819000AD, 0x819100B0, - 0x81920078, 0x81980071, 0x81A50159, 0x81A60078, 0x81C00071, 0x81CF0078, 0x81D00071, 0x81E20078, - 0x81E40071, 0x81E80094, 0x81E90158, 0x81EA015A, 0x81EB0078, 0x8200015B, 0x8214015C, 0x82280071, - 0x824F0078, 0x825000A8, 0x825100A9, 0x825200AA, 0x825300AB, 0x825400AC, 0x82550078, 0x8400009B, - 0x84030078, 0x8404009B, 0x841B0078, 0x841C009B, 0x841D0078, 0x841E009B, 0x841F0078, 0x8500009B, - 0x85010083, 0x85020078, 0x85030083, 0x85040078, 0x85060083, 0x8508009B, 0x850A0078, 0x850B009B, - 0x850C0078, 0x850D009B, 0x851A0078, 0x851C0083, 0x851E0078, 0x8520015D, 0x8521015E, 0x8522015F, - 0x85230160, 0x85240078, 0x8528009A, 0x852D0078, 0xE8000094, 0xE87B0078, 0xE8800094, 0xE8940078, - 0xE8950094, 0xE8AF0894, 0xE8B300A7, 0xE8B40083, 0xE8B50094, 0xE8B700A7, 0xE8BA0057, 0xE8BE0083, - 0xE8C20094, 0xE8C30083, 0xE8C60094, 0xE8D50083, 0xE8D70094, 0xE8DE0894, 0xE8E10094, 0xE8EF0078, - 0xE9000054, 0xE9210083, 0xE9230078, 0xE9800054, 0xE9AC0078, 0xEA002877, 0xEA0D2855, 0xEA1A2877, - 0xEA272855, 0xEA342877, 0xEA412855, 0xEA4E2877, 0xEA500078, 0xEA512877, 0xEA520078, 0xEA532877, - 0xEA540078, 0xEA552877, 0xEA5B2855, 0xEA5D0078, 0xEA5F2855, 0xEA620078, 0xEA632855, 0xEA682877, - 0xEA752855, 0xEA822877, 0xEA830078, 0xEA842877, 0xEA860078, 0xEA872877, 0xEA8F2855, 0xEA9C2877, - 0xEA9D0078, 0xEA9E2877, 0xEAA40078, 0xEAA52877, 0xEAA92855, 0xEAB62877, 0xEAC32855, 0xEAD02877, - 0xEADD2855, 0xEAEA2877, 0xEAF72855, 0xEB042877, 0xEB112855, 0xEB1E2877, 0xEB2B2855, 0xEB382877, - 0xEB452855, 0xEB530078, 0xEB542877, 0xEB612855, 0xEB712877, 0xEB7E2855, 0xEB8E2877, 0xEB9B2855, - 0xEBAB2877, 0xEBB82855, 0xEBC82877, 0xEBD52855, 0xEBE50078, 0xEBE7280E, 0xEBE82810, 0xEBE92812, - 0xEBEA2814, 0xEBEB2816, 0xEBEC280E, 0xEBED2810, 0xEBEE2812, 0xEBEF2814, 0xEBF02816, 0xEBF1280E, - 0xEBF22810, 0xEBF32812, 0xEBF42814, 0xEBF52816, 0xEBF6280E, 0xEBF72810, 0xEBF82812, 0xEBF92814, - 0xEBFA2816, 0xEBFB280E, 0xEBFC2810, 0xEBFD2812, 0xEBFE2814, 0xEBFF2816, 0xEC000078 - }; - - static const uint32_t a1[] = { - 0x00000071, 0x536C0078, 0x7C000871, 0x7D0F0078 - }; - - static const uint32_t a7[] = { - 0x00100057, 0x00400078, 0x00800083, 0x00F80078, 0x8000013F, 0xFFFF0078 - }; - - static const uint32_t a8[] = { - 0x0000013F, 0x7FFF0078 - }; - - static const uint32_t a16[] = { - 0x00800865, 0x00880065, 0x00890865, 0x00930065, 0x00940865, 0x00980161, 0x00991065, 0x009A0865, - 0x009C0863, 0x009F1063, 0x00A00063, 0x00A10863, 0x00A41055, 0x00A50065, 0x00A60865, 0x00A90065, - 0x00AA0865, 0x00B30065, 0x00B40865, 0x00BC0863, 0x00BF1162, 0x00C00163, 0x00C10065, 0x00C30063, - 0x00C40068, 0x00C50063, 0x00C60055, 0x00C70164, 0x00C80063, 0x00C90068, 0x00CA0165, 0x00CB0166, - 0x00CC0065, 0x00CD0055, 0x00CE0167, 0x00CF0168, 0x00D00865, 0x00D10065, 0x00D30063, 0x00D4006F, - 0x00D50055, 0x00D60065, 0x00D70863, 0x00D80070, 0x00D90063, 0x00DB0169, 0x00DC0065, 0x00DD0071, - 0x00DE0065, 0x00DF016A, 0x00E00071, 0x00E21074, 0x00E31072, 0x00E41073, 0x00E51074, 0x00E60863, - 0x00EE016B, 0x00EF0865, 0x00F20065, 0x00F30865, 0x00F81072, 0x00F91073, 0x00FA0865, 0x00FB016C, - 0x00FC0865, 0x010E0065, 0x010F0865, 0x01100055, 0x01110065, 0x01130865, 0x011A0055, 0x011D0063, - 0x011E016D, 0x011F0055, 0x0120016E, 0x01210078, 0x01280055, 0x0129016F, 0x012A0055, 0x012B007A, - 0x012C0170, 0x012D0171, 0x012E0055, 0x01310172, 0x01320055, 0x01340173, 0x01350055, 0x01370173, - 0x01380055, 0x013A0174, 0x013B0055, 0x0141007D, 0x01420055, 0x0145007E, 0x01460055, 0x01587881, - 0x015C0082, 0x015D0081, 0x01610037, 0x01630082, 0x01680081, 0x01690037, 0x016C1037, 0x016F0037, - 0x01707881, 0x01720037, 0x01800083, 0x01A00883, 0x01A20175, 0x01A30083, 0x01B80078, 0x01BA0037, - 0x01BB0078, 0x01C20837, 0x01C30806, 0x01C40885, 0x01C50078, 0x01C70887, 0x01C80060, 0x01D50860, - 0x01D60889, 0x01D80061, 0x01E50861, 0x01E6088C, 0x01E70078, 0x01E81176, 0x01E90877, 0x01EA1177, - 0x01EB0055, 0x01EC0065, 0x01F81093, 0x01F90055, 0x01FA1178, 0x01FB0063, 0x01FC10D8, 0x01FD0065, - 0x01FE0077, 0x02000892, 0x02020092, 0x02030892, 0x02040092, 0x02060892, 0x02070092, 0x02080060, - 0x020C0860, 0x020D0060, 0x02180061, 0x021C0861, 0x021D0061, 0x02280893, 0x022A0093, 0x022B0893, - 0x022C0093, 0x022E0893, 0x022F0093, 0x02300065, 0x023B0865, 0x023C0065, 0x02410083, 0x02430078, - 0x02440095, 0x02450065, 0x02600863, 0x02610063, 0x02670078, 0x02680865, 0x026A0065, 0x026B0865, - 0x026C0065, 0x026D0865, 0x02700065, 0x02710865, 0x02740065, 0x02750865, 0x027B0065, 0x027C0865, - 0x027D0078, 0x02800065, 0x02880078, 0x02980096, 0x02AB0078, 0x02AC0081, 0x02AD0097, 0x02B00098, - 0x02C31055, 0x02C40097, 0x02C50078, 0x02C80083, 0x02E1009A, 0x02E20083, 0x02E40078, 0x02E8009B, - 0x02F50078, 0x02F8009B, 0x02F9009A, 0x02FA0078, 0x0300009C, 0x03020078, 0x03050140, 0x0306009D, - 0x03070054, 0x03080083, 0x030B0078, 0x030D009D, 0x030E0078, 0x030F009D, 0x0310009E, 0x0311089E, - 0x0313009E, 0x031D0078, 0x0320009E, 0x03250083, 0x032F0078, 0x03300179, 0x0331017A, 0x0332017B, - 0x0333017C, 0x0334017D, 0x033500A5, 0x0336009D, 0x0337009E, 0x033A109E, 0x033C009E, 0x0369089E, - 0x036A009E, 0x036B0083, 0x036E009C, 0x036F0083, 0x0372009F, 0x03730083, 0x03740054, 0x03750083, - 0x0377009E, 0x0378000F, 0x03790011, 0x037A0013, 0x037B0015, 0x037C0017, 0x037D009E, 0x037E00A6, - 0x037F009E, 0x0380009D, 0x03870057, 0x03880083, 0x0389009E, 0x03980083, 0x03A50078, 0x03A6009E, - 0x03B70078, 0x03C0009E, 0x03D30083, 0x03D8009E, 0x03D90078, 0x04800083, 0x048100A7, 0x04820071, - 0x04940871, 0x04950071, 0x04980871, 0x04990071, 0x049D0078, 0x049E0071, 0x049F00A7, 0x04A00083, - 0x04A400A7, 0x04A60083, 0x04A70078, 0x04A80083, 0x04AA0078, 0x04AC0871, 0x04B00071, 0x04B10083, - 0x04B20097, 0x04B3017E, 0x04B4017F, 0x04B50180, 0x04B60181, 0x04B70182, 0x04B80078, 0x04BE0071, - 0x04BF0078, 0x04C00083, 0x04C100A7, 0x04C20071, 0x04C60078, 0x04C70071, 0x04C80078, 0x04C90071, - 0x04D40078, 0x04D50071, 0x04D80078, 0x04DB0071, 0x04DD0078, 0x04DE0071, 0x04DF00A7, 0x04E00083, - 0x04E20078, 0x04E300A7, 0x04E40078, 0x04E508A7, 0x04E60083, 0x04E70078, 0x04EB00A7, 0x04EC0078, - 0x04EE0871, 0x04F00071, 0x04F10083, 0x04F20078, 0x04F3017E, 0x04F4017F, 0x04F50180, 0x04F60181, - 0x04F70182, 0x04F80071, 0x04F90008, 0x04FA00B6, 0x04FB00B7, 0x04FC0183, 0x04FD0078, 0x05000083, - 0x050100A7, 0x05020071, 0x05050078, 0x05070071, 0x05080078, 0x05090071, 0x05140078, 0x05150071, - 0x05180078, 0x05190871, 0x051A0071, 0x051B0078, 0x051C0071, 0x051D0078, 0x051F00A7, 0x05200083, - 0x05210078, 0x05230083, 0x05240078, 0x05250083, 0x05270078, 0x052C0871, 0x052E0078, 0x0533017E, - 0x0534017F, 0x05350180, 0x05360181, 0x05370182, 0x05380083, 0x05390071, 0x053A0078, 0x05400083, - 0x054100A7, 0x05420071, 0x05540078, 0x05550071, 0x05580078, 0x05590071, 0x055D0078, 0x055E0071, - 0x055F00A7, 0x05600083, 0x056400A7, 0x05660083, 0x05670078, 0x05700071, 0x05710083, 0x05720078, - 0x0573017E, 0x0574017F, 0x05750180, 0x05760181, 0x05770182, 0x05780008, 0x05790078, 0x05800083, - 0x058100A7, 0x05820071, 0x05860078, 0x05870071, 0x05880078, 0x05890071, 0x05940078, 0x05950071, - 0x05980078, 0x05990071, 0x059D0078, 0x059E0071, 0x059F0083, 0x05A20078, 0x05A300A7, 0x05A40078, - 0x05A508A7, 0x05A60083, 0x05A70078, 0x05AB00A7, 0x05AC0078, 0x05AE0871, 0x05AF0071, 0x05B10078, - 0x05B3017E, 0x05B4017F, 0x05B50180, 0x05B60181, 0x05B70182, 0x05B80071, 0x05B90078, 0x05C10071, - 0x05C50078, 0x05C70071, 0x05C80078, 0x05C90071, 0x05CB0078, 0x05CC0071, 0x05CD0078, 0x05CF0071, - 0x05D00078, 0x05D10071, 0x05D20078, 0x05D40071, 0x05D50078, 0x05D70071, 0x05DD0078, 0x05DF00A7, - 0x05E10078, 0x05E300A7, 0x05E40078, 0x05E508A7, 0x05E60083, 0x05E70078, 0x05EB00A7, 0x05EC0078, - 0x05F3017E, 0x05F4017F, 0x05F50180, 0x05F60181, 0x05F70182, 0x05F80184, 0x05F90054, 0x05FC0008, - 0x05FD0078, 0x060000A7, 0x06020071, 0x06060078, 0x06070071, 0x06080078, 0x06090071, 0x06140078, - 0x06150071, 0x061D0078, 0x061F0083, 0x062000A7, 0x06220078, 0x06230083, 0x06240078, 0x06250083, - 0x06270078, 0x062A0083, 0x062B0078, 0x06300071, 0x06310078, 0x0633017E, 0x0634017F, 0x06350180, - 0x06360181, 0x06370182, 0x06380078, 0x064100A7, 0x06420071, 0x06460078, 0x06470071, 0x06480078, - 0x06490071, 0x06540078, 0x06550071, 0x065D0078, 0x065E0071, 0x065F00B2, 0x066000A7, 0x06620078, - 0x066308A7, 0x06640078, 0x066508A7, 0x06660083, 0x06670078, 0x066A00A7, 0x066B0078, 0x06700071, - 0x06710078, 0x0673017E, 0x0674017F, 0x06750180, 0x06760181, 0x06770182, 0x06780078, 0x068100A7, - 0x06820071, 0x06860078, 0x06870071, 0x06880078, 0x06890071, 0x06940078, 0x06950071, 0x069D0078, - 0x069F00A7, 0x06A00083, 0x06A20078, 0x06A300A7, 0x06A40078, 0x06A508A7, 0x06A60083, 0x06A70078, - 0x06AB00A7, 0x06AC0078, 0x06B00071, 0x06B10078, 0x06B3017E, 0x06B4017F, 0x06B50180, 0x06B60181, - 0x06B70182, 0x06B80078, 0x06C100A7, 0x06C20071, 0x06CB0078, 0x06CD0071, 0x06DF0078, 0x06E00071, - 0x06E30078, 0x06E700A7, 0x06E90083, 0x06EA0078, 0x06EC00A7, 0x06EE08A7, 0x06EF00A7, 0x06F00078, - 0x06F900A7, 0x06FA0078, 0x07000071, 0x07180083, 0x07191071, 0x071A0083, 0x071D0078, 0x071F0008, - 0x07200071, 0x07230083, 0x07270097, 0x0728017E, 0x0729017F, 0x072A0180, 0x072B0181, 0x072C0182, - 0x072D0097, 0x072E0078, 0x07400071, 0x07410078, 0x07430071, 0x07440078, 0x07460071, 0x07470078, - 0x074A0071, 0x07540078, 0x07550071, 0x07580083, 0x07591071, 0x075A0083, 0x075E0071, 0x075F0078, - 0x07600071, 0x07620078, 0x07640083, 0x07670078, 0x0768017E, 0x0769017F, 0x076A0180, 0x076B0181, - 0x076C0182, 0x076D0078, 0x076E1071, 0x076F0078, 0x07800094, 0x07820097, 0x07890094, 0x078C0083, - 0x078D0094, 0x0790017E, 0x0791017F, 0x07920180, 0x07930181, 0x07940182, 0x079500B3, 0x079A0083, - 0x079D00BF, 0x079F00A7, 0x07A00071, 0x07A10871, 0x07A20071, 0x07A60871, 0x07A70071, 0x07AB0871, - 0x07AC0071, 0x07B40871, 0x07B50078, 0x07B80083, 0x07B90883, 0x07BB1083, 0x07BD0083, 0x07BF00A7, - 0x07C00883, 0x07C10083, 0x07C20097, 0x07C30083, 0x07C40071, 0x07C60078, 0x07C80083, 0x07C90883, - 0x07CA0083, 0x07CE0883, 0x07CF0083, 0x07D30883, 0x07D40083, 0x07DC0883, 0x07DD0083, 0x07DE0078, - 0x07DF0094, 0x07E60078, 0x07E70094, 0x07E80097, 0x07E90078, 0x08000071, 0x08150078, 0x08160083, - 0x081800A7, 0x08190078, 0x081B0083, 0x081D0078, 0x0820017E, 0x0821017F, 0x08220180, 0x08230181, - 0x08240182, 0x08250097, 0x08280071, 0x082B00A7, 0x082C0083, 0x082D0078, 0x085000B5, 0x08630078, - 0x08680071, 0x087D0097, 0x087E0078, 0x08800071, 0x08AD0078, 0x08AF0071, 0x08D10078, 0x08D40071, - 0x08FD0078, 0x09000071, 0x09240078, 0x09250071, 0x09270078, 0x09280071, 0x092B0078, 0x092D0071, - 0x092F0078, 0x09300071, 0x09440078, 0x09450071, 0x09470078, 0x09480071, 0x09580078, 0x09590071, - 0x095B0078, 0x095C0071, 0x095F0078, 0x09610071, 0x09630078, 0x09640071, 0x096B0078, 0x096C0071, - 0x09880078, 0x09890071, 0x098B0078, 0x098C0071, 0x09AD0078, 0x09AF0083, 0x09B00097, 0x09B400AD, - 0x09B500AE, 0x09B6012D, 0x09B7012E, 0x09B8012F, 0x09B90185, 0x09BA0186, 0x09BB0187, 0x09BC0188, - 0x09BD0184, 0x09BE0078, 0x09C00071, 0x09C80054, 0x09CD0078, 0x09D00071, 0x09FA0078, 0x0A000071, - 0x0B360097, 0x0B370071, 0x0B3B0078, 0x0B400071, 0x0B4D00B4, 0x0B4E0078, 0x0B500071, 0x0B750097, - 0x0B770189, 0x0B780078, 0x0B800071, 0x0B860078, 0x0B870071, 0x0B890083, 0x0B8A0078, 0x0B900071, - 0x0B990083, 0x0B9A0097, 0x0B9B0078, 0x0BA00071, 0x0BA90083, 0x0BAA0078, 0x0BB00071, 0x0BB60078, - 0x0BB70071, 0x0BB80078, 0x0BB90083, 0x0BBA0078, 0x0BC00071, 0x0BDA00C2, 0x0BDB0083, 0x0BDF00A7, - 0x0BE40083, 0x0BEA0097, 0x0BEB0081, 0x0BEC0097, 0x0BED0008, 0x0BEE0083, 0x0BEF0078, 0x0BF0017E, - 0x0BF1017F, 0x0BF20180, 0x0BF30181, 0x0BF40182, 0x0BF50078, 0x0BF80106, 0x0BF90107, 0x0BFA0108, - 0x0BFB0109, 0x0BFC010A, 0x0BFD0078, 0x0C000006, 0x0C050083, 0x0C070078, 0x0C08017E, 0x0C09017F, - 0x0C0A0180, 0x0C0B0181, 0x0C0C0182, 0x0C0D0078, 0x0C100071, 0x0C210081, 0x0C220071, 0x0C3C0078, - 0x0C400071, 0x0C540083, 0x0C550078, 0x0C800071, 0x0C8E0078, 0x0C900083, 0x0C9100A7, 0x0C930083, - 0x0C9400C8, 0x0C960078, 0x0C9800A7, 0x0C9C0083, 0x0C9E0078, 0x0CA20006, 0x0CA3017E, 0x0CA4017F, - 0x0CA50180, 0x0CA60181, 0x0CA70182, 0x0CA80071, 0x0CB70078, 0x0CB80071, 0x0CBA0078, 0x0CC00071, - 0x0CD50078, 0x0CD800A7, 0x0CE00071, 0x0CE400A7, 0x0CE50078, 0x0CE8017E, 0x0CE9017F, 0x0CEA0180, - 0x0CEB0181, 0x0CEC0182, 0x0CED0078, 0x0CEF0006, 0x0CF00054, 0x0D000071, 0x0D0B0083, 0x0D0C00A7, - 0x0D0E0078, 0x0D0F0097, 0x0D100078, 0x0E800055, 0x0E967881, 0x0E970081, 0x0E987881, 0x0E9D0081, - 0x0E9E7881, 0x0EB17055, 0x0EB50055, 0x0ECD7881, 0x0EE00083, 0x0EE20078, 0x0F000865, 0x0F4B0855, - 0x0F4D098A, 0x0F4E0078, 0x0F500865, 0x0F7D0078, 0x0F8008C9, 0x0F8408CA, 0x0F8808C9, 0x0F8B0078, - 0x0F8C08CA, 0x0F8F0078, 0x0F9008C9, 0x0F9408CA, 0x0F9808C9, 0x0F9C08CA, 0x0FA008C9, 0x0FA30078, - 0x0FA408CA, 0x0FA70078, 0x0FA808C9, 0x0FAC08CA, 0x0FB008C9, 0x0FB408CA, 0x0FB808CB, 0x0FB908CC, - 0x0FBB08CD, 0x0FBC08CE, 0x0FBD08CF, 0x0FBE08D0, 0x0FBF0078, 0x0FC008C9, 0x0FC408D1, 0x0FC808C9, - 0x0FCC08D1, 0x0FD008C9, 0x0FD408D1, 0x0FD808C9, 0x0FD9098B, 0x0FDA0078, 0x0FDB0855, 0x0FDC08CA, - 0x0FDD08D2, 0x0FDE1037, 0x0FE00837, 0x0FE1098B, 0x0FE20078, 0x0FE30855, 0x0FE408D5, 0x0FE60837, - 0x0FE808C9, 0x0FE90855, 0x0FEA0078, 0x0FEB0855, 0x0FEC08CA, 0x0FED08D6, 0x0FEE0837, 0x0FF008C9, - 0x0FF10855, 0x0FF20890, 0x0FF30855, 0x0FF408CA, 0x0FF508D7, 0x0FF60837, 0x0FF80078, 0x0FF9098B, - 0x0FFA0078, 0x0FFB0855, 0x0FFC08D9, 0x0FFD08DA, 0x0FFE0837, 0x0FFF0078, 0x10000805, 0x10011005, - 0x10035805, 0x10041005, 0x10050057, 0x1007018C, 0x10085899, 0x10090099, 0x100B1006, 0x100C018D, - 0x100D00DB, 0x100E018D, 0x100F00DB, 0x10100006, 0x10121006, 0x10130006, 0x1014018E, 0x1015018F, - 0x10160190, 0x10175853, 0x10180007, 0x10191007, 0x101A0006, 0x101B1006, 0x101C0126, 0x101D0006, - 0x101F0038, 0x10200006, 0x10220009, 0x10231006, 0x10250006, 0x102B1006, 0x102C0006, 0x102F1005, - 0x10300057, 0x10320078, 0x10350057, 0x10387855, 0x10390078, 0x103A7910, 0x103B7911, 0x103C7912, - 0x103D780B, 0x103E7809, 0x103F7855, 0x1040705D, 0x1041705B, 0x10427110, 0x10437111, 0x10447112, - 0x1045700B, 0x10467009, 0x10470078, 0x10487081, 0x104A0078, 0x10500008, 0x105B0078, 0x10680083, - 0x106E0095, 0x10700083, 0x10710095, 0x10720083, 0x10760078, 0x10801054, 0x10831077, 0x10841054, - 0x10852877, 0x10872855, 0x10882877, 0x10892855, 0x108A2877, 0x108B0054, 0x108C2877, 0x108F0054, - 0x10901054, 0x10910054, 0x10950991, 0x10962877, 0x10972855, 0x10982877, 0x109A1071, 0x109C2855, - 0x109D1054, 0x109E2855, 0x109F2877, 0x10A00019, 0x10A22877, 0x10A32855, 0x10A50019, 0x10A60078, - 0x10A9305F, 0x10AF3106, 0x10B01192, 0x10B11193, 0x10B21194, 0x10B31195, 0x10B41196, 0x10B51197, - 0x10B61198, 0x10B71199, 0x10B8119A, 0x10B9119B, 0x10BA119C, 0x10BB119D, 0x10BC119E, 0x10BD119F, - 0x10BE11A0, 0x10BF11A1, 0x10C001A2, 0x10C101A3, 0x10C20078, 0x10C80019, 0x10CA0054, 0x10CD0819, - 0x10CE0054, 0x10D10019, 0x10D20054, 0x10E60854, 0x10E70819, 0x10E80054, 0x10FA0019, 0x110000E8, - 0x11020019, 0x110408FB, 0x110500FC, 0x11070019, 0x110800E8, 0x11090059, 0x110A01A4, 0x110B0019, - 0x110D00E8, 0x11110019, 0x111500E8, 0x111610E8, 0x111800E8, 0x111A0019, 0x111C00E8, 0x111E00FE, - 0x111F00E8, 0x112008E8, 0x112101A5, 0x112200E8, 0x112308E8, 0x112500E8, 0x11260019, 0x112900FE, - 0x112B0019, 0x112F00E8, 0x11300019, 0x113200FE, 0x11360819, 0x113708FE, 0x113900FE, 0x113A08FE, - 0x113B00FE, 0x113C08FE, 0x113D00FE, 0x114008FE, 0x114100FE, 0x114208FE, 0x114300FE, 0x114408FE, - 0x114500FE, 0x11460019, 0x114700FD, 0x11490019, 0x115100FE, 0x11520019, 0x115300E8, 0x115401A6, - 0x115608E8, 0x115800FE, 0x115C0019, 0x115F00E8, 0x11600019, 0x116400FD, 0x116601A7, 0x11670019, - 0x116800FE, 0x11690019, 0x116B00FE, 0x117008FE, 0x117200FE, 0x117508FE, 0x11770019, 0x117800FE, - 0x11790102, 0x117A00E8, 0x117B0103, 0x117C00E8, 0x117D0104, 0x117E0105, 0x117F00E8, 0x11800054, - 0x118400FE, 0x11860054, 0x119000E8, 0x11910054, 0x11940809, 0x11950054, 0x119B0094, 0x11BD0054, - 0x11CA0094, 0x11CB0054, 0x11CD0019, 0x11DA00BF, 0x11DB0054, 0x11EE0078, 0x12000054, 0x12130078, - 0x12200054, 0x12250078, 0x123018C4, 0x123118C5, 0x123218C6, 0x123318C7, 0x1234191F, 0x1235191A, - 0x1236191B, 0x1237191C, 0x1238191D, 0x1239191E, 0x123A10C4, 0x123B10C5, 0x123C10C6, 0x123D10C7, - 0x123E111F, 0x123F111A, 0x1240111B, 0x1241111C, 0x1242111D, 0x1243111E, 0x1244105A, 0x124510E3, - 0x124610E4, 0x124710E5, 0x124811A8, 0x124911A9, 0x124A11AA, 0x124B11AB, 0x124C11AC, 0x124D11AD, - 0x124E1094, 0x125B1918, 0x12681919, 0x1275010B, 0x1276010C, 0x1277010D, 0x1278010E, 0x1279010F, - 0x127A0106, 0x127B0107, 0x127C0108, 0x127D0109, 0x127E010A, 0x127F00C3, 0x12800054, 0x12DB0019, - 0x12DC0054, 0x12E00019, 0x12E10054, 0x12FC0019, 0x13000054, 0x13370019, 0x13380054, 0x134E0078, - 0x13500054, 0x13590078, 0x13800054, 0x13820078, 0x13830054, 0x13850078, 0x13860054, 0x13A90078, - 0x13AC0054, 0x13AF0078, 0x13B00054, 0x13B4000A, 0x13BB00C4, 0x13BC00C5, 0x13BD00C6, 0x13BE00C7, - 0x13BF011F, 0x13C000C4, 0x13C100C5, 0x13C200C6, 0x13C300C7, 0x13C4011F, 0x13C500C4, 0x13C600C5, - 0x13C700C6, 0x13C800C7, 0x13C9011F, 0x13CA0078, 0x13CC0054, 0x13DF0078, 0x13E00019, 0x13E100FD, - 0x13E20009, 0x13E30078, 0x13E80019, 0x13E900E8, 0x13EA00FD, 0x13EB0019, 0x13EE00FD, 0x13EF0019, - 0x13F100FE, 0x13F3000A, 0x13F60078, 0x13F80019, 0x14000094, 0x14800019, 0x14C10009, 0x14C601AE, - 0x14C701AF, 0x14C80009, 0x14CC0019, 0x14CD00E8, 0x14D80019, 0x14E000FE, 0x14E100E8, 0x14E200FE, - 0x14E30019, 0x14E400E8, 0x14E50019, 0x14E700FD, 0x14E90019, 0x14EA00FE, 0x14EB0019, 0x14EC000A, - 0x14EE0019, 0x14F000E8, 0x14F30019, 0x14F400E8, 0x14F50019, 0x14FA01B0, 0x14FB00E8, 0x14FC00FE, - 0x14FD0019, 0x14FE000A, 0x14FF0019, 0x150500E8, 0x150E0019, 0x150F00E8, 0x15110019, 0x151400E8, - 0x151500FD, 0x15170019, 0x151A00FE, 0x151B0019, 0x151E00FE, 0x151F0019, 0x152B00E8, 0x152C0019, - 0x153200FE, 0x15330019, 0x153500E8, 0x15380019, 0x153900E8, 0x153A1019, 0x153B0019, 0x153C00FD, - 0x153D00E8, 0x153E00FD, 0x154200E8, 0x154500FD, 0x154600E8, 0x154800FD, 0x154E00E8, 0x155000FD, - 0x155100E8, 0x15520019, 0x155300FE, 0x155700FD, 0x155800E8, 0x155900FD, 0x155A00E8, 0x155D00FD, - 0x156300E8, 0x156600FD, 0x156B0019, 0x157101B1, 0x15730019, 0x157600FE, 0x15770019, 0x157900E8, - 0x157A0019, 0x157B00FD, 0x157D00E8, 0x157F0019, 0x15800054, 0x158A0078, 0x16000096, 0x16170078, - 0x16180098, 0x162F0078, 0x16400065, 0x16720054, 0x16750078, 0x167C0006, 0x167E005F, 0x167F0006, - 0x16800125, 0x16930078, 0x16980071, 0x16B30078, 0x16B77881, 0x16B80078, 0x16C00071, 0x16CB0078, - 0x16D00071, 0x16D30078, 0x16D40071, 0x16D70078, 0x16D80071, 0x16DB0078, 0x16DC0071, 0x16DF0078, - 0x16E00071, 0x16E30078, 0x16E40071, 0x16E70078, 0x16E80071, 0x16EB0078, 0x16EC0071, 0x16EF0078, - 0x17000006, 0x170100E0, 0x17030006, 0x17040126, 0x17050006, 0x170600E0, 0x17070006, 0x170B0099, - 0x170C0078, 0x170E00E0, 0x170F0078, 0x17400054, 0x174F1054, 0x17500054, 0x17791054, 0x177A0078, - 0x17801054, 0x17EB0078, 0x17F80054, 0x17FE0078, 0x18000006, 0x18020081, 0x180301B2, 0x1804000A, - 0x18090054, 0x180A000A, 0x180E00B4, 0x180F00BF, 0x181001B3, 0x181101B4, 0x181201B5, 0x181301B6, - 0x181401B7, 0x18150083, 0x18180081, 0x181B0054, 0x181C11B8, 0x181D0081, 0x181E0006, 0x181F0054, - 0x18200071, 0x18320871, 0x18350071, 0x18380871, 0x183A0071, 0x183B0871, 0x183D0071, 0x183E0871, - 0x183F0071, 0x184B0078, 0x184C0083, 0x184D1037, 0x184E0081, 0x184F8071, 0x18500071, 0x18620871, - 0x18650071, 0x18680871, 0x186A0071, 0x186B0871, 0x186D0071, 0x186E0871, 0x186F0071, 0x187B0871, - 0x187D0006, 0x187E0081, 0x187F8071, 0x18800078, 0x18820071, 0x18960078, 0x18981071, 0x18C70078, - 0x18C80094, 0x18C978B6, 0x18CA78B7, 0x18CB7894, 0x18D00071, 0x18DC0078, 0x18E00054, 0x18E80078, - 0x18F80071, 0x19001094, 0x190E1054, 0x190F0078, 0x191010B6, 0x191110B7, 0x191210B8, 0x191310B9, - 0x191410B0, 0x19151094, 0x19220078, 0x192819B9, 0x192919BA, 0x192A19BB, 0x192B19BC, 0x192C19BD, - 0x192D19BE, 0x192E19BF, 0x192F19C0, 0x19301894, 0x193E1854, 0x193F0094, 0x194018B6, 0x194118B7, - 0x194218B8, 0x194318B9, 0x194418B0, 0x19451894, 0x195819C1, 0x195919C2, 0x195A19C3, 0x195B19C4, - 0x195C19C5, 0x195D19C6, 0x195E19C7, 0x195F19C8, 0x19601094, 0x19666854, 0x19681894, 0x197F0078, - 0x19806894, 0x19AC1094, 0x19B86894, 0x19BB6854, 0x19BD6894, 0x19EF6854, 0x19F01094, 0x19FF6854, - 0x1A000071, 0x26DB0078, 0x26E00054, 0x27000071, 0x4FDE0078, 0x50000071, 0x500A0081, 0x500B0071, - 0x52460078, 0x52480054, 0x52630078, 0x53800037, 0x538B0078, 0x54000071, 0x54050083, 0x54060071, - 0x541100A7, 0x54120083, 0x541300A7, 0x54140054, 0x54160078, 0x56000071, 0x6BD20078, 0x6C00013E, - 0x7000013F, 0x7C800871, 0x7D070071, 0x7D0A0871, 0x7D0F0071, 0x7D120871, 0x7D130071, 0x7D150871, - 0x7D170078, 0x7D180871, 0x7D350078, 0x7D380871, 0x7D6D0078, 0x7D801055, 0x7D830078, 0x7D891055, - 0x7D8C0078, 0x7D8E089B, 0x7D90289B, 0x7D94280B, 0x7D95089B, 0x7D9B0078, 0x7D9C089B, 0x7D9E0078, - 0x7DA0089B, 0x7DA20078, 0x7DA3089B, 0x7DA7109B, 0x7DA8209E, 0x7DAA489E, 0x7DAB209E, 0x7DAC489E, - 0x7DAD209E, 0x7DAE489E, 0x7DAF209E, 0x7DB0489E, 0x7DB1209E, 0x7DB2489E, 0x7DB3209E, 0x7DB4489E, - 0x7DB5209E, 0x7DB6489E, 0x7DB7209E, 0x7DB8489E, 0x7DB9209E, 0x7DBA489E, 0x7DBB209E, 0x7DBC489E, - 0x7DBD209E, 0x7DBE489E, 0x7DBF209E, 0x7DC0489E, 0x7DC1209E, 0x7DC8489E, 0x7DC9209E, 0x7DCA489E, - 0x7DCB209E, 0x7DCC489E, 0x7DCD209E, 0x7DCE489E, 0x7DCF209E, 0x7DD1489E, 0x7DD2209E, 0x7DD4489E, - 0x7DD5209E, 0x7DD6489E, 0x7DD7209E, 0x7DD90078, 0x7DE9409E, 0x7DEA389E, 0x7DEB409E, 0x7DEF209E, - 0x7DF3489E, 0x7DF5209E, 0x7DFC409E, 0x7DFD389E, 0x7DFE209E, 0x7DFF489E, 0x7E00409E, 0x7E32209E, - 0x7E4B389E, 0x7E6F489E, 0x7E7A409E, 0x7E88209E, 0x7E96389E, 0x7E9A489E, 0x7E9E409E, 0x7E9F00BF, - 0x7EA00078, 0x7EA8209E, 0x7EA9389E, 0x7EAD209E, 0x7EAE389E, 0x7EAF209E, 0x7EB0389E, 0x7EB3209E, - 0x7EB5389E, 0x7EB7209E, 0x7EB9389E, 0x7EBA209E, 0x7EBB389E, 0x7EBC209E, 0x7EBE389E, 0x7EBF209E, - 0x7EC1389E, 0x7EC2209E, 0x7EC4389E, 0x7EC5209E, 0x7EC6389E, 0x7EC80078, 0x7EC9389E, 0x7ECB209E, - 0x7ECE389E, 0x7ECF209E, 0x7EDA389E, 0x7EDB209E, 0x7EE1389E, 0x7EE3209E, 0x7EE40078, 0x7EF8409E, - 0x7EFE0054, 0x7EFF0078, 0x7F000083, 0x7F088006, 0x7F0B80B4, 0x7F0C8006, 0x7F0D0078, 0x7F100083, - 0x7F120078, 0x7F188099, 0x7F198038, 0x7F1A80B4, 0x7F220006, 0x7F2380B4, 0x7F241006, 0x7F261038, - 0x7F286006, 0x7F290078, 0x7F2A600C, 0x7F2B6006, 0x7F2C60B4, 0x7F2F6007, 0x7F306006, 0x7F31600D, - 0x7F326019, 0x7F330078, 0x7F346008, 0x7F356006, 0x7F360078, 0x7F38489E, 0x7F39009E, 0x7F3A0078, - 0x7F3B489E, 0x7F40409E, 0x7F45389E, 0x7F46409E, 0x7F48389E, 0x7F49409E, 0x7F4B389E, 0x7F4C409E, - 0x7F4D389E, 0x7F4E409E, 0x7F4F389E, 0x7F50409E, 0x7F51389E, 0x7F52409E, 0x7F53389E, 0x7F54409E, - 0x7F59389E, 0x7F5A409E, 0x7F5B389E, 0x7F5C409E, 0x7F5D389E, 0x7F5E409E, 0x7F5F389E, 0x7F60409E, - 0x7F61389E, 0x7F62409E, 0x7F63389E, 0x7F64409E, 0x7F65389E, 0x7F66409E, 0x7F67389E, 0x7F68409E, - 0x7F69389E, 0x7F6A409E, 0x7F6B389E, 0x7F6C409E, 0x7F6D389E, 0x7F6E409E, 0x7F6F389E, 0x7F70409E, - 0x7F71389E, 0x7F72409E, 0x7F73389E, 0x7F74409E, 0x7F75389E, 0x7F76409E, 0x7F79389E, 0x7F7A409E, - 0x7F7E0078, 0x7F7F0057, 0x7F808806, 0x7F818807, 0x7F838806, 0x7F84880A, 0x7F85880B, 0x7F86880D, - 0x7F87880C, 0x7F88880F, 0x7F898811, 0x7F8A8813, 0x7F8B8815, 0x7F8C8817, 0x7F8D8806, 0x7F8E8819, - 0x7F8F8806, 0x7F908860, 0x7F9D8835, 0x7F9E8836, 0x7F9F8838, 0x7FA08861, 0x7FAD8835, 0x7FAE8836, - 0x7FAF8809, 0x7FB05006, 0x7FB1500A, 0x7FB25006, 0x7FB35071, 0x7FCF5081, 0x7FD05071, 0x7FDF0078, - 0x7FE15071, 0x7FE40078, 0x7FE55071, 0x7FE80078, 0x7FE95071, 0x7FEC0078, 0x7FED5071, 0x7FEE0078, - 0x7FF08808, 0x7FF18837, 0x7FF28808, 0x7FF30078, 0x7FF45019, 0x7FF65054, 0x7FF70078, 0x7FFC0141, - 0x7FFE0054, 0x7FFF0078, 0x80000071, 0x80130078, 0x80140071, 0x801D0078, 0x801E0071, 0x80270078, - 0x80280071, 0x802F0078, 0x80400071, 0x807D0078, 0x80800006, 0x80810078, 0x808300AD, 0x808400AE, - 0x8085012D, 0x8086012E, 0x8087012F, 0x80880185, 0x80890186, 0x808A0187, 0x808B0188, 0x808C0184, - 0x808D01C9, 0x808E01CA, 0x808F01CB, 0x809001CC, 0x809101CD, 0x809201CE, 0x809301CF, 0x809401D0, - 0x809500BE, 0x809601D1, 0x809701D2, 0x809801D3, 0x809901D4, 0x809A0078, 0x809B0094, 0x80A0014E, - 0x80A10152, 0x80A20153, 0x80A30157, 0x80A40154, 0x80A50155, 0x80A60156, 0x80A70152, 0x80A80150, - 0x80A90153, 0x80AA01D5, 0x80AB0154, 0x80AC014F, 0x80AD0158, 0x80AF0152, 0x80B00154, 0x80B201D6, - 0x80B30150, 0x80B501D7, 0x80B60153, 0x80B80156, 0x80B90152, 0x80BA005F, 0x80BC0054, 0x80C50078, - 0x81800071, 0x818F0078, 0x8190012D, 0x819100BB, 0x81920078, 0x81980071, 0x81A50078, 0x81C00071, - 0x81CF0097, 0x81D00071, 0x81E20078, 0x81E40071, 0x81E8014F, 0x81E90154, 0x81EA0155, 0x81EB0078, - 0x8200015B, 0x8214015C, 0x82280071, 0x824F0078, 0x8250017E, 0x8251017F, 0x82520180, 0x82530181, - 0x82540182, 0x82550078, 0x8400009B, 0x84030078, 0x8405009B, 0x841C0078, 0x841F009B, 0x84200078, - 0x85000083, 0x85030078, 0x85060083, 0x8508009B, 0x851A0078, 0x851C0083, 0x851D0078, 0x851F0083, - 0x852001D8, 0x852101D9, 0x852201DA, 0x852301DB, 0x85240078, 0x8528009A, 0x852C0078, 0xE8000094, - 0xE87B0078, 0xE8800094, 0xE8930078, 0xE8950094, 0xE8AF0894, 0xE8B200A7, 0xE8B30083, 0xE8B50094, - 0xE8B600A7, 0xE8B90057, 0xE8BD0083, 0xE8C10094, 0xE8C20083, 0xE8C60094, 0xE8D50083, 0xE8D70094, - 0xE8DD0894, 0xE8E00094, 0xE8EF0078, 0xE9000054, 0xE9210083, 0xE9220054, 0xE9230078, 0xE9800054, - 0xE9AB0078, 0xEA002877, 0xEA0D2855, 0xEA1A2877, 0xEA272855, 0xEA2A0078, 0xEA2B2855, 0xEA342877, - 0xEA412855, 0xEA4E0078, 0xEA4F2877, 0xEA500078, 0xEA522877, 0xEA530078, 0xEA542877, 0xEA560078, - 0xEA572877, 0xEA5B2855, 0xEA682877, 0xEA752855, 0xEA822877, 0xEA850078, 0xEA862877, 0xEA8A0078, - 0xEA8B2877, 0xEA8E0078, 0xEA8F2855, 0xEA9C2877, 0xEA9F0078, 0xEAA02877, 0xEAA20078, 0xEAA52877, - 0xEAA80078, 0xEAA92855, 0xEAB62877, 0xEAC32855, 0xEAD02877, 0xEADD2855, 0xEAEA2877, 0xEAF72855, - 0xEB042877, 0xEB112855, 0xEB1E2877, 0xEB2B2855, 0xEB382877, 0xEB452855, 0xEB530078, 0xEB542877, - 0xEB6029DC, 0xEB612855, 0xEB6D29DC, 0xEB6E2855, 0xEB712877, 0xEB7D29DC, 0xEB7E2855, 0xEB8A29DC, - 0xEB8B2855, 0xEB8E2877, 0xEB9A29DC, 0xEB9B2855, 0xEBA729DC, 0xEBA82855, 0xEBAB2877, 0xEBB729DC, - 0xEBB82855, 0xEBC429DC, 0xEBC52855, 0xEBC82877, 0xEBD429DC, 0xEBD52855, 0xEBE129DC, 0xEBE22855, - 0xEBE50078, 0xEBE7280F, 0xEBE82811, 0xEBE92813, 0xEBEA2815, 0xEBEB2817, 0xEBEC280F, 0xEBED2811, - 0xEBEE2813, 0xEBEF2815, 0xEBF02817, 0xEBF1280F, 0xEBF22811, 0xEBF32813, 0xEBF42815, 0xEBF52817, - 0xEBF6280F, 0xEBF72811, 0xEBF82813, 0xEBF92815, 0xEBFA2817, 0xEBFB280F, 0xEBFC2811, 0xEBFD2813, - 0xEBFE2815, 0xEBFF2817, 0xEC000078 - }; - - static const uint32_t a17[] = { - 0x00000071, 0x536B0078, 0x7C000871, 0x7D0F0078 - }; - - static const uint32_t a23[] = { - 0x00000057, 0x00010078, 0x00100057, 0x00400078, 0x00800083, 0x00F80078, 0x8000013F, 0xFFFF0078 - }; - - static const uint32_t a24[] = { - 0x0000013F, 0x7FFF0078 - }; - - - // The full set of all arrays to be searched. - static const Range FULL_DATA[] = { - {sizeof(a0)/sizeof(uint32_t), a0}, - {sizeof(a1)/sizeof(uint32_t), a1}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {sizeof(a7)/sizeof(uint32_t), a7}, - {sizeof(a8)/sizeof(uint32_t), a8}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {sizeof(a16)/sizeof(uint32_t), a16}, - {sizeof(a17)/sizeof(uint32_t), a17}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {sizeof(a23)/sizeof(uint32_t), a23}, - {sizeof(a24)/sizeof(uint32_t), a24}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0} - }; - - // Array of uppercase differences - static const short UCDIFF[] = { - 0, -32, 743, 121, -1, -232, -300, 97, - 163, 130, 56, -2, -79, -210, -206, -205, - -202, -203, -207, -209, -211, -213, -214, -218, - -217, -219, -83, 84, -38, -37, -31, -64, - -63, -62, -57, -47, -54, -86, -80, 7, - -96, -48, -59, 8, 74, 86, 100, 128, - 112, 126, 9, -7205, -16, -26, -7264, -40 - }; - - // Array of lowercase differences - static const short LCDIFF[] = { - 0, 32, 1, -199, -121, 210, 206, 205, - 79, 202, 203, 207, 211, 209, 213, 214, - 218, 217, 219, 2, -97, -56, -130, -163, - 83, 38, 37, 64, 63, -60, -7, 80, - 48, 7264, -8, -74, -9, -86, -100, -112, - -128, -126, -7517, -8383, -8262, 16, 26, 40 - }; - - // Array of titlecase differences - static const short TCDIFF[] = { - 3, 1, 0, -1 - }; - - // Array of mirrored character differences - static const short MIRROR_DIFF[] = { - 0, 1, -1, 2, -2, 16, -16, 3, - -3, 2016, 138, 1824, 2104, 2108, 2106, -138, - 8, 7, -8, -7, -1824, -2016, -2104, -2106, - -2108 - }; - - // Array of all possible numeric values - static const int NUMERICS[] = { - -1, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, -2, 100, 1000, - 40, 50, 60, 70, 80, 90, 10000, 500, - 5000, 36, 37, 38, 39, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 200, 300, - 400, 600, 700, 800, 900, 2000, 3000, 4000, - 6000, 7000, 8000, 9000, 20000, 30000, 40000, 50000, - 60000, 70000, 80000, 90000 - }; - - // All possible packed data values, no duplicates - static const uint32_t PACKED_DATA[] = { - 0x00000000, 0x0000012F, 0x0000016F, 0x0000014F, 0x0000018F, 0x0000018C, 0x000001B8, 0x000000B8, - 0x000000BA, 0x020005B5, 0x040005B6, 0x00000099, 0x000000F8, 0x00000094, 0x02000069, 0x04000069, - 0x06000069, 0x08000069, 0x0A000069, 0x0C000069, 0x0E000069, 0x10000069, 0x12000069, 0x14000069, - 0x060005B9, 0x000001B9, 0x080005B9, 0x16020001, 0x18020001, 0x1A020001, 0x1C020001, 0x1E020001, - 0x20020001, 0x22020001, 0x24020001, 0x26020001, 0x28020001, 0x2A020001, 0x2C020001, 0x2E020001, - 0x30020001, 0x32020001, 0x34020001, 0x36020001, 0x38020001, 0x3A020001, 0x3C020001, 0x3E020001, - 0x40020001, 0x42020001, 0x44020001, 0x46020001, 0x48020001, 0x060005B5, 0x080005B6, 0x000001BB, - 0x000001B7, 0x16000802, 0x18000802, 0x1A000802, 0x1C000802, 0x1E000802, 0x20000802, 0x22000802, - 0x24000802, 0x26000802, 0x28000802, 0x2A000802, 0x2C000802, 0x2E000802, 0x30000802, 0x32000802, - 0x34000802, 0x36000802, 0x38000802, 0x3A000802, 0x3C000802, 0x3E000802, 0x40000802, 0x42000802, - 0x44000802, 0x46000802, 0x48000802, 0x000000EC, 0x000001BC, 0x00000002, 0x0A0005BD, 0x00000130, - 0x000000BC, 0x000000B9, 0x0600006B, 0x0800006B, 0x00001002, 0x0400006B, 0x0C0005BE, 0x4A0001AB, - 0x00020001, 0x00000802, 0x00001802, 0x00040001, 0x00060001, 0x00002002, 0x00080001, 0x000C0001, - 0x000E0001, 0x00100001, 0x00140001, 0x00160001, 0x00180001, 0x00004002, 0x00004802, 0x00200001, - 0x00220001, 0x00000005, 0x00A60001, 0x01805802, 0x01042003, 0x00280001, 0x002C0001, 0x00000001, - 0x00000000, 0x00007002, 0x00007802, 0x00009802, 0x0000A802, 0x0000B802, 0x0000C002, 0x0000C802, - 0x0000D002, 0x00000004, 0x000001A4, 0x00000106, 0x00320001, 0x00340001, 0x00360001, 0x00380001, - 0x0000E002, 0x0000E802, 0x0000F002, 0x0000F802, 0x00010002, 0x00010802, 0x00012002, 0x00012802, - 0x00013802, 0x003A0001, 0x003E0001, 0x00013002, 0x0000001C, 0x00000107, 0x00400001, 0x00000018, - 0x00014802, 0x000001B4, 0x00000038, 0x00000025, 0x00000050, 0x00000058, 0x00000045, 0x00000044, - 0x020000C9, 0x060000C9, 0x0A0000C9, 0x0E0000C9, 0x120000C9, 0x000000D8, 0x0000005C, 0x00000008, - 0x02000009, 0x06000009, 0x0A000009, 0x0E000009, 0x12000009, 0x0400000B, 0x0800000B, 0x0000000B, - 0x1600000B, 0x4E00000B, 0x00000006, 0x4A00000B, 0x000001B5, 0x00420001, 0x0600000B, 0x0A00000B, - 0x0E00000B, 0x1200000B, 0x3E00000B, 0x5200000B, 0x5600000B, 0x5A00000B, 0x5C00000B, 0x000001B6, - 0x2400000A, 0x2800000A, 0x00000010, 0x020001AB, 0x060001AB, 0x0A0001AB, 0x0E0001AB, 0x120001AB, - 0x00000108, 0x00015802, 0x00440001, 0x00016002, 0x00016802, 0x00017002, 0x00017802, 0x00018002, - 0x00018802, 0x00440003, 0x00460001, 0x00480003, 0x00019802, 0x004A0001, 0x004C0001, 0x004E0001, - 0x003C0001, 0x00500001, 0x00520001, 0x000001BD, 0x0000018D, 0x000001D0, 0x00000250, 0x00000230, - 0x040005BE, 0x000000F9, 0x0200006B, 0x0A00006B, 0x0E00006B, 0x1200006B, 0x00540001, 0x00560001, - 0x000005B9, 0x045A000A, 0x085A000A, 0x0C5A000A, 0x105A000A, 0x145A000A, 0x185A000A, 0x525A000A, - 0x5E5A000A, 0x0401A00A, 0x0801A00A, 0x0C01A00A, 0x1001A00A, 0x1401A00A, 0x1801A00A, 0x5201A00A, - 0x5E01A00A, 0x4E00000A, 0x5C00000A, 0x0E0005B9, 0x100005B9, 0x020005B9, 0x040005B9, 0x160005B9, - 0x180005B9, 0x1A0005B9, 0x200005B9, 0x220005B9, 0x240005B9, 0x260005B9, 0x040001AB, 0x080001AB, - 0x0C0001AB, 0x100001AB, 0x140001AB, 0x180001AB, 0x1C0001AB, 0x200001AB, 0x240001AB, 0x280001AB, - 0x0C00006B, 0x1000006B, 0x1400006B, 0x1800006B, 0x1C00006B, 0x2000006B, 0x2400006B, 0x2800006B, - 0x005C001C, 0x0001A81C, 0x1A0001AB, 0x1E0001AB, 0x220001AB, 0x260001AB, 0x2A0001AB, 0x160001AB, - 0x020005B6, 0x100005B6, 0x280005B9, 0x2C0005B9, 0x300005B9, 0x0001B002, 0x020005BD, 0x0600000A, - 0x0A00000A, 0x0E00000A, 0x1200000A, 0x1600000A, 0x3E00000A, 0x0C00000B, 0x1000000B, 0x1400000B, - 0x2E0001AB, 0x320001AB, 0x360001AB, 0x3A0001AB, 0x3E0001AB, 0x420001AB, 0x460001AB, 0x640001AB, - 0x680001AB, 0x6A0001AB, 0x6E0001AB, 0x720001AB, 0x760001AB, 0x7A0001AB, 0x00000013, 0x00000012, - 0x0000005A, 0x000001B0, 0x7C00000B, 0x8000000B, 0x8200000B, 0x8600000B, 0x8C00000B, 0x6000000B, - 0x9200000B, 0x9600000B, 0x9800000B, 0x9C00000B, 0xA000000B, 0xA400000B, 0x4A0001AA, 0x040001AA, - 0x520001AA, 0x600001AA, 0x0C0001AA, 0x5E0001AA, 0x160001AA, 0x4C0001AA, 0x4E0001AA, 0x9E0001AA, - 0x060001AA, 0x8800000A, 0x2A0001AA, 0x005E0001, 0x0001B802, 0x0400002B, 0x0800002B, 0x1600002B, - 0x4C00002B, 0x00002802, 0x00003002, 0x000A0001, 0x00120001, 0x00003802, 0x001A0001, 0x001C0001, - 0x001E0001, 0x00240001, 0x00005002, 0x00006002, 0x002A0001, 0x002E0001, 0x00300001, 0x00006802, - 0x00008002, 0x00008802, 0x00009002, 0x0000A002, 0x0000B002, 0x0000D906, 0x00011002, 0x00011802, - 0x00014002, 0x040000C9, 0x080000C9, 0x0C0000C9, 0x100000C9, 0x140000C9, 0x04000009, 0x08000009, - 0x0C000009, 0x10000009, 0x14000009, 0x2200000B, 0x4C00000B, 0x2A00000B, 0x5000000B, 0x5400000B, - 0x5800000B, 0x2600000A, 0x00015002, 0x00019002, 0x00000030, 0x000001BE, 0x0000014E, 0x00000210, - 0x000001F0, 0x00580001, 0x065A000A, 0x0A5A000A, 0x0E5A000A, 0x125A000A, 0x165A000A, 0x1A5A000A, - 0x4C5A000A, 0x4E5A000A, 0x0601A00A, 0x0A01A00A, 0x0E01A00A, 0x1201A00A, 0x1601A00A, 0x1A01A00A, - 0x4C01A00A, 0x4E01A00A, 0x6000000A, 0x0000000A, 0x120005B9, 0x140005B9, 0x1C0005B9, 0x1E0005B9, - 0x1600006B, 0x1A00006B, 0x1E00006B, 0x2200006B, 0x2600006B, 0x2A00006B, 0x0E0005B5, 0x040005B5, - 0x2A0005B9, 0x2E0005B9, 0x0200000A, 0x0400000A, 0x0800000A, 0x0C00000A, 0x1000000A, 0x1400000A, - 0x2A00000A, 0x2C0001AB, 0x300001AB, 0x340001AB, 0x380001AB, 0x3C0001AB, 0x400001AB, 0x440001AB, - 0x480001AB, 0x620001AB, 0x660001AB, 0x500001AB, 0x6C0001AB, 0x700001AB, 0x740001AB, 0x780001AB, - 0x520001AB, 0x7E00000B, 0x5E00000B, 0x8400000B, 0x8800000B, 0x8A00000B, 0x8E00000B, 0x9000000B, - 0x9400000B, 0x9A00000B, 0x9E00000B, 0xA200000B, 0xA600000B, 0x5C0001AA, 0x3E0001AA, 0x7E0001AA, - 0x0600002B, 0x0A00002B, 0x2A00002B, 0x4E00002B, 0x00000019 - }; -} diff --git a/libs/utils/Flattenable.cpp b/libs/utils/Flattenable.cpp new file mode 100644 index 0000000..1f2ffaa --- /dev/null +++ b/libs/utils/Flattenable.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2006 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/Flattenable.h> + +namespace android { + +Flattenable::~Flattenable() { +} + +}; // namespace android diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp index 450af8d..7e0f881 100644 --- a/libs/utils/ResourceTypes.cpp +++ b/libs/utils/ResourceTypes.cpp @@ -229,12 +229,12 @@ Res_png_9patch* Res_png_9patch::deserialize(const void* inData) // -------------------------------------------------------------------- ResStringPool::ResStringPool() - : mError(NO_INIT), mOwnedData(NULL) + : mError(NO_INIT), mOwnedData(NULL), mHeader(NULL), mCache(NULL) { } ResStringPool::ResStringPool(const void* data, size_t size, bool copyData) - : mError(NO_INIT), mOwnedData(NULL) + : mError(NO_INIT), mOwnedData(NULL), mHeader(NULL), mCache(NULL) { setTo(data, size, copyData); } @@ -296,7 +296,17 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) (int)size); return (mError=BAD_TYPE); } - mStrings = (const char16_t*) + + size_t charSize; + if (mHeader->flags&ResStringPool_header::UTF8_FLAG) { + charSize = sizeof(uint8_t); + mCache = (char16_t**)malloc(sizeof(char16_t**)*mHeader->stringCount); + memset(mCache, 0, sizeof(char16_t**)*mHeader->stringCount); + } else { + charSize = sizeof(char16_t); + } + + mStrings = (const void*) (((const uint8_t*)data)+mHeader->stringsStart); if (mHeader->stringsStart >= (mHeader->header.size-sizeof(uint16_t))) { LOGW("Bad string block: string pool starts at %d, after total size %d\n", @@ -305,7 +315,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) } if (mHeader->styleCount == 0) { mStringPoolSize = - (mHeader->header.size-mHeader->stringsStart)/sizeof(uint16_t); + (mHeader->header.size-mHeader->stringsStart)/charSize; } else { // check invariant: styles follow the strings if (mHeader->stylesStart <= mHeader->stringsStart) { @@ -314,7 +324,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) return (mError=BAD_TYPE); } mStringPoolSize = - (mHeader->stylesStart-mHeader->stringsStart)/sizeof(uint16_t); + (mHeader->stylesStart-mHeader->stringsStart)/charSize; } // check invariant: stringCount > 0 requires a string pool to exist @@ -329,13 +339,19 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) for (i=0; i<mHeader->stringCount; i++) { e[i] = dtohl(mEntries[i]); } - char16_t* s = const_cast<char16_t*>(mStrings); - for (i=0; i<mStringPoolSize; i++) { - s[i] = dtohs(mStrings[i]); + if (!(mHeader->flags&ResStringPool_header::UTF8_FLAG)) { + const char16_t* strings = (const char16_t*)mStrings; + char16_t* s = const_cast<char16_t*>(strings); + for (i=0; i<mStringPoolSize; i++) { + s[i] = dtohs(strings[i]); + } } } - if (mStrings[mStringPoolSize-1] != 0) { + if ((mHeader->flags&ResStringPool_header::UTF8_FLAG && + ((uint8_t*)mStrings)[mStringPoolSize-1] != 0) || + (!mHeader->flags&ResStringPool_header::UTF8_FLAG && + ((char16_t*)mStrings)[mStringPoolSize-1] != 0)) { LOGW("Bad string block: last string is not 0-terminated\n"); return (mError=BAD_TYPE); } @@ -410,24 +426,95 @@ void ResStringPool::uninit() free(mOwnedData); mOwnedData = NULL; } + if (mHeader != NULL && mCache != NULL) { + for (size_t x = 0; x < mHeader->stringCount; x++) { + if (mCache[x] != NULL) { + free(mCache[x]); + mCache[x] = NULL; + } + } + free(mCache); + mCache = NULL; + } } +#define DECODE_LENGTH(str, chrsz, len) \ + len = *(str); \ + if (*(str)&(1<<(chrsz*8-1))) { \ + (str)++; \ + len = (((len)&((1<<(chrsz*8-1))-1))<<(chrsz*8)) + *(str); \ + } \ + (str)++; + const uint16_t* ResStringPool::stringAt(size_t idx, size_t* outLen) const { if (mError == NO_ERROR && idx < mHeader->stringCount) { - const uint32_t off = (mEntries[idx]/sizeof(uint16_t)); + const bool isUTF8 = (mHeader->flags&ResStringPool_header::UTF8_FLAG) != 0; + const uint32_t off = mEntries[idx]/(isUTF8?sizeof(char):sizeof(char16_t)); if (off < (mStringPoolSize-1)) { - const char16_t* str = mStrings+off; - *outLen = *str; - if ((*str)&0x8000) { - str++; - *outLen = (((*outLen)&0x7fff)<<16) + *str; - } - if ((uint32_t)(str+1+*outLen-mStrings) < mStringPoolSize) { - return str+1; + if (!isUTF8) { + const char16_t* strings = (char16_t*)mStrings; + const char16_t* str = strings+off; + DECODE_LENGTH(str, sizeof(char16_t), *outLen) + if ((uint32_t)(str+*outLen-strings) < mStringPoolSize) { + return str; + } else { + LOGW("Bad string block: string #%d extends to %d, past end at %d\n", + (int)idx, (int)(str+*outLen-strings), (int)mStringPoolSize); + } } else { - LOGW("Bad string block: string #%d extends to %d, past end at %d\n", - (int)idx, (int)(str+1+*outLen-mStrings), (int)mStringPoolSize); + const uint8_t* strings = (uint8_t*)mStrings; + const uint8_t* str = strings+off; + DECODE_LENGTH(str, sizeof(uint8_t), *outLen) + size_t encLen; + DECODE_LENGTH(str, sizeof(uint8_t), encLen) + if ((uint32_t)(str+encLen-strings) < mStringPoolSize) { + AutoMutex lock(mDecodeLock); + if (mCache[idx] != NULL) { + return mCache[idx]; + } + char16_t *u16str = (char16_t *)calloc(*outLen+1, sizeof(char16_t)); + if (!u16str) { + LOGW("No memory when trying to allocate decode cache for string #%d\n", + (int)idx); + return NULL; + } + const unsigned char *u8src = reinterpret_cast<const unsigned char *>(str); + utf8_to_utf16(u8src, encLen, u16str, *outLen); + mCache[idx] = u16str; + return u16str; + } else { + LOGW("Bad string block: string #%d extends to %d, past end at %d\n", + (int)idx, (int)(str+encLen-strings), (int)mStringPoolSize); + } + } + } else { + LOGW("Bad string block: string #%d entry is at %d, past end at %d\n", + (int)idx, (int)(off*sizeof(uint16_t)), + (int)(mStringPoolSize*sizeof(uint16_t))); + } + } + return NULL; +} + +const char* ResStringPool::string8At(size_t idx, size_t* outLen) const +{ + if (mError == NO_ERROR && idx < mHeader->stringCount) { + const bool isUTF8 = (mHeader->flags&ResStringPool_header::UTF8_FLAG) != 0; + const uint32_t off = mEntries[idx]/(isUTF8?sizeof(char):sizeof(char16_t)); + if (off < (mStringPoolSize-1)) { + if (isUTF8) { + const uint8_t* strings = (uint8_t*)mStrings; + const uint8_t* str = strings+off; + DECODE_LENGTH(str, sizeof(uint8_t), *outLen) + size_t encLen; + DECODE_LENGTH(str, sizeof(uint8_t), encLen) + if ((uint32_t)(str+encLen-strings) < mStringPoolSize) { + return (const char*)str; + } else { + LOGW("Bad string block: string #%d extends to %d, past end at %d\n", + (int)idx, (int)(str+encLen-strings), (int)mStringPoolSize); + } } } else { LOGW("Bad string block: string #%d entry is at %d, past end at %d\n", @@ -466,6 +553,10 @@ ssize_t ResStringPool::indexOfString(const char16_t* str, size_t strLen) const size_t len; + // TODO optimize searching for UTF-8 strings taking into account + // the cache fill to determine when to convert the searched-for + // string key to UTF-8. + if (mHeader->flags&ResStringPool_header::SORTED_FLAG) { // Do a binary search for the string... ssize_t l = 0; @@ -513,6 +604,13 @@ size_t ResStringPool::size() const return (mError == NO_ERROR) ? mHeader->stringCount : 0; } +#ifndef HAVE_ANDROID_OS +bool ResStringPool::isUTF8() const +{ + return (mHeader->flags&ResStringPool_header::UTF8_FLAG)!=0; +} +#endif + // -------------------------------------------------------------------- // -------------------------------------------------------------------- // -------------------------------------------------------------------- @@ -527,6 +625,10 @@ void ResXMLParser::restart() mCurNode = NULL; mEventCode = mTree.mError == NO_ERROR ? START_DOCUMENT : BAD_DOCUMENT; } +const ResStringPool& ResXMLParser::getStrings() const +{ + return mTree.mStrings; +} ResXMLParser::event_code_t ResXMLParser::getEventType() const { @@ -1043,6 +1145,7 @@ status_t ResXMLTree::getError() const void ResXMLTree::uninit() { mError = NO_INIT; + mStrings.uninit(); if (mOwnedData) { free(mOwnedData); mOwnedData = NULL; @@ -1050,11 +1153,6 @@ void ResXMLTree::uninit() restart(); } -const ResStringPool& ResXMLTree::getStrings() const -{ - return mStrings; -} - status_t ResXMLTree::validateNode(const ResXMLTree_node* node) const { const uint16_t eventCode = dtohs(node->header.type); @@ -1751,7 +1849,7 @@ bool ResTable::getResourceName(uint32_t resID, resource_name* outName) const if (Res_GETPACKAGE(resID)+1 == 0) { LOGW("No package identifier when getting name for resource number 0x%08x", resID); } else { - LOGW("Resources don't contain package for resource number 0x%08x", resID); + LOGW("No known package when getting name for resource number 0x%08x", resID); } return false; } @@ -1799,9 +1897,9 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag if (p < 0) { if (Res_GETPACKAGE(resID)+1 == 0) { - LOGW("No package identifier when getting name for resource number 0x%08x", resID); + LOGW("No package identifier when getting value for resource number 0x%08x", resID); } else { - LOGW("Resources don't contain package for resource number 0x%08x", resID); + LOGW("No known package when getting value for resource number 0x%08x", resID); } return BAD_INDEX; } @@ -1822,7 +1920,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag const PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { LOGW("Bad identifier when getting value for resource number 0x%08x", resID); - return false; + return BAD_INDEX; } size_t ip = grp->packages.size(); while (ip > 0) { @@ -1904,7 +2002,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag return bestPackage->header->index; } - return BAD_INDEX; + return BAD_VALUE; } ssize_t ResTable::resolveReference(Res_value* value, ssize_t blockIndex, @@ -1919,6 +2017,9 @@ ssize_t ResTable::resolveReference(Res_value* value, ssize_t blockIndex, uint32_t newFlags = 0; const ssize_t newIndex = getResource(value->data, value, true, &newFlags, outConfig); + if (newIndex == BAD_INDEX) { + return BAD_INDEX; + } TABLE_THEME(LOGI("Resolving reference %p: newIndex=%d, type=0x%x, data=%p\n", (void*)lastRef, (int)newIndex, (int)value->dataType, (void*)value->data)); //printf("Getting reference 0x%08x: newIndex=%d\n", value->data, newIndex); @@ -3947,13 +4048,19 @@ void ResTable::print_value(const Package* pkg, const Res_value& value) const printf("(attribute) 0x%08x\n", value.data); } else if (value.dataType == Res_value::TYPE_STRING) { size_t len; - const char16_t* str = pkg->header->values.stringAt( + const char* str8 = pkg->header->values.string8At( value.data, &len); - if (str == NULL) { - printf("(string) null\n"); + if (str8 != NULL) { + printf("(string8) \"%s\"\n", str8); } else { - printf("(string) \"%s\"\n", - String8(str, len).string()); + const char16_t* str16 = pkg->header->values.stringAt( + value.data, &len); + if (str16 != NULL) { + printf("(string16) \"%s\"\n", + String8(str16, len).string()); + } else { + printf("(string) null\n"); + } } } else if (value.dataType == Res_value::TYPE_FLOAT) { printf("(float) %g\n", *(const float*)&value.data); @@ -4044,22 +4151,165 @@ void ResTable::print(bool inclValues) const } else { sprintf(density, "%d", (int)dval); } - printf(" config %d lang=%c%c cnt=%c%c orien=%d touch=%d density=%s key=%d infl=%d nav=%d w=%d h=%d sz=%d lng=%d\n", - (int)configIndex, - type->config.language[0] ? type->config.language[0] : '-', - type->config.language[1] ? type->config.language[1] : '-', - type->config.country[0] ? type->config.country[0] : '-', - type->config.country[1] ? type->config.country[1] : '-', - type->config.orientation, - type->config.touchscreen, - density, - type->config.keyboard, - type->config.inputFlags, - type->config.navigation, - dtohs(type->config.screenWidth), - dtohs(type->config.screenHeight), - type->config.screenLayout&ResTable_config::MASK_SCREENSIZE, - type->config.screenLayout&ResTable_config::MASK_SCREENLONG); + printf(" config %d", (int)configIndex); + if (type->config.mcc != 0) { + printf(" mcc=%d", dtohs(type->config.mcc)); + } + if (type->config.mnc != 0) { + printf(" mnc=%d", dtohs(type->config.mnc)); + } + if (type->config.locale != 0) { + printf(" lang=%c%c cnt=%c%c", + type->config.language[0] ? type->config.language[0] : '-', + type->config.language[1] ? type->config.language[1] : '-', + type->config.country[0] ? type->config.country[0] : '-', + type->config.country[1] ? type->config.country[1] : '-'); + } + if (type->config.screenLayout != 0) { + printf(" sz=%d", + type->config.screenLayout&ResTable_config::MASK_SCREENSIZE); + switch (type->config.screenLayout&ResTable_config::MASK_SCREENSIZE) { + case ResTable_config::SCREENSIZE_SMALL: + printf(" (small)"); + break; + case ResTable_config::SCREENSIZE_NORMAL: + printf(" (normal)"); + break; + case ResTable_config::SCREENSIZE_LARGE: + printf(" (large)"); + break; + } + printf(" lng=%d", + type->config.screenLayout&ResTable_config::MASK_SCREENLONG); + switch (type->config.screenLayout&ResTable_config::MASK_SCREENLONG) { + case ResTable_config::SCREENLONG_NO: + printf(" (notlong)"); + break; + case ResTable_config::SCREENLONG_YES: + printf(" (long)"); + break; + } + } + if (type->config.orientation != 0) { + printf(" orient=%d", type->config.orientation); + switch (type->config.orientation) { + case ResTable_config::ORIENTATION_PORT: + printf(" (port)"); + break; + case ResTable_config::ORIENTATION_LAND: + printf(" (land)"); + break; + case ResTable_config::ORIENTATION_SQUARE: + printf(" (square)"); + break; + } + } + if (type->config.uiMode != 0) { + printf(" type=%d", + type->config.uiMode&ResTable_config::MASK_UI_MODE_TYPE); + switch (type->config.uiMode&ResTable_config::MASK_UI_MODE_TYPE) { + case ResTable_config::UI_MODE_TYPE_NORMAL: + printf(" (normal)"); + break; + case ResTable_config::UI_MODE_TYPE_CAR: + printf(" (car)"); + break; + } + printf(" night=%d", + type->config.uiMode&ResTable_config::MASK_UI_MODE_NIGHT); + switch (type->config.uiMode&ResTable_config::MASK_UI_MODE_NIGHT) { + case ResTable_config::UI_MODE_NIGHT_NO: + printf(" (no)"); + break; + case ResTable_config::UI_MODE_NIGHT_YES: + printf(" (yes)"); + break; + } + } + if (dval != 0) { + printf(" density=%s", density); + } + if (type->config.touchscreen != 0) { + printf(" touch=%d", type->config.touchscreen); + switch (type->config.touchscreen) { + case ResTable_config::TOUCHSCREEN_NOTOUCH: + printf(" (notouch)"); + break; + case ResTable_config::TOUCHSCREEN_STYLUS: + printf(" (stylus)"); + break; + case ResTable_config::TOUCHSCREEN_FINGER: + printf(" (finger)"); + break; + } + } + if (type->config.inputFlags != 0) { + printf(" keyhid=%d", type->config.inputFlags&ResTable_config::MASK_KEYSHIDDEN); + switch (type->config.inputFlags&ResTable_config::MASK_KEYSHIDDEN) { + case ResTable_config::KEYSHIDDEN_NO: + printf(" (no)"); + break; + case ResTable_config::KEYSHIDDEN_YES: + printf(" (yes)"); + break; + case ResTable_config::KEYSHIDDEN_SOFT: + printf(" (soft)"); + break; + } + printf(" navhid=%d", type->config.inputFlags&ResTable_config::MASK_NAVHIDDEN); + switch (type->config.inputFlags&ResTable_config::MASK_NAVHIDDEN) { + case ResTable_config::NAVHIDDEN_NO: + printf(" (no)"); + break; + case ResTable_config::NAVHIDDEN_YES: + printf(" (yes)"); + break; + } + } + if (type->config.keyboard != 0) { + printf(" kbd=%d", type->config.keyboard); + switch (type->config.keyboard) { + case ResTable_config::KEYBOARD_NOKEYS: + printf(" (nokeys)"); + break; + case ResTable_config::KEYBOARD_QWERTY: + printf(" (qwerty)"); + break; + case ResTable_config::KEYBOARD_12KEY: + printf(" (12key)"); + break; + } + } + if (type->config.navigation != 0) { + printf(" nav=%d", type->config.navigation); + switch (type->config.navigation) { + case ResTable_config::NAVIGATION_NONAV: + printf(" (nonav)"); + break; + case ResTable_config::NAVIGATION_DPAD: + printf(" (dpad)"); + break; + case ResTable_config::NAVIGATION_TRACKBALL: + printf(" (trackball)"); + break; + case ResTable_config::NAVIGATION_WHEEL: + printf(" (wheel)"); + break; + } + } + if (type->config.screenWidth != 0) { + printf(" w=%d", dtohs(type->config.screenWidth)); + } + if (type->config.screenHeight != 0) { + printf(" h=%d", dtohs(type->config.screenHeight)); + } + if (type->config.sdkVersion != 0) { + printf(" sdk=%d", dtohs(type->config.sdkVersion)); + } + if (type->config.minorVersion != 0) { + printf(" mver=%d", dtohs(type->config.minorVersion)); + } + printf("\n"); size_t entryCount = dtohl(type->entryCount); uint32_t entriesStart = dtohl(type->entriesStart); if ((entriesStart&0x3) != 0) { diff --git a/libs/utils/String16.cpp b/libs/utils/String16.cpp index aef67f2..eab7b2b 100644 --- a/libs/utils/String16.cpp +++ b/libs/utils/String16.cpp @@ -172,10 +172,6 @@ int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2 : 0); } -// --------------------------------------------------------------------------- - -namespace android { - static inline size_t utf8_char_len(uint8_t ch) { @@ -215,8 +211,38 @@ utf8_to_utf32(const uint8_t *src, size_t length) //printf("Char at %p: len=%d, utf-16=%p\n", src, length, (void*)result); } +void +utf8_to_utf16(const uint8_t *src, size_t srcLen, + char16_t* dst, const size_t dstLen) +{ + const uint8_t* const end = src + srcLen; + const char16_t* const dstEnd = dst + dstLen; + while (src < end && dst < dstEnd) { + size_t len = utf8_char_len(*src); + uint32_t codepoint = utf8_to_utf32((const uint8_t*)src, len); + + // Convert the UTF32 codepoint to one or more UTF16 codepoints + if (codepoint <= 0xFFFF) { + // Single UTF16 character + *dst++ = (char16_t) codepoint; + } else { + // Multiple UTF16 characters with surrogates + codepoint = codepoint - 0x10000; + *dst++ = (char16_t) ((codepoint >> 10) + 0xD800); + *dst++ = (char16_t) ((codepoint & 0x3FF) + 0xDC00); + } + + src += len; + } + if (dst < dstEnd) { + *dst = 0; + } +} + // --------------------------------------------------------------------------- +namespace android { + static SharedBuffer* gEmptyStringBuf = NULL; static char16_t* gEmptyString = NULL; @@ -260,30 +286,14 @@ static char16_t* allocFromUTF8(const char* in, size_t len) p += utf8len; } - SharedBuffer* buf = SharedBuffer::alloc((chars+1)*sizeof(char16_t)); + size_t bufSize = (chars+1)*sizeof(char16_t); + SharedBuffer* buf = SharedBuffer::alloc(bufSize); if (buf) { p = in; char16_t* str = (char16_t*)buf->data(); - char16_t* d = str; - while (p < end) { - size_t len = utf8_char_len(*p); - uint32_t codepoint = utf8_to_utf32((const uint8_t*)p, len); - - // Convert the UTF32 codepoint to one or more UTF16 codepoints - if (codepoint <= 0xFFFF) { - // Single UTF16 character - *d++ = (char16_t) codepoint; - } else { - // Multiple UTF16 characters with surrogates - codepoint = codepoint - 0x10000; - *d++ = (char16_t) ((codepoint >> 10) + 0xD800); - *d++ = (char16_t) ((codepoint & 0x3FF) + 0xDC00); - } - - p += len; - } - *d = 0; + utf8_to_utf16((const uint8_t*)p, len, str, bufSize); + //printf("Created UTF-16 string from UTF-8 \"%s\":", in); //printHexData(1, str, buf->size(), 16, 1); //printf("\n"); diff --git a/libs/utils/String8.cpp b/libs/utils/String8.cpp index e908ec1..3a34838 100644 --- a/libs/utils/String8.cpp +++ b/libs/utils/String8.cpp @@ -208,10 +208,23 @@ static char* allocFromUTF16OrUTF32(const T* in, L len) return getEmptyString(); } -// Note: not dealing with expanding surrogate pairs. static char* allocFromUTF16(const char16_t* in, size_t len) { - return allocFromUTF16OrUTF32<char16_t, size_t>(in, len); + if (len == 0) return getEmptyString(); + + const size_t bytes = utf8_length_from_utf16(in, len); + + SharedBuffer* buf = SharedBuffer::alloc(bytes+1); + LOG_ASSERT(buf, "Unable to allocate shared buffer"); + if (buf) { + char* str = (char*)buf->data(); + + utf16_to_utf8(in, len, str, bytes+1); + + return str; + } + + return getEmptyString(); } static char* allocFromUTF32(const char32_t* in, size_t len) @@ -762,6 +775,26 @@ size_t utf8_length_from_utf32(const char32_t *src, size_t src_len) return ret; } +size_t utf8_length_from_utf16(const char16_t *src, size_t src_len) +{ + if (src == NULL || src_len == 0) { + return 0; + } + size_t ret = 0; + const char16_t* const end = src + src_len; + while (src < end) { + if ((*src & 0xFC00) == 0xD800 && (src + 1) < end + && (*++src & 0xFC00) == 0xDC00) { + // surrogate pairs are always 4 bytes. + ret += 4; + src++; + } else { + ret += android::utf32_to_utf8_bytes((char32_t) *src++); + } + } + return ret; +} + static int32_t utf32_at_internal(const char* cur, size_t *num_read) { const char first_char = *cur; @@ -848,3 +881,33 @@ size_t utf32_to_utf8(const char32_t* src, size_t src_len, } return cur - dst; } + +size_t utf16_to_utf8(const char16_t* src, size_t src_len, + char* dst, size_t dst_len) +{ + if (src == NULL || src_len == 0 || dst == NULL || dst_len == 0) { + return 0; + } + const char16_t* cur_utf16 = src; + const char16_t* const end_utf16 = src + src_len; + char *cur = dst; + const char* const end = dst + dst_len; + while (cur_utf16 < end_utf16 && cur < end) { + char32_t utf32; + // surrogate pairs + if ((*cur_utf16 & 0xFC00) == 0xD800 && (cur_utf16 + 1) < end_utf16) { + utf32 = (*cur_utf16++ - 0xD800) << 10; + utf32 |= *cur_utf16++ - 0xDC00; + utf32 += 0x10000; + } else { + utf32 = (char32_t) *cur_utf16++; + } + size_t len = android::utf32_to_utf8_bytes(utf32); + android::utf32_to_utf8((uint8_t*)cur, utf32, len); + cur += len; + } + if (cur < end) { + *cur = '\0'; + } + return cur - dst; +} diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp index ec3db09..2b1f490 100644 --- a/libs/utils/Threads.cpp +++ b/libs/utils/Threads.cpp @@ -20,6 +20,8 @@ #include <utils/threads.h> #include <utils/Log.h> +#include <cutils/sched_policy.h> + #include <stdio.h> #include <stdlib.h> #include <memory.h> @@ -269,6 +271,58 @@ void androidSetCreateThreadFunc(android_create_thread_fn func) gCreateThreadFn = func; } +pid_t androidGetTid() +{ +#ifdef HAVE_GETTID + return gettid(); +#else + return getpid(); +#endif +} + +int androidSetThreadSchedulingGroup(pid_t tid, int grp) +{ + if (grp > ANDROID_TGROUP_MAX || grp < 0) { + return BAD_VALUE; + } + +#if defined(HAVE_PTHREADS) + if (set_sched_policy(tid, (grp == ANDROID_TGROUP_BG_NONINTERACT) ? + SP_BACKGROUND : SP_FOREGROUND)) { + return PERMISSION_DENIED; + } +#endif + + return NO_ERROR; +} + +int androidSetThreadPriority(pid_t tid, int pri) +{ + int rc = 0; + +#if defined(HAVE_PTHREADS) + int lasterr = 0; + + if (pri >= ANDROID_PRIORITY_BACKGROUND) { + rc = set_sched_policy(tid, SP_BACKGROUND); + } else if (getpriority(PRIO_PROCESS, tid) >= ANDROID_PRIORITY_BACKGROUND) { + rc = set_sched_policy(tid, SP_FOREGROUND); + } + + if (rc) { + lasterr = errno; + } + + if (setpriority(PRIO_PROCESS, tid, pri) < 0) { + rc = INVALID_OPERATION; + } else { + errno = lasterr; + } +#endif + + return rc; +} + namespace android { /* diff --git a/libs/utils/Unicode.cpp b/libs/utils/Unicode.cpp deleted file mode 100644 index f92703e..0000000 --- a/libs/utils/Unicode.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (C) 2008 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/AndroidUnicode.h> -#include "CharacterData.h" - -#define LOG_TAG "Unicode" -#include <utils/Log.h> - -// ICU headers for using macros -#include <unicode/utf16.h> - -#define MIN_RADIX 2 -#define MAX_RADIX 36 - -#define TYPE_SHIFT 0 -#define TYPE_MASK ((1<<5)-1) - -#define DIRECTION_SHIFT (TYPE_SHIFT+5) -#define DIRECTION_MASK ((1<<5)-1) - -#define MIRRORED_SHIFT (DIRECTION_SHIFT+5) -#define MIRRORED_MASK ((1<<1)-1) - -#define TOUPPER_SHIFT (MIRRORED_SHIFT+1) -#define TOUPPER_MASK ((1<<6)-1) - -#define TOLOWER_SHIFT (TOUPPER_SHIFT+6) -#define TOLOWER_MASK ((1<<6)-1) - -#define TOTITLE_SHIFT (TOLOWER_SHIFT+6) -#define TOTITLE_MASK ((1<<2)-1) - -#define MIRROR_SHIFT (TOTITLE_SHIFT+2) -#define MIRROR_MASK ((1<<5)-1) - -#define NUMERIC_SHIFT (TOTITLE_SHIFT+2) -#define NUMERIC_MASK ((1<<7)-1) - -#define DECOMPOSITION_SHIFT (11) -#define DECOMPOSITION_MASK ((1<<5)-1) - -/* - * Returns the value stored in the CharacterData tables that contains - * an index into the packed data table and the decomposition type. - */ -static uint16_t findCharacterValue(UChar32 c) -{ - LOG_ASSERT(c >= 0 && c <= 0x10FFFF, "findCharacterValue received an invalid codepoint"); - if (c < 256) - return CharacterData::LATIN1_DATA[c]; - - // Rotate the bits because the tables are separated into even and odd codepoints - c = (c >> 1) | ((c & 1) << 20); - - CharacterData::Range search = CharacterData::FULL_DATA[c >> 16]; - const uint32_t* array = search.array; - - // This trick is so that that compare in the while loop does not - // need to shift the array entry down by 16 - c <<= 16; - c |= 0xFFFF; - - int high = (int)search.length - 1; - int low = 0; - - if (high < 0) - return 0; - - while (low < high - 1) - { - int probe = (high + low) >> 1; - - // The entries contain the codepoint in the high 16 bits and the index - // into PACKED_DATA in the low 16. - if (array[probe] > (unsigned)c) - high = probe; - else - low = probe; - } - - LOG_ASSERT((array[low] <= (unsigned)c), "A suitable range was not found"); - return array[low] & 0xFFFF; -} - -uint32_t android::Unicode::getPackedData(UChar32 c) -{ - // findCharacterValue returns a 16-bit value with the top 5 bits containing a decomposition type - // and the remaining bits containing an index. - return CharacterData::PACKED_DATA[findCharacterValue(c) & 0x7FF]; -} - -android::Unicode::CharType android::Unicode::getType(UChar32 c) -{ - if (c < 0 || c >= 0x10FFFF) - return CHARTYPE_UNASSIGNED; - return (CharType)((getPackedData(c) >> TYPE_SHIFT) & TYPE_MASK); -} - -android::Unicode::DecompositionType android::Unicode::getDecompositionType(UChar32 c) -{ - // findCharacterValue returns a 16-bit value with the top 5 bits containing a decomposition type - // and the remaining bits containing an index. - return (DecompositionType)((findCharacterValue(c) >> DECOMPOSITION_SHIFT) & DECOMPOSITION_MASK); -} - -int android::Unicode::getDigitValue(UChar32 c, int radix) -{ - if (radix < MIN_RADIX || radix > MAX_RADIX) - return -1; - - int tempValue = radix; - - if (c >= '0' && c <= '9') - tempValue = c - '0'; - else if (c >= 'a' && c <= 'z') - tempValue = c - 'a' + 10; - else if (c >= 'A' && c <= 'Z') - tempValue = c - 'A' + 10; - - return tempValue < radix ? tempValue : -1; -} - -int android::Unicode::getNumericValue(UChar32 c) -{ - if (isMirrored(c)) - return -1; - - return (int) CharacterData::NUMERICS[((getPackedData(c) >> NUMERIC_SHIFT) & NUMERIC_MASK)]; -} - -UChar32 android::Unicode::toLower(UChar32 c) -{ - return c + CharacterData::LCDIFF[(getPackedData(c) >> TOLOWER_SHIFT) & TOLOWER_MASK]; -} - -UChar32 android::Unicode::toUpper(UChar32 c) -{ - return c + CharacterData::UCDIFF[(getPackedData(c) >> TOUPPER_SHIFT) & TOUPPER_MASK]; -} - -android::Unicode::Direction android::Unicode::getDirectionality(UChar32 c) -{ - uint32_t data = getPackedData(c); - - if (0 == data) - return DIRECTIONALITY_UNDEFINED; - - Direction d = (Direction) ((data >> DIRECTION_SHIFT) & DIRECTION_MASK); - - if (DIRECTION_MASK == d) - return DIRECTIONALITY_UNDEFINED; - - return d; -} - -bool android::Unicode::isMirrored(UChar32 c) -{ - return ((getPackedData(c) >> MIRRORED_SHIFT) & MIRRORED_MASK) != 0; -} - -UChar32 android::Unicode::toMirror(UChar32 c) -{ - if (!isMirrored(c)) - return c; - - return c + CharacterData::MIRROR_DIFF[(getPackedData(c) >> MIRROR_SHIFT) & MIRROR_MASK]; -} - -UChar32 android::Unicode::toTitle(UChar32 c) -{ - int32_t diff = CharacterData::TCDIFF[(getPackedData(c) >> TOTITLE_SHIFT) & TOTITLE_MASK]; - - if (TOTITLE_MASK == diff) - return toUpper(c); - - return c + diff; -} - - diff --git a/libs/utils/VectorImpl.cpp b/libs/utils/VectorImpl.cpp index 2c2d667..0322af7 100644 --- a/libs/utils/VectorImpl.cpp +++ b/libs/utils/VectorImpl.cpp @@ -173,9 +173,10 @@ status_t VectorImpl::sort(VectorImpl::compar_r_t cmp, void* state) if (!array) return NO_MEMORY; temp = malloc(mItemSize); if (!temp) return NO_MEMORY; - _do_construct(temp, 1); item = reinterpret_cast<char*>(array) + mItemSize*(i); curr = reinterpret_cast<char*>(array) + mItemSize*(i-1); + } else { + _do_destroy(temp, 1); } _do_copy(temp, item, 1); @@ -183,12 +184,14 @@ status_t VectorImpl::sort(VectorImpl::compar_r_t cmp, void* state) ssize_t j = i-1; void* next = reinterpret_cast<char*>(array) + mItemSize*(i); do { + _do_destroy(next, 1); _do_copy(next, curr, 1); next = curr; --j; curr = reinterpret_cast<char*>(array) + mItemSize*(j); } while (j>=0 && (cmp(curr, temp, state) > 0)); + _do_destroy(next, 1); _do_copy(next, temp, 1); } i++; diff --git a/opengl/libagl/Android.mk b/opengl/libagl/Android.mk index 9837845..6cb146c 100644 --- a/opengl/libagl/Android.mk +++ b/opengl/libagl/Android.mk @@ -29,7 +29,7 @@ LOCAL_CFLAGS += -DLOG_TAG=\"libagl\" LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES LOCAL_CFLAGS += -fvisibility=hidden -LOCAL_SHARED_LIBRARIES := libcutils libhardware libutils libpixelflinger +LOCAL_SHARED_LIBRARIES := libcutils libhardware libutils libpixelflinger libETC1 LOCAL_LDLIBS := -lpthread -ldl ifeq ($(TARGET_ARCH),arm) @@ -39,6 +39,11 @@ endif ifneq ($(TARGET_SIMULATOR),true) # we need to access the private Bionic header <bionic_tls.h> + # on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER + # behavior from the bionic Android.mk file + ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER + endif LOCAL_C_INCLUDES += bionic/libc/private endif diff --git a/opengl/libagl/copybit.cpp b/opengl/libagl/copybit.cpp index 4cacc11..67d1ce7 100644 --- a/opengl/libagl/copybit.cpp +++ b/opengl/libagl/copybit.cpp @@ -48,19 +48,8 @@ static void textureToCopyBitImage( const GGLSurface* surface, int32_t opFormat, android_native_buffer_t* buffer, copybit_image_t* img) { - uint32_t vstride = 0; - if (opFormat == COPYBIT_FORMAT_YCbCr_422_SP || - opFormat == COPYBIT_FORMAT_YCbCr_420_SP) { - // NOTE: this static_cast is really not safe b/c we can't know for - // sure the buffer passed is of the right type. - // However, since we do this only for YUV formats, we should be safe - // since only SurfaceFlinger makes use of them. - GraphicBuffer* graphicBuffer = static_cast<GraphicBuffer*>(buffer); - vstride = graphicBuffer->getVerticalStride(); - } - img->w = surface->stride; - img->h = vstride ? vstride : surface->height; + img->h = surface->height; img->format = opFormat; img->base = surface->data; img->handle = (native_handle_t *)buffer->handle; @@ -98,8 +87,6 @@ static bool supportedCopybitsFormat(int format) { case COPYBIT_FORMAT_BGRA_8888: case COPYBIT_FORMAT_RGBA_5551: case COPYBIT_FORMAT_RGBA_4444: - case COPYBIT_FORMAT_YCbCr_422_SP: - case COPYBIT_FORMAT_YCbCr_420_SP: return true; default: return false; diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 81864bd..b6e0aae 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -2092,7 +2092,20 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, if (native_buffer->common.version != sizeof(android_native_buffer_t)) return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); - + + switch (native_buffer->format) { + case HAL_PIXEL_FORMAT_RGBA_8888: + case HAL_PIXEL_FORMAT_RGBX_8888: + case HAL_PIXEL_FORMAT_RGB_888: + case HAL_PIXEL_FORMAT_RGB_565: + case HAL_PIXEL_FORMAT_BGRA_8888: + case HAL_PIXEL_FORMAT_RGBA_5551: + case HAL_PIXEL_FORMAT_RGBA_4444: + break; + default: + return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); + } + native_buffer->common.incRef(&native_buffer->common); return (EGLImageKHR)native_buffer; } diff --git a/opengl/libagl/fixed_asm.S b/opengl/libagl/fixed_asm.S index 6cbc56f..05044f2 100644 --- a/opengl/libagl/fixed_asm.S +++ b/opengl/libagl/fixed_asm.S @@ -20,7 +20,9 @@ .align .global gglFloatToFixed + .type gglFloatToFixed, %function .global gglFloatToFixedFast + .type gglFloatToFixedFast, %function /* diff --git a/opengl/libagl/iterators.S b/opengl/libagl/iterators.S index daf2937..8c86482 100644 --- a/opengl/libagl/iterators.S +++ b/opengl/libagl/iterators.S @@ -21,6 +21,7 @@ .arm .global iterators0032 + .type iterators0032, %function /* * iterators0032 diff --git a/opengl/libagl/light.cpp b/opengl/libagl/light.cpp index f211bca..ca715db 100644 --- a/opengl/libagl/light.cpp +++ b/opengl/libagl/light.cpp @@ -217,18 +217,26 @@ static inline void validate_light_mvi(ogles_context_t* c) { uint32_t en = c->lighting.enabledLights; // Vector from object to viewer, in eye coordinates - const vec4_t eyeViewer = { 0, 0, 0x1000, 0 }; while (en) { const int i = 31 - gglClz(en); en &= ~(1<<i); light_t& l = c->lighting.lights[i]; +#if OBJECT_SPACE_LIGHTING c->transforms.mvui.point4(&c->transforms.mvui, &l.objPosition, &l.position); +#else + l.objPosition = l.position; +#endif vnorm3(l.normalizedObjPosition.v, l.objPosition.v); - c->transforms.mvui.point4(&c->transforms.mvui, - &l.objViewer, &eyeViewer); - vnorm3(l.objViewer.v, l.objViewer.v); } + const vec4_t eyeViewer = { 0, 0, 0x10000, 0 }; +#if OBJECT_SPACE_LIGHTING + c->transforms.mvui.point3(&c->transforms.mvui, + &c->lighting.objViewer, &eyeViewer); + vnorm3(c->lighting.objViewer.v, c->lighting.objViewer.v); +#else + c->lighting.objViewer = eyeViewer; +#endif } static inline void validate_light(ogles_context_t* c) @@ -337,6 +345,7 @@ void lightVertex(ogles_context_t* c, vertex_t* v) { // emission and ambient for the whole scene vec4_t r = c->lighting.implicitSceneEmissionAndAmbient; + const vec4_t objViewer = c->lighting.objViewer; uint32_t en = c->lighting.enabledLights; if (ggl_likely(en)) { @@ -347,7 +356,11 @@ void lightVertex(ogles_context_t* c, vertex_t* v) c->arrays.normal.fetch(c, n.v, c->arrays.normal.element(v->index & vertex_cache_t::INDEX_MASK)); - // TODO: right now we handle GL_RESCALE_NORMALS as if ti were +#if !OBJECT_SPACE_LIGHTING + c->transforms.mvui.point3(&c->transforms.mvui, &n, &n); +#endif + + // TODO: right now we handle GL_RESCALE_NORMALS as if it were // GL_NORMALIZE. We could optimize this by scaling mvui // appropriately instead. if (c->transforms.rescaleNormals) @@ -380,13 +393,13 @@ void lightVertex(ogles_context_t* c, vertex_t* v) s = dot3(n.v, d.v); s = (s<0) ? (twoSide?(-s):0) : s; vsa3(t.v, l.implicitDiffuse.v, s, l.implicitAmbient.v); - + // specular if (ggl_unlikely(s && l.implicitSpecular.v[3])) { vec4_t h; - h.x = d.x + l.objViewer.x; - h.y = d.y + l.objViewer.y; - h.z = d.z + l.objViewer.z; + h.x = d.x + objViewer.x; + h.y = d.y + objViewer.y; + h.z = d.z + objViewer.z; vnorm3(h.v, h.v); s = dot3(n.v, h.v); s = (s<0) ? (twoSide?(-s):0) : s; @@ -515,15 +528,18 @@ static void lightxv(GLenum i, GLenum pname, const GLfixed *params, ogles_context case GL_POSITION: { ogles_validate_transform(c, transform_state_t::MODELVIEW); transform_t& mv = c->transforms.modelview.transform; - memcpy(light.position.v, params, sizeof(light.position.v)); - mv.point4(&mv, &light.position, &light.position); + mv.point4(&mv, &light.position, reinterpret_cast<vec4_t const*>(params)); invalidate_lighting(c); return; } case GL_SPOT_DIRECTION: { +#if OBJECT_SPACE_LIGHTING ogles_validate_transform(c, transform_state_t::MVUI); transform_t& mvui = c->transforms.mvui; - mvui.point3(&mvui, &light.spotDir, (vec4_t*)params); + mvui.point3(&mvui, &light.spotDir, reinterpret_cast<vec4_t const*>(params)); +#else + light.spotDir = *reinterpret_cast<vec4_t const*>(params); +#endif vnorm3(light.normalizedSpotDir.v, light.spotDir.v); invalidate_lighting(c); return; @@ -748,8 +764,8 @@ void glMaterialfv( case GL_SPECULAR: what = c->lighting.front.specular.v; break; case GL_EMISSION: what = c->lighting.front.emission.v; break; case GL_AMBIENT_AND_DIFFUSE: - what = c->lighting.front.ambient.v; break; - other = c->lighting.front.diffuse.v; break; + what = c->lighting.front.ambient.v; + other = c->lighting.front.diffuse.v; break; case GL_SHININESS: c->lighting.front.shininess = gglFloatToFixed(params[0]); @@ -788,8 +804,8 @@ void glMaterialxv( case GL_SPECULAR: what = c->lighting.front.specular.v; break; case GL_EMISSION: what = c->lighting.front.emission.v; break; case GL_AMBIENT_AND_DIFFUSE: - what = c->lighting.front.ambient.v; break; - other= c->lighting.front.diffuse.v; break; + what = c->lighting.front.ambient.v; + other = c->lighting.front.diffuse.v; break; case GL_SHININESS: c->lighting.front.shininess = gglFloatToFixed(params[0]); diff --git a/opengl/libagl/light.h b/opengl/libagl/light.h index 6dae25f..39e3309 100644 --- a/opengl/libagl/light.h +++ b/opengl/libagl/light.h @@ -22,6 +22,13 @@ #include <stddef.h> #include <sys/types.h> + +// Set to 1 for object-space lighting evaluation. +// There are still some bugs with object-space lighting, +// especially visible in the San Angeles demo. +#define OBJECT_SPACE_LIGHTING 0 + + namespace android { namespace gl { diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp index 3c50977..9520f04 100644 --- a/opengl/libagl/matrix.cpp +++ b/opengl/libagl/matrix.cpp @@ -55,6 +55,7 @@ static void normal__nop(transform_t const*, vec4_t* c, vec4_t const* o); static void point2__generic(transform_t const*, vec4_t* c, vec4_t const* o); static void point3__generic(transform_t const*, vec4_t* c, vec4_t const* o); static void point4__generic(transform_t const*, vec4_t* c, vec4_t const* o); +static void point3__mvui(transform_t const*, vec4_t* c, vec4_t const* o); static void point4__mvui(transform_t const*, vec4_t* c, vec4_t const* o); // ---------------------------------------------------------------------------- @@ -209,7 +210,7 @@ void mvui_transform_t::picker() { flags = 0; ops = OP_ALL; - point3 = point4__mvui; + point3 = point3__mvui; point4 = point4__mvui; } @@ -600,17 +601,31 @@ void transform_state_t::update_mvui() GLfloat r[16]; const GLfloat* const mv = modelview.top().elements(); - // TODO: we need a faster invert, especially for when the modelview - // is a rigid-body matrix + /* + When evaluating the lighting equation in eye-space, normals + are transformed by the upper 3x3 modelview inverse-transpose. + http://www.opengl.org/documentation/specs/version1.1/glspec1.1/node26.html + + (note that inverse-transpose is distributive). + Also note that: + l(obj) = inv(modelview).l(eye) for local light + l(obj) = tr(modelview).l(eye) for infinite light + */ + invert(r, mv); GLfixed* const x = mvui.matrix.m; - for (int i=0 ; i<4 ; i++) { - x[I(i,0)] = gglFloatToFixed(r[I(i,0)]); - x[I(i,1)] = gglFloatToFixed(r[I(i,1)]); - x[I(i,2)] = gglFloatToFixed(r[I(i,2)]); - x[I(i,4)] = gglFloatToFixed(r[I(i,3)]); - } + +#if OBJECT_SPACE_LIGHTING + for (int i=0 ; i<4 ; i++) + for (int j=0 ; j<4 ; j++) + x[I(i,j)] = gglFloatToFixed(r[I(i,j)]); +#else + for (int i=0 ; i<4 ; i++) + for (int j=0 ; j<4 ; j++) + x[I(i,j)] = gglFloatToFixed(r[I(j,i)]); +#endif + mvui.picker(); } @@ -739,8 +754,22 @@ void point4__generic(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) { lhs->w = mla4(rx, m[ 3], ry, m[ 7], rz, m[11], rw, m[15]); } +void point3__mvui(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) { + // this is used for transforming light positions back to object space. + // w is used as a switch for directional lights, so we need + // to preserve it. + const GLfixed* const m = mx->matrix.m; + const GLfixed rx = rhs->x; + const GLfixed ry = rhs->y; + const GLfixed rz = rhs->z; + lhs->x = mla3(rx, m[ 0], ry, m[ 4], rz, m[ 8]); + lhs->y = mla3(rx, m[ 1], ry, m[ 5], rz, m[ 9]); + lhs->z = mla3(rx, m[ 2], ry, m[ 6], rz, m[10]); + lhs->w = 0; +} + void point4__mvui(transform_t const* mx, vec4_t* lhs, vec4_t const* rhs) { - // this used for transforming light positions back to object space. + // this is used for transforming light positions back to object space. // w is used as a switch for directional lights, so we need // to preserve it. const GLfixed* const m = mx->matrix.m; diff --git a/opengl/libagl/state.cpp b/opengl/libagl/state.cpp index 0f1f27d..27bb545 100644 --- a/opengl/libagl/state.cpp +++ b/opengl/libagl/state.cpp @@ -37,7 +37,7 @@ namespace android { // ---------------------------------------------------------------------------- static char const * const gVendorString = "Android"; -static char const * const gRendererString = "Android PixelFlinger 1.2"; +static char const * const gRendererString = "Android PixelFlinger 1.3"; static char const * const gVersionString = "OpenGL ES-CM 1.0"; static char const * const gExtensionsString = "GL_OES_byte_coordinates " // OK @@ -51,6 +51,9 @@ static char const * const gExtensionsString = // "GL_OES_point_size_array " // TODO // "GL_OES_point_sprite " // TODO "GL_OES_EGL_image " // OK +#ifdef GL_OES_compressed_ETC1_RGB8_texture + "GL_OES_compressed_ETC1_RGB8_texture " // OK +#endif "GL_ARB_texture_compression " // OK "GL_ARB_texture_non_power_of_two " // OK "GL_ANDROID_user_clip_plane " // OK @@ -386,6 +389,7 @@ const GLubyte* glGetString(GLenum string) void glGetIntegerv(GLenum pname, GLint *params) { + int i; ogles_context_t* c = ogles_context_t::get(); switch (pname) { case GL_ALIASED_POINT_SIZE_RANGE: @@ -431,6 +435,10 @@ void glGetIntegerv(GLenum pname, GLint *params) params[ 7] = GL_PALETTE8_R5_G6_B5_OES; params[ 8] = GL_PALETTE8_RGBA4_OES; params[ 9] = GL_PALETTE8_RGB5_A1_OES; + i = 10; +#ifdef GL_OES_compressed_ETC1_RGB8_texture + params[i++] = GL_ETC1_RGB8_OES; +#endif break; case GL_DEPTH_BITS: params[0] = c->rasterizer.state.buffers.depth.format ? 0 : 16; diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp index 13d078e..9407bd5 100644 --- a/opengl/libagl/texture.cpp +++ b/opengl/libagl/texture.cpp @@ -24,6 +24,7 @@ #include "TextureObjectManager.h" #include <private/ui/android_natives_priv.h> +#include <ETC1/etc1.h> #ifdef LIBAGL_USE_GRALLOC_COPYBITS #include "copybit.h" @@ -583,7 +584,7 @@ static void decodePalette4(const GLvoid *data, int level, int width, int height, static __attribute__((noinline)) -void set_depth_and_fog(ogles_context_t* c, GLint z) +void set_depth_and_fog(ogles_context_t* c, GGLfixed z) { const uint32_t enables = c->rasterizer.state.enables; // we need to compute Zw @@ -592,8 +593,8 @@ void set_depth_and_fog(ogles_context_t* c, GLint z) GGLfixed Zw; GGLfixed n = gglFloatToFixed(c->transforms.vpt.zNear); GGLfixed f = gglFloatToFixed(c->transforms.vpt.zFar); - if (z<=0) Zw = n; - else if (z>=1) Zw = f; + if (z<=0) Zw = n; + else if (z>=0x10000) Zw = f; else Zw = gglMulAddx(z, (f-n), n); if (enables & GGL_ENABLE_FOG) { // set up fog if needed... @@ -836,7 +837,7 @@ static void drawTexiOES(GLint x, GLint y, GLint z, GLint w, GLint h, ogles_conte c->rasterizer.procs.texCoord2i(c, s0, t0); const uint32_t enables = c->rasterizer.state.enables; if (ggl_unlikely(enables & (GGL_ENABLE_DEPTH_TEST|GGL_ENABLE_FOG))) - set_depth_and_fog(c, z); + set_depth_and_fog(c, gglIntToFixed(z)); c->rasterizer.procs.color4xv(c, c->currentColorClamped.v); c->rasterizer.procs.disable(c, GGL_W_LERP); @@ -1081,11 +1082,6 @@ void glCompressedTexImage2D( ogles_error(c, GL_INVALID_ENUM); return; } - if ((internalformat < GL_PALETTE4_RGB8_OES || - internalformat > GL_PALETTE8_RGB5_A1_OES)) { - ogles_error(c, GL_INVALID_ENUM); - return; - } if (width<0 || height<0 || border!=0) { ogles_error(c, GL_INVALID_VALUE); return; @@ -1121,6 +1117,12 @@ void glCompressedTexImage2D( format = GL_RGBA; type = GL_UNSIGNED_SHORT_5_5_5_1; break; +#ifdef GL_OES_compressed_ETC1_RGB8_texture + case GL_ETC1_RGB8_OES: + format = GL_RGB; + type = GL_UNSIGNED_BYTE; + break; +#endif default: ogles_error(c, GL_INVALID_ENUM); return; @@ -1133,6 +1135,30 @@ void glCompressedTexImage2D( int32_t size; GGLSurface* surface; + +#ifdef GL_OES_compressed_ETC1_RGB8_texture + if (internalformat == GL_ETC1_RGB8_OES) { + GLsizei compressedSize = etc1_get_encoded_data_size(width, height); + if (compressedSize > imageSize) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + int error = createTextureSurface(c, &surface, &size, + level, format, type, width, height); + if (error) { + ogles_error(c, error); + return; + } + if (etc1_decode_image( + (const etc1_byte*)data, + (etc1_byte*)surface->data, + width, height, 3, surface->stride*3) != 0) { + ogles_error(c, GL_INVALID_OPERATION); + } + return; + } +#endif + // all mipmap levels are specified at once. const int numLevels = level<0 ? -level : 1; @@ -1389,9 +1415,20 @@ void glCopyTexImage2D( // (x,y) is the lower-left corner of colorBuffer y = cbSurface.height - (y + height); + /* The GLES spec says: + * If any of the pixels within the specified rectangle are outside + * the framebuffer associated with the current rendering context, + * then the values obtained for those pixels are undefined. + */ + if (x+width > GLint(cbSurface.width)) + width = cbSurface.width - x; + + if (y+height > GLint(cbSurface.height)) + height = cbSurface.height - y; + int err = copyPixels(c, txSurface, 0, 0, - cbSurface, x, y, cbSurface.width, cbSurface.height); + cbSurface, x, y, width, height); if (err) { ogles_error(c, err); } @@ -1439,8 +1476,19 @@ void glCopyTexSubImage2D( const GGLSurface& cbSurface = c->rasterizer.state.buffers.color.s; y = cbSurface.height - (y + height); + /* The GLES spec says: + * If any of the pixels within the specified rectangle are outside + * the framebuffer associated with the current rendering context, + * then the values obtained for those pixels are undefined. + */ + if (x+width > GLint(cbSurface.width)) + width = cbSurface.width - x; + + if (y+height > GLint(cbSurface.height)) + height = cbSurface.height - y; + int err = copyPixels(c, - surface, xoffset, yoffset, + txSurface, xoffset, yoffset, cbSurface, x, y, width, height); if (err) { ogles_error(c, err); @@ -1580,6 +1628,11 @@ void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) return; } + if (image == EGL_NO_IMAGE_KHR) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + android_native_buffer_t* native_buffer = (android_native_buffer_t*)image; if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) { ogles_error(c, GL_INVALID_VALUE); @@ -1604,4 +1657,26 @@ void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { + ogles_context_t* c = ogles_context_t::get(); + if (target != GL_RENDERBUFFER_OES) { + ogles_error(c, GL_INVALID_ENUM); + return; + } + + if (image == EGL_NO_IMAGE_KHR) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + + android_native_buffer_t* native_buffer = (android_native_buffer_t*)image; + if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + if (native_buffer->common.version != sizeof(android_native_buffer_t)) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + + // well, we're not supporting this extension anyways } diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk index 37b9a43..6b7020f 100644 --- a/opengl/libs/Android.mk +++ b/opengl/libs/Android.mk @@ -20,6 +20,11 @@ LOCAL_MODULE:= libEGL ifeq ($(TARGET_SIMULATOR),true) else LOCAL_SHARED_LIBRARIES += libdl + # Bionic's private TLS header relies on the ARCH_ARM_HAVE_TLS_REGISTER to + # select the appropriate TLS codepath + ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER + endif # we need to access the private Bionic header <bionic_tls.h> LOCAL_C_INCLUDES += bionic/libc/private endif @@ -75,6 +80,9 @@ ifeq ($(TARGET_SIMULATOR),true) else LOCAL_SHARED_LIBRARIES += libdl # we need to access the private Bionic header <bionic_tls.h> + ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER + endif LOCAL_C_INCLUDES += bionic/libc/private endif @@ -108,6 +116,9 @@ ifeq ($(TARGET_SIMULATOR),true) else LOCAL_SHARED_LIBRARIES += libdl # we need to access the private Bionic header <bionic_tls.h> + ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER + endif LOCAL_C_INCLUDES += bionic/libc/private endif @@ -136,3 +147,17 @@ LOCAL_MODULE:= libETC1 include $(BUILD_HOST_STATIC_LIBRARY) +############################################################################### +# Build the ETC1 device library +# + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + ETC1/etc1.cpp \ +# + +LOCAL_LDLIBS := -lpthread -ldl +LOCAL_MODULE:= libETC1 + +include $(BUILD_SHARED_LIBRARY) diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index c22c21b..89b3e1f 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -166,7 +166,8 @@ struct egl_display_t { uint32_t magic; DisplayImpl disp[IMPL_NUM_IMPLEMENTATIONS]; EGLint numTotalConfigs; - volatile int32_t refs; + uint32_t refs; + Mutex lock; egl_display_t() : magic('_dpy'), numTotalConfigs(0) { } ~egl_display_t() { magic = 0; } @@ -644,9 +645,12 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) egl_display_t * const dp = get_display(dpy); if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - if (android_atomic_inc(&dp->refs) > 0) { + Mutex::Autolock _l(dp->lock); + + if (dp->refs > 0) { if (major != NULL) *major = VERSION_MAJOR; if (minor != NULL) *minor = VERSION_MINOR; + dp->refs++; return EGL_TRUE; } @@ -728,6 +732,7 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) } if (res == EGL_TRUE) { + dp->refs++; if (major != NULL) *major = VERSION_MAJOR; if (minor != NULL) *minor = VERSION_MINOR; return EGL_TRUE; @@ -743,8 +748,18 @@ EGLBoolean eglTerminate(EGLDisplay dpy) egl_display_t* const dp = get_display(dpy); if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - if (android_atomic_dec(&dp->refs) != 1) + + Mutex::Autolock _l(dp->lock); + + if (dp->refs == 0) { + return setError(EGL_NOT_INITIALIZED, EGL_FALSE); + } + + // this is specific to Android, display termination is ref-counted. + if (dp->refs > 1) { + dp->refs--; return EGL_TRUE; + } EGLBoolean res = EGL_FALSE; for (int i=0 ; i<IMPL_NUM_IMPLEMENTATIONS ; i++) { @@ -767,6 +782,7 @@ EGLBoolean eglTerminate(EGLDisplay dpy) // TODO: all egl_object_t should be marked for termination + dp->refs--; dp->numTotalConfigs = 0; clearTLS(); return res; @@ -1111,10 +1127,10 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, if (cur_c == NULL) { // no current context if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) { - // calling eglMakeCurrent( ..., EGL_NO_CONTEXT, !=0, !=0); - return setError(EGL_BAD_PARAMETER, EGL_FALSE); + // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT); + return setError(EGL_BAD_MATCH, EGL_FALSE); } - // not an error, there is just not current context. + // not an error, there is just no current context. return EGL_TRUE; } } diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp index b8e3283..924737e 100644 --- a/opengl/libs/GLES2/gl2.cpp +++ b/opengl/libs/GLES2/gl2.cpp @@ -114,6 +114,6 @@ void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { GLeglImageOES implImage = (GLeglImageOES)egl_get_image_for_current_context((EGLImageKHR)image); - __glEGLImageTargetRenderbufferStorageOES(target, image); + __glEGLImageTargetRenderbufferStorageOES(target, implImage); } diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp index 0c9352e..d71ff76 100644 --- a/opengl/libs/GLES_CM/gl.cpp +++ b/opengl/libs/GLES_CM/gl.cpp @@ -47,6 +47,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLsizei count); GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); } void glColorPointerBounds(GLint size, GLenum type, GLsizei stride, @@ -66,6 +72,21 @@ void glVertexPointerBounds(GLint size, GLenum type, glVertexPointer(size, type, stride, pointer); } +void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count) { + glPointSizePointerOES(type, stride, pointer); +} + +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count) { + glMatrixIndexPointerOES(size, type, stride, pointer); +} + +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count) { + glWeightPointerOES(size, type, stride, pointer); +} + // ---------------------------------------------------------------------------- // Actual GL entry-points // ---------------------------------------------------------------------------- @@ -164,6 +185,6 @@ void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { GLeglImageOES implImage = (GLeglImageOES)egl_get_image_for_current_context((EGLImageKHR)image); - __glEGLImageTargetRenderbufferStorageOES(target, image); + __glEGLImageTargetRenderbufferStorageOES(target, implImage); } diff --git a/opengl/tests/fillrate/Android.mk b/opengl/tests/fillrate/Android.mk index a7d30c2..191c59b 100644 --- a/opengl/tests/fillrate/Android.mk +++ b/opengl/tests/fillrate/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ + libutils \ libEGL \ libGLESv1_CM \ libui diff --git a/opengl/tests/finish/Android.mk b/opengl/tests/finish/Android.mk index 5620814..aa607c6 100644 --- a/opengl/tests/finish/Android.mk +++ b/opengl/tests/finish/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ + libutils \ libEGL \ libGLESv1_CM \ libui diff --git a/opengl/tests/gl2_java/Android.mk b/opengl/tests/gl2_java/Android.mk new file mode 100644 index 0000000..34f4aee --- /dev/null +++ b/opengl/tests/gl2_java/Android.mk @@ -0,0 +1,18 @@ +######################################################################### +# OpenGL ES 2.0 Java sample +######################################################################### + +TOP_LOCAL_PATH:= $(call my-dir) + +# Build activity + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_PACKAGE_NAME := GL2Java + +include $(BUILD_PACKAGE) diff --git a/opengl/tests/gl2_java/AndroidManifest.xml b/opengl/tests/gl2_java/AndroidManifest.xml new file mode 100644 index 0000000..585b63f --- /dev/null +++ b/opengl/tests/gl2_java/AndroidManifest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2009, 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. +*/ +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.gl2java"> + <uses-feature android:glEsVersion="0x00020000" /> + <application + android:label="@string/gl2java_activity"> + <activity android:name="GL2JavaActivity" + android:theme="@android:style/Theme.NoTitleBar.Fullscreen" + android:launchMode="singleTask" + android:configChanges="orientation|keyboardHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/opengl/tests/gl2_java/res/values/strings.xml b/opengl/tests/gl2_java/res/values/strings.xml new file mode 100644 index 0000000..d718b1d --- /dev/null +++ b/opengl/tests/gl2_java/res/values/strings.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2006, 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. +*/ +--> + +<!-- This file contains resource definitions for displayed strings, allowing + them to be changed based on the locale and options. --> + +<resources> + <!-- Simple strings. --> + <string name="gl2java_activity">GL2Java</string> + +</resources> + diff --git a/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaActivity.java b/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaActivity.java new file mode 100644 index 0000000..37654fb --- /dev/null +++ b/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaActivity.java @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package com.android.gl2java; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.view.WindowManager; + +import java.io.File; + + +public class GL2JavaActivity extends Activity { + + GL2JavaView mView; + + @Override protected void onCreate(Bundle icicle) { + super.onCreate(icicle); + mView = new GL2JavaView(getApplication()); + setContentView(mView); + } + + @Override protected void onPause() { + super.onPause(); + mView.onPause(); + } + + @Override protected void onResume() { + super.onResume(); + mView.onResume(); + } +} diff --git a/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaView.java b/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaView.java new file mode 100644 index 0000000..7f2bfd3 --- /dev/null +++ b/opengl/tests/gl2_java/src/com/android/gl2java/GL2JavaView.java @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2009 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. + */ + +package com.android.gl2java; + +import android.content.Context; +import android.opengl.GLSurfaceView; +import android.util.AttributeSet; +import android.util.Log; +import android.view.KeyEvent; +import android.view.MotionEvent; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; + +import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.egl.EGLContext; +import javax.microedition.khronos.egl.EGLDisplay; +import javax.microedition.khronos.opengles.GL10; + +import android.opengl.GLES20; + +/** + * An implementation of SurfaceView that uses the dedicated surface for + * displaying an OpenGL animation. This allows the animation to run in a + * separate thread, without requiring that it be driven by the update mechanism + * of the view hierarchy. + * + * The application-specific rendering code is delegated to a GLView.Renderer + * instance. + */ +class GL2JavaView extends GLSurfaceView { + private static String TAG = "GL2JavaView"; + + public GL2JavaView(Context context) { + super(context); + setEGLContextClientVersion(2); + setRenderer(new Renderer()); + } + + private static class Renderer implements GLSurfaceView.Renderer { + + public Renderer() { + mTriangleVertices = ByteBuffer.allocateDirect(mTriangleVerticesData.length * 4) + .order(ByteOrder.nativeOrder()).asFloatBuffer(); + mTriangleVertices.put(mTriangleVerticesData).position(0); + } + + public void onDrawFrame(GL10 gl) { + GLES20.glClearColor(0.0f, 0.0f, 1.0f, 1.0f); + GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT); + GLES20.glUseProgram(mProgram); + checkGlError("glUseProgram"); + + GLES20.glVertexAttribPointer(mvPositionHandle, 2, GLES20.GL_FLOAT, false, 0, mTriangleVertices); + checkGlError("glVertexAttribPointer"); + GLES20.glEnableVertexAttribArray(mvPositionHandle); + checkGlError("glEnableVertexAttribArray"); + GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3); + checkGlError("glDrawArrays"); + + } + + public void onSurfaceChanged(GL10 gl, int width, int height) { + GLES20.glViewport(0, 0, width, height); + } + + public void onSurfaceCreated(GL10 gl, EGLConfig config) { + mProgram = createProgram(mVertexShader, mFragmentShader); + if (mProgram == 0) { + return; + } + mvPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition"); + checkGlError("glGetAttribLocation"); + if (mvPositionHandle == -1) { + throw new RuntimeException("Could not get attrib location for vPosition"); + } + } + + private int loadShader(int shaderType, String source) { + int shader = GLES20.glCreateShader(shaderType); + if (shader != 0) { + GLES20.glShaderSource(shader, source); + GLES20.glCompileShader(shader); + int[] compiled = new int[1]; + GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0); + if (compiled[0] == 0) { + Log.e(TAG, "Could not compile shader " + shaderType + ":"); + Log.e(TAG, GLES20.glGetShaderInfoLog(shader)); + GLES20.glDeleteShader(shader); + shader = 0; + } + } + return shader; + } + + private int createProgram(String vertexSource, String fragmentSource) { + int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource); + if (vertexShader == 0) { + return 0; + } + + int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); + if (pixelShader == 0) { + return 0; + } + + int program = GLES20.glCreateProgram(); + if (program != 0) { + GLES20.glAttachShader(program, vertexShader); + checkGlError("glAttachShader"); + GLES20.glAttachShader(program, pixelShader); + checkGlError("glAttachShader"); + GLES20.glLinkProgram(program); + int[] linkStatus = new int[1]; + GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0); + if (linkStatus[0] != GLES20.GL_TRUE) { + Log.e(TAG, "Could not link program: "); + Log.e(TAG, GLES20.glGetProgramInfoLog(program)); + GLES20.glDeleteProgram(program); + program = 0; + } + } + return program; + } + + private void checkGlError(String op) { + int error; + while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { + Log.e(TAG, op + ": glError " + error); + throw new RuntimeException(op + ": glError " + error); + } + } + + private final float[] mTriangleVerticesData = { 0.0f, 0.5f, -0.5f, -0.5f, + 0.5f, -0.5f }; + + private FloatBuffer mTriangleVertices; + + private final String mVertexShader = "attribute vec4 vPosition;\n" + + "void main() {\n" + + " gl_Position = vPosition;\n" + + "}\n"; + + private final String mFragmentShader = "precision mediump float;\n" + + "void main() {\n" + + " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n" + + "}\n"; + + private int mProgram; + private int mvPositionHandle; + + } +} + diff --git a/opengl/tests/gl2_jni/Android.mk b/opengl/tests/gl2_jni/Android.mk index 81247df..384966c 100644 --- a/opengl/tests/gl2_jni/Android.mk +++ b/opengl/tests/gl2_jni/Android.mk @@ -11,7 +11,7 @@ TOP_LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE_TAGS := user +LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(call all-subdir-java-files) diff --git a/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIView.java b/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIView.java index 2dae090..72b1dfb 100644 --- a/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIView.java +++ b/opengl/tests/gl2_jni/src/com/android/gl2jni/GL2JNIView.java @@ -56,19 +56,22 @@ import javax.microedition.khronos.opengles.GL10; */ class GL2JNIView extends GLSurfaceView { private static String TAG = "GL2JNIView"; - GL2JNIView(Context context) { + + public GL2JNIView(Context context) { super(context); - init(); + init(false, 0, 0); } - public GL2JNIView(Context context, AttributeSet attrs) { - super(context, attrs); - init(); + public GL2JNIView(Context context, boolean translucent, int depth, int stencil) { + super(context); + init(translucent, depth, stencil); } - private void init() { + private void init(boolean translucent, int depth, int stencil) { setEGLContextFactory(new ContextFactory()); - setEGLConfigChooser(new ConfigChooser()); + setEGLConfigChooser( translucent ? + new ConfigChooser(8,8,8,8, depth, stencil) : + new ConfigChooser(5,6,5,0, depth, stencil)); setRenderer(new Renderer()); } @@ -105,6 +108,16 @@ class GL2JNIView extends GLSurfaceView { EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL10.EGL_NONE }; + + public ConfigChooser(int r, int g, int b, int a, int depth, int stencil) { + mRedSize = r; + mGreenSize = g; + mBlueSize = b; + mAlphaSize = a; + mDepthSize = depth; + mStencilSize = stencil; + } + public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) { int[] num_config = new int[1]; @@ -112,14 +125,158 @@ class GL2JNIView extends GLSurfaceView { int numConfigs = num_config[0]; - Log.w(TAG, String.format("Found %d configurations", numConfigs)); if (numConfigs <= 0) { throw new IllegalArgumentException("No configs match configSpec"); } EGLConfig[] configs = new EGLConfig[numConfigs]; egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config); - return configs[0]; + // printConfigs(egl, display, configs); + return chooseConfig(egl, display, configs); } + + public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display, + EGLConfig[] configs) { + EGLConfig closestConfig = null; + int closestDistance = 1000; + for(EGLConfig config : configs) { + int d = findConfigAttrib(egl, display, config, + EGL10.EGL_DEPTH_SIZE, 0); + int s = findConfigAttrib(egl, display, config, + EGL10.EGL_STENCIL_SIZE, 0); + if (d >= mDepthSize && s>= mStencilSize) { + int r = findConfigAttrib(egl, display, config, + EGL10.EGL_RED_SIZE, 0); + int g = findConfigAttrib(egl, display, config, + EGL10.EGL_GREEN_SIZE, 0); + int b = findConfigAttrib(egl, display, config, + EGL10.EGL_BLUE_SIZE, 0); + int a = findConfigAttrib(egl, display, config, + EGL10.EGL_ALPHA_SIZE, 0); + int distance = Math.abs(r - mRedSize) + + Math.abs(g - mGreenSize) + + Math.abs(b - mBlueSize) + + Math.abs(a - mAlphaSize); + if (distance < closestDistance) { + closestDistance = distance; + closestConfig = config; + } + } + } + return closestConfig; + } + + private int findConfigAttrib(EGL10 egl, EGLDisplay display, + EGLConfig config, int attribute, int defaultValue) { + + if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) { + return mValue[0]; + } + return defaultValue; + } + + private void printConfigs(EGL10 egl, EGLDisplay display, + EGLConfig[] configs) { + int numConfigs = configs.length; + Log.w(TAG, String.format("%d configurations", numConfigs)); + for (int i = 0; i < numConfigs; i++) { + Log.w(TAG, String.format("Configuration %d:\n", i)); + printConfig(egl, display, configs[i]); + } + } + + private void printConfig(EGL10 egl, EGLDisplay display, + EGLConfig config) { + int[] attributes = { + EGL10.EGL_BUFFER_SIZE, + EGL10.EGL_ALPHA_SIZE, + EGL10.EGL_BLUE_SIZE, + EGL10.EGL_GREEN_SIZE, + EGL10.EGL_RED_SIZE, + EGL10.EGL_DEPTH_SIZE, + EGL10.EGL_STENCIL_SIZE, + EGL10.EGL_CONFIG_CAVEAT, + EGL10.EGL_CONFIG_ID, + EGL10.EGL_LEVEL, + EGL10.EGL_MAX_PBUFFER_HEIGHT, + EGL10.EGL_MAX_PBUFFER_PIXELS, + EGL10.EGL_MAX_PBUFFER_WIDTH, + EGL10.EGL_NATIVE_RENDERABLE, + EGL10.EGL_NATIVE_VISUAL_ID, + EGL10.EGL_NATIVE_VISUAL_TYPE, + 0x3030, // EGL10.EGL_PRESERVED_RESOURCES, + EGL10.EGL_SAMPLES, + EGL10.EGL_SAMPLE_BUFFERS, + EGL10.EGL_SURFACE_TYPE, + EGL10.EGL_TRANSPARENT_TYPE, + EGL10.EGL_TRANSPARENT_RED_VALUE, + EGL10.EGL_TRANSPARENT_GREEN_VALUE, + EGL10.EGL_TRANSPARENT_BLUE_VALUE, + 0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB, + 0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA, + 0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL, + 0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL, + EGL10.EGL_LUMINANCE_SIZE, + EGL10.EGL_ALPHA_MASK_SIZE, + EGL10.EGL_COLOR_BUFFER_TYPE, + EGL10.EGL_RENDERABLE_TYPE, + 0x3042 // EGL10.EGL_CONFORMANT + }; + String[] names = { + "EGL_BUFFER_SIZE", + "EGL_ALPHA_SIZE", + "EGL_BLUE_SIZE", + "EGL_GREEN_SIZE", + "EGL_RED_SIZE", + "EGL_DEPTH_SIZE", + "EGL_STENCIL_SIZE", + "EGL_CONFIG_CAVEAT", + "EGL_CONFIG_ID", + "EGL_LEVEL", + "EGL_MAX_PBUFFER_HEIGHT", + "EGL_MAX_PBUFFER_PIXELS", + "EGL_MAX_PBUFFER_WIDTH", + "EGL_NATIVE_RENDERABLE", + "EGL_NATIVE_VISUAL_ID", + "EGL_NATIVE_VISUAL_TYPE", + "EGL_PRESERVED_RESOURCES", + "EGL_SAMPLES", + "EGL_SAMPLE_BUFFERS", + "EGL_SURFACE_TYPE", + "EGL_TRANSPARENT_TYPE", + "EGL_TRANSPARENT_RED_VALUE", + "EGL_TRANSPARENT_GREEN_VALUE", + "EGL_TRANSPARENT_BLUE_VALUE", + "EGL_BIND_TO_TEXTURE_RGB", + "EGL_BIND_TO_TEXTURE_RGBA", + "EGL_MIN_SWAP_INTERVAL", + "EGL_MAX_SWAP_INTERVAL", + "EGL_LUMINANCE_SIZE", + "EGL_ALPHA_MASK_SIZE", + "EGL_COLOR_BUFFER_TYPE", + "EGL_RENDERABLE_TYPE", + "EGL_CONFORMANT" + }; + int[] value = new int[1]; + for (int i = 0; i < attributes.length; i++) { + int attribute = attributes[i]; + String name = names[i]; + if ( egl.eglGetConfigAttrib(display, config, attribute, value)) { + Log.w(TAG, String.format(" %s: %d\n", name, value[0])); + } else { + // Log.w(TAG, String.format(" %s: failed\n", name)); + while (egl.eglGetError() != EGL10.EGL_SUCCESS); + } + } + } + + // Subclasses can adjust these values: + protected int mRedSize; + protected int mGreenSize; + protected int mBlueSize; + protected int mAlphaSize; + protected int mDepthSize; + protected int mStencilSize; + private int[] mValue = new int[1]; } private static class Renderer implements GLSurfaceView.Renderer { diff --git a/opengl/tests/gl_basic/gl_basic.cpp b/opengl/tests/gl_basic/gl_basic.cpp index 7dc2378..feb964a 100644 --- a/opengl/tests/gl_basic/gl_basic.cpp +++ b/opengl/tests/gl_basic/gl_basic.cpp @@ -1,32 +1,39 @@ // Simple OpenGL ES 1.x application showing how to initialize and draw something. -#include <EGL/egl.h>
+#include <EGL/egl.h> + #include <GLES/gl.h> #include <GLES/glext.h> #include <ui/FramebufferNativeWindow.h> #include <ui/EGLUtils.h> -#include <stdio.h>
+#include <stdio.h> + #include <stdlib.h> #include <math.h> using namespace android; -
-EGLDisplay eglDisplay;
-EGLSurface eglSurface;
-EGLContext eglContext;
-GLuint texture;
-
+ +EGLDisplay eglDisplay; +EGLSurface eglSurface; +EGLContext eglContext; +GLuint texture; + #define FIXED_ONE 0x10000 -#define ITERATIONS 50
-
-int init_gl_surface(void);
-void free_gl_surface(void);
-void init_scene(void);
-void render();
+#define ITERATIONS 50 + +int init_gl_surface(void); +void free_gl_surface(void); +void init_scene(void); +void render(); void create_texture(void); -int readTimer(void);
+int readTimer(void); + +static void printGLString(const char *name, GLenum s) { + const char *v = (const char *) glGetString(s); + fprintf(stderr, "GL %s = %s\n", name, v); +} static void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, @@ -87,7 +94,6 @@ static void gluLookAt(float eyeX, float eyeY, float eyeZ, glTranslatef(-eyeX, -eyeY, -eyeZ); } - void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) { #define X(VAL) {VAL, #VAL} @@ -183,125 +189,129 @@ int printEGLConfigurations(EGLDisplay dpy) { free(configs); return true; } -
-int main(int argc, char **argv)
-{
- int q; - int start, end;
+int main(int argc, char **argv) +{ + int q; + int start, end; printf("Initializing EGL...\n"); -
- if(!init_gl_surface())
- {
- printf("GL initialisation failed - exiting\n");
- return 0;
- }
-
- init_scene();
-
- create_texture();
-
+ if(!init_gl_surface()) + { + printf("GL initialisation failed - exiting\n"); + return 0; + } + init_scene(); + create_texture(); printf("Running...\n"); - while(true) { render(); - }
-
- free_gl_surface();
-
- return 0;
-}
-
-int init_gl_surface(void)
-{
- EGLint numConfigs = 1;
- EGLConfig myConfig = {0};
- EGLint attrib[] =
- {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_NONE
- };
-
- if ( (eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY )
- {
- printf("eglGetDisplay failed\n");
- return 0;
} -
- if ( eglInitialize(eglDisplay, NULL, NULL) != EGL_TRUE )
- {
- printf("eglInitialize failed\n");
- return 0;
+ free_gl_surface(); + return 0; +} + +int init_gl_surface(void) +{ + EGLint numConfigs = 1; + EGLConfig myConfig = {0}; + EGLint attrib[] = + { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_NONE + }; + + if ( (eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY ) + { + printf("eglGetDisplay failed\n"); + return 0; + } + + if ( eglInitialize(eglDisplay, NULL, NULL) != EGL_TRUE ) + { + printf("eglInitialize failed\n"); + return 0; } if (! printEGLConfigurations(eglDisplay)) { printf("printEGLConfigurations failed.\n"); return 0; - }
- EGLNativeWindowType window = android_createDisplaySurface();
- EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);
-
+ } + + EGLNativeWindowType window = android_createDisplaySurface(); + EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig); + if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig, - window, 0)) == EGL_NO_SURFACE )
- {
- printf("eglCreateWindowSurface failed\n");
- return 0;
- }
-
- if ( (eglContext = eglCreateContext(eglDisplay, myConfig, 0, 0)) == EGL_NO_CONTEXT )
- {
- printf("eglCreateContext failed\n");
- return 0;
- }
-
- if ( eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext) != EGL_TRUE )
- {
- printf("eglMakeCurrent failed\n");
- return 0;
- }
-
- return 1;
-}
-
-void free_gl_surface(void)
-{
- if (eglDisplay != EGL_NO_DISPLAY)
- {
- eglMakeCurrent( EGL_NO_DISPLAY, EGL_NO_SURFACE,
- EGL_NO_SURFACE, EGL_NO_CONTEXT );
- eglDestroyContext( eglDisplay, eglContext );
- eglDestroySurface( eglDisplay, eglSurface );
- eglTerminate( eglDisplay );
- eglDisplay = EGL_NO_DISPLAY;
- }
-}
-
-void init_scene(void)
-{
+ window, 0)) == EGL_NO_SURFACE ) + { + printf("eglCreateWindowSurface failed\n"); + return 0; + } + + if ( (eglContext = eglCreateContext(eglDisplay, myConfig, 0, 0)) == EGL_NO_CONTEXT ) + { + printf("eglCreateContext failed\n"); + return 0; + } + + if ( eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext) != EGL_TRUE ) + { + printf("eglMakeCurrent failed\n"); + return 0; + } + + int w, h; + + eglQuerySurface(eglDisplay, eglSurface, EGL_WIDTH, &w); + checkEglError("eglQuerySurface"); + eglQuerySurface(eglDisplay, eglSurface, EGL_HEIGHT, &h); + checkEglError("eglQuerySurface"); + GLint dim = w < h ? w : h; + + fprintf(stderr, "Window dimensions: %d x %d\n", w, h); + + printGLString("Version", GL_VERSION); + printGLString("Vendor", GL_VENDOR); + printGLString("Renderer", GL_RENDERER); + printGLString("Extensions", GL_EXTENSIONS); + + return 1; +} + +void free_gl_surface(void) +{ + if (eglDisplay != EGL_NO_DISPLAY) + { + eglMakeCurrent( EGL_NO_DISPLAY, EGL_NO_SURFACE, + EGL_NO_SURFACE, EGL_NO_CONTEXT ); + eglDestroyContext( eglDisplay, eglContext ); + eglDestroySurface( eglDisplay, eglSurface ); + eglTerminate( eglDisplay ); + eglDisplay = EGL_NO_DISPLAY; + } +} + +void init_scene(void) +{ glDisable(GL_DITHER); glEnable(GL_CULL_FACE); - float ratio = 320.0f / 480.0f; glViewport(0, 0, 320, 480); - glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustumf(-ratio, ratio, -1, 1, 1, 10); - - glMatrixMode(GL_MODELVIEW);
+ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt( 0, 0, 3, // eye 0, 0, 0, // center 0, 1, 0); // up -
- glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_VERTEX_ARRAY);
+ glEnable(GL_TEXTURE_2D); + glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); -}
-
-void create_texture(void)
-{
+} + +void create_texture(void) +{ const unsigned int on = 0xff0000ff; const unsigned int off = 0xffffffff; const unsigned int pixels[] = @@ -314,44 +324,42 @@ void create_texture(void) off, on, off, on, off, on, off, on, on, off, on, off, on, off, on, off, off, on, off, on, off, on, off, on, - };
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-}
-
-void render()
-{
+ }; + + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); +} + +void render() +{ int i, j; - int quads = 1;
-
- const GLfloat vertices[] = {
- -1, -1, 0,
- 1, -1, 0,
- 1, 1, 0,
- -1, 1, 0
- };
-
- const GLfixed texCoords[] = {
- 0, 0,
- FIXED_ONE, 0,
- FIXED_ONE, FIXED_ONE,
- 0, FIXED_ONE
- };
-
+ int quads = 1; + + const GLfloat vertices[] = { + -1, -1, 0, + 1, -1, 0, + 1, 1, 0, + -1, 1, 0 + }; + + const GLfixed texCoords[] = { + 0, 0, + FIXED_ONE, 0, + FIXED_ONE, FIXED_ONE, + 0, FIXED_ONE + }; + const GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; -
- glVertexPointer(3, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FIXED, 0, texCoords); + glVertexPointer(3, GL_FLOAT, 0, vertices); + glTexCoordPointer(2, GL_FIXED, 0, texCoords); glClearColor(1.0, 1.0, 1.0, 1.0); - int nelem = sizeof(indices)/sizeof(indices[0]); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glDrawElements(GL_TRIANGLES, nelem, GL_UNSIGNED_SHORT, indices); - eglSwapBuffers(eglDisplay, eglSurface);
-}
- + eglSwapBuffers(eglDisplay, eglSurface); +} diff --git a/opengl/tests/gl_jni/Android.mk b/opengl/tests/gl_jni/Android.mk index 4029fa1..f1bd31d 100644 --- a/opengl/tests/gl_jni/Android.mk +++ b/opengl/tests/gl_jni/Android.mk @@ -11,7 +11,7 @@ TOP_LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE_TAGS := user +LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(call all-subdir-java-files) diff --git a/opengl/tests/gldual/Android.mk b/opengl/tests/gldual/Android.mk new file mode 100644 index 0000000..995a5d7 --- /dev/null +++ b/opengl/tests/gldual/Android.mk @@ -0,0 +1,51 @@ +######################################################################### +# OpenGL ES JNI sample +# This makefile builds both an activity and a shared library. +######################################################################### +ifneq ($(TARGET_SIMULATOR),true) # not 64 bit clean + +TOP_LOCAL_PATH:= $(call my-dir) + +# Build activity + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_PACKAGE_NAME := GLDual + +LOCAL_JNI_SHARED_LIBRARIES := libgldualjni + +include $(BUILD_PACKAGE) + +######################################################################### +# Build JNI Shared Library +######################################################################### + +LOCAL_PATH:= $(LOCAL_PATH)/jni + +include $(CLEAR_VARS) + +# Optional tag would mean it doesn't get installed by default +LOCAL_MODULE_TAGS := optional + +LOCAL_CFLAGS := -Werror + +LOCAL_SRC_FILES:= \ + gl_code.cpp + +LOCAL_SHARED_LIBRARIES := \ + libutils \ + libEGL \ + libGLESv2 + +LOCAL_MODULE := libgldualjni + +LOCAL_PRELINK_MODULE := false + +include $(BUILD_SHARED_LIBRARY) + +endif # TARGET_SIMULATOR diff --git a/opengl/tests/gldual/AndroidManifest.xml b/opengl/tests/gldual/AndroidManifest.xml new file mode 100644 index 0000000..06f4c4d --- /dev/null +++ b/opengl/tests/gldual/AndroidManifest.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2009, 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. +*/ +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.gldual"> + <application + android:label="@string/gldual_activity"> + <activity android:name="GLDualActivity" + android:theme="@android:style/Theme.NoTitleBar.Fullscreen" + android:launchMode="singleTask" + android:configChanges="orientation|keyboardHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/opengl/tests/gldual/jni/gl_code.cpp b/opengl/tests/gldual/jni/gl_code.cpp new file mode 100644 index 0000000..f1f0a1f --- /dev/null +++ b/opengl/tests/gldual/jni/gl_code.cpp @@ -0,0 +1,165 @@ +// OpenGL ES 2.0 code + +#include <nativehelper/jni.h> +#define LOG_TAG "GL2JNI gl_code.cpp" +#include <utils/Log.h> + +#include <EGL/egl.h> +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +static void printGLString(const char *name, GLenum s) { + const char *v = (const char *) glGetString(s); + LOGI("GL %s = %s\n", name, v); +} + +static void checkGlError(const char* op) { + for (GLint error = glGetError(); error; error + = glGetError()) { + LOGI("after %s() glError (0x%x)\n", op, error); + } +} + +static const char gVertexShader[] = "attribute vec4 vPosition;\n" + "void main() {\n" + " gl_Position = vPosition;\n" + "}\n"; + +static const char gFragmentShader[] = "precision mediump float;\n" + "void main() {\n" + " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n" + "}\n"; + +GLuint loadShader(GLenum shaderType, const char* pSource) { + GLuint shader = glCreateShader(shaderType); + if (shader) { + glShaderSource(shader, 1, &pSource, NULL); + glCompileShader(shader); + GLint compiled = 0; + glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + if (!compiled) { + GLint infoLen = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen) { + char* buf = (char*) malloc(infoLen); + if (buf) { + glGetShaderInfoLog(shader, infoLen, NULL, buf); + LOGE("Could not compile shader %d:\n%s\n", + shaderType, buf); + free(buf); + } + glDeleteShader(shader); + shader = 0; + } + } + } + return shader; +} + +GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) { + GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource); + if (!vertexShader) { + return 0; + } + + GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource); + if (!pixelShader) { + return 0; + } + + GLuint program = glCreateProgram(); + if (program) { + glAttachShader(program, vertexShader); + checkGlError("glAttachShader"); + glAttachShader(program, pixelShader); + checkGlError("glAttachShader"); + glLinkProgram(program); + GLint linkStatus = GL_FALSE; + glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); + if (linkStatus != GL_TRUE) { + GLint bufLength = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); + if (bufLength) { + char* buf = (char*) malloc(bufLength); + if (buf) { + glGetProgramInfoLog(program, bufLength, NULL, buf); + LOGE("Could not link program:\n%s\n", buf); + free(buf); + } + } + glDeleteProgram(program); + program = 0; + } + } + return program; +} + +GLuint gProgram; +GLuint gvPositionHandle; + +bool setupGraphics(int w, int h) { + printGLString("Version", GL_VERSION); + printGLString("Vendor", GL_VENDOR); + printGLString("Renderer", GL_RENDERER); + printGLString("Extensions", GL_EXTENSIONS); + + LOGI("setupGraphics(%d, %d)", w, h); + gProgram = createProgram(gVertexShader, gFragmentShader); + if (!gProgram) { + LOGE("Could not create program."); + return false; + } + gvPositionHandle = glGetAttribLocation(gProgram, "vPosition"); + checkGlError("glGetAttribLocation"); + LOGI("glGetAttribLocation(\"vPosition\") = %d\n", + gvPositionHandle); + + glViewport(0, 0, w, h); + checkGlError("glViewport"); + return true; +} + +const GLfloat gTriangleVertices[] = { 0.0f, 0.5f, -0.5f, -0.5f, + 0.5f, -0.5f }; + +void renderFrame() { + static float grey; + grey += 0.01f; + if (grey > 1.0f) { + grey = 0.0f; + } + glClearColor(grey, grey, grey, 1.0f); + checkGlError("glClearColor"); + glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); + checkGlError("glClear"); + + glUseProgram(gProgram); + checkGlError("glUseProgram"); + + glVertexAttribPointer(gvPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, gTriangleVertices); + checkGlError("glVertexAttribPointer"); + glEnableVertexAttribArray(gvPositionHandle); + checkGlError("glEnableVertexAttribArray"); + glDrawArrays(GL_TRIANGLES, 0, 3); + checkGlError("glDrawArrays"); +} + +extern "C" { + JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_init(JNIEnv * env, jobject obj, jint width, jint height); + JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_step(JNIEnv * env, jobject obj); +}; + +JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_init(JNIEnv * env, jobject obj, jint width, jint height)
+{ + setupGraphics(width, height); +} + +JNIEXPORT void JNICALL Java_com_android_gldual_GLDualLib_step(JNIEnv * env, jobject obj) +{ + renderFrame(); +} + diff --git a/opengl/tests/gldual/res/layout/gldual_activity.xml b/opengl/tests/gldual/res/layout/gldual_activity.xml new file mode 100644 index 0000000..d75acbc --- /dev/null +++ b/opengl/tests/gldual/res/layout/gldual_activity.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text" + + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <android.opengl.GLSurfaceView android:id="@+id/gl1" + android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="1" /> + <com.android.gldual.GLDualGL2View android:id="@+id/gl2" + android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="1" /> +</LinearLayout> diff --git a/opengl/tests/gldual/res/values/strings.xml b/opengl/tests/gldual/res/values/strings.xml new file mode 100644 index 0000000..4267dff --- /dev/null +++ b/opengl/tests/gldual/res/values/strings.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2006, 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. +*/ +--> + +<!-- This file contains resource definitions for displayed strings, allowing + them to be changed based on the locale and options. --> + +<resources> + <!-- Simple strings. --> + <string name="gldual_activity">GLDual</string> + +</resources> + diff --git a/opengl/tests/gldual/src/com/android/gldual/GLDualActivity.java b/opengl/tests/gldual/src/com/android/gldual/GLDualActivity.java new file mode 100644 index 0000000..9d88f64 --- /dev/null +++ b/opengl/tests/gldual/src/com/android/gldual/GLDualActivity.java @@ -0,0 +1,53 @@ +/* + * 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. + */ + +package com.android.gldual; + +import android.app.Activity; +import android.content.Context; +import android.opengl.GLSurfaceView; +import android.os.Bundle; +import android.view.View; +import android.widget.LinearLayout; + + +public class GLDualActivity extends Activity { + + GLSurfaceView mGLView; + GLDualGL2View mGL2View; + + @Override protected void onCreate(Bundle icicle) { + super.onCreate(icicle); + View root = getLayoutInflater().inflate(R.layout.gldual_activity, null); + mGLView = (GLSurfaceView) root.findViewById(R.id.gl1); + mGLView.setEGLConfigChooser(5,6,5,0,0,0); + mGLView.setRenderer(new TriangleRenderer()); + mGL2View = (GLDualGL2View) root.findViewById(R.id.gl2); + setContentView(root); + } + + @Override protected void onPause() { + super.onPause(); + mGLView.onPause(); + mGL2View.onPause(); + } + + @Override protected void onResume() { + super.onResume(); + mGLView.onResume(); + mGL2View.onResume(); + } +} diff --git a/opengl/tests/gldual/src/com/android/gldual/GLDualGL2View.java b/opengl/tests/gldual/src/com/android/gldual/GLDualGL2View.java new file mode 100644 index 0000000..8f5e347 --- /dev/null +++ b/opengl/tests/gldual/src/com/android/gldual/GLDualGL2View.java @@ -0,0 +1,299 @@ +/* + * Copyright (C) 2009 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. + */ + +package com.android.gldual; +/* + * Copyright (C) 2008 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. + */ + + +import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.egl.EGLContext; +import javax.microedition.khronos.egl.EGLDisplay; +import javax.microedition.khronos.opengles.GL10; + +import android.content.Context; +import android.opengl.GLSurfaceView; +import android.util.AttributeSet; +import android.util.Log; + +/** + * An implementation of SurfaceView that uses the dedicated surface for + * displaying an OpenGL animation. This allows the animation to run in a + * separate thread, without requiring that it be driven by the update mechanism + * of the view hierarchy. + * + * The application-specific rendering code is delegated to a GLView.Renderer + * instance. + */ +class GLDualGL2View extends GLSurfaceView { + private static String TAG = "GLDualGL2View"; + + public GLDualGL2View(Context context) { + super(context); + init(false, 0, 0); + } + + public GLDualGL2View(Context context, AttributeSet set) { + super(context, set); + init(false, 0, 0); + } + + public GLDualGL2View(Context context, boolean translucent, int depth, int stencil) { + super(context); + init(translucent, depth, stencil); + } + + private void init(boolean translucent, int depth, int stencil) { + setEGLContextFactory(new ContextFactory()); + setEGLConfigChooser( translucent ? + new ConfigChooser(8,8,8,8, depth, stencil) : + new ConfigChooser(5,6,5,0, depth, stencil)); + setRenderer(new Renderer()); + } + + private static class ContextFactory implements GLSurfaceView.EGLContextFactory { + private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098; + public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { + Log.w(TAG, "creating OpenGL ES 2.0 context"); + checkEglError("Before eglCreateContext", egl); + int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; + EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list); + checkEglError("After eglCreateContext", egl); + return context; + } + + public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) { + egl.eglDestroyContext(display, context); + } + } + + private static void checkEglError(String prompt, EGL10 egl) { + int error; + while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) { + Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error)); + } + } + + private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser { + private static int EGL_OPENGL_ES2_BIT = 4; + private static int[] s_configAttribs2 = + { + EGL10.EGL_RED_SIZE, 4, + EGL10.EGL_GREEN_SIZE, 4, + EGL10.EGL_BLUE_SIZE, 4, + EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL10.EGL_NONE + }; + + public ConfigChooser(int r, int g, int b, int a, int depth, int stencil) { + mRedSize = r; + mGreenSize = g; + mBlueSize = b; + mAlphaSize = a; + mDepthSize = depth; + mStencilSize = stencil; + } + + public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) { + + int[] num_config = new int[1]; + egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config); + + int numConfigs = num_config[0]; + + if (numConfigs <= 0) { + throw new IllegalArgumentException("No configs match configSpec"); + } + EGLConfig[] configs = new EGLConfig[numConfigs]; + egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config); + // printConfigs(egl, display, configs); + return chooseConfig(egl, display, configs); + } + + public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display, + EGLConfig[] configs) { + EGLConfig closestConfig = null; + int closestDistance = 1000; + for(EGLConfig config : configs) { + int d = findConfigAttrib(egl, display, config, + EGL10.EGL_DEPTH_SIZE, 0); + int s = findConfigAttrib(egl, display, config, + EGL10.EGL_STENCIL_SIZE, 0); + if (d >= mDepthSize && s>= mStencilSize) { + int r = findConfigAttrib(egl, display, config, + EGL10.EGL_RED_SIZE, 0); + int g = findConfigAttrib(egl, display, config, + EGL10.EGL_GREEN_SIZE, 0); + int b = findConfigAttrib(egl, display, config, + EGL10.EGL_BLUE_SIZE, 0); + int a = findConfigAttrib(egl, display, config, + EGL10.EGL_ALPHA_SIZE, 0); + int distance = Math.abs(r - mRedSize) + + Math.abs(g - mGreenSize) + + Math.abs(b - mBlueSize) + + Math.abs(a - mAlphaSize); + if (distance < closestDistance) { + closestDistance = distance; + closestConfig = config; + } + } + } + return closestConfig; + } + + private int findConfigAttrib(EGL10 egl, EGLDisplay display, + EGLConfig config, int attribute, int defaultValue) { + + if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) { + return mValue[0]; + } + return defaultValue; + } + + private void printConfigs(EGL10 egl, EGLDisplay display, + EGLConfig[] configs) { + int numConfigs = configs.length; + Log.w(TAG, String.format("%d configurations", numConfigs)); + for (int i = 0; i < numConfigs; i++) { + Log.w(TAG, String.format("Configuration %d:\n", i)); + printConfig(egl, display, configs[i]); + } + } + + private void printConfig(EGL10 egl, EGLDisplay display, + EGLConfig config) { + int[] attributes = { + EGL10.EGL_BUFFER_SIZE, + EGL10.EGL_ALPHA_SIZE, + EGL10.EGL_BLUE_SIZE, + EGL10.EGL_GREEN_SIZE, + EGL10.EGL_RED_SIZE, + EGL10.EGL_DEPTH_SIZE, + EGL10.EGL_STENCIL_SIZE, + EGL10.EGL_CONFIG_CAVEAT, + EGL10.EGL_CONFIG_ID, + EGL10.EGL_LEVEL, + EGL10.EGL_MAX_PBUFFER_HEIGHT, + EGL10.EGL_MAX_PBUFFER_PIXELS, + EGL10.EGL_MAX_PBUFFER_WIDTH, + EGL10.EGL_NATIVE_RENDERABLE, + EGL10.EGL_NATIVE_VISUAL_ID, + EGL10.EGL_NATIVE_VISUAL_TYPE, + 0x3030, // EGL10.EGL_PRESERVED_RESOURCES, + EGL10.EGL_SAMPLES, + EGL10.EGL_SAMPLE_BUFFERS, + EGL10.EGL_SURFACE_TYPE, + EGL10.EGL_TRANSPARENT_TYPE, + EGL10.EGL_TRANSPARENT_RED_VALUE, + EGL10.EGL_TRANSPARENT_GREEN_VALUE, + EGL10.EGL_TRANSPARENT_BLUE_VALUE, + 0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB, + 0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA, + 0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL, + 0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL, + EGL10.EGL_LUMINANCE_SIZE, + EGL10.EGL_ALPHA_MASK_SIZE, + EGL10.EGL_COLOR_BUFFER_TYPE, + EGL10.EGL_RENDERABLE_TYPE, + 0x3042 // EGL10.EGL_CONFORMANT + }; + String[] names = { + "EGL_BUFFER_SIZE", + "EGL_ALPHA_SIZE", + "EGL_BLUE_SIZE", + "EGL_GREEN_SIZE", + "EGL_RED_SIZE", + "EGL_DEPTH_SIZE", + "EGL_STENCIL_SIZE", + "EGL_CONFIG_CAVEAT", + "EGL_CONFIG_ID", + "EGL_LEVEL", + "EGL_MAX_PBUFFER_HEIGHT", + "EGL_MAX_PBUFFER_PIXELS", + "EGL_MAX_PBUFFER_WIDTH", + "EGL_NATIVE_RENDERABLE", + "EGL_NATIVE_VISUAL_ID", + "EGL_NATIVE_VISUAL_TYPE", + "EGL_PRESERVED_RESOURCES", + "EGL_SAMPLES", + "EGL_SAMPLE_BUFFERS", + "EGL_SURFACE_TYPE", + "EGL_TRANSPARENT_TYPE", + "EGL_TRANSPARENT_RED_VALUE", + "EGL_TRANSPARENT_GREEN_VALUE", + "EGL_TRANSPARENT_BLUE_VALUE", + "EGL_BIND_TO_TEXTURE_RGB", + "EGL_BIND_TO_TEXTURE_RGBA", + "EGL_MIN_SWAP_INTERVAL", + "EGL_MAX_SWAP_INTERVAL", + "EGL_LUMINANCE_SIZE", + "EGL_ALPHA_MASK_SIZE", + "EGL_COLOR_BUFFER_TYPE", + "EGL_RENDERABLE_TYPE", + "EGL_CONFORMANT" + }; + int[] value = new int[1]; + for (int i = 0; i < attributes.length; i++) { + int attribute = attributes[i]; + String name = names[i]; + if ( egl.eglGetConfigAttrib(display, config, attribute, value)) { + Log.w(TAG, String.format(" %s: %d\n", name, value[0])); + } else { + // Log.w(TAG, String.format(" %s: failed\n", name)); + while (egl.eglGetError() != EGL10.EGL_SUCCESS); + } + } + } + + // Subclasses can adjust these values: + protected int mRedSize; + protected int mGreenSize; + protected int mBlueSize; + protected int mAlphaSize; + protected int mDepthSize; + protected int mStencilSize; + private int[] mValue = new int[1]; + } + + private static class Renderer implements GLSurfaceView.Renderer { + public void onDrawFrame(GL10 gl) { + GLDualLib.step(); + } + + public void onSurfaceChanged(GL10 gl, int width, int height) { + GLDualLib.init(width, height); + } + + public void onSurfaceCreated(GL10 gl, EGLConfig config) { + // Do nothing. + } + } +} + diff --git a/opengl/tests/gldual/src/com/android/gldual/GLDualLib.java b/opengl/tests/gldual/src/com/android/gldual/GLDualLib.java new file mode 100644 index 0000000..d8f765e --- /dev/null +++ b/opengl/tests/gldual/src/com/android/gldual/GLDualLib.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package com.android.gldual; + +// Wrapper for native library + +public class GLDualLib { + + static { + System.loadLibrary("gldualjni"); + } + + /** + * @param width the current view width + * @param height the current view height + */ + public static native void init(int width, int height); + public static native void step(); +} diff --git a/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java b/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java new file mode 100644 index 0000000..a082d47 --- /dev/null +++ b/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2009 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. + */ + +package com.android.gldual; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.nio.ShortBuffer; + +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +import android.opengl.GLSurfaceView; +import android.opengl.GLU; +import android.os.SystemClock; + +public class TriangleRenderer implements GLSurfaceView.Renderer{ + + public TriangleRenderer() { + mTriangle = new Triangle(); + } + + public void onSurfaceCreated(GL10 gl, EGLConfig config) { + /* + * By default, OpenGL enables features that improve quality + * but reduce performance. One might want to tweak that + * especially on software renderer. + */ + gl.glDisable(GL10.GL_DITHER); + + /* + * Some one-time OpenGL initialization can be made here + * probably based on features of this particular context + */ + gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, + GL10.GL_FASTEST); + + gl.glClearColor(.5f, .5f, .5f, 1); + gl.glShadeModel(GL10.GL_SMOOTH); + } + + public void onDrawFrame(GL10 gl) { + /* + * By default, OpenGL enables features that improve quality + * but reduce performance. One might want to tweak that + * especially on software renderer. + */ + gl.glDisable(GL10.GL_DITHER); + + /* + * Usually, the first thing one might want to do is to clear + * the screen. The most efficient way of doing this is to use + * glClear(). + */ + + gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); + + /* + * Now we're ready to draw some 3D objects + */ + + gl.glMatrixMode(GL10.GL_MODELVIEW); + gl.glLoadIdentity(); + + GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f); + + gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); + + long time = SystemClock.uptimeMillis() % 4000L; + float angle = 0.090f * ((int) time); + + gl.glRotatef(angle, 0, 0, 1.0f); + + mTriangle.draw(gl); + } + + public void onSurfaceChanged(GL10 gl, int w, int h) { + gl.glViewport(0, 0, w, h); + + /* + * Set our projection matrix. This doesn't have to be done + * each time we draw, but usually a new projection needs to + * be set when the viewport is resized. + */ + + float ratio = (float) w / h; + gl.glMatrixMode(GL10.GL_PROJECTION); + gl.glLoadIdentity(); + gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7); + + } + + private Triangle mTriangle; +} + +class Triangle { + public Triangle() { + + // Buffers to be passed to gl*Pointer() functions + // must be direct, i.e., they must be placed on the + // native heap where the garbage collector cannot + // move them. + // + // Buffers with multi-byte datatypes (e.g., short, int, float) + // must have their byte order set to native order + + ByteBuffer vbb = ByteBuffer.allocateDirect(VERTS * 3 * 4); + vbb.order(ByteOrder.nativeOrder()); + mFVertexBuffer = vbb.asFloatBuffer(); + + ByteBuffer tbb = ByteBuffer.allocateDirect(VERTS * 2 * 4); + tbb.order(ByteOrder.nativeOrder()); + + ByteBuffer ibb = ByteBuffer.allocateDirect(VERTS * 2); + ibb.order(ByteOrder.nativeOrder()); + mIndexBuffer = ibb.asShortBuffer(); + + // A unit-sided equalateral triangle centered on the origin. + float[] coords = { + // X, Y, Z + -0.5f, -0.25f, 0, + 0.5f, -0.25f, 0, + 0.0f, 0.559016994f, 0 + }; + + for (int i = 0; i < VERTS; i++) { + for(int j = 0; j < 3; j++) { + mFVertexBuffer.put(coords[i*3+j] * 2.0f); + } + } + + for(int i = 0; i < VERTS; i++) { + mIndexBuffer.put((short) i); + } + + mFVertexBuffer.position(0); + mIndexBuffer.position(0); + } + + public void draw(GL10 gl) { + gl.glFrontFace(GL10.GL_CCW); + gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer); + gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, VERTS, + GL10.GL_UNSIGNED_SHORT, mIndexBuffer); + } + + private final static int VERTS = 3; + + private FloatBuffer mFVertexBuffer; + private ShortBuffer mIndexBuffer; +} diff --git a/opengl/tests/swapinterval/Android.mk b/opengl/tests/swapinterval/Android.mk index 619447c..9a4145e 100644 --- a/opengl/tests/swapinterval/Android.mk +++ b/opengl/tests/swapinterval/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ + libutils \ libEGL \ libGLESv1_CM \ libui diff --git a/opengl/tests/testPauseResume/Android.mk b/opengl/tests/testPauseResume/Android.mk new file mode 100644 index 0000000..450473a --- /dev/null +++ b/opengl/tests/testPauseResume/Android.mk @@ -0,0 +1,22 @@ +######################################################################### +# OpenGL ES JNI sample +# This makefile builds both an activity and a shared library. +######################################################################### +ifneq ($(TARGET_SIMULATOR),true) # not 64 bit clean + +TOP_LOCAL_PATH:= $(call my-dir) + +# Build activity + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_PACKAGE_NAME := TestEGL + +include $(BUILD_PACKAGE) + +endif # TARGET_SIMULATOR diff --git a/opengl/tests/testPauseResume/AndroidManifest.xml b/opengl/tests/testPauseResume/AndroidManifest.xml new file mode 100644 index 0000000..3e8e7e7 --- /dev/null +++ b/opengl/tests/testPauseResume/AndroidManifest.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2009, 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. +*/ +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.test"> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <application + android:label="@string/test_activity"> + <activity android:name="TestActivity" + android:theme="@android:style/Theme.NoTitleBar.Fullscreen" + android:launchMode="singleTask" + android:screenOrientation="landscape" + android:configChanges="orientation|keyboardHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/opengl/tests/testPauseResume/README b/opengl/tests/testPauseResume/README new file mode 100644 index 0000000..87db74a --- /dev/null +++ b/opengl/tests/testPauseResume/README @@ -0,0 +1,37 @@ +Repro steps: + +build, install and run the attached test program TestEgl.apk + +The program does not draw anything to the screen, it just prints to the log, so use adb logcat to watch the output. + +Expected behavior: + +constantly increasing "step" count: + + +W/TestActivity( 1885): ****** step 235 resume +W/TestActivity( 1885): step 236 pause +W/TestActivity( 1885): ****** step 236 resume + +and so on. + +Actual behavior: + +W/TestActivity( 1466): ****** step 25 resume +W/TestActivity( 1466): step 26 pause +W/TestActivity( 1466): ****** step 26 resume +W/dalvikvm( 1466): threadid=8: thread exiting with uncaught exception (group=0x4001d7f0) +E/AndroidRuntime( 1466): FATAL EXCEPTION: GLThread 9 +E/AndroidRuntime( 1466): java.lang.RuntimeException: createContext failed: EGL_BAD_ALLOC +E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1067) +E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1059) +E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:925) +E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1236) +E/AndroidRuntime( 1466): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1106) +W/TestActivity( 1466): step 27 pause +W/TestActivity( 1466): ****** step 27 resume +W/TestActivity( 1466): step 28 pause +W/TestActivity( 1466): ****** step 28 resume + + +See http://b/issue?id=2550745 for further details. diff --git a/opengl/tests/testPauseResume/res/values/strings.xml b/opengl/tests/testPauseResume/res/values/strings.xml new file mode 100644 index 0000000..208fe15 --- /dev/null +++ b/opengl/tests/testPauseResume/res/values/strings.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2006, 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. +*/ +--> + +<!-- This file contains resource definitions for displayed strings, allowing + them to be changed based on the locale and options. --> + +<resources> + <!-- Simple strings. --> + <string name="test_activity">Test Egl</string> + +</resources> + diff --git a/opengl/tests/testPauseResume/src/com/android/test/TestActivity.java b/opengl/tests/testPauseResume/src/com/android/test/TestActivity.java new file mode 100644 index 0000000..9dc7132 --- /dev/null +++ b/opengl/tests/testPauseResume/src/com/android/test/TestActivity.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +package com.android.test; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; + +public class TestActivity extends Activity { + private final static String TAG = "TestActivity"; + TestView mView; + boolean mToggle; + int mCount; + final static int PAUSE_DELAY = 100; + Runnable mRunnable = new Runnable() { + public void run() { + if (mToggle) { + Log.w(TAG, "****** step " + mCount + " resume"); + mCount++; + mView.onResume(); + } else { + Log.w(TAG, "step " + mCount + " pause"); + mView.onPause(); + } + mToggle = ! mToggle; + mView.postDelayed(mRunnable, PAUSE_DELAY); + } + }; + + @Override + protected void onCreate(Bundle icicle) { + super.onCreate(icicle); + mView = new TestView(getApplication()); + mView.setFocusableInTouchMode(true); + setContentView(mView); + mView.postDelayed(mRunnable, PAUSE_DELAY); + } + + @Override + protected void onPause() { + super.onPause(); + mView.onPause(); + } + + @Override + protected void onResume() { + super.onResume(); + mView.onResume(); + } +} diff --git a/opengl/tests/testPauseResume/src/com/android/test/TestView.java b/opengl/tests/testPauseResume/src/com/android/test/TestView.java new file mode 100644 index 0000000..8c28f13 --- /dev/null +++ b/opengl/tests/testPauseResume/src/com/android/test/TestView.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2009 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. + */ + +package com.android.test; +/* + * Copyright (C) 2008 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. + */ + + +import android.content.Context; +import android.opengl.GLSurfaceView; +import android.util.AttributeSet; +import android.util.Log; +import android.view.KeyEvent; +import android.view.MotionEvent; + +import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; +/** + * An implementation of SurfaceView that uses the dedicated surface for + * displaying an OpenGL animation. This allows the animation to run in a + * separate thread, without requiring that it be driven by the update mechanism + * of the view hierarchy. + * + * The application-specific rendering code is delegated to a GLView.Renderer + * instance. + */ +class TestView extends GLSurfaceView { + TestView(Context context) { + super(context); + init(); + } + + public TestView(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + private void init() { + setRenderer(new Renderer()); + } + + private class Renderer implements GLSurfaceView.Renderer { + private static final String TAG = "Renderer"; + public void onDrawFrame(GL10 gl) { + // Do nothing. + } + + public void onSurfaceChanged(GL10 gl, int width, int height) { + // Do nothing. + } + + public void onSurfaceCreated(GL10 gl, EGLConfig config) { + // Do nothing. + } + } +} + diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen index 9bff0b2..6c1a231 100755 --- a/opengl/tools/glgen/gen +++ b/opengl/tools/glgen/gen @@ -63,7 +63,7 @@ rm src/*.class pushd out > /dev/null mkdir classes -javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java android/opengl/GLES10.java android/opengl/GLES10Ext.java android/opengl/GLES11.java android/opengl/GLES11Ext.java +javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java android/opengl/GLES10.java android/opengl/GLES10Ext.java android/opengl/GLES11.java android/opengl/GLES11Ext.java android/opengl/GLES20.java popd > /dev/null JAVA_RESULT=$? if [ $JAVA_RESULT -ne 0 ]; then @@ -109,7 +109,7 @@ do compareGenerated ../../java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x done -for x in GLES10 GLES10Ext GLES11 GLES11Ext +for x in GLES10 GLES10Ext GLES11 GLES11Ext GLES20 do compareGenerated ../../java/android/opengl generated/android/opengl ${x}.java compareGenerated ../../../core/jni generated/C android_opengl_${x}.cpp diff --git a/opengl/tools/glgen/specs/gles11/GLES20.spec b/opengl/tools/glgen/specs/gles11/GLES20.spec new file mode 100644 index 0000000..61094d1 --- /dev/null +++ b/opengl/tools/glgen/specs/gles11/GLES20.spec @@ -0,0 +1,142 @@ +void glActiveTexture ( GLenum texture )
+void glAttachShader ( GLuint program, GLuint shader )
+void glBindAttribLocation ( GLuint program, GLuint index, const char *name )
+void glBindBuffer ( GLenum target, GLuint buffer )
+void glBindFramebuffer ( GLenum target, GLuint framebuffer )
+void glBindRenderbuffer ( GLenum target, GLuint renderbuffer )
+void glBindTexture ( GLenum target, GLuint texture )
+void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+void glBlendEquation ( GLenum mode )
+void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha )
+void glBlendFunc ( GLenum sfactor, GLenum dfactor )
+void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
+void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
+GLenum glCheckFramebufferStatus ( GLenum target )
+void glClear ( GLbitfield mask )
+void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+void glClearDepthf ( GLclampf depth )
+void glClearStencil ( GLint s )
+void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
+void glCompileShader ( GLuint shader )
+void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
+void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
+void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
+void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
+GLuint glCreateProgram ( void )
+GLuint glCreateShader ( GLenum type )
+void glCullFace ( GLenum mode )
+void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers )
+void glDeleteProgram ( GLuint program )
+void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers )
+void glDeleteShader ( GLuint shader )
+void glDeleteTextures ( GLsizei n, const GLuint *textures )
+void glDepthFunc ( GLenum func )
+void glDepthMask ( GLboolean flag )
+void glDepthRangef ( GLclampf zNear, GLclampf zFar )
+void glDetachShader ( GLuint program, GLuint shader )
+void glDisable ( GLenum cap )
+void glDisableVertexAttribArray ( GLuint index )
+void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
+void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
+void glEnable ( GLenum cap )
+void glEnableVertexAttribArray ( GLuint index )
+void glFinish ( void )
+void glFlush ( void )
+void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer )
+void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
+void glFrontFace ( GLenum mode )
+void glGenBuffers ( GLsizei n, GLuint *buffers )
+void glGenerateMipmap ( GLenum target )
+void glGenFramebuffers ( GLsizei n, GLuint *framebuffers )
+void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers )
+void glGenTextures ( GLsizei n, GLuint *textures )
+void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders )
+int glGetAttribLocation ( GLuint program, const char *name )
+void glGetBooleanv ( GLenum pname, GLboolean *params )
+void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+GLenum glGetError ( void )
+void glGetFloatv ( GLenum pname, GLfloat *params )
+void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+void glGetIntegerv ( GLenum pname, GLint *params )
+void glGetProgramiv ( GLuint program, GLenum pname, GLint *params )
+void glGetProgramInfoLog ( GLuint program, GLsizei bufsize, GLsizei *length, char *infolog )
+void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params )
+void glGetShaderInfoLog ( GLuint shader, GLsizei bufsize, GLsizei *length, char *infolog )
+void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision )
+void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source )
+const GLubyte * glGetString ( GLenum name )
+void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+void glGetUniformfv ( GLuint program, GLint location, GLfloat *params )
+void glGetUniformiv ( GLuint program, GLint location, GLint *params )
+int glGetUniformLocation ( GLuint program, const char *name )
+void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params )
+void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params )
+// void glGetVertexAttribPointerv ( GLuint index, GLenum pname, void **pointer )
+void glHint ( GLenum target, GLenum mode )
+GLboolean glIsBuffer ( GLuint buffer )
+GLboolean glIsEnabled ( GLenum cap )
+GLboolean glIsFramebuffer ( GLuint framebuffer )
+GLboolean glIsProgram ( GLuint program )
+GLboolean glIsRenderbuffer ( GLuint renderbuffer )
+GLboolean glIsShader ( GLuint shader )
+GLboolean glIsTexture ( GLuint texture )
+void glLineWidth ( GLfloat width )
+void glLinkProgram ( GLuint program )
+void glPixelStorei ( GLenum pname, GLint param )
+void glPolygonOffset ( GLfloat factor, GLfloat units )
+void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
+void glReleaseShaderCompiler ( void )
+void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
+void glSampleCoverage ( GLclampf value, GLboolean invert )
+void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
+void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length )
+void glShaderSource ( GLuint shader )
+void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
+void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask )
+void glStencilMask ( GLuint mask )
+void glStencilMaskSeparate ( GLenum face, GLuint mask )
+void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
+void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass )
+void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
+void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+void glTexParameteri ( GLenum target, GLenum pname, GLint param )
+void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
+void glUniform1f ( GLint location, GLfloat x )
+void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v )
+void glUniform1i ( GLint location, GLint x )
+void glUniform1iv ( GLint location, GLsizei count, const GLint *v )
+void glUniform2f ( GLint location, GLfloat x, GLfloat y )
+void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v )
+void glUniform2i ( GLint location, GLint x, GLint y )
+void glUniform2iv ( GLint location, GLsizei count, const GLint *v )
+void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z )
+void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v )
+void glUniform3i ( GLint location, GLint x, GLint y, GLint z )
+void glUniform3iv ( GLint location, GLsizei count, const GLint *v )
+void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v )
+void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w )
+void glUniform4iv ( GLint location, GLsizei count, const GLint *v )
+void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value )
+void glUseProgram ( GLuint program )
+void glValidateProgram ( GLuint program )
+void glVertexAttrib1f ( GLuint indx, GLfloat x )
+void glVertexAttrib1fv ( GLuint indx, const GLfloat *values )
+void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y )
+void glVertexAttrib2fv ( GLuint indx, const GLfloat *values )
+void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z )
+void glVertexAttrib3fv ( GLuint indx, const GLfloat *values )
+void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+void glVertexAttrib4fv ( GLuint indx, const GLfloat *values )
+void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr )
+void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
\ No newline at end of file diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec index 1468ab9..f917128 100644 --- a/opengl/tools/glgen/specs/gles11/checks.spec +++ b/opengl/tools/glgen/specs/gles11/checks.spec @@ -37,7 +37,6 @@ glBlendEquation unsupported glBlendEquationSeparate unsupported glBlendFuncSeparate unsupported glCheckFramebufferStatusOES unsupported return 0 -glCurrentPaletteMatrixOES unsupported glDeleteFramebuffersOES unsupported glDeleteRenderbuffersOES unsupported glFramebufferRenderbufferOES unsupported @@ -52,11 +51,8 @@ glGetRenderbufferParameterivOES unsupported glGetTexGen unsupported glIsFramebufferOES unsupported return JNI_FALSE glIsRenderbufferOES unsupported return JNI_FALSE -glLoadPaletteFromModelViewMatrixOES unsupported -glMatrixIndexPointerOES unsupported glRenderbufferStorageOES unsupported return false glTexGen unsupported glTexGenf unsupported glTexGeni unsupported glTexGenx unsupported -glWeightPointerOES unsupported diff --git a/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack index ca9e6d2..d6012d9 100644 --- a/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack +++ b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack @@ -7,14 +7,14 @@ void glBlendFuncSeparate ( GLint srcRGB, GLint dstRGB, GLint srcAlpha, GLint dst GLint glCheckFramebufferStatusOES ( GLint target ) void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) void glCopyTexImage2D ( GLint target, GLint level, GLint internalformat, GLint x, GLint y, GLint width, GLint height, GLint border ) -void glDeleteFramebuffersOES ( GLint n, GLint *framebuffers ) -void glDeleteRenderbuffersOES ( GLint n, GLint *renderbuffers ) +void glDeleteFramebuffersOES ( GLint n, GLuint *framebuffers ) +void glDeleteRenderbuffersOES ( GLint n, GLuint *renderbuffers ) void glEnable ( GLint cap ) void glFramebufferRenderbufferOES ( GLint target, GLint attachment, GLint renderbuffertarget, GLint renderbuffer ) void glFramebufferTexture2DOES ( GLint target, GLint attachment, GLint textarget, GLint texture, GLint level ) void glGenerateMipmapOES ( GLint target ) -void glGenFramebuffersOES ( GLint n, GLint *framebuffers ) -void glGenRenderbuffersOES ( GLint n, GLint *renderbuffers ) +void glGenFramebuffersOES ( GLint n, GLuint *framebuffers ) +void glGenRenderbuffersOES ( GLint n, GLuint *renderbuffers ) void glGetFramebufferAttachmentParameterivOES ( GLint target, GLint attachment, GLint pname, GLint *params ) void glGetIntegerv ( GLint pname, GLint *params ) void glGetRenderbufferParameterivOES ( GLint target, GLint pname, GLint *params ) diff --git a/opengl/tools/glgen/specs/jsr239/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks index 063cdc7..9f8a793 100644 --- a/opengl/tools/glgen/specs/jsr239/glspec-checks +++ b/opengl/tools/glgen/specs/jsr239/glspec-checks @@ -29,32 +29,28 @@ glDrawTexfvOES check coords 5 glDrawTexivOES check coords 5 glDrawTexsvOES check coords 5 glDrawTexxvOES check coords 5 -glBindFramebufferOES unsupported -glBindRenderbufferOES unsupported -glBlendEquation unsupported -glBlendEquationSeparate unsupported -glBlendFuncSeparate unsupported -glCheckFramebufferStatusOES unsupported return 0 -glCurrentPaletteMatrixOES unsupported -glDeleteFramebuffersOES unsupported -glDeleteRenderbuffersOES unsupported -glFramebufferRenderbufferOES unsupported -glFramebufferStorageOES unsupported -glFramebufferTexture2DOES unsupported -glGenFramebuffersOES unsupported -glGenRenderbuffersOES unsupported -glGenerateMipmapOES unsupported +glBindFramebufferOES requires OES_framebuffer_object +glBindRenderbufferOES requires OES_framebuffer_object +glBlendEquation requires OES_blend_subtract +glBlendEquationSeparate requires OES_blend_equation_separate +glBlendFuncSeparate requires OES_blend_equation_separate +glCheckFramebufferStatusOES requires OES_framebuffer_object return 0 +glDeleteFramebuffersOES requires OES_framebuffer_object check framebuffers n +glDeleteRenderbuffersOES requires OES_framebuffer_object check renderbuffers n +glFramebufferRenderbufferOES requires OES_framebuffer_object +glFramebufferStorageOES requires OES_framebuffer_object +glFramebufferTexture2DOES requires OES_framebuffer_object +glGenFramebuffersOES requires OES_framebuffer_object check framebuffers n +glGenRenderbuffersOES requires OES_framebuffer_object check renderbuffers n +glGenerateMipmapOES requires OES_framebuffer_object +glGetFramebufferAttachmentParameterivOES requires OES_framebuffer_object +glGetRenderbufferParameterivOES requires OES_framebuffer_object +glIsFramebufferOES requires OES_framebuffer_object return JNI_FALSE +glIsRenderbufferOES requires OES_framebuffer_object return JNI_FALSE +glRenderbufferStorageOES requires OES_framebuffer_object +glGetTexGen requires OES_texture_cube_map +glTexGen requires OES_texture_cube_map +glTexGenf requires OES_texture_cube_map +glTexGeni requires OES_texture_cube_map +glTexGenx requires OES_texture_cube_map glGetBufferParameter unsupported -glGetFramebufferAttachmentParameterivOES unsupported -glGetRenderbufferParameterivOES unsupported -glGetTexGen unsupported -glIsFramebufferOES unsupported return JNI_FALSE -glIsRenderbufferOES unsupported return JNI_FALSE -glLoadPaletteFromModelViewMatrixOES unsupported -glMatrixIndexPointerOES unsupported -glRenderbufferStorageOES unsupported return false -glTexGen unsupported -glTexGenf unsupported -glTexGeni unsupported -glTexGenx unsupported -glWeightPointerOES unsupported diff --git a/opengl/tools/glgen/src/CFunc.java b/opengl/tools/glgen/src/CFunc.java index a89e1c5..4847694 100644 --- a/opengl/tools/glgen/src/CFunc.java +++ b/opengl/tools/glgen/src/CFunc.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2006 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. + */ import java.util.*; diff --git a/opengl/tools/glgen/src/CType.java b/opengl/tools/glgen/src/CType.java index 826c90d..e0f0ca6 100644 --- a/opengl/tools/glgen/src/CType.java +++ b/opengl/tools/glgen/src/CType.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2006 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. + */ public class CType { @@ -44,8 +59,12 @@ public class CType { baseType.equals("void"); } + public boolean isConstCharPointer() { + return isConst && isPointer && baseType.equals("char"); + } + public boolean isTypedPointer() { - return isPointer() && !isVoid(); + return isPointer() && !isVoid() && !isConstCharPointer(); } public void setBaseType(String baseType) { diff --git a/opengl/tools/glgen/src/CodeEmitter.java b/opengl/tools/glgen/src/CodeEmitter.java index ebb9727..3a4834e 100644 --- a/opengl/tools/glgen/src/CodeEmitter.java +++ b/opengl/tools/glgen/src/CodeEmitter.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2006 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. + */ public interface CodeEmitter { diff --git a/opengl/tools/glgen/src/GLESCodeEmitter.java b/opengl/tools/glgen/src/GLESCodeEmitter.java index b303503..d138250 100644 --- a/opengl/tools/glgen/src/GLESCodeEmitter.java +++ b/opengl/tools/glgen/src/GLESCodeEmitter.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2009 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. + */ + import java.io.PrintStream; /** diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java index 3715a96..500cf0b 100644 --- a/opengl/tools/glgen/src/GenerateGL.java +++ b/opengl/tools/glgen/src/GenerateGL.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2006 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. + */ import java.io.BufferedReader; import java.io.File; diff --git a/opengl/tools/glgen/src/GenerateGLES.java b/opengl/tools/glgen/src/GenerateGLES.java index 60775b7..6468957 100644 --- a/opengl/tools/glgen/src/GenerateGLES.java +++ b/opengl/tools/glgen/src/GenerateGLES.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2009 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. + */ import java.io.BufferedReader; import java.io.File; @@ -70,7 +85,7 @@ public class GenerateGLES { // Generate files for(String suffix: new String[] {"GLES10", "GLES10Ext", - "GLES11", "GLES11Ext"}) + "GLES11", "GLES11Ext", "GLES20"}) { BufferedReader spec11Reader = new BufferedReader(new FileReader("specs/gles11/" diff --git a/opengl/tools/glgen/src/JFunc.java b/opengl/tools/glgen/src/JFunc.java index 63c045b..e3d73b6 100644 --- a/opengl/tools/glgen/src/JFunc.java +++ b/opengl/tools/glgen/src/JFunc.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2006 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. + */ import java.util.ArrayList; import java.util.List; diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java index df1177b..deb2f01 100644 --- a/opengl/tools/glgen/src/JType.java +++ b/opengl/tools/glgen/src/JType.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2006 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. + */ import java.util.HashMap; @@ -6,6 +21,7 @@ public class JType { String baseType; boolean isArray; boolean isClass; + boolean isString; static HashMap<CType,JType> typeMapping = new HashMap<CType,JType>(); static HashMap<CType,JType> arrayTypeMapping = new HashMap<CType,JType>(); @@ -27,7 +43,10 @@ public class JType { typeMapping.put(new CType("GLubyte"), new JType("byte")); typeMapping.put(new CType("GLuint"), new JType("int")); typeMapping.put(new CType("void"), new JType("void")); - typeMapping.put(new CType("GLubyte", true, true), new JType("String")); + typeMapping.put(new CType("GLubyte", true, true), new JType("String", false, false)); + typeMapping.put(new CType("char", false, true), new JType("byte")); + typeMapping.put(new CType("char", true, true), new JType("String", false, false)); + typeMapping.put(new CType("int"), new JType("int")); // Untyped pointers map to untyped Buffers typeMapping.put(new CType("GLvoid", true, true), @@ -42,6 +61,8 @@ public class JType { // Typed pointers map to typed Buffers typeMapping.put(new CType("GLboolean", false, true), new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLenum", false, true), + new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLfixed", false, true), new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLfixed", true, true), @@ -54,6 +75,8 @@ public class JType { new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLint", true, true), new JType("java.nio.IntBuffer", true, false)); + typeMapping.put(new CType("GLsizei", false, true), + new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLuint", false, true), new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLuint", true, true), @@ -62,8 +85,11 @@ public class JType { new JType("java.nio.ShortBuffer", true, false)); // Typed pointers map to arrays + offsets + arrayTypeMapping.put(new CType("char", false, true), + new JType("byte", false, true)); arrayTypeMapping.put(new CType("GLboolean", false, true), new JType("boolean", false, true)); + arrayTypeMapping.put(new CType("GLenum", false, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true)); @@ -71,6 +97,8 @@ public class JType { arrayTypeMapping.put(new CType("GLint", false, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLint", true, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLshort", true, true), new JType("short", false, true)); + arrayTypeMapping.put(new CType("GLsizei", false, true), new JType("int", false, true)); + arrayTypeMapping.put(new CType("GLsizei", true, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLuint", false, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true)); @@ -109,6 +137,10 @@ public class JType { return isClass; } + public boolean isString() { + return baseType.equals("String"); + } + public boolean isPrimitive() { return !isClass() && !isArray(); } diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java index 2cdb244..ebaca90 100644 --- a/opengl/tools/glgen/src/JniCodeEmitter.java +++ b/opengl/tools/glgen/src/JniCodeEmitter.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2006 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. + */ + import java.io.PrintStream; import java.util.ArrayList; import java.util.HashSet; @@ -37,6 +53,12 @@ public class JniCodeEmitter { jniName += "L"; } else if (baseType.equals("byte")) { jniName += "B"; + } else if (baseType.equals("String")) { + jniName += "Ljava/lang/String;"; + } else if (baseType.equals("void")) { + // nothing. + } else { + throw new RuntimeException("Uknown primitive basetype " + baseType); } return jniName; } @@ -113,10 +135,15 @@ public class JniCodeEmitter { emitFunction(jfunc, out, false, false); } + boolean isPointerFunc(JFunc jfunc) { + String name = jfunc.getName(); + return (name.endsWith("Pointer") || name.endsWith("PointerOES")) + && jfunc.getCFunc().hasPointerArg(); + } + void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) { boolean isVoid = jfunc.getType().isVoid(); - boolean isPointerFunc = jfunc.getName().endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); if (!isVoid) { out.println(iii + @@ -200,6 +227,8 @@ public class JniCodeEmitter { index += 5; } else if (checks[index].equals("unsupported")) { index += 1; + } else if (checks[index].equals("requires")) { + index += 2; } else if (checks[index].equals("nullAllowed")) { return true; } else { @@ -232,6 +261,8 @@ public class JniCodeEmitter { index += 5; } else if (checks[index].equals("unsupported")) { index += 1; + } else if (checks[index].equals("requires")) { + index += 2; } else if (checks[index].equals("nullAllowed")) { index += 1; } else { @@ -252,6 +283,8 @@ public class JniCodeEmitter { while (index < checks.length) { if (checks[index].equals("unsupported")) { return true; + } else if (checks[index].equals("requires")) { + index += 2; } else if (checks[index].equals("return")) { index += 2; } else if (checks[index].startsWith("check")) { @@ -269,7 +302,34 @@ public class JniCodeEmitter { } return false; } - + + String isRequiresFunc(CFunc cfunc) { + String[] checks = mChecker.getChecks(cfunc.getName()); + int index = 1; + if (checks != null) { + while (index < checks.length) { + if (checks[index].equals("unsupported")) { + index += 1; + } else if (checks[index].equals("requires")) { + return checks[index+1]; + } else if (checks[index].equals("return")) { + index += 2; + } else if (checks[index].startsWith("check")) { + index += 3; + } else if (checks[index].equals("ifcheck")) { + index += 5; + } else if (checks[index].equals("nullAllowed")) { + index += 1; + } else { + System.out.println("Error: unknown keyword \"" + + checks[index] + "\""); + System.exit(0); + } + } + } + return null; + } + void emitNativeBoundsChecks(CFunc cfunc, String cname, PrintStream out, boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) { @@ -354,6 +414,9 @@ public class JniCodeEmitter { } else if (checks[index].equals("unsupported")) { // ignore index += 1; + } else if (checks[index].equals("requires")) { + // ignore + index += 2; } else if (checks[index].equals("nullAllowed")) { // ignore index += 1; @@ -400,9 +463,7 @@ public class JniCodeEmitter { * if !interfaceDecl: public <returntype> func(args) { body } */ void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) { - boolean isPointerFunc = - jfunc.getName().endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); if (!nativeDecl && !interfaceDecl && !isPointerFunc) { // If it's not a pointer function, we've already emitted it @@ -504,6 +565,34 @@ public class JniCodeEmitter { out.println(iii + " (stride >= 0)) {"); out.println(iii + indent + "_vertexPointer = pointer;"); out.println(iii + "}"); + } else if (fname.equals("glPointSizePointerOES")) { + out.println(iii + "if (((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_pointSizePointerOES = pointer;"); + out.println(iii + "}"); + } else if (fname.equals("glMatrixIndexPointerOES")) { + out.println(iii + "if (((size == 2) ||"); + out.println(iii + " (size == 3) ||"); + out.println(iii + " (size == 4)) &&"); + out.println(iii + " ((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_BYTE) ||"); + out.println(iii + " (type == GL_SHORT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_matrixIndexPointerOES = pointer;"); + out.println(iii + "}"); + } else if (fname.equals("glWeightPointer")) { + out.println(iii + "if (((size == 2) ||"); + out.println(iii + " (size == 3) ||"); + out.println(iii + " (size == 4)) &&"); + out.println(iii + " ((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_BYTE) ||"); + out.println(iii + " (type == GL_SHORT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_weightPointerOES = pointer;"); + out.println(iii + "}"); } } @@ -603,9 +692,9 @@ public class JniCodeEmitter { // String outName = "android_" + jfunc.getName(); - boolean isPointerFunc = outName.endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); boolean isVBOPointerFunc = (outName.endsWith("Pointer") || + outName.endsWith("PointerOES") || outName.endsWith("DrawElements")) && !jfunc.getCFunc().hasPointerArg(); if (isPointerFunc) { @@ -629,7 +718,7 @@ public class JniCodeEmitter { } // Append signature to function name - String sig = getJniMangledName(signature).replace('.', '_'); + String sig = getJniMangledName(signature).replace('.', '_').replace('/', '_'); out.print("__" + sig); outName += "__" + sig; @@ -652,6 +741,7 @@ public class JniCodeEmitter { nativeRegistrations.add(s); List<Integer> nonPrimitiveArgs = new ArrayList<Integer>(); + List<Integer> stringArgs = new ArrayList<Integer>(); int numBufferArgs = 0; List<String> bufferArgNames = new ArrayList<String>(); @@ -682,6 +772,9 @@ public class JniCodeEmitter { } else { suffix = ""; } + if (argType.isString()) { + stringArgs.add(new Integer(i)); + } out.print(getJniType(argType) + " " + jfunc.getArgName(i) + suffix); } @@ -692,14 +785,19 @@ public class JniCodeEmitter { int numArrays = 0; int numBuffers = 0; + int numStrings = 0; for (int i = 0; i < nonPrimitiveArgs.size(); i++) { int idx = nonPrimitiveArgs.get(i).intValue(); - if (jfunc.getArgType(idx).isArray()) { + JType argType = jfunc.getArgType(idx); + if (argType.isArray()) { ++numArrays; } - if (jfunc.getArgType(idx).isBuffer()) { + if (argType.isBuffer()) { ++numBuffers; } + if (argType.isString()) { + ++numStrings; + } } // Emit method body @@ -730,13 +828,31 @@ public class JniCodeEmitter { out.println(); return; } - + + String requiresExtension = isRequiresFunc(cfunc); + if (requiresExtension != null) { + out.println(indent + + "if (! supportsExtension(_env, _this, have_" + requiresExtension + "ID)) {"); + out.println(indent + indent + + "_env->ThrowNew(UOEClass,"); + out.println(indent + indent + + " \"" + cfunc.getName() + "\");"); + if (isVoid) { + out.println(indent + indent + " return;"); + } else { + String retval = getErrorReturnValue(cfunc); + out.println(indent + indent + " return " + retval + ";"); + } + out.println(indent + "}"); + } if (mUseContextPointer) { out.println(indent + "android::gl::ogles_context_t *ctx = getContext(_env, _this);"); } - boolean emitExceptionCheck = (numArrays > 0 || numBuffers > 0) && + boolean initializeReturnValue = stringArgs.size() > 0; + + boolean emitExceptionCheck = (numArrays > 0 || numBuffers > 0 || numStrings > 0) && hasNonConstArg(jfunc, cfunc, nonPrimitiveArgs); // mChecker.getChecks(cfunc.getName()) != null @@ -759,6 +875,9 @@ public class JniCodeEmitter { if (retval != null) { out.println(indent + returnType.getDeclaration() + " _returnValue = " + retval + ";"); + } else if (initializeReturnValue) { + out.println(indent + returnType.getDeclaration() + + " _returnValue = 0;"); } else { out.println(indent + returnType.getDeclaration() + " _returnValue;"); @@ -789,7 +908,7 @@ public class JniCodeEmitter { jfunc.getArgName(idx) + "_base = (" + decl + ") 0;"); } - remaining = (numArrays <= 1 && numBuffers <= 1) ? "_remaining" : + remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" : "_" + cname + "Remaining"; out.println(indent + "jint " + remaining + ";"); @@ -803,6 +922,40 @@ public class JniCodeEmitter { out.println(); } + // Emit local variable declaration for strings + if (stringArgs.size() > 0) { + for (int i = 0; i < stringArgs.size(); i++) { + int idx = stringArgs.get(i).intValue(); + int cIndex = jfunc.getArgCIndex(idx); + String cname = cfunc.getArgName(cIndex); + + out.println(indent + "const char* _native" + cname + " = 0;"); + } + + out.println(); + } + + // Null pointer checks and GetStringUTFChars + if (stringArgs.size() > 0) { + for (int i = 0; i < stringArgs.size(); i++) { + int idx = stringArgs.get(i).intValue(); + int cIndex = jfunc.getArgCIndex(idx); + String cname = cfunc.getArgName(cIndex); + + CType type = cfunc.getArgType(jfunc.getArgCIndex(idx)); + String decl = type.getDeclaration(); + out.println(indent + "if (!" + cname + ") {"); + out.println(indent + " _env->ThrowNew(IAEClass, \"" + cname + " == null\");"); + out.println(indent + " goto exit;"); + needsExit = true; + out.println(indent + "}"); + + out.println(indent + "_native" + cname + " = _env->GetStringUTFChars(" + cname + ", 0);"); + } + + out.println(); + } + // Emit 'GetPrimitiveArrayCritical' for arrays // Emit 'GetPointer' calls for Buffer pointers int bufArgIdx = 0; @@ -814,7 +967,7 @@ public class JniCodeEmitter { String cname = cfunc.getArgName(cIndex); offset = numArrays <= 1 ? "offset" : cname + "Offset"; - remaining = (numArrays <= 1 && numBuffers <= 1) ? "_remaining" : + remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" : "_" + cname + "Remaining"; if (jfunc.getArgType(idx).isArray()) { @@ -957,8 +1110,11 @@ public class JniCodeEmitter { out.print(indent + indent + "(" + typecast + - ")" + - cfunc.getArgName(i)); + ")"); + if (cfunc.getArgType(i).isConstCharPointer()) { + out.print("_native"); + } + out.print(cfunc.getArgName(i)); if (i == numArgs - 1) { if (isPointerFunc) { @@ -1025,6 +1181,22 @@ public class JniCodeEmitter { } } + // Emit local variable declaration for strings + if (stringArgs.size() > 0) { + for (int i = 0; i < stringArgs.size(); i++) { + int idx = stringArgs.get(i).intValue(); + int cIndex = jfunc.getArgCIndex(idx); + String cname = cfunc.getArgName(cIndex); + + out.println(indent + "if (_native" + cname + ") {"); + out.println(indent + " _env->ReleaseStringUTFChars(" + cname + ", _native" + cname + ");"); + out.println(indent + "}"); + } + + out.println(); + } + + if (!isVoid) { out.println(indent + "return _returnValue;"); } diff --git a/opengl/tools/glgen/src/Jsr239CodeEmitter.java b/opengl/tools/glgen/src/Jsr239CodeEmitter.java index 335d226..c10efe3 100644 --- a/opengl/tools/glgen/src/Jsr239CodeEmitter.java +++ b/opengl/tools/glgen/src/Jsr239CodeEmitter.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2009 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. + */ + import java.io.PrintStream; /** diff --git a/opengl/tools/glgen/src/ParameterChecker.java b/opengl/tools/glgen/src/ParameterChecker.java index df26acd..bff6d86 100644 --- a/opengl/tools/glgen/src/ParameterChecker.java +++ b/opengl/tools/glgen/src/ParameterChecker.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2006 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. + */ import java.io.BufferedReader; import java.util.HashMap; diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if index 428ccee..c5e34cd 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if @@ -18,6 +18,8 @@ package android.opengl; +import java.nio.Buffer; + public class GLES11Ext { public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009; public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D; @@ -127,4 +129,10 @@ public class GLES11Ext { static { _nativeClassInit(); } -
\ No newline at end of file + + private static final int GL_BYTE = GLES10.GL_BYTE; + private static final int GL_FIXED = GLES10.GL_FIXED; + private static final int GL_FLOAT = GLES10.GL_FLOAT; + private static final int GL_SHORT = GLES10.GL_SHORT; + + private static Buffer _matrixIndexPointerOES;
\ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp index 294d1ce..2548b32 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp @@ -23,6 +23,15 @@ #include <GLES/gl.h> #include <GLES/glext.h> +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +} + static int initialized = 0; static jclass nioAccessClass; @@ -121,5 +130,17 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) commit ? 0 : JNI_ABORT); } +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + } + return (void*) buf; +} // -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if index 26f466f..81572d2 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if @@ -149,3 +149,4 @@ public class GLES11 extends GLES10 { _nativeClassInit(); } + private static Buffer _pointSizePointerOES; diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp index 294d1ce..4c297f7 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp @@ -23,6 +23,13 @@ #include <GLES/gl.h> #include <GLES/glext.h> +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +} + static int initialized = 0; static jclass nioAccessClass; @@ -121,5 +128,18 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) commit ? 0 : JNI_ABORT); } +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + } + return (void*) buf; +} + // -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if new file mode 100644 index 0000000..b615e0a --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if @@ -0,0 +1,330 @@ +** +** Copyright 2009, 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. +*/ + +// This source file is automatically generated + +package android.opengl; + +/** OpenGL ES 2.0 + */ +public class GLES20 { + public static final int GL_ACTIVE_TEXTURE = 0x84E0; + public static final int GL_DEPTH_BUFFER_BIT = 0x00000100; + public static final int GL_STENCIL_BUFFER_BIT = 0x00000400; + public static final int GL_COLOR_BUFFER_BIT = 0x00004000; + public static final int GL_FALSE = 0; + public static final int GL_TRUE = 1; + public static final int GL_POINTS = 0x0000; + public static final int GL_LINES = 0x0001; + public static final int GL_LINE_LOOP = 0x0002; + public static final int GL_LINE_STRIP = 0x0003; + public static final int GL_TRIANGLES = 0x0004; + public static final int GL_TRIANGLE_STRIP = 0x0005; + public static final int GL_TRIANGLE_FAN = 0x0006; + public static final int GL_ZERO = 0; + public static final int GL_ONE = 1; + public static final int GL_SRC_COLOR = 0x0300; + public static final int GL_ONE_MINUS_SRC_COLOR = 0x0301; + public static final int GL_SRC_ALPHA = 0x0302; + public static final int GL_ONE_MINUS_SRC_ALPHA = 0x0303; + public static final int GL_DST_ALPHA = 0x0304; + public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305; + public static final int GL_DST_COLOR = 0x0306; + public static final int GL_ONE_MINUS_DST_COLOR = 0x0307; + public static final int GL_SRC_ALPHA_SATURATE = 0x0308; + public static final int GL_FUNC_ADD = 0x8006; + public static final int GL_BLEND_EQUATION = 0x8009; + public static final int GL_BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ + public static final int GL_BLEND_EQUATION_ALPHA = 0x883D; + public static final int GL_FUNC_SUBTRACT = 0x800A; + public static final int GL_FUNC_REVERSE_SUBTRACT = 0x800B; + public static final int GL_BLEND_DST_RGB = 0x80C8; + public static final int GL_BLEND_SRC_RGB = 0x80C9; + public static final int GL_BLEND_DST_ALPHA = 0x80CA; + public static final int GL_BLEND_SRC_ALPHA = 0x80CB; + public static final int GL_CONSTANT_COLOR = 0x8001; + public static final int GL_ONE_MINUS_CONSTANT_COLOR = 0x8002; + public static final int GL_CONSTANT_ALPHA = 0x8003; + public static final int GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004; + public static final int GL_BLEND_COLOR = 0x8005; + public static final int GL_ARRAY_BUFFER = 0x8892; + public static final int GL_ELEMENT_ARRAY_BUFFER = 0x8893; + public static final int GL_ARRAY_BUFFER_BINDING = 0x8894; + public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + public static final int GL_STREAM_DRAW = 0x88E0; + public static final int GL_STATIC_DRAW = 0x88E4; + public static final int GL_DYNAMIC_DRAW = 0x88E8; + public static final int GL_BUFFER_SIZE = 0x8764; + public static final int GL_BUFFER_USAGE = 0x8765; + public static final int GL_CURRENT_VERTEX_ATTRIB = 0x8626; + public static final int GL_FRONT = 0x0404; + public static final int GL_BACK = 0x0405; + public static final int GL_FRONT_AND_BACK = 0x0408; + public static final int GL_TEXTURE_2D = 0x0DE1; + public static final int GL_CULL_FACE = 0x0B44; + public static final int GL_BLEND = 0x0BE2; + public static final int GL_DITHER = 0x0BD0; + public static final int GL_STENCIL_TEST = 0x0B90; + public static final int GL_DEPTH_TEST = 0x0B71; + public static final int GL_SCISSOR_TEST = 0x0C11; + public static final int GL_POLYGON_OFFSET_FILL = 0x8037; + public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + public static final int GL_SAMPLE_COVERAGE = 0x80A0; + public static final int GL_NO_ERROR = 0; + public static final int GL_INVALID_ENUM = 0x0500; + public static final int GL_INVALID_VALUE = 0x0501; + public static final int GL_INVALID_OPERATION = 0x0502; + public static final int GL_OUT_OF_MEMORY = 0x0505; + public static final int GL_CW = 0x0900; + public static final int GL_CCW = 0x0901; + public static final int GL_LINE_WIDTH = 0x0B21; + public static final int GL_ALIASED_POINT_SIZE_RANGE = 0x846D; + public static final int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E; + public static final int GL_CULL_FACE_MODE = 0x0B45; + public static final int GL_FRONT_FACE = 0x0B46; + public static final int GL_DEPTH_RANGE = 0x0B70; + public static final int GL_DEPTH_WRITEMASK = 0x0B72; + public static final int GL_DEPTH_CLEAR_VALUE = 0x0B73; + public static final int GL_DEPTH_FUNC = 0x0B74; + public static final int GL_STENCIL_CLEAR_VALUE = 0x0B91; + public static final int GL_STENCIL_FUNC = 0x0B92; + public static final int GL_STENCIL_FAIL = 0x0B94; + public static final int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95; + public static final int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96; + public static final int GL_STENCIL_REF = 0x0B97; + public static final int GL_STENCIL_VALUE_MASK = 0x0B93; + public static final int GL_STENCIL_WRITEMASK = 0x0B98; + public static final int GL_STENCIL_BACK_FUNC = 0x8800; + public static final int GL_STENCIL_BACK_FAIL = 0x8801; + public static final int GL_STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; + public static final int GL_STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; + public static final int GL_STENCIL_BACK_REF = 0x8CA3; + public static final int GL_STENCIL_BACK_VALUE_MASK = 0x8CA4; + public static final int GL_STENCIL_BACK_WRITEMASK = 0x8CA5; + public static final int GL_VIEWPORT = 0x0BA2; + public static final int GL_SCISSOR_BOX = 0x0C10; + public static final int GL_COLOR_CLEAR_VALUE = 0x0C22; + public static final int GL_COLOR_WRITEMASK = 0x0C23; + public static final int GL_UNPACK_ALIGNMENT = 0x0CF5; + public static final int GL_PACK_ALIGNMENT = 0x0D05; + public static final int GL_MAX_TEXTURE_SIZE = 0x0D33; + public static final int GL_MAX_VIEWPORT_DIMS = 0x0D3A; + public static final int GL_SUBPIXEL_BITS = 0x0D50; + public static final int GL_RED_BITS = 0x0D52; + public static final int GL_GREEN_BITS = 0x0D53; + public static final int GL_BLUE_BITS = 0x0D54; + public static final int GL_ALPHA_BITS = 0x0D55; + public static final int GL_DEPTH_BITS = 0x0D56; + public static final int GL_STENCIL_BITS = 0x0D57; + public static final int GL_POLYGON_OFFSET_UNITS = 0x2A00; + public static final int GL_POLYGON_OFFSET_FACTOR = 0x8038; + public static final int GL_TEXTURE_BINDING_2D = 0x8069; + public static final int GL_SAMPLE_BUFFERS = 0x80A8; + public static final int GL_SAMPLES = 0x80A9; + public static final int GL_SAMPLE_COVERAGE_VALUE = 0x80AA; + public static final int GL_SAMPLE_COVERAGE_INVERT = 0x80AB; + public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; + public static final int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3; + public static final int GL_DONT_CARE = 0x1100; + public static final int GL_FASTEST = 0x1101; + public static final int GL_NICEST = 0x1102; + public static final int GL_GENERATE_MIPMAP_HINT = 0x8192; + public static final int GL_BYTE = 0x1400; + public static final int GL_UNSIGNED_BYTE = 0x1401; + public static final int GL_SHORT = 0x1402; + public static final int GL_UNSIGNED_SHORT = 0x1403; + public static final int GL_INT = 0x1404; + public static final int GL_UNSIGNED_INT = 0x1405; + public static final int GL_FLOAT = 0x1406; + public static final int GL_FIXED = 0x140C; + public static final int GL_DEPTH_COMPONENT = 0x1902; + public static final int GL_ALPHA = 0x1906; + public static final int GL_RGB = 0x1907; + public static final int GL_RGBA = 0x1908; + public static final int GL_LUMINANCE = 0x1909; + public static final int GL_LUMINANCE_ALPHA = 0x190A; + public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; + public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; + public static final int GL_UNSIGNED_SHORT_5_6_5 = 0x8363; + public static final int GL_FRAGMENT_SHADER = 0x8B30; + public static final int GL_VERTEX_SHADER = 0x8B31; + public static final int GL_MAX_VERTEX_ATTRIBS = 0x8869; + public static final int GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; + public static final int GL_MAX_VARYING_VECTORS = 0x8DFC; + public static final int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; + public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; + public static final int GL_MAX_TEXTURE_IMAGE_UNITS = 0x8872; + public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; + public static final int GL_SHADER_TYPE = 0x8B4F; + public static final int GL_DELETE_STATUS = 0x8B80; + public static final int GL_LINK_STATUS = 0x8B82; + public static final int GL_VALIDATE_STATUS = 0x8B83; + public static final int GL_ATTACHED_SHADERS = 0x8B85; + public static final int GL_ACTIVE_UNIFORMS = 0x8B86; + public static final int GL_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; + public static final int GL_ACTIVE_ATTRIBUTES = 0x8B89; + public static final int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; + public static final int GL_SHADING_LANGUAGE_VERSION = 0x8B8C; + public static final int GL_CURRENT_PROGRAM = 0x8B8D; + public static final int GL_NEVER = 0x0200; + public static final int GL_LESS = 0x0201; + public static final int GL_EQUAL = 0x0202; + public static final int GL_LEQUAL = 0x0203; + public static final int GL_GREATER = 0x0204; + public static final int GL_NOTEQUAL = 0x0205; + public static final int GL_GEQUAL = 0x0206; + public static final int GL_ALWAYS = 0x0207; + public static final int GL_KEEP = 0x1E00; + public static final int GL_REPLACE = 0x1E01; + public static final int GL_INCR = 0x1E02; + public static final int GL_DECR = 0x1E03; + public static final int GL_INVERT = 0x150A; + public static final int GL_INCR_WRAP = 0x8507; + public static final int GL_DECR_WRAP = 0x8508; + public static final int GL_VENDOR = 0x1F00; + public static final int GL_RENDERER = 0x1F01; + public static final int GL_VERSION = 0x1F02; + public static final int GL_EXTENSIONS = 0x1F03; + public static final int GL_NEAREST = 0x2600; + public static final int GL_LINEAR = 0x2601; + public static final int GL_NEAREST_MIPMAP_NEAREST = 0x2700; + public static final int GL_LINEAR_MIPMAP_NEAREST = 0x2701; + public static final int GL_NEAREST_MIPMAP_LINEAR = 0x2702; + public static final int GL_LINEAR_MIPMAP_LINEAR = 0x2703; + public static final int GL_TEXTURE_MAG_FILTER = 0x2800; + public static final int GL_TEXTURE_MIN_FILTER = 0x2801; + public static final int GL_TEXTURE_WRAP_S = 0x2802; + public static final int GL_TEXTURE_WRAP_T = 0x2803; + public static final int GL_TEXTURE = 0x1702; + public static final int GL_TEXTURE_CUBE_MAP = 0x8513; + public static final int GL_TEXTURE_BINDING_CUBE_MAP = 0x8514; + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; + public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; + public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; + public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + public static final int GL_TEXTURE0 = 0x84C0; + public static final int GL_TEXTURE1 = 0x84C1; + public static final int GL_TEXTURE2 = 0x84C2; + public static final int GL_TEXTURE3 = 0x84C3; + public static final int GL_TEXTURE4 = 0x84C4; + public static final int GL_TEXTURE5 = 0x84C5; + public static final int GL_TEXTURE6 = 0x84C6; + public static final int GL_TEXTURE7 = 0x84C7; + public static final int GL_TEXTURE8 = 0x84C8; + public static final int GL_TEXTURE9 = 0x84C9; + public static final int GL_TEXTURE10 = 0x84CA; + public static final int GL_TEXTURE11 = 0x84CB; + public static final int GL_TEXTURE12 = 0x84CC; + public static final int GL_TEXTURE13 = 0x84CD; + public static final int GL_TEXTURE14 = 0x84CE; + public static final int GL_TEXTURE15 = 0x84CF; + public static final int GL_TEXTURE16 = 0x84D0; + public static final int GL_TEXTURE17 = 0x84D1; + public static final int GL_TEXTURE18 = 0x84D2; + public static final int GL_TEXTURE19 = 0x84D3; + public static final int GL_TEXTURE20 = 0x84D4; + public static final int GL_TEXTURE21 = 0x84D5; + public static final int GL_TEXTURE22 = 0x84D6; + public static final int GL_TEXTURE23 = 0x84D7; + public static final int GL_TEXTURE24 = 0x84D8; + public static final int GL_TEXTURE25 = 0x84D9; + public static final int GL_TEXTURE26 = 0x84DA; + public static final int GL_TEXTURE27 = 0x84DB; + public static final int GL_TEXTURE28 = 0x84DC; + public static final int GL_TEXTURE29 = 0x84DD; + public static final int GL_TEXTURE30 = 0x84DE; + public static final int GL_TEXTURE31 = 0x84DF; + public static final int GL_REPEAT = 0x2901; + public static final int GL_CLAMP_TO_EDGE = 0x812F; + public static final int GL_MIRRORED_REPEAT = 0x8370; + public static final int GL_FLOAT_VEC2 = 0x8B50; + public static final int GL_FLOAT_VEC3 = 0x8B51; + public static final int GL_FLOAT_VEC4 = 0x8B52; + public static final int GL_INT_VEC2 = 0x8B53; + public static final int GL_INT_VEC3 = 0x8B54; + public static final int GL_INT_VEC4 = 0x8B55; + public static final int GL_BOOL = 0x8B56; + public static final int GL_BOOL_VEC2 = 0x8B57; + public static final int GL_BOOL_VEC3 = 0x8B58; + public static final int GL_BOOL_VEC4 = 0x8B59; + public static final int GL_FLOAT_MAT2 = 0x8B5A; + public static final int GL_FLOAT_MAT3 = 0x8B5B; + public static final int GL_FLOAT_MAT4 = 0x8B5C; + public static final int GL_SAMPLER_2D = 0x8B5E; + public static final int GL_SAMPLER_CUBE = 0x8B60; + public static final int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; + public static final int GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; + public static final int GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; + public static final int GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; + public static final int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; + public static final int GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; + public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; + public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; + public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + public static final int GL_COMPILE_STATUS = 0x8B81; + public static final int GL_INFO_LOG_LENGTH = 0x8B84; + public static final int GL_SHADER_SOURCE_LENGTH = 0x8B88; + public static final int GL_SHADER_COMPILER = 0x8DFA; + public static final int GL_SHADER_BINARY_FORMATS = 0x8DF8; + public static final int GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9; + public static final int GL_LOW_FLOAT = 0x8DF0; + public static final int GL_MEDIUM_FLOAT = 0x8DF1; + public static final int GL_HIGH_FLOAT = 0x8DF2; + public static final int GL_LOW_INT = 0x8DF3; + public static final int GL_MEDIUM_INT = 0x8DF4; + public static final int GL_HIGH_INT = 0x8DF5; + public static final int GL_FRAMEBUFFER = 0x8D40; + public static final int GL_RENDERBUFFER = 0x8D41; + public static final int GL_RGBA4 = 0x8056; + public static final int GL_RGB5_A1 = 0x8057; + public static final int GL_RGB565 = 0x8D62; + public static final int GL_DEPTH_COMPONENT16 = 0x81A5; + public static final int GL_STENCIL_INDEX = 0x1901; + public static final int GL_STENCIL_INDEX8 = 0x8D48; + public static final int GL_RENDERBUFFER_WIDTH = 0x8D42; + public static final int GL_RENDERBUFFER_HEIGHT = 0x8D43; + public static final int GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; + public static final int GL_RENDERBUFFER_RED_SIZE = 0x8D50; + public static final int GL_RENDERBUFFER_GREEN_SIZE = 0x8D51; + public static final int GL_RENDERBUFFER_BLUE_SIZE = 0x8D52; + public static final int GL_RENDERBUFFER_ALPHA_SIZE = 0x8D53; + public static final int GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54; + public static final int GL_RENDERBUFFER_STENCIL_SIZE = 0x8D55; + public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; + public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; + public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; + public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; + public static final int GL_COLOR_ATTACHMENT0 = 0x8CE0; + public static final int GL_DEPTH_ATTACHMENT = 0x8D00; + public static final int GL_STENCIL_ATTACHMENT = 0x8D20; + public static final int GL_NONE = 0; + public static final int GL_FRAMEBUFFER_COMPLETE = 0x8CD5; + public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; + public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; + public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; + public static final int GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD; + public static final int GL_FRAMEBUFFER_BINDING = 0x8CA6; + public static final int GL_RENDERBUFFER_BINDING = 0x8CA7; + public static final int GL_MAX_RENDERBUFFER_SIZE = 0x84E8; + public static final int GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506; + + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } diff --git a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp new file mode 100644 index 0000000..e451e9a --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp @@ -0,0 +1,150 @@ +** +** Copyright 2009, 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. +*/ + +// This source file is automatically generated + +#include <android_runtime/AndroidRuntime.h> +#include <utils/misc.h> + +#include <assert.h> +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInitBuffer(JNIEnv *_env) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + } + return (void*) buf; +} + +static int +getNumCompressedTextureFormats() { + int numCompressedTextureFormats = 0; + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats); + return numCompressedTextureFormats; +} + +static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { + glVertexAttribPointer(indx, size, type, normalized, stride, pointer); +} + +// -------------------------------------------------------------------------- + diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp new file mode 100644 index 0000000..d92f515 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.cpp @@ -0,0 +1,27 @@ +#include <string.h> + +/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ +static +jstring +android_glGetProgramInfoLog (JNIEnv *_env, jobject _this, jint shader) { + GLint infoLen = 0; + jstring _result = 0; + char* buf = 0; + glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen) { + char* buf = (char*) malloc(infoLen); + if (buf == 0) { + _env->ThrowNew(IAEClass, "out of memory"); + goto exit; + } + glGetProgramInfoLog(shader, infoLen, NULL, buf); + _result = _env->NewStringUTF(buf); + } else { + _result = _env->NewStringUTF(""); + } +exit: + if (buf) { + free(buf); + } + return _result; +}
\ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java new file mode 100644 index 0000000..762df39 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2009 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. + */ + + // C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length, + // GLchar * infoLog); + + public static native String glGetProgramInfoLog( + int program + ); diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.nativeReg new file mode 100644 index 0000000..8553f2d --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.nativeReg @@ -0,0 +1 @@ +{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog }, diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp new file mode 100644 index 0000000..5441d66 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.cpp @@ -0,0 +1,27 @@ +#include <string.h> + +/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ +static +jstring +android_glGetShaderInfoLog (JNIEnv *_env, jobject _this, jint shader) { + GLint infoLen = 0; + jstring _result = 0; + char* buf = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen) { + char* buf = (char*) malloc(infoLen); + if (buf == 0) { + _env->ThrowNew(IAEClass, "out of memory"); + goto exit; + } + glGetShaderInfoLog(shader, infoLen, NULL, buf); + _result = _env->NewStringUTF(buf); + } else { + _result = _env->NewStringUTF(""); + } +exit: + if (buf) { + free(buf); + } + return _result; +}
\ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java new file mode 100644 index 0000000..af529c0 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2009 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. + */ + + // C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length, + // GLchar * infoLog); + + public static native String glGetShaderInfoLog( + int shader + ); diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.nativeReg new file mode 100644 index 0000000..71163c3 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.nativeReg @@ -0,0 +1 @@ +{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog }, diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.java b/opengl/tools/glgen/stubs/gles11/glGetString.java index fba249b..d44a6dd 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetString.java +++ b/opengl/tools/glgen/stubs/gles11/glGetString.java @@ -1,3 +1,19 @@ +/*
+ * Copyright (C) 2009 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.
+ */
+
// C function const GLubyte * glGetString ( GLenum name )
public static native String glGetString(
diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp b/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp new file mode 100644 index 0000000..c274108 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glShaderSource.cpp @@ -0,0 +1,17 @@ + +/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */ +static +void +android_glShaderSource + (JNIEnv *_env, jobject _this, jint shader, jstring string) { + + if (!string) { + _env->ThrowNew(IAEClass, "string == null"); + return; + } + + const char* nativeString = _env->GetStringUTFChars(string, 0); + const char* strings[] = {nativeString}; + glShaderSource(shader, 1, strings, 0); + _env->ReleaseStringUTFChars(string, nativeString); +} diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.java b/opengl/tools/glgen/stubs/gles11/glShaderSource.java new file mode 100644 index 0000000..e9fcef3 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glShaderSource.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2009 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. + */ + + // C function void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint* length ) + + public static native void glShaderSource( + int shader, + String string + ); diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.nativeReg b/opengl/tools/glgen/stubs/gles11/glShaderSource.nativeReg new file mode 100644 index 0000000..b17783a --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glShaderSource.nativeReg @@ -0,0 +1 @@ +{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource }, diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp index 4494643..c2464b0 100644 --- a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp +++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp @@ -23,6 +23,23 @@ #include <GLES/gl.h> #include <GLES/glext.h> +// Work around differences between the generated name and the actual name. + +#define glBlendEquation glBlendEquationOES +#define glBlendEquationSeparate glBlendEquationSeparateOES +#define glBlendFuncSeparate glBlendFuncSeparateOES +#define glGetTexGenfv glGetTexGenfvOES +#define glGetTexGeniv glGetTexGenivOES +#define glGetTexGenxv glGetTexGenxvOES +#define glTexGenf glTexGenfOES +#define glTexGenfv glTexGenfvOES +#define glTexGeni glTexGeniOES +#define glTexGeniv glTexGenivOES +#define glTexGenx glTexGenxOES +#define glTexGenxv glTexGenxvOES + + + /* special calls implemented in Android's GLES wrapper used to more * efficiently bound-check passed arrays */ extern "C" { @@ -34,6 +51,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLsizei count); GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); } static int initialized = 0; @@ -52,6 +75,11 @@ static jmethodID allowIndirectBuffersID; static jfieldID positionID; static jfieldID limitID; static jfieldID elementSizeShiftID; +static jfieldID haveCheckedExtensionsID; +static jfieldID have_OES_blend_equation_separateID; +static jfieldID have_OES_blend_subtractID; +static jfieldID have_OES_framebuffer_objectID; +static jfieldID have_OES_texture_cube_mapID; /* Cache method IDs each time the class is loaded. */ @@ -66,6 +94,11 @@ nativeClassInitBuffer(JNIEnv *_env) jclass g11impClassLocal = _env->FindClass("com/google/android/gles_jni/GLImpl"); G11ImplClass = (jclass) _env->NewGlobalRef(g11impClassLocal); + haveCheckedExtensionsID = _env->GetFieldID(G11ImplClass, "haveCheckedExtensions", "Z"); + have_OES_blend_equation_separateID = _env->GetFieldID(G11ImplClass, "have_OES_blend_equation_separate", "Z"); + have_OES_blend_subtractID = _env->GetFieldID(G11ImplClass, "have_OES_blend_subtract", "Z"); + have_OES_framebuffer_objectID = _env->GetFieldID(G11ImplClass, "have_OES_framebuffer_object", "Z"); + have_OES_texture_cube_mapID = _env->GetFieldID(G11ImplClass, "have_OES_texture_cube_map", "Z"); getBasePointerID = _env->GetStaticMethodID(nioAccessClass, "getBasePointer", "(Ljava/nio/Buffer;)J"); @@ -187,5 +220,63 @@ getNumCompressedTextureFormats() { return numCompressedTextureFormats; } +// Check if the extension at the head of pExtensions is pExtension. Note that pExtensions is +// terminated by either 0 or space, while pExtension is terminated by 0. + +static bool +extensionEqual(const GLubyte* pExtensions, const GLubyte* pExtension) { + while (true) { + char a = *pExtensions++; + char b = *pExtension++; + bool aEnd = a == '\0' || a == ' '; + bool bEnd = b == '\0'; + if ( aEnd || bEnd) { + return aEnd == bEnd; + } + if ( a != b ) { + return false; + } + } +} + +static const GLubyte* +nextExtension(const GLubyte* pExtensions) { + while (true) { + char a = *pExtensions++; + if ( a == '\0') { + return pExtensions-1; + } else if ( a == ' ') { + return pExtensions; + } + } +} + +static bool +checkForExtension(const GLubyte* pExtensions, const GLubyte* pExtension) { + for (;*pExtensions != '\0'; pExtensions = nextExtension(pExtensions)) { + if (extensionEqual(pExtensions, pExtension)) { + return true; + } + } + return false; +} + +static bool +supportsExtension(JNIEnv *_env, jobject impl, jfieldID fieldId) { + if (!_env->GetBooleanField(impl, haveCheckedExtensionsID)) { + _env->SetBooleanField(impl, haveCheckedExtensionsID, true); + const GLubyte* sExtensions = glGetString(GL_EXTENSIONS); + _env->SetBooleanField(impl, have_OES_blend_equation_separateID, + checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_equation_separate")); + _env->SetBooleanField(impl, have_OES_blend_subtractID, + checkForExtension(sExtensions, (const GLubyte*) "GL_OES_blend_subtract")); + _env->SetBooleanField(impl, have_OES_framebuffer_objectID, + checkForExtension(sExtensions, (const GLubyte*) "GL_OES_framebuffer_object")); + _env->SetBooleanField(impl, have_OES_texture_cube_mapID, + checkForExtension(sExtensions, (const GLubyte*) "GL_OES_texture_cube_map")); + } + return _env->GetBooleanField(impl, fieldId); +} + // -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl index fe60c5d..3727106 100644 --- a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl +++ b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl @@ -44,6 +44,15 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack { Buffer _normalPointer = null; Buffer _texCoordPointer = null; Buffer _vertexPointer = null; + Buffer _pointSizePointerOES = null; + Buffer _matrixIndexPointerOES = null; + Buffer _weightPointerOES = null; + + private boolean haveCheckedExtensions; + private boolean have_OES_blend_equation_separate; + private boolean have_OES_blend_subtract; + private boolean have_OES_framebuffer_object; + private boolean have_OES_texture_cube_map; public GLImpl() { } diff --git a/vpn/java/android/net/vpn/VpnManager.java b/vpn/java/android/net/vpn/VpnManager.java index 6df612e..ce522c8 100644 --- a/vpn/java/android/net/vpn/VpnManager.java +++ b/vpn/java/android/net/vpn/VpnManager.java @@ -16,11 +16,15 @@ package android.net.vpn; +import java.io.File; + import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; +import android.os.Environment; +import android.os.SystemProperties; import android.util.Log; /** @@ -65,7 +69,7 @@ public class VpnManager { /** Error code to indicate a successful connection. */ public static final int VPN_ERROR_NO_ERROR = 0; - public static final String PROFILES_PATH = "/data/misc/vpn/profiles"; + public static final String PROFILES_PATH = "/misc/vpn/profiles"; private static final String PACKAGE_PREFIX = VpnManager.class.getPackage().getName() + "."; @@ -77,7 +81,12 @@ public class VpnManager { private static final String ACTION_VPN_SETTINGS = PACKAGE_PREFIX + "SETTINGS"; - private static final String TAG = VpnManager.class.getSimpleName(); + public static final String TAG = VpnManager.class.getSimpleName(); + + // TODO(oam): Test VPN when EFS is enabled (will do later)... + public static String getProfilePath() { + return Environment.getDataDirectory().getPath() + PROFILES_PATH; + } /** * Returns all supported VPN types. diff --git a/vpn/tests/vpntests/Android.mk b/vpn/tests/vpntests/Android.mk new file mode 100644 index 0000000..a19fb56 --- /dev/null +++ b/vpn/tests/vpntests/Android.mk @@ -0,0 +1,14 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +# We only want this apk build for tests. +LOCAL_MODULE_TAGS := tests + +# Include all test java files. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_JAVA_LIBRARIES := android.test.runner +LOCAL_PACKAGE_NAME := FrameworksVpnTests + +include $(BUILD_PACKAGE) + diff --git a/vpn/tests/vpntests/AndroidManifest.xml b/vpn/tests/vpntests/AndroidManifest.xml new file mode 100644 index 0000000..d8405f6 --- /dev/null +++ b/vpn/tests/vpntests/AndroidManifest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 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. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.frameworks.vpntests"> + <uses-permission android:name="android.permission.RECEIVE_SMS"/> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.READ_CONTACTS" /> + <uses-permission android:name="android.permission.WRITE_CONTACTS" /> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" /> + <uses-permission android:name="android.permission.WRITE_APN_SETTINGS" /> + <uses-permission android:name="android.permission.BROADCAST_STICKY" /> + + <application> + <uses-library android:name="android.test.runner" /> + </application> + + <instrumentation + android:name="android.test.InstrumentationTestRunner" + android:targetPackage="com.android.frameworks.vpntests" + android:label="Frameworks VPN Tests" /> +</manifest> diff --git a/vpn/tests/vpntests/src/android/net/vpn/VpnTest.java b/vpn/tests/vpntests/src/android/net/vpn/VpnTest.java new file mode 100755 index 0000000..46a57d3 --- /dev/null +++ b/vpn/tests/vpntests/src/android/net/vpn/VpnTest.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2009 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. + */ + +package android.net.vpn; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.vpn.L2tpProfile; +import android.net.vpn.L2tpIpsecProfile; +import android.net.vpn.L2tpIpsecPskProfile; +import android.net.vpn.PptpProfile; +import android.net.vpn.VpnManager; +import android.net.vpn.VpnProfile; +import android.net.vpn.VpnState; +import android.net.vpn.VpnType; +import android.os.ConditionVariable; +import android.os.Parcel; +import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.SmallTest; +import android.text.TextUtils; + +/** + * Unit test class to test VPN api + * Use the below command to run the vpn unit test only + * runtest vpntest or + * adb shell am instrument -e class 'com.android.unit_tests.VpnTest' + * -w com.android.unit_tests/android.test.InstrumentationTestRunner + */ +public class VpnTest extends AndroidTestCase { + private static final String NAME = "a name"; + private static final String SERVER_NAME = "a server name"; + private static final String ID = "some id"; + private static final String SUFFICES = "some suffices"; + private static final String ROUTES = "some routes"; + private static final String SAVED_NAME = "some name"; + + @Override + public void setUp() { + } + + @Override + public void tearDown() { + } + + @SmallTest + public void testVpnType() { + testVpnType(VpnType.L2TP); + testVpnType(VpnType.L2TP_IPSEC); + testVpnType(VpnType.L2TP_IPSEC_PSK); + testVpnType(VpnType.PPTP); + } + + @SmallTest + public void testVpnProfile() { + VpnState state = VpnState.CONNECTING; + testVpnProfile(createTestProfile(state), state); + } + + @SmallTest + public void testGetType() { + assertEquals(VpnType.L2TP, new L2tpProfile().getType()); + assertEquals(VpnType.L2TP_IPSEC, new L2tpIpsecProfile().getType()); + assertEquals(VpnType.L2TP_IPSEC_PSK, + new L2tpIpsecPskProfile().getType()); + assertEquals(VpnType.PPTP, new PptpProfile().getType()); + } + + @SmallTest + public void testVpnTypes() { + assertTrue(VpnManager.getSupportedVpnTypes().length > 0); + } + + @SmallTest + public void testGetTypeFromManager() { + VpnManager m = new VpnManager(getContext()); + VpnType[] types = VpnManager.getSupportedVpnTypes(); + for (VpnType t : types) { + assertEquals(t, m.createVpnProfile(t).getType()); + } + } + + @SmallTest + public void testParcelable() { + VpnProfile p = createTestProfile(VpnState.CONNECTED); + Parcel parcel = Parcel.obtain(); + p.writeToParcel(parcel, 0); + parcel.setDataPosition(0); + + // VpnState is transient and not saved in the parcel + testVpnProfile(VpnProfile.CREATOR.createFromParcel(parcel), null); + } + + @SmallTest + public void testReceiver() { + final String profileName = "whatever"; + final VpnState state = VpnState.DISCONNECTING; + final ConditionVariable cv = new ConditionVariable(); + cv.close(); + BroadcastReceiver r = new BroadcastReceiver() { + public void onReceive(Context c, Intent i) { + assertEquals(profileName, + i.getStringExtra(VpnManager.BROADCAST_PROFILE_NAME)); + assertEquals(state, i.getSerializableExtra( + VpnManager.BROADCAST_CONNECTION_STATE)); + cv.open(); + } + }; + + VpnManager m = new VpnManager(getContext()); + m.registerConnectivityReceiver(r); + m.broadcastConnectivity(profileName, state); + + // fail it if onReceive() doesn't get executed in 5 sec + assertTrue(cv.block(5000)); + } + + private void testVpnType(VpnType type) { + assertFalse(TextUtils.isEmpty(type.getDisplayName())); + assertNotNull(type.getProfileClass()); + } + + private VpnProfile createTestProfile(VpnState state) { + VpnProfile p = new L2tpProfile(); + p.setName(NAME); + p.setServerName(SERVER_NAME); + p.setId(ID); + p.setDomainSuffices(SUFFICES); + p.setRouteList(ROUTES); + p.setSavedUsername(SAVED_NAME); + p.setState(state); + return p; + } + + private void testVpnProfile(VpnProfile p, VpnState state) { + assertEquals(NAME, p.getName()); + assertEquals(SERVER_NAME, p.getServerName()); + assertEquals(ID, p.getId()); + assertEquals(SUFFICES, p.getDomainSuffices()); + assertEquals(ROUTES, p.getRouteList()); + assertEquals(SAVED_NAME, p.getSavedUsername()); + if (state != null) assertEquals(state, p.getState()); + } +} |