New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEW: Add Android backButtonLeavesApp to New Input #1914
base: develop
Are you sure you want to change the base?
NEW: Add Android backButtonLeavesApp to New Input #1914
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manugildev Thanks for submitting this PR. Would you mind filling in the PR template to aid the review process for this new functionality and API surface being proposed? Instructions for filling in the PR template are available in the PR itself but also here: https://github.com/Unity-Technologies/InputSystem/blob/develop/.github/pull_request_template.md
Clearly describing the purpose of the PR and motivating the changes made makes it simpler to understand and review.
In addition som initial questions:
- This is adding a new type of device, AndroidDevice that communicates with the native backend/run-time via IOCTL command GCC. However I do not see any Unity version dependent #ifdef checks present. Is this IOCTL command available back to Unity 2019 which the Input System package is still compliant with? If not, please guard the availability of this feature under appropriate compile-time version checks if intended to just return default if runtime is not implementing the IOCTL command and document from which Unity version this is expected to work, or guard the API under a certain UNITY version to control availability.
- Noted that CHANGELOG.md do not contain an addition under ADD section describing the addition, would it be possible to get that added?
Packages/com.unity.inputsystem/InputSystem/Plugins/Android/GetCustomCommand.cs
Outdated
Show resolved
Hide resolved
Packages/com.unity.inputsystem/InputSystem/Plugins/Android/GetCustomCommand.cs
Outdated
Show resolved
Hide resolved
Packages/com.unity.inputsystem/InputSystem/Plugins/Android/AndroidDevice.cs
Show resolved
Hide resolved
Packages/com.unity.inputsystem/InputSystem/Plugins/Android/AndroidSupport.cs
Outdated
Show resolved
Hide resolved
Packages/com.unity.inputsystem/InputSystem/Plugins/Android/GetCustomCommand.cs
Outdated
Show resolved
Hide resolved
P.S you probably need to some tests to validate SetCustomCommand/GetCustomCommand works fine |
Packages/com.unity.inputsystem/InputSystem/Plugins/Android/InputSettingsAndroid.cs
Show resolved
Hide resolved
971e6e3
to
ab07662
Compare
Packages/com.unity.inputsystem/InputSystem/Plugins/Android/AndroidDevice.cs
Show resolved
Hide resolved
a28f01d
to
04e1db1
Compare
37c9174
to
6f93df2
Compare
…nLeavesApp on device
6f93df2
to
2dc6312
Compare
public class AndroidDevice : InputDevice | ||
{ | ||
[InputControl(synthetic = true)] | ||
public ButtonControl button { get; protected set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this? I see it's a public API, how would user use it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to get rid of this ButtonControl. InputDevices need to have AT LEAST one control. If not they throw an exception. In our case, this controls is not needed
Description
Add
backButtonLeavesApp
support for New Input System.Changes made
This PR creates a new
AndroidDevice
that is registered during initialization. ThisAndroidDevice
represents a handheld device, and can be use to store device specific input functions that are not part of other input devices such as the keyboard, gamepad or sensors.We also added
SetCustomCommand
andGetCustomCommand
used to be able to set and get respectively a payload between the InputSystem package and runtime. This is then used to set and getbackButtonLeavesApp
to the native runtime. This two new commands are general purpose commands, and can be used for any other input device.backButtonLeavesApp
, is just a boolean flag needed for Predictive Back Gesture (PBG) support to work on Android. This allows users to preview the destination or other result of a back gesture before fully completing it, allowing them to decide whether to continue or stay in the current view.Notes
This new API can be used as such:
Checklist
Before review:
Changed
,Fixed
,Added
sections.([case %number%](https://issuetracker.unity3d.com/issues/...))
.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.