diff options
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/MountService.java | 25 | ||||
-rw-r--r-- | services/java/com/android/server/am/UriPermission.java | 6 | ||||
-rw-r--r-- | services/java/com/android/server/sip/SipSessionGroup.java | 29 |
3 files changed, 52 insertions, 8 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; |