Merge change Id6f158b3 into eclair

* changes:
  Removed javadoc link to hidden class (temporary fix for build)
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index ca8660c..642c943 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -86,9 +86,9 @@
         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 @@
         DUMP(path);
     }
 }
-
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 6862e5a..b99b6d7 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/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 46dc895..9765496 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -321,7 +321,8 @@
      */
     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 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 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 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 @@
             final String authTokenType, final String[] requiredFeatures,
             final Bundle addAccountOptions,
             final Activity activity, AccountManagerCallback<Bundle> 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 AccountManagerFuture<Account[]> getAccountsByTypeAndFeatures(
             final String type, final String[] features,
             AccountManagerCallback<Account[]> callback, Handler handler) {
-        if (type == null) throw new IllegalArgumentException("type is null");
         return new Future2Task<Account[]>(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 @@
             //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 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 9c60141..4f59c4e 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -429,14 +429,6 @@
         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 @@
 
         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 @@
         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 @@
         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 @@
         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 @@
         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 60b406d..0467516 100644
--- a/core/java/android/content/ContentProviderOperation.java
+++ b/core/java/android/content/ContentProviderOperation.java
@@ -545,7 +545,8 @@
                         "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_util_Process.cpp b/core/jni/android_util_Process.cpp
index 5b6c7ea..d8c2234 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -51,6 +51,8 @@
 #undef __KERNEL__
 #endif
 
+#define POLICY_DEBUG 0
+
 using namespace android;
 
 static void signalExceptionForPriorityError(JNIEnv* env, jobject obj, int err)
@@ -212,6 +214,26 @@
         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 b7d987e..5cbe1b2 100644
--- a/graphics/java/android/renderscript/ProgramStore.java
+++ b/graphics/java/android/renderscript/ProgramStore.java
@@ -49,7 +49,7 @@
         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 @@
         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) {