More device policy work: clarify password modes, monkeying.

Clarifies what the password modes mean, renaming them to "quality"
and updating their documentation and the implementation to follow.

Also adds a facility to find out if a monkey is running, which I
need for the api demo to avoid letting it wipe the device.
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 09b88ee..2e39c10 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1178,6 +1178,14 @@
             int enterAnim = data.readInt();
             int exitAnim = data.readInt();
             overridePendingTransition(token, packageName, enterAnim, exitAnim);
+            reply.writeNoException();
+            return true;
+        }
+        
+        case IS_USER_A_MONKEY_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            reply.writeInt(isUserAMonkey() ? 1 : 0);
+            reply.writeNoException();
             return true;
         }
         }
@@ -2598,5 +2606,17 @@
         reply.recycle();
     }
     
+    public boolean isUserAMonkey() throws RemoteException {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
+        reply.readException();
+        boolean res = reply.readInt() != 0;
+        data.recycle();
+        reply.recycle();
+        return res;
+    }
+    
     private IBinder mRemote;
 }