{"push_id":664198189,"size":1,"distinct_size":1,"ref":"refs/heads/lp5.1","head":"637c80b26bf4be2223f414ae987d3f853060f3b6","before":"17733fb622bc4d48095ef80861b9ad79ca837254","commits":[{"sha":"637c80b26bf4be2223f414ae987d3f853060f3b6","author":{"email":"79955bf58572f59fdcc4b7570349ce3da48c0ad7@gmail.com","name":"jyates"},"message":"[1/2] Slims Hardware Key Rebinding\n\nFirst thanks to CM team for the 2 years where we used their approach for our\ncustom hw key rebinding. This hardware key rebinding\npatches did in the past a good job and we extended it prior 4.3 with a lot\nSlim custom stuff.\n\nBut it is time to go new way and to do the complete\nhardware key rebinding more flexible and more centralized. Especially due\nthat we have now all possible shorcutactions centralized in 4.4\n\nPossible mapping are:\nACTION_HOME\nACTION_BACK\nACTION_SEARCH (in app search)\nACTION_VOICE_SEARCH\nACTION_MENU_BIG\nACTION_POWER\nACTION_NOTIFICATIONS\nACTION_QS\nACTION_RECENTS\nACTION_SCREENSHOT\nACTION_IME\nACTION_LAST_APP\nACTION_KILL\nACTION_ASSIST\nACTION_VIB\nACTION_SILENT\nACTION_VIB_SILENT\nACTION_POWER_MENU\nACTION_TORCH\nACTION_EXPANDED_DESKTOP\nACTION_THEME_SWITCH\n\nand custom app/shorcut of course\n\nPossible actions on all keys are:\nnormal tap / longpress / double tap\n\nSo to sumarize if it is in settings array enabled user can bind whatever of the above\nactions to every hardware key action.\n\nMain changes to prior solutions are:\n- do not depend anymore on hardcoded integer values. We use now strings. This has\n  the advantage that we can save whatever shorcut or intent URI we have into this\n  value. And gives us the possibility in future without changing anything on the hw\n  key rebinding code to get more options/or modify the options. Actions are holded\n  like on all other of our features in ButtonsConstants.java\n- All actions are peformed over our SlimActions like all other features. SlimActions\n  takes care about all possible solutions the user can run into and sets the right\n  open animation, keyguard handling etc etc. As well it is easier to maintain only\n  one code base.\n- Only observe and update the values on hardware key devices. On non hw key devices\n  the complete code is non operational\n- Removed in settings the not needed overlay due that we can use the fb one to\n  check if it is a hw key device or not.\n- Major cleanup of a lot old code.\n\nThis patch add as well one new SlimActions action....VOICE_SEARCH\n\nTo configure your device you need to add the device overlay as usual:\n\noverlay/frameworks/base/core/res/res/values/config.xml\n<!-- Hardware \"softkeys\" present on the device, stored as a bit field.\n         This integer should equal the sum of the corresponding value for each\n         of the following keys present:\n            1 - Home\n            2 - Back\n            4 - Menu\n            8 - Assistant (search)\n           16 - App switch\n        For example, a device with Home, Back and Menu keys would set this\n        config to 7. -->\n    <integer name=\"config_deviceHardwareKeys\">7</integer>\n\nAlso requires Settings commit (https://gerrit.slimroms.net/#/c/2389/)\nand overlay to function correctly\n\ncheers HCP and kufi\n\nPS:\n- code cleanup and some code comments\nPS:\n- fix softkey devices\nPS:\n- fix back button (I think lol)\nPS:\n- fix wrong null checks lol\nPS\n- revert back to last ps due of more derp\nPS\n- added some debbugging lines\nPS\n- redefine injectInputEvent code and get rid of the handler we used to fix\n  exception due that PhoneWindowManager is no UI thread and cannot handle the handler\n  and to speed up navbar/navring etc. No need to delay it for 30ms\nPS\n- reworked the complete interpretation code. To fix up the initial issues we had on first patchsets\n  and as well the new ones. Nuked vibrations as well and lets handle it like all other over SlimActions\n  cleanup again\nPS\n- I remember that jeff had similar problem in the past and got the solution. We just check now\n  who is really calling home key event. If it is a VIRTUAL key then launch home....for all other\n  lauch the saved action on the home event. As well this fixes the wrong launch if DoubleTap\n  timed out and launches home (now it launches the saved action for home like it should).\nPS\n- cleanup\nPS\n- finally fixed home button\nPS\n- last major cleanup\n- cancel recent preloads only if it is really required\nPS\n- introduce central HwKeyHelper class to avoid code duplication in PhoneWindowManager and as well\n  in Settings\nPS\n- fix small logical error in home key handling to avoid to go over SlimActions if button is set to default\n  home\nPS\n- fix wrong menu default value\nPS\n- added double tap to all bindable buttons\n- fixed reported missing vibration on longpress\n- possible fix menu shows up on longpress menu\nPS\n- small cleanup\nPS\n- fix home/assist/appswitch call when it is set on the natural button as longpress or doubletapp.\nPS\n- attempt to fix the problem mentioned in PatchSet above on the other keys + simplify this fix\n  Please test\nPS\n- fix navbar\nPS\n- fix double vibration if double tap is pending\n- fix deprecated System.SHOW_PROCESS value call and call Global instead\n- execute on assist and appswitch default action if no other action was executed before\n- HwKeyHelper do not call provider values if not needed\n- cleanup\nPS\n- menu and back button: if normal tap action does not equal natural back action return -1\n  to avoid processing back/menu action\nPS\n- reset the indicating boolean for prevend second vibration when we reset the doubletap\n  callback - this fixes the reported issue that vibration is suddenly completly gone\nPS\n- return on back and menu hardware trigger always the action and let it use the virtual\n  key to process the final action\nPS\n- handle virtual key on back and menu a bit other\n- rename vibration var\nPS\n- fix double vibration if double tap is disabled\nPS\n- fix back key wrong condition on double tap which caused 2 action calls\nPS\n- do not assume that double tap has always a pending vibration...check for the action\n- respect keyguard on APP_SWITCH key\nPS\n- remove again the keyguard check lol....I forgot that I was some months ago allready\nintelligent enough to check this in SlimActions lol. So no need to check it twice\n\nChange-Id: Ic5c9b4eb03d2baa3b0ddfb3e9fcaf10d6e45dcd3\n\nConflicts:\n\tcore/java/android/provider/Settings.java\n\tcore/java/com/android/internal/util/slim/ButtonsConstants.java\n\tcore/java/com/android/internal/util/slim/SlimActions.java\n\tcore/res/res/values/config.xml\n\tpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java\n\nThanks Fusionjack for working on adding back some of these actions!!!!\n\nAction: Add kill-app and last-app actions\n\nForward port from KitKat\n\nAdd back action for screenshot\n\nSigned-off-by: RobbieL811 <RobbieLancaster811@gmail.com>\n\nFix some stuff in commandqueue.java\n\nSigned-off-by: RobbieL811 <RobbieLancaster811@gmail.com>\n\nChange-Id: I4bd88926bf1a423964e370800a7c6d64a9555d28","distinct":true,"url":"https://api.github.com/repos/SlimDarkness/frameworks_base/commits/637c80b26bf4be2223f414ae987d3f853060f3b6"}]}