Cache the application context instead of Activity.
When storing a reference to a Context, ensure that it's the
Application context rather than Activity Context.
Bug: 5084293
Change-Id: Ib0be5f8ceb91846bb985d0813a8f22cabd44eaf8
diff --git a/src/com/android/browser/DownloadTouchIcon.java b/src/com/android/browser/DownloadTouchIcon.java
index 64a7316..ba299b6 100644
--- a/src/com/android/browser/DownloadTouchIcon.java
+++ b/src/com/android/browser/DownloadTouchIcon.java
@@ -60,7 +60,7 @@
*/
public DownloadTouchIcon(Tab tab, Context ctx, ContentResolver cr, WebView view) {
mTab = tab;
- mContext = ctx;
+ mContext = ctx.getApplicationContext();
mContentResolver = cr;
// Store these in case they change.
mOriginalUrl = view.getOriginalUrl();
@@ -77,7 +77,7 @@
*/
public DownloadTouchIcon(Context ctx, ContentResolver cr, String url) {
mTab = null;
- mContext = ctx;
+ mContext = ctx.getApplicationContext();
mContentResolver = cr;
mOriginalUrl = null;
mUrl = url;
@@ -91,7 +91,7 @@
*/
public DownloadTouchIcon(Context context, Message msg, String userAgent) {
mMessage = msg;
- mContext = context;
+ mContext = context.getApplicationContext();
mContentResolver = null;
mOriginalUrl = null;
mUrl = null;