1

Accessibility Services provide us a way to take actions for users,Is it possible to shutdown a phone with this feature?As shown in the code :

public class MyAccessibilityService extends AccessibilityService {

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    // get the source node of the event
    AccessibilityNodeInfo nodeInfo = event.getSource();

    // Use the event and node information to determine
    // what action to take

    // take action on behalf of the user
    nodeInfo.performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);

    // recycle the nodeInfo object
    nodeInfo.recycle();
}
...
}

Can we implement 'shutdown' in "//what action to take" section? You can check this service in https://developer.android.com/guide/topics/ui/accessibility/services.html#act-for-users

coco_
  • 503
  • 1
  • 4
  • 6
  • possible duplicate of [Power-Off or Restart an android device via Code/Program?](http://stackoverflow.com/questions/6305491/power-off-or-restart-an-android-device-via-code-program) – Alex Florescu Sep 03 '14 at 10:57
  • not what i want,but thanks@AlexFlorescu – coco_ Sep 03 '14 at 11:48
  • Could you please clarify what is it that you want and how/why it's not covered by the other question, to help people give you a good answer? Thanks! – Alex Florescu Sep 04 '14 at 16:14
  • No, as of 4.4.4 there is no way to shut down the device from an AccessibilityService. – alanv Sep 04 '14 at 19:39
  • Ok. I want to implement "shutdown" by taking actions for users so that I don't need to ask for a root permission.For other ways,i'm always told to have root permission or only system apps have the permission to shutdown.Sorry for my unclear question and poor English,I'm a fresh man here.@AlexFlorescu – coco_ Sep 05 '14 at 01:12
  • why?Do you mean it can be implemented before 4.4.4?@alanv – coco_ Sep 05 '14 at 07:16

0 Answers0