Merge branch 'eclair-plus-aosp' of ssh://android-git.corp.google.com:29418/platform/frameworks/base into eclair-mr2-plus-aosp
This commit is contained in:
@@ -563,7 +563,19 @@ status_t CameraService::Client::setOverlay()
|
|||||||
status_t ret = NO_ERROR;
|
status_t ret = NO_ERROR;
|
||||||
if (mSurface != 0) {
|
if (mSurface != 0) {
|
||||||
if (mOverlayRef.get() == NULL) {
|
if (mOverlayRef.get() == NULL) {
|
||||||
|
|
||||||
|
// FIXME:
|
||||||
|
// Surfaceflinger may hold onto the previous overlay reference for some
|
||||||
|
// time after we try to destroy it. retry a few times. In the future, we
|
||||||
|
// should make the destroy call block, or possibly specify that we can
|
||||||
|
// 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);
|
||||||
|
if (mOverlayRef != NULL) break;
|
||||||
|
LOGD("Overlay create failed - retrying");
|
||||||
|
usleep(20000);
|
||||||
|
}
|
||||||
if ( mOverlayRef.get() == NULL )
|
if ( mOverlayRef.get() == NULL )
|
||||||
{
|
{
|
||||||
LOGE("Overlay Creation Failed!");
|
LOGE("Overlay Creation Failed!");
|
||||||
|
|||||||
@@ -290,6 +290,11 @@ public class SimpleMesh extends BaseObj {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addTriangle(int idx1, int idx2, int idx3) {
|
public void addTriangle(int idx1, int idx2, int idx3) {
|
||||||
|
if((idx1 >= mVtxCount) || (idx1 < 0) ||
|
||||||
|
(idx2 >= mVtxCount) || (idx2 < 0) ||
|
||||||
|
(idx3 >= mVtxCount) || (idx3 < 0)) {
|
||||||
|
throw new IllegalStateException("Index provided greater than vertex count.");
|
||||||
|
}
|
||||||
if ((mIndexCount + 3) >= mIndexData.length) {
|
if ((mIndexCount + 3) >= mIndexData.length) {
|
||||||
short t[] = new short[mIndexData.length * 2];
|
short t[] = new short[mIndexData.length * 2];
|
||||||
System.arraycopy(mIndexData, 0, t, 0, mIndexData.length);
|
System.arraycopy(mIndexData, 0, t, 0, mIndexData.length);
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public:
|
|||||||
|
|
||||||
uint32_t getMessageToClient(void *data, size_t *receiveLen, size_t bufferLen, bool wait);
|
uint32_t getMessageToClient(void *data, size_t *receiveLen, size_t bufferLen, bool wait);
|
||||||
bool sendMessageToClient(void *data, uint32_t cmdID, size_t len, bool waitForSpace);
|
bool sendMessageToClient(void *data, uint32_t cmdID, size_t len, bool waitForSpace);
|
||||||
|
bool runScript(Script *s, uint32_t launchID);
|
||||||
|
|
||||||
void initToClient();
|
void initToClient();
|
||||||
void deinitToClient();
|
void deinitToClient();
|
||||||
@@ -212,7 +213,6 @@ private:
|
|||||||
|
|
||||||
void initEGL();
|
void initEGL();
|
||||||
|
|
||||||
bool runScript(Script *s, uint32_t launchID);
|
|
||||||
bool runRootScript();
|
bool runRootScript();
|
||||||
|
|
||||||
static void * threadProc(void *);
|
static void * threadProc(void *);
|
||||||
|
|||||||
@@ -1008,6 +1008,13 @@ static uint32_t SC_toClient(void *data, int cmdID, int len, int waitForSpace)
|
|||||||
return rsc->sendMessageToClient(data, cmdID, len, waitForSpace != 0);
|
return rsc->sendMessageToClient(data, cmdID, len, waitForSpace != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SC_scriptCall(int scriptID)
|
||||||
|
{
|
||||||
|
GET_TLS();
|
||||||
|
rsc->runScript((Script *)scriptID, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Class implementation
|
// Class implementation
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1289,6 +1296,9 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
|
|||||||
{ "debugHexI32", (void *)&SC_debugHexI32,
|
{ "debugHexI32", (void *)&SC_debugHexI32,
|
||||||
"void", "(void *, int)" },
|
"void", "(void *, int)" },
|
||||||
|
|
||||||
|
{ "scriptCall", (void *)&SC_scriptCall,
|
||||||
|
"void", "(int)" },
|
||||||
|
|
||||||
|
|
||||||
{ NULL, NULL, NULL, NULL }
|
{ NULL, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -454,11 +454,11 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
|
|||||||
|
|
||||||
// recompute visible region
|
// recompute visible region
|
||||||
recomputeVisibleRegions = true;
|
recomputeVisibleRegions = true;
|
||||||
|
}
|
||||||
|
|
||||||
// we now have the correct size, unfreeze the screen
|
// we now have the correct size, unfreeze the screen
|
||||||
mFreezeLock.clear();
|
mFreezeLock.clear();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (lcblk->getQueuedCount()) {
|
if (lcblk->getQueuedCount()) {
|
||||||
// signal an event if we have more buffers waiting
|
// signal an event if we have more buffers waiting
|
||||||
|
|||||||
@@ -746,6 +746,8 @@ status_t Surface::getBufferLocked(int index, int usage)
|
|||||||
currentBuffer->setIndex(index);
|
currentBuffer->setIndex(index);
|
||||||
mNeedFullUpdate = true;
|
mNeedFullUpdate = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
err = err<0 ? err : NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -68,19 +68,22 @@ class DeviceStorageMonitorService extends Binder {
|
|||||||
private static final int EVENT_LOG_FREE_STORAGE_LEFT = 2746;
|
private static final int EVENT_LOG_FREE_STORAGE_LEFT = 2746;
|
||||||
private static final long DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD = 2 * 1024 * 1024; // 2MB
|
private static final long DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD = 2 * 1024 * 1024; // 2MB
|
||||||
private static final long DEFAULT_CHECK_INTERVAL = MONITOR_INTERVAL*60*1000;
|
private static final long DEFAULT_CHECK_INTERVAL = MONITOR_INTERVAL*60*1000;
|
||||||
private long mFreeMem;
|
private long mFreeMem; // on /data
|
||||||
private long mLastReportedFreeMem;
|
private long mLastReportedFreeMem;
|
||||||
private long mLastReportedFreeMemTime;
|
private long mLastReportedFreeMemTime;
|
||||||
private boolean mLowMemFlag=false;
|
private boolean mLowMemFlag=false;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private ContentResolver mContentResolver;
|
private ContentResolver mContentResolver;
|
||||||
long mBlkSize;
|
private long mTotalMemory; // on /data
|
||||||
long mTotalMemory;
|
private StatFs mDataFileStats;
|
||||||
StatFs mFileStats;
|
private StatFs mSystemFileStats;
|
||||||
|
private StatFs mCacheFileStats;
|
||||||
private static final String DATA_PATH = "/data";
|
private static final String DATA_PATH = "/data";
|
||||||
long mThreadStartTime = -1;
|
private static final String SYSTEM_PATH = "/system";
|
||||||
boolean mClearSucceeded = false;
|
private static final String CACHE_PATH = "/cache";
|
||||||
boolean mClearingCache;
|
private long mThreadStartTime = -1;
|
||||||
|
private boolean mClearSucceeded = false;
|
||||||
|
private boolean mClearingCache;
|
||||||
private Intent mStorageLowIntent;
|
private Intent mStorageLowIntent;
|
||||||
private Intent mStorageOkIntent;
|
private Intent mStorageOkIntent;
|
||||||
private CachePackageDataObserver mClearCacheObserver;
|
private CachePackageDataObserver mClearCacheObserver;
|
||||||
@@ -119,8 +122,13 @@ class DeviceStorageMonitorService extends Binder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final void restatDataDir() {
|
private final void restatDataDir() {
|
||||||
mFileStats.restat(DATA_PATH);
|
try {
|
||||||
mFreeMem = mFileStats.getAvailableBlocks()*mBlkSize;
|
mDataFileStats.restat(DATA_PATH);
|
||||||
|
mFreeMem = (long) mDataFileStats.getAvailableBlocks() *
|
||||||
|
mDataFileStats.getBlockSize();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// use the old value of mFreeMem
|
||||||
|
}
|
||||||
// Allow freemem to be overridden by debug.freemem for testing
|
// Allow freemem to be overridden by debug.freemem for testing
|
||||||
String debugFreeMem = SystemProperties.get("debug.freemem");
|
String debugFreeMem = SystemProperties.get("debug.freemem");
|
||||||
if (!"".equals(debugFreeMem)) {
|
if (!"".equals(debugFreeMem)) {
|
||||||
@@ -135,7 +143,24 @@ class DeviceStorageMonitorService extends Binder {
|
|||||||
if((mLastReportedFreeMemTime == 0) ||
|
if((mLastReportedFreeMemTime == 0) ||
|
||||||
(currTime-mLastReportedFreeMemTime) >= freeMemLogInterval) {
|
(currTime-mLastReportedFreeMemTime) >= freeMemLogInterval) {
|
||||||
mLastReportedFreeMemTime = currTime;
|
mLastReportedFreeMemTime = currTime;
|
||||||
EventLog.writeEvent(EVENT_LOG_FREE_STORAGE_LEFT, mFreeMem);
|
long mFreeSystem = -1, mFreeCache = -1;
|
||||||
|
try {
|
||||||
|
mSystemFileStats.restat(SYSTEM_PATH);
|
||||||
|
mFreeSystem = (long) mSystemFileStats.getAvailableBlocks() *
|
||||||
|
mSystemFileStats.getBlockSize();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// ignore; report -1
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
mCacheFileStats.restat(CACHE_PATH);
|
||||||
|
mFreeCache = (long) mCacheFileStats.getAvailableBlocks() *
|
||||||
|
mCacheFileStats.getBlockSize();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// ignore; report -1
|
||||||
|
}
|
||||||
|
mCacheFileStats.restat(CACHE_PATH);
|
||||||
|
EventLog.writeEvent(EVENT_LOG_FREE_STORAGE_LEFT,
|
||||||
|
mFreeMem, mFreeSystem, mFreeCache);
|
||||||
}
|
}
|
||||||
// Read the reporting threshold from Gservices
|
// Read the reporting threshold from Gservices
|
||||||
long threshold = Gservices.getLong(mContentResolver,
|
long threshold = Gservices.getLong(mContentResolver,
|
||||||
@@ -247,11 +272,12 @@ class DeviceStorageMonitorService extends Binder {
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
mContentResolver = mContext.getContentResolver();
|
mContentResolver = mContext.getContentResolver();
|
||||||
//create StatFs object
|
//create StatFs object
|
||||||
mFileStats = new StatFs(DATA_PATH);
|
mDataFileStats = new StatFs(DATA_PATH);
|
||||||
//initialize block size
|
mSystemFileStats = new StatFs(SYSTEM_PATH);
|
||||||
mBlkSize = mFileStats.getBlockSize();
|
mCacheFileStats = new StatFs(CACHE_PATH);
|
||||||
//initialize total storage on device
|
//initialize total storage on device
|
||||||
mTotalMemory = ((long)mFileStats.getBlockCount()*mBlkSize)/100L;
|
mTotalMemory = ((long)mDataFileStats.getBlockCount() *
|
||||||
|
mDataFileStats.getBlockSize())/100L;
|
||||||
mStorageLowIntent = new Intent(Intent.ACTION_DEVICE_STORAGE_LOW);
|
mStorageLowIntent = new Intent(Intent.ACTION_DEVICE_STORAGE_LOW);
|
||||||
mStorageOkIntent = new Intent(Intent.ACTION_DEVICE_STORAGE_OK);
|
mStorageOkIntent = new Intent(Intent.ACTION_DEVICE_STORAGE_OK);
|
||||||
checkMemory(true);
|
checkMemory(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user