Keyguard: LaterLock: improve the handling of policy timeout

If the security policy specifies a maximumTimeToLock, the
previous implementation would consider the screen's
displayTimeout as having elapsed, even if the user simply
pushed the power button to turn the screen off.

Consider the case of a 30 minute policy timeout and a 30 minute
display timeout.  In this case, pressing the power button will
cause the phone to be immediately locked (even if the user
requested it remain unlocked for 30 minutes).

This commit differentiates these two cases (display timeout
vs. user initiated display off) and only counts the displayTimeout
period if it wasn't user initiated.  After this change, the
lock would only occur 30 minutes after the power button was
pushed.

Note: if the user requests, in the Settings app, that the
Daydream start immediately, it will still consider the
displayTimeout to have occurred because we don't have enough
context at this level to tell whethr or not Daydream was
user initiated or due to a displayTimeout.

Change-Id: I8ea971c75685b2c2b9d4ec050a7bce6e28f45746
Fix PhoneWindowManager animationFinished callback.

Change-Id: I86863a44e3e710aa5ea6ad433a42a3fad3bccac1
PackageManager: Limit the platform-key protection to test-keys builds

This block (change I7390b3bdf5289411f7a335c69635bed9f74bbfb3) is intended
to protect the system from abuse of well-known keys. That's not the case
if the system is signed with dev or release keys.

Change-Id: Ifb66f775dd28c577447634ae177442732a18b592
Fix the ribbon duplication issue.
The ribbons were instantiated once in BaseStatusBar and once in PhoneStatusBar. Mend that by removing ribbons from BaseStatusBar, just like it's done in AOKP.

Change-Id: I77280ede4884d68acf8058a913e47a7e3ab55f77
KeyguardViewMediator: Play lock screen sound sooner

When the screen is locked, there is a long pause before the lock
sound actually plays.

This makes that sound happen much sooner.

Change-Id: Iede7a5d22291d1ada98800d2b380c255547df61d
Camera: Adds support for meta data callbacks

- This change adds a new type of callback
  that will be called when there are pending
  meta data notifications.

Change-Id: I84f5cbafe4f023c7b0efa9ec8620756b0eaa428d
Prevent EventHub from adding input device twice

When Android first starts up, it scans /dev/input for input devices.
In some rare instances, the EventHub gets another notification that
some device nodes are created. It then proceeds to add the same
input device again. This causes the system to get two events per
touch or key stroke.

This adds a check to prevent adding the same device if the operation
is triggerd by inotify.

Change-Id: I68b02594f1c7f14067611735db0b3763378ec7ea
Signed-off-by: Daniel Leung <daniel.leung@linux.intel.com>
IntentService: Fix to run with a lower priority flag.

Added extra contructor to start IntentService with a diferent priority.

Change-Id: I4224ca56ae7eee2c099140bf0242be33b8690ad8
Signed-off-by: Gonçalo Ferreira <monxalo@gmail.com>
Fix one wifi and ethernet concurrency bug

enable wifi and connect to a AP while ethernet cable plugged in.
wifi will be teared down.But driver is not stopped.After unplug
ethernet cable.It will failed to auto reconnect wifi.fix it here.

Change-Id: I1b0156cf89f26747ce67ebad2b4138e8d61f30df
Signed-off-by: Jianzheng Zhou <jianzheng.zhou@freescale.com>
Prevent MediaScanner infinite loop with invalid path

including double slash  "/storage/sdcard0/xx//xxx/xxxx"

Change-Id: I112a70c88b5ec662482b79c3151310b9b9b52e40
FastScroller: Fix to use appropriate index

Fix FastScroller to use appropriate index to determine the
the position of a section while calculating the y coordinates
of thumb. In case of last section, use totalItemCount to determine
next section position.

Change-Id: I89bfd483949b5c14f85303b50380a73b4a4e635e
framework-res: Remove gingerbread scrolls

Change-Id: I74dbac134c701c7b0253130191ad4d9e3519b097
fix Typo on OpenGLRenderer (libhwui) Properties

See: http://code.google.com/p/android/issues/detail?id=60165

In file

https://android.googlesource.com/platform/docs/source.android.com/+/master/src/devices/tuning.jd

Line 109 says property is called "texture_cache_flush_rate" however in the code it is called "texture_cache_flushrate". See that in file

https://android.googlesource.com/platform/frameworks/base/+/master/libs/hwui/Properties.h

Change-Id: I4b6aff888608e9d7c9de66421f68114081250b9b
SystemUI: Ignore lint check ProtectedPermissions

Change-Id: Idf8ccd37cfb02e6da136187eb872e97e22b158e6
LockScreen: allow hardware key longpress to put device to sleep

Change-Id: I54260e21c462bcabd9b6383e22f44d644630b4d3
SystemUI: Remove obsolete layout params (fix lint warning)

Change-Id: I41f688c9a351189c9929dc1f4947c0124820f5ad
Add Motorola EMU audio dock jack sensing support

Don't route to dock output just because the device is docked.
Let the actual jack presence to control it.

Change-Id: I4066d08b1aa58ead39aad9410b9dd71624776187
Camera button support (1/2)

Add new bitmask for Camera button and "hasCamera" boolean.
For those devices that have dedicated Camera key
(like Sony ZL/ZR/Z1/...)

Change-Id: I1a6681664f9f3fd3f30221ba10b082cb5f8cafca
Camera button support: make it actually work

Previous commits were merged so fast that I didn't even
added the code that actually DOES launch the camera.
Let me fix that.

Change-Id: I4fcb3c46e5fd50e273dcf19fd3eb35a3f9d979e0
FW: Fix Notification Shortcuts

All credits to SlimRoms for their awesome work on the Notifications shortcuts, this commit corrects the PAC code to the SlimRoms 4.3 implementation.

Unable to cherry-pick a commit to correct our code issues but the original commit retains authorship and all credits for this code are solely attributed to the SlimRoms team, I have only corrected the PAC code port of this feature.

Change-Id: I418dba621cd98745cb6804a2bdd2ba447e580daf