ActivityManager class. This is available from API Level 1.
However, starting from Level 8, we were pleasantly surprised to find that there was another method called isUserAMonkey ().
After reading this method, what does it mean? "Judge whether a user is a monkey "? It's impossible ..
So curious, I started to view the SDK.
Only "Returns" true "if the user interface is currently being messed with by a monkey ."
--> If the current UI is being fooled by a monkey, true is returned ..???
What are the planes? What does it mean?
So curious, I started to view the source code again!
The source code is as follows:
[Java]View
Plaincopyprint?
- /**
- * Returns "true" if the user interface is currently being messed
- * By a monkey.
- */
- Public static Boolean isuseramonkey (){
- Try {
- Return activitymanagernative. getdefault (). isuseramonkey ();
- } Catch (RemoteException e ){
- }
- Return false;
- }
Continue, I came to the ActivityManagerNative class again.
[Java]View
Plaincopyprint?
- 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;
- }
Tomorrow. Haha... removed.