[1/2] Uptodate ActiveDisplay with Omni

----------FRAMEWORK PARTS-------------------
revert this --> https://github.com/PAC-man/android_frameworks_base/commit/b3b33db6a6550adef586201ffefe81108b056d0e

https://github.com/omnirom/android_frameworks_base/commit/434928a07e43b727485b7abd79f47b0a1bc03a9f
[1/2] Base: Fix pimp up ActiveDisplay

This is a fix for the new features added with change: https://gerrit.omnirom.org/#/c/2819/

1. Fix the bug when Pocket mode is set to Notifications only and you
unlock your device with power key and if you put your hands over
proximity sensor the device will turn off (very annoying). The problem
was that mWakedByPocketMode it was put in wrong place.

2. Added an option in active display settings for "turn off display if
device gets pocketed again" (it's annoying for me, because i cover
the proximity very often).

3. Added an option in active display settings for proximity threshold.
I use this active display feature as an replacement for "sweep2wake",
and when my phone it's on the table, i just want to pass my hand over
it to show me the clock or notification (this was ok before the pimp up
commit), and now, you can choose how many seconds for proximity
threshold.

Practicaly, this commit fix one bug, and add settings for the
features added in 'pimp up' commit.

THANKS --> Sergiu Sandor <micku7zu@gmail.com>
-----------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/e4d93db54a9cd27345ae44c4dad6a4eb40656b4e
base: ActiveDisplay: fix for disappearing notification bar

What a derp
http://jira.omnirom.org/browse/OMNI-158
http://jira.omnirom.org/browse/OMNI-101
PS2
dont do it on secure lockscreens
PS4
check if lookscreen is enabled

THANKS --> Maxwen
-----------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/6df6cb44afac23178b53644fa590b2ed52fc73aa
 Base: Fix ActiveDisplay problem
follow kitkat changes
fix ActiveDisplay never disabled after using turn off display option

THANKS --> 0xD34D
-----------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/aabb34f109cb2adbd6c9f271fc963beed728a58e
 Base: ActiveDisplay check for Immersive Mode Enable

As we know, Immersive Mode will force StatusBar and NavigationBar to Hide
while ActivieDisplay always setSystemUiVisibility flags for Both if enabled,
and will cause a conflict for that flags

// how to reproduce bug:
// set ImmersiveMode enable
// set ActiveDisplay enable
// Turn Off screen, swipe to sensor, ActiveDisplay showing
// Turn Off screen again (using Power button)
// Turn On screen (using Power button)
// pull Quicksettings, disable ImmersiveMode from ImmersiveTile
// Turn Off screen again, swipe to sensor, ActiveDisplay showing
// unlock via ActiveDisplay
// voila.... random flags will be set into setSystemUiVisibility
// (sometimes navbar or statusbar or both are gone)

lets make ActiveDisplay check for ImmersiveMode enable/disable,
so ActiveDisplay will not always setSystemUiVisibility flags
if ImmersiveMode enable

also workaround fix for unknown icon (?) sometimes appears
(if Show All Notification enabled)
(based from user report at XDA thread, why they always report there not in JIRA :/)

THANKS -->  Squadzone
-------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/02f017e7f1a590a2c161de5408e28dd1e0d6318c
 Base: Disable proximity sensor when screen goes on in ActiveDisplay/PocketMode.

Active Display (in Pocket Mode) currently only switches off the proximity sensor in some cases.
If the user switches on the screen itself, the sensor is left running. This change
stops the sensor as soon as the screen goes on. Active Display already started the sensor each
time the screen goes off.

PS2: In the mode that turns the screen off again when the device is pocketed,
the sensor stays on until you leave ActiveDisplay.

THANKS -->  GidiKroon
--------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/5fb130d9929e986ac995e4f1e13cf2e21aa6bc83
 Base: more fix Active Display

fix http://jira.omnirom.org/browse/OMNI-352
fix http://jira.omnirom.org/browse/OMNI-357

THANKS --> Squadzone
------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/2806eabf10d410e7b01201c6d08c3fb69ba55ffd
 Base: more fix Active Display (again)

maybe fix
http://jira.omnirom.org/browse/OMNI-313
http://jira.omnirom.org/browse/OMNI-421
http://jira.omnirom.org/browse/OMNI-401

THANKS --> Squadzone
------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/752e13f6d74126c85dead13f1cecb5a66d0a4d1c
 [1/2] Base: ActiveDisplay (rework interface)

really fix AD buggy stuff
tested with Music play
tested with No lockscreen
tested with faster screen turn off
check all sensor going off if AD not Showing or Disabled
fix notification posted/removed
make AD using System Window so it will covered all screen
fix Navbar translucent if Lockscreen Blur merged :P
now using Rounded Image
also introduce new RoundedImageView widget
 courtesy of @vinc3m1 (thanks)
fix build
fix sometimes screen turn off after unlock because screen timeout (hopefully)
now using new parser to get Notification data (thanks @Achep for the parser)
rework lightsensor manager
add NotificationUtils
fix brightness sometimes not changing

add support applications privacy mode (will not show content message if enable on each app)
see http://jira.omnirom.org/browse/OMNI-600

allow bypass AD if no notification and lockscreen is secure
see http://jira.omnirom.org/browse/OMNI-594

fix proximity always enable after adding new feature allow bypass AD
fix parsing notification data from app with targetSDK < 17

fix excluded app value (no body notice this broken since AD merged into OmniRom xD )

add option to allow bypass AD
make AD multiuser support

THANKS --> Squadzone
---------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/452d3baad3db13e0b85ac8dcd6a89d56d1845032
 Base: fix ClockView ActiveDisplay

why no body report this bug?

this happen since AD merger into omnirom for the first time
i found this bug after using 24 time format LOL

THANKS --> Squadzone
--------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/3e1bc8ef78c37ace8ec149ac2e73af2217aaa20f
 ActiveDisplay: Fix for flo and other devices
The changes made to layout/active_display_content.xml were not
made to its layout-land and layout-sw600dp counterparts

Make them here too to stop flo from crashlooping in systemui.

These values may need to be tweaked later, but preventing crashloops
is top priority.

THANKS -->  Entropy512
------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/3ca94cc408da6a2aa23c6658b17fd77ed693de46
 [1/2] Base: fix ActiveDisplay for WifiOnly Devices

fix http://jira.omnirom.org/browse/OMNI-637
also fix for devices with unsupported Proximity sensor and Light sensor

THANKS -->  Squadzone
------------------------------------------------------------------------------------------------

PAC commets:
not applyed QUIET HOURS -> https://github.com/omnirom/android_frameworks_base/commit/e3a1a775bcacc48512cfd47ea1274597d60ad5bf
is taken from slim & not implemented yet

Change-Id: Ib5b1d30faad057705cc6c24e439770a5ff5f16e8
Fix NPE for MSim

Change-Id: I4ea94f8261b028368cddc444e6417a8cdf533b2e
Signed-off-by: Lokesh Chamane <lokesh.c703@gmail.com>
Bye bye Blank Android dude...

Change-Id: I338f63f65ead7889ff48c497c2083333fcaf5f52
Signed-off-by: Lokesh Chamane <lokesh.c703@gmail.com>
[1/2] Speed up booting on multicore devices.

1. Add multithreading support to Installer/installd.
2. Parallelize package scanning.
3. Parallelize boot dexopt.

Conflicts:
        services/java/com/android/server/pm/PackageManagerService.java

Change-Id: Id42b2bf4a737f93f9ecd9b5819344adbb735f0fb
Live Volume Steps [1/2]

-Created by me(@Meticulus) for the almighty BeanStalk ROM!

-Volume steps changes are instant, no need to reboot!

PS2: Clean up
PS3: Rebase
PS4: include lvs: transitioned volume steps volume normalization from Commit 5331
PS5: Nope, we don't squash commits for no reason.
PS6: Rebase and correct whitespace

Change-Id: Ia821c7326f6ba8c9e35b4c0b4caa9c9fb5e060f2
lvs: transitioned volume steps volume normalization.

-This calculates an equivalent volume ratio for the new
volume steps.

-example: Volume steps are set at 60. Volume is set at 5. That is
very low volume. Then volume steps are switched to 5. Now you
are instantly in a state were your volume steps are 5 and your
volume is 5. That's full volume! This fixes that issue.

-So it basically keeps the volume from jumping around while your
changing volume steps. It may be a little lower but should be
very close.

PS5: Back to single commit mode, no unneeded squashes here.

Change-Id: I5151938997cde9932ee492615dc9bf68c80ca895
Decrease Vol Panel Transparency

As I was kindly told at dinner...160 is aparently too transparent. Bump to 208,
 50% of difference of previous value and 255.

Change-Id: I938d0e37b5807c83d25a35e2fb08fcdfb02db18f
Fix the screen-off animation ignoring value set in ro.sf.hwrotation

Before: http://www.youtube.com/watch?v=lGzz5agWvro&feature=youtu.be
After: http://www.youtube.com/watch?v=NSq0uWqlAjM&feature=youtu.be

PS2: Rebased
PS3: This doesn't need to depend on unrelated commits.

Change-Id: Ib0729440cc76a604ff400cb9c4e8da3350b7d214
[1/2] fwbase: Correct toast animations

Change-Id: Ib538f9429e474e06b7ff19d0b8200285f40c2886
Keyguard: LockScreen Glowpad DoubleTap Gesture[2/2]

Add option
Case 1: Sleep
Case 2: Torch
---------------------------------------
PS2: Delete tabs
PS3: delete white space
PS4: derp
PS5: another derp

Signed-off-by: SectorAndroidRD <SectorAndroidRD@gmail.com>
Change-Id: I2e4a596dc95a568c03b2b193684c961625a641b3
Revert "Revert "UserTile : Check if profile has a photo""

Fixed properly by CM, see depending commit.

This reverts commit 7ba3c9f1336c3daaaa0db4676f6d45e260bfb3ab.

Change-Id: I7a643b32498f15db8cd4c74051a256af44184788
SystemUI: Fix displaying of user photo.

If owner profile does not have a photo but any associated profile have it
then photo will not be displayed. This case was broken by 67735c4efc458534906b2fb4683300c6e84c809b.

Change-Id: Ied7b1f8a5998c18bffcfd8bd603b4aa35d705c80
core: AST translations

Change-Id: Ic76c1cf2067ceff5896ee6340b16e84803f66d2f
Use MODE_ASK as the default ops mode in Privacy Guard

 * Prompting the user is far more useful as a default behavior. The
   choice will be remembered after the first request.

Change-Id: Ie62f932047f8b761bd0dd9f836bcd1132062edf5
Revert "Revert "Block application install from unknown sources through adb""

This reverts commit 82b0dd815c827ff68f201d752cdd5c1d08fb39a6.

Change-Id: I4ba932d9e71157235721336040582f5280c0c131
Fix for positioning of glyphs within a bitmap

For positioning of glyphs within a bitmap, roundf(int + float) is used,
where the float is the glyph position and the int is the text position.
When the text position is varied, this may lead to the sum being rounded
in different directions, due to floating point rounding, caused by that
floating point numbers have different precision in different ranges.

This may therefore lead to slightly different positioning for glyphs and
therefore slightly different widths and heights for text strings,
depending on the position they are rendered at.

The solution in this patch is to use int + (int) roundf(float), which
has consistent rounding, and also enables us to use the full range of
ints.

Change-Id: Id1143cdfcbdfa9915ced878ae04df589a3e03cee
Release locked buffer when it fails to acquire graphics buffer

The JNI buffer in ImageReader_imageSetup is not released when
it fails to acquire graphics buffer. After all JNI buffers are
exhausted, ACQUIRE_MAX_IMAGES will be returned and leads to
error. The JNI buffer should be released when it fails to acquire
graphics buffer.

Change-Id: I3319a58ac44e36c8593b404672a685c4b589a735
Fixed upgrading from forward-lock application to system application

Fixes the case when the app on system is newer than the
currently installed. Something that can happen e.g. after
a FOTA update.

Change-Id: I102e9cdd5693d5e66667c0c8989dc2643c72dd16
Fix graphics corruption caused by HWUI caches

Some caches(PatchCache, TextureCache, PathCache) for HWUI
uses deferred removal for their cache entries even though
actual resource objects are immediately freed by
ResourceCache.
For this reason, the uniqueness of a resource address in
the caches is not guaranteed in specific cases.
(Because malloc() can return the same address when malloc()
and free() called very frequently.)

So it can be possible the cache have two cache entries for
two different resources but the same memory address.
(Of course one of the resources is already freed.)
It also can be possible mGarbage vector in PatchCache has
duplicated addresses and this can lead to duplicated free
blocks in the free block list and graphics corruption.
(Deferred removal was implmeneted based on an assumption of
unique resource addresses.)

So this patch makes sure resource objects are freed after
the resources are removed from the caches to guarantee
the uniqueness of a resource address and prevent graphics
corruption.

Change-Id: I040f033a4fc783d2c4bc04b113589657c36fb15b
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>

Fix AOSP build - DO NOT MERGE

Change-Id: I42b420c2ce89ce364a2809b28b827964e6923fa1
Revert "Revert "Revert "Block application install from unknown sources through adb"""

This reverts commit a7ea39712a880252ffd13be0b5861e4a1c1288a7.

Change-Id: I23d4ef912a17057756a091ffc8b8bf3bde11342b