OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package com.android.webview.chromium; | 5 package com.android.webview.chromium; |
6 | 6 |
7 import android.Manifest; | 7 import android.Manifest; |
8 import android.app.ActivityManager; | 8 import android.app.ActivityManager; |
9 import android.content.ComponentCallbacks2; | 9 import android.content.ComponentCallbacks2; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 System.loadLibrary("webviewchromium_plat_support"); | 232 System.loadLibrary("webviewchromium_plat_support"); |
233 | 233 |
234 // Use shared preference to check for package downgrade. | 234 // Use shared preference to check for package downgrade. |
235 mWebViewPrefs = ContextUtils.getApplicationContext().getSharedPreference
s( | 235 mWebViewPrefs = ContextUtils.getApplicationContext().getSharedPreference
s( |
236 CHROMIUM_PREFS_NAME, Context.MODE_PRIVATE); | 236 CHROMIUM_PREFS_NAME, Context.MODE_PRIVATE); |
237 int lastVersion = mWebViewPrefs.getInt(VERSION_CODE_PREF, 0); | 237 int lastVersion = mWebViewPrefs.getInt(VERSION_CODE_PREF, 0); |
238 int currentVersion = packageInfo.versionCode; | 238 int currentVersion = packageInfo.versionCode; |
239 if (!versionCodeGE(currentVersion, lastVersion)) { | 239 if (!versionCodeGE(currentVersion, lastVersion)) { |
240 // The WebView package has been downgraded since we last ran in this
application. | 240 // The WebView package has been downgraded since we last ran in this
application. |
241 // Delete the WebView data directory's contents. | 241 // Delete the WebView data directory's contents. |
242 String dataDir = PathUtils.getDataDirectory(ContextUtils.getApplicat
ionContext()); | 242 String dataDir = PathUtils.getDataDirectory(); |
243 Log.i(TAG, "WebView package downgraded from " + lastVersion + " to "
+ currentVersion | 243 Log.i(TAG, "WebView package downgraded from " + lastVersion + " to "
+ currentVersion |
244 + "; deleting contents of " + dataDir); | 244 + "; deleting contents of " + dataDir); |
245 deleteContents(new File(dataDir)); | 245 deleteContents(new File(dataDir)); |
246 } | 246 } |
247 if (lastVersion != currentVersion) { | 247 if (lastVersion != currentVersion) { |
248 mWebViewPrefs.edit().putInt(VERSION_CODE_PREF, currentVersion).apply
(); | 248 mWebViewPrefs.edit().putInt(VERSION_CODE_PREF, currentVersion).apply
(); |
249 } | 249 } |
250 | 250 |
251 mShouldDisableThreadChecking = | 251 mShouldDisableThreadChecking = |
252 shouldDisableThreadChecking(ContextUtils.getApplicationContext()
); | 252 shouldDisableThreadChecking(ContextUtils.getApplicationContext()
); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 mWebViewDatabase = new WebViewDatabaseAdapter(this, awDatabase); | 646 mWebViewDatabase = new WebViewDatabaseAdapter(this, awDatabase); |
647 } | 647 } |
648 } | 648 } |
649 return mWebViewDatabase; | 649 return mWebViewDatabase; |
650 } | 650 } |
651 | 651 |
652 WebViewDelegate getWebViewDelegate() { | 652 WebViewDelegate getWebViewDelegate() { |
653 return mWebViewDelegate; | 653 return mWebViewDelegate; |
654 } | 654 } |
655 } | 655 } |
OLD | NEW |