Keyguard: add smart cover support

Change-Id: I436eba7678b923a9f293e15d786447214bc9bdcb
Signed-off-by: Roman Birg <roman@cyngn.com>

Conflicts:
	packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java

(cherry picked from commit 3fc05a17fb917160579a84a501d4e0c051b3b34a)
[ActivityManager] Fix race condition in pss collection

Symptom:
There has a race condition that two threads are accessing
the mPendingPssProcesses simultaneously. One of the thread
is collecting the process pss by looping the mPendingPssProcesses.
The other thread is requesting to collect pss of all processes,
which clears mPendingPssProcesses and adding processes back.

Solution:
Avoid race condition by adding synchornized protection.

Change-Id: Ifb090eda9c4a1b8e3fd980fe0171e9dd77773b46
(cherry picked from commit 00df0d8b39115f92ec0d2914b9cedac93a9070de)
Themes: Fix setting wallpaper from a legacy theme

Change-Id: I3bfc9ee24d2a3ee5c1bdb97f2c07427e6d723206
(cherry picked from commit 7ab9b05e117a3bb3dd7cac1af36ff64daaf81713)
Themes: Track NotFoundException on app launch failure

We should probably keep an eye on NotFoundExceptions too since they
are a common exception thrown when a bad theme is applied.

Change-Id: I2ccaed0349a90ab99b99fb83cef0c9183d598088
(cherry picked from commit e006f78534ad4944f439f288a7555c1fa1cd052b)
Themes: Remove listener if exception is thrown

If something goes wrong and a client does not remove itself, the
theme manager may still have a reference to the listener and an
exception is thrown while trying to call one of the listener's methods.
When this happens, we should not only log it but remove the bad listener.

Change-Id: I052cdcc10b0eaa75ebf076b3ece5f8a668d3868e
(cherry picked from commit 0139dfa477889525d22654dd8ef3c07e60a8ae47)
SystemUI: hide up arrow NavRing indicator if no targets present

If there aren't any navring targets setup (the user has removed all of
them, or maybe search assistant is not present) then there is still a
hint in the lockscreen to pull up from the nav bar.

If there are no targets setup, hide the arrow indicator.

Change-Id: I65103a4cec668a9a8b3f678f991f5acba17d19f5
Signed-off-by: Roman Birg <roman@cyngn.com>

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java

(cherry picked from commit 61072f720c41b0a0d791059539772d62c0dd0ead)
Revert "SystemUI: don't show eq tile while casting"

Does not work as intended.

This reverts commit 72dc45fb1b219aafa1d4b2fe62d144739ae4a552.

Change-Id: Ifd40c70c45b038983145369287a6dae177ac0a4c
(cherry picked from commit 255a89a5353ed3b4b2c60a8744eb21e51b39547f)
frameworks: allow last app action to be assigned to hardware keys

Also fix multi-user handling for 'switch to last app' and 'kill
foreground app' actions.

Change-Id: I1fb586d19b1198e6888b0f11e0a2813acf0bcd5b
Signed-off-by: Roman Birg <roman@cyngn.com>
Signed-off-by: Danny Baumann <dannybaumann@web.de>

Conflicts:
	core/java/android/provider/Settings.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

(cherry picked from commit 0f04068fa4c2366789904174e86d2fb72de2c8a0)
Fix build

(cherry picked from commit d16fe9a732ddf6e961f5c5a8f3d621ed4c5ca878)