diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 449e2adb98..97214b1be1 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -17,6 +17,7 @@ + @@ -27,6 +31,8 @@ class DownloadChunkTask extends AsyncTask private int m_httpErrorCode = NOT_SET; private long m_downloadedBytes = 0; + private WakeLock m_wakeLock = null; + native void onWrite(long httpCallbackID, long beg, byte [] data, long size); native void onFinish(long httpCallbackID, long httpCode, long beg, long end); @@ -43,12 +49,17 @@ class DownloadChunkTask extends AsyncTask @Override protected void onPreExecute() { + PowerManager pm = (PowerManager)MWMActivity.getCurrentContext().getSystemService( + android.content.Context.POWER_SERVICE); + m_wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); + m_wakeLock.acquire(); } @Override protected void onPostExecute(Void resCode) { onFinish(m_httpCallbackID, 200, m_beg, m_end); + m_wakeLock.release(); } @Override @@ -57,6 +68,7 @@ class DownloadChunkTask extends AsyncTask // Report error in callback only if we're not forcibly canceled if (m_httpErrorCode != NOT_SET) onFinish(m_httpCallbackID, m_httpErrorCode, m_beg, m_end); + m_wakeLock.release(); } @Override