Make ImageView drawable update more efficient in some cases.

When updating the view's drawable via setImageResource or setImageURI,
make sure to skip the layout pass if the old and new drawable have equal
sizes. This follows what is already done for setDrawable().

Change-Id: If73d225e38d0a2f7c616c4aeb33f67bdaed390f1
Avoid layout passes when updating data activity indicators.

ImageView can optimize out layout passes if old and new drawable have
equal sizes. Take advantage of that by displaying a transparent drawable
with the same size as the in/out drawables when there's no activity
instead of clearing out the drawable in that case.

Change-Id: Iaaa556ffab3ed4be1da8016ed40d0a9c2efcde01
[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.

[2/2] part: https://gerrit.omnirom.org/#/c/3381/

Change-Id: I9e49ddb89002699714dcc3b3d2b1df87dc4bab4b
Fix a bootloop problem when /data/system/usagestats/usage-history.xml is empty.
This often occurs after an incomplete reboot/shutdown or battery pull.

Patchset 2: Cleanup
Patchset 3: More Cleanup
Patchset 4: derp

Change-Id: I4f01151f4051df4ae1b85fa460ec7a9e70122878
Merge "[1/2] Base: Fix pimp up ActiveDisplay" into android-4.4
Merge "Fix a bootloop problem when /data/system/usagestats/usage-history.xml is empty. This often occurs after an incomplete reboot/shutdown or battery pull." into android-4.4
Merge "Avoid layout passes when updating data activity indicators." into android-4.4
Merge "Make ImageView drawable update more efficient in some cases." into android-4.4
merge changes from Omni 4.4 into local branch

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/activedisplay/ActiveDisplayView.java

Change-Id: Ic63c0a041bc7e2bc70c766acddbb4aeea24e3c81
Active display: Add NPE check

Change-Id: I3f5869006cfb9f97637407074fdcbb2e7925df62