diff options
author | Robert Horvath <robhor@google.com> | 2020-03-20 17:19:06 +0100 |
---|---|---|
committer | Robert Horvath <robhor@google.com> | 2020-03-20 17:19:06 +0100 |
commit | a4b5e9688622bcaa18e12cc43e3acf59577bbdab (patch) | |
tree | c7b32209c7c122dc33830d99af237f43d012a426 | |
parent | 711ba26816dc2102578ab087c7919dcc9cc9be9f (diff) |
PackageInstaller: Initial focus in non-touch mode on Cancel
The initial focus for AlertDialogs in non-touch mode is the positive
button. However, in the PackageInstaller confirmation dialog, the
positive button is initially disabled to prevent tap jacking.
To provide users in non-touch mode with a sensible default focus, put
initial focus in non-touch mode on the cancel button.
Bug: 152026824
Test: On Android TV, with a remote:
1. Install file explorer app
2. Push another apk to device
3. Use file explorer to start apk installation
4. Verify "Cancel" button is focused
Test: Doing the above with touch does not lead to any visible focus
Change-Id: Iafec25df23c45171c450f5f42cc5da9bf0087ae4
-rw-r--r-- | packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java index a2fa46130076..a95677d0202f 100644 --- a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java +++ b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java @@ -406,6 +406,10 @@ public class PackageInstallerActivity extends AlertActivity { mOk = mAlert.getButton(DialogInterface.BUTTON_POSITIVE); mOk.setEnabled(false); + + if (!mOk.isInTouchMode()) { + mAlert.getButton(DialogInterface.BUTTON_NEGATIVE).requestFocus(); + } } /** |