Thread about finding way and writing down how to close games on OUYA without hard shutdown.
EDIT 21.03.2025
Short answer is get app named Soft keys 2 and enable accessibility options, pick where
you like software keys and I suggest on top with theme 2 and transparency 100%, I played Homm3 HD version on Ouya with seeing all resources and could bring up Ouya SYSTEM menu with physical mouse, I use physical mouse and controller. App version 2 for Android 4.1
Link here:
https://apkpure.com/soft-keys-2-home-back-button/com.dogusumit.softkeys2/downloading
So far with all third party controllers I have never gotten to work ‘OUYA system menu’.
I have some info into how OUYA system menu is activated:
Cleanly shutting down audio
When you exit the app and/or open the system menu, any ongoing game audio should be paused or stopped. Your app is responsible for managing its own audio. Failing to do so may be grounds for review process failure.
When the system overlay menu opens (e.g. when the system button is held or double tapped) the framework broadcasts a sticky intent with the action tv.ouya.intent.action.OUYA_MENU_APPEARING
(also defined in OuyaIntent). You can set up a BroadcastReceiver for this either dynamically or statically.
Full link here:
In keylayout files for xbox360 wired, ps3? Controllers have button mapping for HOME and HOME ALT but they never do anything in-game.
For some reason only original OUYA controller is able to show system menu. How is that?
New info 04/01/2025
System Button
The OUYA System button is a special case. Double tapping the System button will open an OUYA menu that lets users exit/pause the game. Your game has no control over this menu and due to the special way the system button is handled, button pressure events for the system button (input.kJoypadButtonXbox360Start) are always positive.
What does all this mean!? It means that you will never receive an nPressure value of 0 for the System button! Ever! So if you actually do anything with the System key, just assume that an nPressure value > 0 means it was pressed. Don’t try to latch or debounce it like you might do with other buttons.
Link here:
New info 04/01/2025
Input
One common issue with Android games is supporting different controller hardware. We’ve created an API
which will remap input from various controller manufacturers to the standard OUYA
button layout. The remapping logic is provided by the Cortex
Framework, and will be constantly updated to add support for more and more controllers.
The easiest way to take advantage of this is by simply extending from the OuyaActivity
class in the ODK
. This will do a couple things automatically for you:
- remap controller input to the standard
OUYA
layout - update
OuyaController
status
This is achieved by:
Link here:
New info 04/01/2025
Android development says HOME is handled by IME framework and never sent to apps.
KEYCODE_HOME
Added in API level 1
public static final int KEYCODE_HOME
Key code constant: Home key. This key is handled by the framework and is never delivered to applications.
Constant Value: 3 (0x00000003)
Link here:
https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_HOME
New info 04/01/2025
It is impossible to detect and/or intercept the HOME button from within an Android app. This is built into the system to prevent malicious apps that cannot be exited.
Link here:
New info 04/01/2025
The Home button is a very dangerous button to override and, because of that, Android will not let you override its behavior the same way you do the BACK button.
Take a look at this discussion.
You will notice that the home button seems to be implemented as a intent invocation, so you’ll end up having to add an intent category to your activity. Then, any time the user hits home, your app will show up as an option. You should consider what it is you are looking to accomplish with the home button. If its not to replace the default home screen of the device, I would be wary of overloading the HOME button, but it is possible (per discussion in above thread.)
Link here:
new info 04/01/2025
Managed to show with Android ADB commands SYSTEM MENU in main screen. I am missing INTENT to start it from ADB command, any ideas how to do it?
#shell@android:/ # dumpsys window | grep -E 'mCurrentFocus'
# OUYA main screen when powered on
# mCurrentFocus=Window{41e8dda0 tv.ouya.console/tv.ouya.console.launcher.home.HomeActivity paused=false}
#shell@android:/ # dumpsys window | grep -E 'mCurrentFocus'
#OUYA play screen to chose game to play
# mCurrentFocus=Window{41ded2f0 tv.ouya.console/tv.ouya.console.launcher.play.PlayActivity paused=false}
#shell@android:/ # dumpsys window | grep -E 'mCurrentFocus'
# OUYA SYSTEM MENU in PLAY menu out-side game
# mCurrentFocus=Window{41df9cd8 tv.ouya.console/tv.ouya.console.launcher.guide.GuideActivity paused=false}
EDIT 20.03.2025
New info:
Use app Android 4.1 Soft keys
when installed, use physical mouse and keyboard or just controller to enable accessibility in app menu, I used this app:
Download Soft Keys - Home Back Button latest 1.0 Android APK
It gives you overlay, if it is too big just disable app from accessibility menu and resize soft keys buttons and re-enable app from accessibility menu. You can use in game apps
for first time Ouya SYSTEM MENU with physical mouse. It means Ouya system menu button is accessible and custom controllers can use it. Investigation needs to be done, how exactly that ‘soft keys’ app does it. I susüect when calling from ADB input keyevent HOME it needs wait time and recall of ADB command or it is too fast to bring up ‘Double-tap HOME button for Ouya Menu’. Super discovery!
EDIT 21.03.2025
Short answer is get app named Soft keys 2 and enable accessibility options, pick where
you like software keys and I suggest on top with theme 2 and transparency 100%, I played Homm3 HD version on Ouya with seeing all resources and could bring up Ouya SYSTEM menu with physical mouse, I use physical mouse and controller.
Link here:
https://apkpure.com/soft-keys-2-home-back-button/com.dogusumit.softkeys2/downloading
I want to mention here honorable ADB command:
adb shell input keyevent APP_SWITCH
it brings up original Android 4.1 recent 2D menu which you can navigate with keyevents or physical controller. One interesting Android constant is keyevent_menu