base: Check for homeAsUp status when collapse actionbar widget

mHomeLayout should be visible if one of DISPLAY_SHOW_HOME or DISPLAY_HOME_AS_UP are set.
collapseItemActionView only checks for DISPLAY_SHOW_HOME, so applications that only uses
DISPLAY_HOME_AS_UP and uses an expandable/collapsible widget (like SearchView) doesn't
properly restore the home layout.
One sample of this behaviour is the DeskClock app. The CitiesActivity doesn't show the homeasup
indicator after collapse the searchview.

aosp change-id: https://android-review.googlesource.com/#/c/71093/

Change-Id: I2f225138771da6bd6b2a468ad616b90c2c0a9d35
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
fb: fix possible NPE on power key handling

fixes reported NPE which can cause SoD

E/InputManager-JNI(  805): An exception was thrown by callback 'interceptKeyBeforeQueueing'.
E/InputManager-JNI(  805): java.lang.NullPointerException
E/InputManager-JNI(  805):      at com.android.internal.policy.impl.PhoneWindowManager.interceptKeyBeforeQueueing(PhoneWindowManager.java:4185)
E/InputManager-JNI(  805):      at com.android.server.wm.InputMonitor.interceptKeyBeforeQueueing(InputMonitor.java:357)
E/InputManager-JNI(  805):      at com.android.server.input.InputManagerService.interceptKeyBeforeQueueing(InputManagerService.java:1351)
E/InputManager-JNI(  805):      at dalvik.system.NativeStart.run(Native Method)
E/InputManager-JNI(  805): An exception was thrown by callback 'interceptKeyBeforeQueueing'.
E/InputManager-JNI(  805): java.lang.NullPointerException
E/InputManager-JNI(  805):      at com.android.internal.policy.impl.PhoneWindowManager.interceptKeyBeforeQueueing(PhoneWindowManager.java:4185)

Change-Id: Ia0aa32c5472d0381d629a83492b42dec419b840e
Revert "Fix a bootloop problem when /data/system/usagestats/usage-history.xml is empty."

This reverts commit 286cba172e026515da98c08c93967a9c679ebba2.

AOSP just pushed 2 days ago a way better fix

Change-Id: Ib69ffad209b9f72857cf584c74cc1f8f74e6937a