title: How to trigger the long-press power menu (shutdown / reboot / etc)
body: <p>I'd like to understand if there's a way to trigger the power menu, as if the user had long-pressed the power button. I can be root / a system app, so normal security restrictions may not apply.</p>
  <p>What I'm trying to do is prevent the screen from sleeping when power is pressed, but keep the long-press power menu. I was able to keep into the <code>PREVENT_POWER_KEY</code> permission, which allows you to catch the key event <code>KEYCODE_POWER</code>, but is also completely disables the normal power button behavior. That leads me to the original question: how to manually trigger the Android power menu.</p>
  <p>I was able to track this down in the Android source: <code>GlobalActions.java</code>. if I'm reading things correctly, it looks like this code programmatically creates a <code>GlobalActionsDialog</code>. This class is not public. My assumption here is that I'm out of luck, but just checking if someone knows a workaround.</p>
  <p>I appreciate one would not normally want to do this, but it is for a custom device + ROM.</p>