[Android] What Google can do is isuseramonkey ()

Source: Internet
Author: User

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?

  1. /**
  2. * Returns "true" if the user interface is currently being messed
  3. * By a monkey.
  4. */
  5. Public static Boolean isuseramonkey (){
  6. Try {
  7. Return activitymanagernative. getdefault (). isuseramonkey ();
  8. } Catch (RemoteException e ){
  9. }
  10. Return false;
  11. }

 

 

Continue, I came to the ActivityManagerNative class again.

 

[Java]View
Plaincopyprint?

  1. Public Boolean isuseramonkey () throws RemoteException {
  2. Parcel DATA = parcel. Obtain ();
  3. Parcel reply = parcel. Obtain ();
  4. Data. writeinterfacetoken (iactivitymanager. descriptor );
  5. Mremote. transact (is_user_a_monkey_transaction, Data, reply, 0 );
  6. Reply. readexception ();
  7. Boolean res = reply. readint ()! = 0;
  8. Data. Recycle ();
  9. Reply. Recycle ();
  10. Return res;
  11. }

 

 

Tomorrow. Haha... removed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.