[1/2] Add to support pause/resume download

We add pause and resume API here so that application can
pause and resume downloads manually by DownloadManager.
This contains two points:
1. add pause and resume download APIs.
2. add another paused reason for this download status.

PS2/3:
* Fix code.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I606b48ca20f43bcc6c119683818c2ab6ff03bfe5
modified last commit
Display: Dirty region propagation

Pass Dirty region values from HW renderer to Surface Texture.

Change-Id: Ibd121ed398a1319d3daf26f9fd39a03323bba666
frameworks/base: Call setDirtyRect to update dirty rectangle

This change updates dirty rectangle instead of dirty region of a
surface.

Change-Id: Ic5c6e68ff644911a596a2432fd14868edbff9b17
Add clear all recents button to in-the-spot user preference

Change-Id: I53c7d5f881542d2644aac8cc09e49ae1c5543bcb
On-The-Spot: Add clear all recents button to user preferences.

PS3: Add proper drawable thanks to / by Dani Rosenkamp @DaNi--
     Fix wrong change id (from abandoned commit)
PS4: More logic drawable

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I632730bee6b409072689e07fb1084ceaca5b1d49
[TEMP] PIE: fix a freezing bug

How to reproduce:
- Enable PIE;
- Toggle between on/of;
- Without close expanded status bar click any tile that use one of this methods -> private void startSettingsActivity(String action) or private void startSettingsActivity(Intent intent);
- System will freez for some seconds and soft reboot;

Solution:
- When deteced PIE mode enabled use a runnable with a less time possible to give time to system colapse panels and perform needed actions

Change-Id: Idc5f112873aa7a31993e7a3c82a1760bb45f8b9b
PIE: Disable orientation sensor when we don't need it

Orientation sensor always enabled causing some device keep awake and
battery drain. This commit fix this issue.

  * Disable/Enable orientation listener when screen turn off/on if PIE
is enabled.
  * If PIE is disabled, recycle it.

Change-Id: I6bda168b3fd62d9f7047ffc3a3c6bfd08e655543
Framework: Create "on-the-spot" preference dialog only if needed

Right now a new instance of the "on-the-spot" preference dialog gets created
each time when the user taps on the immersive tile or each time when the
user pulls the statusbar from the right side. It should only be created if
it's really needed.

PS2: RecentsActivity clear all
PS3: Made method static and check is in SettingConfirmationHelper
	(thanks to Yamil!) + rebase ("Long press recents to switch to last
	 app"
PS4: Removed unneeded variable

Change-Id: I464edebbfec9e3452d36876ed8ef69ab915fd872
Signed-off-by: Parthipan Ramesh <parthipan.ramesh@gmail.com>

	packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
frameworks/base: Fix the random UI corruption

On low memory device, when a view goes to background. Its HW layer cache
will be destroyed to release memory. There is a very rare case that the
hardware render is not valid when destroy the layer, so the layer is not
destroyed and reused when the view comes to foreground. But the GL
context has changed, so the view is not rendered correctly due to its
HW layer cache. To fix this issue, destroy the layer in a safelyRun. Make
sure the layer is destroyed correctly.

Change-Id: I1c714e1d53db7353d5169e874a7cd0f527c3f67b
CRs-Fixed: 623239
frameworks/base: Fix change propagating issue

destroyLayer() function has been modified in kk. It is not correct
to propagate the UI corruption fix from jb to kk without considering
the new changes made in kk. This change is to make it align with
the new code in kk.

Change-Id: I34d11b230b9390fe8a989ab6f9c7d3a48d586205
Fix double finger when 'Quick pull down' is disabled.

If "Quick pull down" is disabled, never do the function "switchToSettings()" and the stock double-finger feature doesn't work.
The OTS preferences only need to check the "statusbar portion" code.

Change-Id: I245854922f2e643e317f7aadd45043542e2f9871
Media process is crashing with NullPointer exception

Sometime, while creating thumnails list of media files in
compose MMS->attach file,  filepath may be null due to
synchronization issue.
Adding NULL check to avoid NUllPointer exception.

Change-Id: Id6cf5612a959b3ae15b44bc60dbbcbe40c624f09
CRs-Fixed: 636494
fix appwidgets not updating commonly found in some apps like dashclock

Change-Id: I4cc273ebc61744b6ca02804290af85742d7ec6bc
saves the fragments animations for all accross modifications or changes

Change-Id: I0685a38beeb19168a67d6d0a1bf30a52f76fc416
update the animation level of the Action Bar

Change-Id: Ib5c54502b1d50d85e6413dfabdd7cf01a4d0ff2f
remove and add some code
Long press recents to switch to last app

Change-Id: I8c52a7b40d4229d523bccc1c9246673b82f5b48b
PEEK [1/2]

Sensors are fully disabled when screen is on. When you turn the screen off,
it will start polling both gyroscope and proximity sensor values. If it detects
using the gyroscope sensor that device is lying on a table, it disables proximity
polling. If it detects with proximity sensor that it is in your pocket, it disables
gyroscope polling. This way, we save some battery from the beginning. Later, when you
receive a notification, it enables a partial wakelock (CPU on but at low frequency),
and starts listening for movement, either from getting it out your pocket or lifting
off from the table. If it detects those events, it will turn on screen and show the notification.
Wakelock timeouts on 10 secs, so if you receive a notification and there is no movement in that time,
sensors will stop polling after that time, disabling peek interaction until a new notification comes.
Peek doesn't process low and min priority notifications.

https://plus.google.com/+ParanoidAndroidCorner/posts/3wppxakBSVR

Contributors:
@D4rKn3sSyS
@Anu6is
@BigBrother1984

Signed-off-by: Jesus David <jesdga95@gmail.com>
Signed-off-by: Curtis Mayers <curtis.mayers@gmail.com>
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
add more missing code