Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java

Issue 2392293002: Disable thread checking for LGE email app (Closed)
Patch Set: use real version code and limit target sdk to n Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
11 import android.content.Intent; 11 import android.content.Intent;
12 import android.content.SharedPreferences; 12 import android.content.SharedPreferences;
13 import android.content.pm.PackageInfo; 13 import android.content.pm.PackageInfo;
14 import android.content.pm.PackageManager; 14 import android.content.pm.PackageManager;
15 import android.content.pm.PackageManager.NameNotFoundException;
16 import android.net.Uri; 15 import android.net.Uri;
17 import android.os.Build; 16 import android.os.Build;
18 import android.os.Looper; 17 import android.os.Looper;
19 import android.os.Process; 18 import android.os.Process;
20 import android.os.StrictMode; 19 import android.os.StrictMode;
21 import android.os.UserManager; 20 import android.os.UserManager;
22 import android.provider.Settings; 21 import android.provider.Settings;
23 import android.util.Log; 22 import android.util.Log;
24 import android.webkit.CookieManager; 23 import android.webkit.CookieManager;
25 import android.webkit.GeolocationPermissions; 24 import android.webkit.GeolocationPermissions;
(...skipping 18 matching lines...) Expand all
44 import org.chromium.android_webview.AwNetworkChangeNotifierRegistrationPolicy; 43 import org.chromium.android_webview.AwNetworkChangeNotifierRegistrationPolicy;
45 import org.chromium.android_webview.AwQuotaManagerBridge; 44 import org.chromium.android_webview.AwQuotaManagerBridge;
46 import org.chromium.android_webview.AwResource; 45 import org.chromium.android_webview.AwResource;
47 import org.chromium.android_webview.AwSettings; 46 import org.chromium.android_webview.AwSettings;
48 import org.chromium.android_webview.HttpAuthDatabase; 47 import org.chromium.android_webview.HttpAuthDatabase;
49 import org.chromium.android_webview.ResourcesContextWrapperFactory; 48 import org.chromium.android_webview.ResourcesContextWrapperFactory;
50 import org.chromium.base.BuildConfig; 49 import org.chromium.base.BuildConfig;
51 import org.chromium.base.CommandLine; 50 import org.chromium.base.CommandLine;
52 import org.chromium.base.ContextUtils; 51 import org.chromium.base.ContextUtils;
53 import org.chromium.base.MemoryPressureListener; 52 import org.chromium.base.MemoryPressureListener;
53 import org.chromium.base.PackageUtils;
54 import org.chromium.base.PathService; 54 import org.chromium.base.PathService;
55 import org.chromium.base.PathUtils; 55 import org.chromium.base.PathUtils;
56 import org.chromium.base.ThreadUtils; 56 import org.chromium.base.ThreadUtils;
57 import org.chromium.base.TraceEvent; 57 import org.chromium.base.TraceEvent;
58 import org.chromium.base.annotations.SuppressFBWarnings; 58 import org.chromium.base.annotations.SuppressFBWarnings;
59 import org.chromium.base.library_loader.LibraryLoader; 59 import org.chromium.base.library_loader.LibraryLoader;
60 import org.chromium.base.library_loader.LibraryProcessType; 60 import org.chromium.base.library_loader.LibraryProcessType;
61 import org.chromium.base.library_loader.ProcessInitException; 61 import org.chromium.base.library_loader.ProcessInitException;
62 import org.chromium.content.browser.ContentViewStatics; 62 import org.chromium.content.browser.ContentViewStatics;
63 import org.chromium.net.NetworkChangeNotifier; 63 import org.chromium.net.NetworkChangeNotifier;
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 } 522 }
523 } 523 }
524 return mStaticMethods; 524 return mStaticMethods;
525 } 525 }
526 526
527 @Override 527 @Override
528 public WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess) { 528 public WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess) {
529 return new WebViewChromium(this, webView, privateAccess, mShouldDisableT hreadChecking); 529 return new WebViewChromium(this, webView, privateAccess, mShouldDisableT hreadChecking);
530 } 530 }
531 531
532 // Check this as a workaround for https://crbug.com/622151. 532 // Check this as a workaround for crash issues.
533 private boolean shouldDisableThreadChecking(Context context) { 533 private boolean shouldDisableThreadChecking(Context context) {
534 // crbug.com/651706
535 final String lgeMailPackageId = "com.lge.email";
536 if (lgeMailPackageId.equals(context.getPackageName())) {
537 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M + 1) return false;
538 int versionCode = PackageUtils.getPackageVersion(context, lgeMailPac kageId);
539 // The version code is provided by LGE.
540 if (versionCode == -1 || versionCode >= 67700000) return false;
541 Log.w(TAG, "Disabling thread check in WebView (http://crbug.com/6517 06). "
542 + "APK name: " + lgeMailPackageId + ", versionCode: " + vers ionCode);
543 return true;
544 }
545
546 // crbug.com/622151
534 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) return false; 547 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) return false;
535 final String htcMailPackageId = "com.htc.android.mail"; 548 final String htcMailPackageId = "com.htc.android.mail";
536 if (!htcMailPackageId.equals(context.getPackageName())) return false; 549 if (!htcMailPackageId.equals(context.getPackageName())) return false;
537 try { 550 int versionCode = PackageUtils.getPackageVersion(context, htcMailPackage Id);
538 PackageInfo packageInfo = 551 if (versionCode == -1) return false;
539 context.getPackageManager().getPackageInfo(htcMailPackageId, 0); 552 // These values are provided by HTC.
540 if (packageInfo == null) return false; 553 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M && versionCode >= 8640 21756) return false;
554 if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M && versionCode >= 866 001861) {
555 return false;
556 }
541 557
542 // These values are provided by HTC. 558 Log.w(TAG, "Disabling thread check in WebView (http://crbug.com/622151). "
543 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M 559 + "APK name: " + htcMailPackageId + ", versionCode: " + versionC ode);
544 && packageInfo.versionCode >= 864021756) return false; 560 return true;
545 if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M
546 && packageInfo.versionCode >= 866001861) return false;
547
548 Log.w(TAG, "Disabling thread check in WebView (http://crbug.com/6221 51). "
549 + "APK name: " + htcMailPackageId + ", versionCode: "
550 + packageInfo.versionCode);
551 return true;
552 } catch (NameNotFoundException e) {
553 // Ignore this exception and return false.
554 }
555 return false;
556 } 561 }
557 562
558 @Override 563 @Override
559 public GeolocationPermissions getGeolocationPermissions() { 564 public GeolocationPermissions getGeolocationPermissions() {
560 synchronized (mLock) { 565 synchronized (mLock) {
561 if (mGeolocationPermissions == null) { 566 if (mGeolocationPermissions == null) {
562 ensureChromiumStartedLocked(true); 567 ensureChromiumStartedLocked(true);
563 } 568 }
564 } 569 }
565 return mGeolocationPermissions; 570 return mGeolocationPermissions;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 this, HttpAuthDatabase.newInstance(context, HTTP_AUTH_DA TABASE_FILE)); 629 this, HttpAuthDatabase.newInstance(context, HTTP_AUTH_DA TABASE_FILE));
625 } 630 }
626 } 631 }
627 return mWebViewDatabase; 632 return mWebViewDatabase;
628 } 633 }
629 634
630 WebViewDelegate getWebViewDelegate() { 635 WebViewDelegate getWebViewDelegate() {
631 return mWebViewDelegate; 636 return mWebViewDelegate;
632 } 637 }
633 } 638 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698