summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/MountService.java25
-rw-r--r--services/java/com/android/server/am/UriPermission.java6
-rw-r--r--services/java/com/android/server/sip/SipSessionGroup.java29
-rw-r--r--services/sensorservice/SensorService.cpp2
-rw-r--r--services/sensorservice/tests/sensorservicetest.cpp17
-rw-r--r--services/surfaceflinger/DisplayHardware/DisplayHardware.cpp4
-rw-r--r--services/surfaceflinger/DisplayHardware/DisplayHardware.h3
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp19
8 files changed, 87 insertions, 18 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 6e8b42e..cfba07a 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -826,6 +826,15 @@ class MountService extends IMountService.Stub
if (!getVolumeState(path).equals(Environment.MEDIA_MOUNTED)) {
return VoldResponseCode.OpFailedVolNotMounted;
}
+
+ /*
+ * Force a GC to make sure AssetManagers in other threads of the
+ * system_server are cleaned up. We have to do this since AssetManager
+ * instances are kept as a WeakReference and it's possible we have files
+ * open on the external storage.
+ */
+ Runtime.getRuntime().gc();
+
// Redundant probably. But no harm in updating state again.
mPms.updateExternalMediaStatus(false, false);
try {
@@ -1277,6 +1286,14 @@ class MountService extends IMountService.Stub
waitForReady();
warnOnNotMounted();
+ /*
+ * Force a GC to make sure AssetManagers in other threads of the
+ * system_server are cleaned up. We have to do this since AssetManager
+ * instances are kept as a WeakReference and it's possible we have files
+ * open on the external storage.
+ */
+ Runtime.getRuntime().gc();
+
int rc = StorageResultCode.OperationSucceeded;
try {
mConnector.doCommand(String.format("asec destroy %s%s", id, (force ? " force" : "")));
@@ -1341,6 +1358,14 @@ class MountService extends IMountService.Stub
}
}
+ /*
+ * Force a GC to make sure AssetManagers in other threads of the
+ * system_server are cleaned up. We have to do this since AssetManager
+ * instances are kept as a WeakReference and it's possible we have files
+ * open on the external storage.
+ */
+ Runtime.getRuntime().gc();
+
int rc = StorageResultCode.OperationSucceeded;
String cmd = String.format("asec unmount %s%s", id, (force ? " force" : ""));
try {
diff --git a/services/java/com/android/server/am/UriPermission.java b/services/java/com/android/server/am/UriPermission.java
index c95546e..0cb6943 100644
--- a/services/java/com/android/server/am/UriPermission.java
+++ b/services/java/com/android/server/am/UriPermission.java
@@ -45,8 +45,8 @@ class UriPermission {
uri = _uri;
}
- void clearModes(int modeFlags) {
- if ((modeFlags&Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
+ void clearModes(int modeFlagsToClear) {
+ if ((modeFlagsToClear&Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
globalModeFlags &= ~Intent.FLAG_GRANT_READ_URI_PERMISSION;
modeFlags &= ~Intent.FLAG_GRANT_READ_URI_PERMISSION;
if (readOwners.size() > 0) {
@@ -56,7 +56,7 @@ class UriPermission {
readOwners.clear();
}
}
- if ((modeFlags&Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
+ if ((modeFlagsToClear&Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
globalModeFlags &= ~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
modeFlags &= ~Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
if (readOwners.size() > 0) {
diff --git a/services/java/com/android/server/sip/SipSessionGroup.java b/services/java/com/android/server/sip/SipSessionGroup.java
index 06b6ec9..a3bf3eb 100644
--- a/services/java/com/android/server/sip/SipSessionGroup.java
+++ b/services/java/com/android/server/sip/SipSessionGroup.java
@@ -712,9 +712,15 @@ class SipSessionGroup implements SipListener {
case Response.UNAUTHORIZED:
case Response.PROXY_AUTHENTICATION_REQUIRED:
if (!handleAuthentication(event)) {
- Log.v(TAG, "Incorrect username/password");
- onRegistrationFailed(SipErrorCode.INVALID_CREDENTIALS,
- "incorrect username or password");
+ if (mLastNonce == null) {
+ onRegistrationFailed(SipErrorCode.SERVER_ERROR,
+ "server does not provide challenge");
+ } else {
+ Log.v(TAG, "Incorrect username/password");
+ onRegistrationFailed(
+ SipErrorCode.INVALID_CREDENTIALS,
+ "incorrect username or password");
+ }
}
return true;
default:
@@ -869,6 +875,9 @@ class SipSessionGroup implements SipListener {
case Response.PROXY_AUTHENTICATION_REQUIRED:
if (handleAuthentication(event)) {
addSipSession(this);
+ } else if (mLastNonce == null) {
+ endCallOnError(SipErrorCode.SERVER_ERROR,
+ "server does not provide challenge");
} else {
endCallOnError(SipErrorCode.INVALID_CREDENTIALS,
"incorrect username or password");
@@ -1027,8 +1036,7 @@ class SipSessionGroup implements SipListener {
private void onError(Response response) {
int statusCode = response.getStatusCode();
- if (!mInCall && ((statusCode == Response.TEMPORARILY_UNAVAILABLE)
- || (statusCode == Response.BUSY_HERE))) {
+ if (!mInCall && (statusCode == Response.BUSY_HERE)) {
endCallOnBusy();
} else {
onError(getErrorCode(statusCode), createErrorMessage(response));
@@ -1037,11 +1045,22 @@ class SipSessionGroup implements SipListener {
private SipErrorCode getErrorCode(int responseStatusCode) {
switch (responseStatusCode) {
+ case Response.TEMPORARILY_UNAVAILABLE:
+ case Response.FORBIDDEN:
+ case Response.GONE:
case Response.NOT_FOUND:
+ case Response.NOT_ACCEPTABLE:
+ case Response.NOT_ACCEPTABLE_HERE:
+ return SipErrorCode.PEER_NOT_REACHABLE;
+
+ case Response.REQUEST_URI_TOO_LONG:
case Response.ADDRESS_INCOMPLETE:
+ case Response.AMBIGUOUS:
return SipErrorCode.INVALID_REMOTE_URI;
+
case Response.REQUEST_TIMEOUT:
return SipErrorCode.TIME_OUT;
+
default:
if (responseStatusCode < 500) {
return SipErrorCode.CLIENT_ERROR;
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 3025f77..e204e04 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -529,7 +529,7 @@ status_t SensorService::SensorEventConnection::sendEvents(
LOGE_IF(size<0, "dropping %d events on the floor (%s)",
count, strerror(-size));
- return size < 0 ? size : NO_ERROR;
+ return size < 0 ? status_t(size) : status_t(NO_ERROR);
}
sp<SensorChannel> SensorService::SensorEventConnection::getSensorChannel() const
diff --git a/services/sensorservice/tests/sensorservicetest.cpp b/services/sensorservice/tests/sensorservicetest.cpp
index e464713..42bf983 100644
--- a/services/sensorservice/tests/sensorservicetest.cpp
+++ b/services/sensorservice/tests/sensorservicetest.cpp
@@ -18,11 +18,11 @@
#include <gui/Sensor.h>
#include <gui/SensorManager.h>
#include <gui/SensorEventQueue.h>
-#include <utils/PollLoop.h>
+#include <utils/Looper.h>
using namespace android;
-bool receiver(int fd, int events, void* data)
+int receiver(int fd, int events, void* data)
{
sp<SensorEventQueue> q((SensorEventQueue*)data);
ssize_t n;
@@ -41,7 +41,7 @@ bool receiver(int fd, int events, void* data)
if (n<0 && n != -EAGAIN) {
printf("error reading events (%s)\n", strerror(-n));
}
- return true;
+ return 1;
}
@@ -51,7 +51,7 @@ int main(int argc, char** argv)
Sensor const* const* list;
ssize_t count = mgr.getSensorList(&list);
- printf("numSensors=%d\n", count);
+ printf("numSensors=%d\n", int(count));
sp<SensorEventQueue> q = mgr.createEventQueue();
printf("queue=%p\n", q.get());
@@ -63,13 +63,16 @@ int main(int argc, char** argv)
q->setEventRate(accelerometer, ms2ns(10));
- sp<PollLoop> loop = new PollLoop(false);
- loop->setCallback(q->getFd(), POLLIN, receiver, q.get());
+ sp<Looper> loop = new Looper(false);
+ loop->addFd(q->getFd(), 0, ALOOPER_EVENT_INPUT, receiver, q.get());
do {
//printf("about to poll...\n");
- int32_t ret = loop->pollOnce(-1, 0, 0);
+ int32_t ret = loop->pollOnce(-1);
switch (ret) {
+ case ALOOPER_POLL_WAKE:
+ //("ALOOPER_POLL_WAKE\n");
+ break;
case ALOOPER_POLL_CALLBACK:
//("ALOOPER_POLL_CALLBACK\n");
break;
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index 2eac0a8..0515110 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -296,6 +296,10 @@ status_t DisplayHardware::compositionComplete() const {
return mNativeWindow->compositionComplete();
}
+int DisplayHardware::getCurrentBufferIndex() const {
+ return mNativeWindow->getCurrentBufferIndex();
+}
+
void DisplayHardware::flip(const Region& dirty) const
{
checkGLErrors();
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.h b/services/surfaceflinger/DisplayHardware/DisplayHardware.h
index 66bf521..2d7900c 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.h
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.h
@@ -87,6 +87,9 @@ public:
return Rect(mWidth, mHeight);
}
+ // only for debugging
+ int getCurrentBufferIndex() const;
+
private:
void init(uint32_t displayIndex) __attribute__((noinline));
void fini() __attribute__((noinline));
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 637ae48..f199ca9 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -38,6 +38,7 @@
#include <utils/StopWatch.h>
#include <ui/GraphicBufferAllocator.h>
+#include <ui/GraphicLog.h>
#include <ui/PixelFormat.h>
#include <pixelflinger/pixelflinger.h>
@@ -371,15 +372,25 @@ bool SurfaceFlinger::threadLoop()
const DisplayHardware& hw(graphicPlane(0).displayHardware());
if (LIKELY(hw.canDraw() && !isFrozen())) {
// repaint the framebuffer (if needed)
+
+ const int index = hw.getCurrentBufferIndex();
+ GraphicLog& logger(GraphicLog::getInstance());
+
+ logger.log(GraphicLog::SF_REPAINT, index);
handleRepaint();
// inform the h/w that we're done compositing
+ logger.log(GraphicLog::SF_COMPOSITION_COMPLETE, index);
hw.compositionComplete();
// release the clients before we flip ('cause flip might block)
+ logger.log(GraphicLog::SF_UNLOCK_CLIENTS, index);
unlockClients();
+ logger.log(GraphicLog::SF_SWAP_BUFFERS, index);
postFramebuffer();
+
+ logger.log(GraphicLog::SF_REPAINT_DONE, index);
} else {
// pretend we did the post
unlockClients();
@@ -1470,8 +1481,7 @@ status_t SurfaceFlinger::onTransact(
int n;
switch (code) {
case 1000: // SHOW_CPU, NOT SUPPORTED ANYMORE
- return NO_ERROR;
- case 1001: // SHOW_FPS, NOT SUPPORTED ANYMORE
+ case 1001: // SHOW_FPS, NOT SUPPORTED ANYMORE
return NO_ERROR;
case 1002: // SHOW_UPDATES
n = data.readInt32();
@@ -1492,6 +1502,11 @@ status_t SurfaceFlinger::onTransact(
setTransactionFlags(eTransactionNeeded|eTraversalNeeded);
return NO_ERROR;
}
+ case 1006:{ // enable/disable GraphicLog
+ int enabled = data.readInt32();
+ GraphicLog::getInstance().setEnabled(enabled);
+ return NO_ERROR;
+ }
case 1007: // set mFreezeCount
mFreezeCount = data.readInt32();
mFreezeDisplayTime = 0;