DownloadProvider: fix the crash when rotate screen.

TrampolineActivity will be recreated when rotate screen,
then the fragment is currently associated with any Activity.
So getActivity() will return a null and caused NullPointerException.

Add the null check before call finish().

CRs-Fixed: 640914

Change-Id: I76f368a597552e824d533b6a66ea23fad4c0cb41
DownloadProvider: add to support download into sdcard storage

When insert into downloads database to start a new download,
will check file uri destination is valid or not, currently it
only support phone storage downloading, what we do is to add
supporting sdcard storage downloading, this will make download
save path setting feature work well.

Change-Id: I7995ae63ec5769103d7ad66bcd677e383ef7f440
DownloadProvider: Still display as downloading after download failed

When the remaining space is less than 10% of the total space,
download will fail, but it still display as downloading in status bar
after failed in "Downloads" app.

Check error status about downloads. If error exists, will update icon
, content title and content text in notification.

CRs-Fixed: 636489

Change-Id: I5554ef3d1505642c5cd847bd3d2e25a29772dc0d
DownloadProvider: Create and implement DialogDismissListener.

  - Better way to dismiss a host activity then explicitly calling
  getActivity() finish().

Change-Id: I121fb63d2d57c6c4b22abac2389d5c3d5ccad6e4
DownloadProvider: Check if the device actually supports second storage.

Change-Id: I78297ca235e058aecfd0ff5a0e990fc3004b4c77
DownloadProvider: Use an alert icon for downloads that have an error status.

Change-Id: If6d0f021cada1a09855009ab3276aa46bec74cfe
Automatic translation import

Change-Id: Icc93454edf18c58289062b577da376c3b7884bc9
Automatic translation import

Change-Id: I691e62b9ace9c1b69911d046ee90d942bada3704
Automatic translation import

Change-Id: I04c02834db0d8201dda37180daf9a929c9545e85
Automatic translation import

Change-Id: I6bd9e60d824f746ba0f3d2f62b4e9c5037043769
Automatic translation import

Change-Id: If529f518eb0d4b6d93c38883bcbd225525d03fe0
DownloadProvider: fix secondary storage support

Change-Id: If9aba4c73b24d052b0379d624302ffda03fdf8e4
Automatic translation import

Change-Id: I26a2d90ab65b87071a19107b45cfc73c4c1f0cda
Automatic translation import

Change-Id: I26a2d90ab65b87071a19107b45cfc73c4c1f0cda
(cherry picked from commit bca6c6fc09e2b4e6f01135b45b87d2529d12a9d7)
Merge branch 'cm-11.0' into stable/cm-11.0