diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index ca8660c0ba927..642c943ffd368 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -86,9 +86,9 @@ static void dumpstate(int full) {
DUMP("/proc/wakelocks");
PRINT("");
PRINT("------ PROCESSES ------");
- EXEC("ps");
+ EXEC1("ps", "-P");
PRINT("------ PROCESSES AND THREADS ------");
- EXEC2("ps", "-t", "-p");
+ EXEC3("ps", "-t", "-p", "-P");
PRINT("------ LIBRANK ------");
EXEC_XBIN("librank");
PRINT("------ BINDER FAILED TRANSACTION LOG ------");
@@ -362,4 +362,3 @@ static void dump_kernel_log(const char *path, const char *title)
DUMP(path);
}
}
-
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 6862e5a3edb41..b99b6d792249a 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -61,6 +61,15 @@
run_command(&c, TIMEOUT); \
}
+#define EXEC1(cmd, a1) \
+{ \
+ static struct Command c = { \
+ "/system/bin/" cmd, \
+ { cmd, a1, 0 } \
+ }; \
+ run_command(&c, TIMEOUT); \
+}
+
#define EXEC2(cmd, a1, a2) \
{ \
static struct Command c = { \
@@ -70,6 +79,15 @@
run_command(&c, TIMEOUT); \
}
+#define EXEC3(cmd, a1, a2, a3) \
+{ \
+ static struct Command c = { \
+ "/system/bin/" cmd, \
+ { cmd, a1, a2, a3, 0 } \
+ }; \
+ run_command(&c, TIMEOUT); \
+}
+
#define EXEC4(cmd, a1, a2, a3, a4) \
{ \
static struct Command c = { \
diff --git a/core/java/android/accounts/AbstractAccountAuthenticator.java b/core/java/android/accounts/AbstractAccountAuthenticator.java
index 0efeb1d36a91b..be2bdbefb59d0 100644
--- a/core/java/android/accounts/AbstractAccountAuthenticator.java
+++ b/core/java/android/accounts/AbstractAccountAuthenticator.java
@@ -88,7 +88,7 @@ import android.Manifest;
* The activity must then call {@link AccountAuthenticatorResponse#onResult} or
* {@link AccountAuthenticatorResponse#onError} when it is complete.
*
If the authenticator cannot synchronously process the request and return a result then it
- * may choose to return null and then use the {@link AccountManagerResponse} to send the result
+ * may choose to return null and then use the AccountManagerResponse to send the result
* when it has completed the request.
*
*
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 46dc895a826e8..9765496762c03 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -321,7 +321,8 @@ public class AccountManager {
*/
public String peekAuthToken(final Account account, final String authTokenType) {
if (account == null) {
- throw new IllegalArgumentException("the account must not be null");
+ Log.e(TAG, "peekAuthToken: the account must not be null");
+ return null;
}
if (authTokenType == null) {
return null;
@@ -346,7 +347,8 @@ public class AccountManager {
*/
public void setPassword(final Account account, final String password) {
if (account == null) {
- throw new IllegalArgumentException("the account must not be null");
+ Log.e(TAG, "the account must not be null");
+ return;
}
try {
mService.setPassword(account, password);
@@ -365,7 +367,8 @@ public class AccountManager {
*/
public void clearPassword(final Account account) {
if (account == null) {
- throw new IllegalArgumentException("the account must not be null");
+ Log.e(TAG, "the account must not be null");
+ return;
}
try {
mService.clearPassword(account);
@@ -388,10 +391,12 @@ public class AccountManager {
*/
public void setUserData(final Account account, final String key, final String value) {
if (account == null) {
- throw new IllegalArgumentException("the account must not be null");
+ Log.e(TAG, "the account must not be null");
+ return;
}
if (key == null) {
- throw new IllegalArgumentException("the key must not be null");
+ Log.e(TAG, "the key must not be null");
+ return;
}
try {
mService.setUserData(account, key, value);
@@ -602,11 +607,14 @@ public class AccountManager {
final String authTokenType, final String[] requiredFeatures,
final Bundle addAccountOptions,
final Activity activity, AccountManagerCallback callback, Handler handler) {
- if (accountType == null) {
- throw new IllegalArgumentException();
- }
return new AmsTask(activity, handler, callback) {
public void doWork() throws RemoteException {
+ if (accountType == null) {
+ Log.e(TAG, "the account must not be null");
+ // to unblock caller waiting on Future.get()
+ set(new Bundle());
+ return;
+ }
mService.addAcount(mResponse, accountType, authTokenType,
requiredFeatures, activity != null, addAccountOptions);
}
@@ -616,9 +624,13 @@ public class AccountManager {
public AccountManagerFuture getAccountsByTypeAndFeatures(
final String type, final String[] features,
AccountManagerCallback callback, Handler handler) {
- if (type == null) throw new IllegalArgumentException("type is null");
return new Future2Task(handler, callback) {
public void doWork() throws RemoteException {
+ if (type == null) {
+ Log.e(TAG, "Type is null");
+ set(new Account[0]);
+ return;
+ }
mService.getAccountsByFeatures(mResponse, type, features);
}
public Account[] bundleToResult(Bundle bundle) throws AuthenticatorException {
@@ -785,7 +797,7 @@ public class AccountManager {
//noinspection ThrowableInstanceNeverThrow
// Log.e(TAG, "calling this from your main thread can lead to deadlock and/or ANRs",
// new Exception());
- // TODO(fredq) remove the log and throw this exception when the callers are fixed
+ // TODO remove the log and throw this exception when the callers are fixed
// throw new IllegalStateException(
// "calling this from your main thread can lead to deadlock");
}
@@ -1338,11 +1350,13 @@ public class AccountManager {
*/
public void removeOnAccountsUpdatedListener(OnAccountsUpdateListener listener) {
if (listener == null) {
- throw new IllegalArgumentException("the listener is null");
+ Log.e(TAG, "Missing listener");
+ return;
}
synchronized (mAccountsUpdatedListeners) {
if (!mAccountsUpdatedListeners.containsKey(listener)) {
- throw new IllegalStateException("this listener was not previously added");
+ Log.e(TAG, "Listener was not previously added");
+ return;
}
mAccountsUpdatedListeners.remove(listener);
if (mAccountsUpdatedListeners.isEmpty()) {
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 9c60141336e63..4f59c4e67edde 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -429,14 +429,6 @@ public class AccountManagerService
checkManageAccountsPermission();
long identityToken = clearCallingIdentity();
try {
- if (account == null) {
- try {
- response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS, "null account");
- } catch (RemoteException e) {
- // it doesn't matter if we are unable to deliver this error
- }
- return;
- }
new RemoveAccountSession(response, account).bind();
} finally {
restoreCallingIdentity(identityToken);
@@ -706,22 +698,6 @@ public class AccountManagerService
long identityToken = clearCallingIdentity();
try {
- try {
- if (account == null) {
- response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS,
- "account is null");
- return;
- }
- if (authTokenType == null) {
- response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS,
- "authTokenType is null");
- return;
- }
- } catch (RemoteException e) {
- // it doesn't matter if we can't deliver this error
- return;
- }
-
// if the caller has permission, do the peek. otherwise go the more expensive
// route of starting a Session
if (permissionGranted) {
@@ -887,16 +863,6 @@ public class AccountManagerService
checkManageAccountsPermission();
long identityToken = clearCallingIdentity();
try {
- try {
- if (authTokenType == null) {
- response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS,
- "authTokenType is null");
- return;
- }
- } catch (RemoteException e) {
- // it doesn't matter if we can't deliver this error
- return;
- }
new Session(response, accountType, expectActivityLaunch) {
public void run() throws RemoteException {
mAuthenticator.addAccount(this, mAccountType, authTokenType, requiredFeatures,
@@ -922,16 +888,6 @@ public class AccountManagerService
checkManageAccountsPermission();
long identityToken = clearCallingIdentity();
try {
- try {
- if (account == null) {
- response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS,
- "account is null");
- return;
- }
- } catch (RemoteException e) {
- // it doesn't matter if we can't deliver this error
- return;
- }
new Session(response, account.type, expectActivityLaunch) {
public void run() throws RemoteException {
mAuthenticator.confirmCredentials(this, account, options);
@@ -952,16 +908,6 @@ public class AccountManagerService
checkManageAccountsPermission();
long identityToken = clearCallingIdentity();
try {
- try {
- if (account == null) {
- response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS,
- "account is null");
- return;
- }
- } catch (RemoteException e) {
- // it doesn't matter if we can't deliver this error
- return;
- }
new Session(response, account.type, expectActivityLaunch) {
public void run() throws RemoteException {
mAuthenticator.updateCredentials(this, account, authTokenType, loginOptions);
@@ -984,16 +930,6 @@ public class AccountManagerService
checkManageAccountsPermission();
long identityToken = clearCallingIdentity();
try {
- try {
- if (accountType == null) {
- response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS,
- "accountType is null");
- return;
- }
- } catch (RemoteException e) {
- // it doesn't matter if we can't deliver this error
- return;
- }
new Session(response, accountType, expectActivityLaunch) {
public void run() throws RemoteException {
mAuthenticator.editProperties(this, mAccountType);
diff --git a/core/java/android/content/ContentProviderOperation.java b/core/java/android/content/ContentProviderOperation.java
index 60b406d36467b..0467516b4b846 100644
--- a/core/java/android/content/ContentProviderOperation.java
+++ b/core/java/android/content/ContentProviderOperation.java
@@ -545,7 +545,8 @@ public class ContentProviderOperation implements Parcelable {
"only updates, deletes, and asserts can have selections");
}
mSelection = selection;
- mSelectionArgs = selectionArgs;
+ mSelectionArgs = new String[selectionArgs.length];
+ System.arraycopy(selectionArgs, 0, mSelectionArgs, 0, selectionArgs.length);
return this;
}
diff --git a/core/jni/android_text_format_Time.cpp b/core/jni/android_text_format_Time.cpp
index 98f4e035c0c95..fde6ca6e2b2a1 100644
--- a/core/jni/android_text_format_Time.cpp
+++ b/core/jni/android_text_format_Time.cpp
@@ -367,10 +367,12 @@ static int get_char(JNIEnv* env, const jchar *s, int spos, int mul,
if (c >= '0' && c <= '9') {
return (c - '0') * mul;
} else {
- char msg[100];
- sprintf(msg, "Parse error at pos=%d", spos);
- jniThrowException(env, "android/util/TimeFormatException", msg);
- *thrown = true;
+ if (!*thrown) {
+ char msg[100];
+ sprintf(msg, "Parse error at pos=%d", spos);
+ jniThrowException(env, "android/util/TimeFormatException", msg);
+ *thrown = true;
+ }
return 0;
}
}
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index 5b6c7ea13e8a6..d8c2234943e3d 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -51,6 +51,8 @@ pid_t gettid() { return syscall(__NR_gettid);}
#undef __KERNEL__
#endif
+#define POLICY_DEBUG 0
+
using namespace android;
static void signalExceptionForPriorityError(JNIEnv* env, jobject obj, int err)
@@ -212,6 +214,26 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
return;
}
+#if POLICY_DEBUG
+ char cmdline[32];
+ int fd;
+
+ strcpy(cmdline, "unknown");
+
+ sprintf(proc_path, "/proc/%d/cmdline", pid);
+ fd = open(proc_path, O_RDONLY);
+ if (fd >= 0) {
+ int rc = read(fd, cmdline, sizeof(cmdline)-1);
+ cmdline[rc] = 0;
+ close(fd);
+ }
+
+ if (grp == ANDROID_TGROUP_BG_NONINTERACT) {
+ LOGD("setProcessGroup: vvv pid %d (%s)", pid, cmdline);
+ } else {
+ LOGD("setProcessGroup: ^^^ pid %d (%s)", pid, cmdline);
+ }
+#endif
sprintf(proc_path, "/proc/%d/task", pid);
if (!(d = opendir(proc_path))) {
// If the process exited on us, don't generate an exception
diff --git a/graphics/java/android/renderscript/ProgramStore.java b/graphics/java/android/renderscript/ProgramStore.java
index b7d987efbb1ad..5cbe1b29415a9 100644
--- a/graphics/java/android/renderscript/ProgramStore.java
+++ b/graphics/java/android/renderscript/ProgramStore.java
@@ -49,7 +49,7 @@ public class ProgramStore extends BaseObj {
SRC_ALPHA (4),
ONE_MINUS_SRC_ALPHA (5),
DST_ALPHA (6),
- ONE_MINUS_DST_ALPA (7),
+ ONE_MINUS_DST_ALPHA (7),
SRC_ALPHA_SATURATE (8);
int mID;
@@ -66,7 +66,7 @@ public class ProgramStore extends BaseObj {
SRC_ALPHA (4),
ONE_MINUS_SRC_ALPHA (5),
DST_ALPHA (6),
- ONE_MINUS_DST_ALPA (7);
+ ONE_MINUS_DST_ALPHA (7);
int mID;
BlendDstFunc(int id) {