Squash UMS Commits [1/3]

Credits: CyanogenMod

Change-Id: I09ed8bcc053f545377f28839673eadd2b9a2b872
Handle backup transport registration dynamically

Bug 11369873

Change-Id: I9bbdcc21ce25159c6645690123b5d03c553b0ddc
[1/2] Slims Hardware Key Rebinding

First thanks to CM team for the 2 years where we used their approach for our
custom hw key rebinding. This hardware key rebinding
patches did in the past a good job and we extended it prior 4.3 with a lot
Slim custom stuff.

But it is time to go new way and to do the complete
hardware key rebinding more flexible and more centralized. Especially due
that we have now all possible shorcutactions centralized in 4.4

Possible mapping are:
ACTION_HOME
ACTION_BACK
ACTION_SEARCH (in app search)
ACTION_VOICE_SEARCH
ACTION_MENU_BIG
ACTION_POWER
ACTION_NOTIFICATIONS
ACTION_QS
ACTION_RECENTS
ACTION_SCREENSHOT
ACTION_IME
ACTION_LAST_APP
ACTION_KILL
ACTION_ASSIST
ACTION_VIB
ACTION_SILENT
ACTION_VIB_SILENT
ACTION_POWER_MENU
ACTION_TORCH
ACTION_EXPANDED_DESKTOP
ACTION_THEME_SWITCH

and custom app/shorcut of course

Possible actions on all keys are:
normal tap / longpress / double tap

So to sumarize if it is in settings array enabled user can bind whatever of the above
actions to every hardware key action.

Main changes to prior solutions are:
- do not depend anymore on hardcoded integer values. We use now strings. This has
  the advantage that we can save whatever shorcut or intent URI we have into this
  value. And gives us the possibility in future without changing anything on the hw
  key rebinding code to get more options/or modify the options. Actions are holded
  like on all other of our features in ButtonsConstants.java
- All actions are peformed over our SlimActions like all other features. SlimActions
  takes care about all possible solutions the user can run into and sets the right
  open animation, keyguard handling etc etc. As well it is easier to maintain only
  one code base.
- Only observe and update the values on hardware key devices. On non hw key devices
  the complete code is non operational
- Removed in settings the not needed overlay due that we can use the fb one to
  check if it is a hw key device or not.
- Major cleanup of a lot old code.

This patch add as well one new SlimActions action....VOICE_SEARCH

To configure your device you need to add the device overlay as usual:

overlay/frameworks/base/core/res/res/values/config.xml
<!-- Hardware "softkeys" present on the device, stored as a bit field.
         This integer should equal the sum of the corresponding value for each
         of the following keys present:
            1 - Home
            2 - Back
            4 - Menu
            8 - Assistant (search)
           16 - App switch
        For example, a device with Home, Back and Menu keys would set this
        config to 7. -->
    <integer name="config_deviceHardwareKeys">7</integer>

Also requires Settings commit (https://gerrit.slimroms.net/#/c/2389/)
and overlay to function correctly

cheers HCP and kufi

PS:
- code cleanup and some code comments
PS:
- fix softkey devices
PS:
- fix back button (I think lol)
PS:
- fix wrong null checks lol
PS
- revert back to last ps due of more derp
PS
- added some debbugging lines
PS
- redefine injectInputEvent code and get rid of the handler we used to fix
  exception due that PhoneWindowManager is no UI thread and cannot handle the handler
  and to speed up navbar/navring etc. No need to delay it for 30ms
PS
- reworked the complete interpretation code. To fix up the initial issues we had on first patchsets
  and as well the new ones. Nuked vibrations as well and lets handle it like all other over SlimActions
  cleanup again
PS
- I remember that jeff had similar problem in the past and got the solution. We just check now
  who is really calling home key event. If it is a VIRTUAL key then launch home....for all other
  lauch the saved action on the home event. As well this fixes the wrong launch if DoubleTap
  timed out and launches home (now it launches the saved action for home like it should).
PS
- cleanup
PS
- finally fixed home button
PS
- last major cleanup
- cancel recent preloads only if it is really required
PS
- introduce central HwKeyHelper class to avoid code duplication in PhoneWindowManager and as well
  in Settings
PS
- fix small logical error in home key handling to avoid to go over SlimActions if button is set to default
  home
PS
- fix wrong menu default value
PS
- added double tap to all bindable buttons
- fixed reported missing vibration on longpress
- possible fix menu shows up on longpress menu
PS
- small cleanup
PS
- fix home/assist/appswitch call when it is set on the natural button as longpress or doubletapp.
PS
- attempt to fix the problem mentioned in PatchSet above on the other keys + simplify this fix
  Please test
PS
- fix navbar
PS
- fix double vibration if double tap is pending
- fix deprecated System.SHOW_PROCESS value call and call Global instead
- execute on assist and appswitch default action if no other action was executed before
- HwKeyHelper do not call provider values if not needed
- cleanup
PS
- menu and back button: if normal tap action does not equal natural back action return -1
  to avoid processing back/menu action
PS
- reset the indicating boolean for prevend second vibration when we reset the doubletap
  callback - this fixes the reported issue that vibration is suddenly completly gone
PS
- return on back and menu hardware trigger always the action and let it use the virtual
  key to process the final action
PS
- handle virtual key on back and menu a bit other
- rename vibration var
PS
- fix double vibration if double tap is disabled
PS
- fix back key wrong condition on double tap which caused 2 action calls
PS
- do not assume that double tap has always a pending vibration...check for the action
- respect keyguard on APP_SWITCH key
PS
- remove again the keyguard check lol....I forgot that I was some months ago allready
intelligent enough to check this in SlimActions lol. So no need to check it twice

Change-Id: Ic5c9b4eb03d2baa3b0ddfb3e9fcaf10d6e45dcd3
[1/2] FB: Make menu unlock configurable

For devices with hardware menu keys, menu unlock is turned on by default
This can cause unintentional unlocks. This commit adds the ability to turn
Menu Unlock on or off as desired (Settings -> Security)

System Default is for menu unlock to be ON. This default value can be
overriden using a device overlay:

overlay/frameworks/base/packages/Keyguard/res/values/config.xml
<!-- Allow the menu hard key to be disabled in LockScreen on some devices -->
    <bool name="config_disableMenuKeyInLockScreen">true</bool>

This commit requires the matching commit from Settings repo:
https://gerrit.slimroms.net/#/c/2395/

Based On: https://gerrit.omnirom.org/#/c/3317/

PS6: correct config/overlay location and make multiuser compatible
PS7: derp
PS8: remove the symbol
PS12: rebase

Conflicts:
	core/java/android/provider/Settings.java

Change-Id: I3b6108e4bd403cb76827daed226a4d6a5b868741
SystemUI: Pimp-up Media Tile (1/1)

Allow double-click to start a sleep timer
	for the currently playing media.

PS:
- clearer button descriptions on different states
- if timer is in progress restore and show the time the
  user had set up and notify that he is in timer progress

Change-Id: I7848523e7bc3d9577361ff55f010a9909d46e665
Harden against transiently unavailable backup transports

The init & clear operations are particularly important to ensure
delivery when at all possible, so we retry those periodically
if the transport is unavailable when we first attempt them.

Now with 100% less build break.

Bug 11716868

Change-Id: I2af4e93788068cfac97c0a48d3568c561eefa23d
fb: finally fix carrier lable shows on first boot sometimes

Issue:
- boot up
- directly open via fast QS pulldown QS
- sometimes carrier label is shown

Expected behaviour: should not show

Fix: Visibility is directly set when the settings observer is registered first time.
If no update was done on the carrier label before the user pulled QS down the first time
it showed up. Vary rare case that this can happen
but should be handled. To fix it do not set the visibility directly and call the
updateCarrierAndWifiLabelVisibility(boolean) method to handle the correct visibility.

As well last cleanup on notification shorcuts...move the check if it is
active or not to the visbility method itself. Way cleaner

And remove the previous attempt to fix the above described issue due
it did not fix it at all

Change-Id: I901beb987c21fe0cdb7a5d9f16f850f4297c15f4
fb: use on virtual POWER_KEY own global menu handling

we use the POWER_KEY down event to call the global menu from SlimActions
to allow to add shorcuts to the global menu.

Handle this undependent of non virtual key events and call the global menu
directly without vibration and without delay.

Just put it into the message que and done

Change-Id: I7d9af04605696d41bee949cfd99f6de4c4be6baa
fb: TRDS change auto detect light conditions method

Currently on critical light conditions it still switches to often between
on and off which results in bad UX and in worse cases to unusable phone
due that it is permanently switching. To prevend that slacken the light mode
level detection and set it when it goes to dark mode way more higher (LIGHT_CONDITION)
and when into light mode back to lower level (DARK_CONDITION)

PS
- 25 looks good

Change-Id: I665f3141fe31f26ca371d10593ff95174d68fc9e
[1/2] base: Add support for ADB over network

Originally from CM.
This patch actually consists of three parts. SlimKat has already patched the ADB service in vendor/slim: init.local.rc

Conflicts:
	core/java/android/provider/Settings.java

PS2: Put CM in commit message, reorder import and fixed space indent.

Change-Id: I2983caddbe6079305a8d8caab32f6538a51d7db9
Notification : Fix app info long-press

Addresses http://code.google.com/p/cyanogenmod/issues/detail?id=7060

Change-Id: I45c0e1b73c08ceffef02db244b947bfcedf3b20a
core: Added national roaming info for Jazztel Movil in Spain

Users of Jazztel in Spain (MCC214 MNC21) can roam on Orange (MCC214 MNC03).

Change-Id: I2d4a3affcd05112e75f4b70e49bfe823bb57a9ba
Signed-off-by: arnau <arnaullv@gmail.com>
core: added national roaming info for Spring Mobil in Sweden...

Spring Mobil users in Sweden (MCC 240, MNC 10)
can roam on Sweden 3G (MNC 05) and on Sweden 2G (MNC 24).

Change-Id: Ie27ad3561de32557a1713d4962fcc9ec52a8b7fe
Initialize pointer members to NULL to avoid illegal reference

mBitmap and mTexture is not initialized to NULL which causes
illegal address access when it fails to be created from
oversized bitmap.
Cherry-picked from AOSP: https://android-review.googlesource.com/#/c/79320/

Change-Id: Iea54bec8788bc5f3a10040fdb43f416c0d41a14c
MediaFocusControl: Deny audio focus if notification stream is 0

Previously audio focus would be granted regardless of notification
volume, meaning that if notifications are muted the media stream would
still be dimished for focus. By checking if STREAM_NOTIFICATION is 0 and
if a notification stream is requesting focus, this is no longer an issue.

Change-Id: Ie10a64e58ce77174a3bbdeaa936646d40c24404f
Signed-off-by: Evan Anderson <evan1124@gmail.com>
Set Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE default value

To be able to customize the "WiFi scan always available"
setting we need to set a default value.

Change-Id: I3673f2613ab9b6a947aed7e29d4cc876140c2180
Fix error checking in MemoryFile.

mmap returns MAP_FAILED on failures, not 0 (NULL).
Also, convert some C style casts to C++ since they
make intent clearer.

Change-Id: I367993c73e9ee576f11ebe76e530d2c2f27c662d
Fixed stylus eraser being rejected by palm rejection

The stylus eraser appeared not to work, i.e. Android did not respond to
input from the eraser. It turned out that all input except stylus input
is rejected when palm rejection is activated. The problem was that the
eraser itself activates palm rejection when it hovers. The solution is
to allow the eraser during palm rejection. This solution makes sense
because the eraser input works in the exact same way as normal stylus
input.

Change-Id: I90824500be7613af4f00427c59ce828528b632f7
Fixed incorrect calculation of dirty invalidation area

Padding was already taken into consideration before calling
invalidateDrawable in ProgressBar.

Change-Id: I75f25b0b7ee87d394422c58888ed3a1cca5d06a8
FLAG_PRIVILEGED disappears if privileged app is updated and rebooted

Since Kitkat, an app pre-loaded under /system/priv-app/ has
FLAG_PRIVILEGED. However, if the app updated and the device
rebooted, privileged flag is unset from pkgFlags. This patch
fix issue to assign privileged flag when scanning the updated
packages.

Bug: 12640283

Change-Id: Ic24b5882f65dabdfae9cc39da3d68661bed4fc31