From b5df6d801cc154899e9f52328eb1e40e90720fa4 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 15 Sep 2009 22:50:40 -0700 Subject: Implement issue #1780928: Need support hiding nav keys. This implements support for devices whose hardware can hide their navigation keys. It works much like the existing keyboardHidden configuration, and for compatibility uses the same configuration change bit. Also add FLAG_TURN_ON_SCREEN for windows, which has the system cause the screen to be turned on when the window is displayed. Great fun when used with FLAG_SHOW_WHEN_LOCKED! Change-Id: I0b867f19af85cfd8786a14cea194b34f7bdd9b7a --- include/utils/ResourceTypes.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h index e524e2a..17ccad6 100644 --- a/include/utils/ResourceTypes.h +++ b/include/utils/ResourceTypes.h @@ -864,6 +864,13 @@ struct ResTable_config KEYSHIDDEN_SOFT = 0x0003, }; + enum { + MASK_NAVHIDDEN = 0x000c, + NAVHIDDEN_ANY = 0x0000, + NAVHIDDEN_NO = 0x0004, + NAVHIDDEN_YES = 0x0008, + }; + union { struct { uint8_t keyboard; @@ -1011,7 +1018,8 @@ struct ResTable_config if (orientation != o.orientation) diffs |= CONFIG_ORIENTATION; if (density != o.density) diffs |= CONFIG_DENSITY; if (touchscreen != o.touchscreen) diffs |= CONFIG_TOUCHSCREEN; - if (((inputFlags^o.inputFlags)&MASK_KEYSHIDDEN) != 0) diffs |= CONFIG_KEYBOARD_HIDDEN; + if (((inputFlags^o.inputFlags)&(MASK_KEYSHIDDEN|MASK_NAVHIDDEN)) != 0) + diffs |= CONFIG_KEYBOARD_HIDDEN; if (keyboard != o.keyboard) diffs |= CONFIG_KEYBOARD; if (navigation != o.navigation) diffs |= CONFIG_NAVIGATION; if (screenSize != o.screenSize) diffs |= CONFIG_SCREEN_SIZE; @@ -1082,6 +1090,11 @@ struct ResTable_config if (!(o.inputFlags & MASK_KEYSHIDDEN)) return true; } + if (((inputFlags^o.inputFlags) & MASK_NAVHIDDEN) != 0) { + if (!(inputFlags & MASK_NAVHIDDEN)) return false; + if (!(o.inputFlags & MASK_NAVHIDDEN)) return true; + } + if (keyboard != o.keyboard) { if (!keyboard) return false; if (!o.keyboard) return true; @@ -1225,6 +1238,18 @@ struct ResTable_config } } + const int navHidden = inputFlags & MASK_NAVHIDDEN; + const int oNavHidden = o.inputFlags & MASK_NAVHIDDEN; + if (navHidden != oNavHidden) { + const int reqNavHidden = + requested->inputFlags & MASK_NAVHIDDEN; + if (reqNavHidden) { + + if (!navHidden) return false; + if (!oNavHidden) return true; + } + } + if ((keyboard != o.keyboard) && requested->keyboard) { return (keyboard); } @@ -1332,6 +1357,12 @@ struct ResTable_config return false; } } + const int navHidden = inputFlags&MASK_NAVHIDDEN; + const int setNavHidden = settings.inputFlags&MASK_NAVHIDDEN; + if (setNavHidden != 0 && navHidden != 0 + && navHidden != setNavHidden) { + return false; + } if (settings.keyboard != 0 && keyboard != 0 && keyboard != settings.keyboard) { return false; -- cgit v1.1