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.annotation.SuppressLint; | |
7 import android.app.Application; | 8 import android.app.Application; |
8 import android.content.Context; | 9 import android.content.Context; |
9 import android.content.ContextWrapper; | 10 import android.content.ContextWrapper; |
10 import android.content.pm.PackageInfo; | 11 import android.content.pm.PackageInfo; |
11 import android.content.res.AssetManager; | 12 import android.content.res.AssetManager; |
12 import android.content.res.Resources; | 13 import android.content.res.Resources; |
13 import android.graphics.Canvas; | 14 import android.graphics.Canvas; |
14 import android.os.Trace; | 15 import android.os.Trace; |
15 import android.util.SparseArray; | 16 import android.util.SparseArray; |
16 import android.view.View; | 17 import android.view.View; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 * A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} co mpatible with the | 191 * A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} co mpatible with the |
191 * API 21 version of the framework in which | 192 * API 21 version of the framework in which |
192 * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been | 193 * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been |
193 * introduced. | 194 * introduced. |
194 * | 195 * |
195 * <p>This class implements the | 196 * <p>This class implements the |
196 * {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} func tionality by using | 197 * {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} func tionality by using |
197 * reflection to call into hidden frameworks APIs released in the API-21 ver sion of the | 198 * reflection to call into hidden frameworks APIs released in the API-21 ver sion of the |
198 * framework. | 199 * framework. |
199 */ | 200 */ |
201 @SuppressLint("NewApi") | |
newt (away)
2015/10/13 20:41:38
Instead of @SuppressLint("NewApi"), use @TargetApi
michaelbai
2015/10/13 21:40:15
Done.
| |
200 private static class Api21CompatibilityDelegate implements WebViewDelegate { | 202 private static class Api21CompatibilityDelegate implements WebViewDelegate { |
201 /** Copy of Trace.TRACE_TAG_WEBVIEW */ | 203 /** Copy of Trace.TRACE_TAG_WEBVIEW */ |
202 private static final long TRACE_TAG_WEBVIEW = 1L << 4; | 204 private static final long TRACE_TAG_WEBVIEW = 1L << 4; |
203 | 205 |
204 /** Hidden APIs released in the API 21 version of the framework */ | 206 /** Hidden APIs released in the API 21 version of the framework */ |
205 private final Method mIsTagEnabledMethod; | 207 private final Method mIsTagEnabledMethod; |
206 private final Method mAddChangeCallbackMethod; | 208 private final Method mAddChangeCallbackMethod; |
207 private final Method mGetViewRootImplMethod; | 209 private final Method mGetViewRootImplMethod; |
208 private final Method mInvokeFunctorMethod; | 210 private final Method mInvokeFunctorMethod; |
209 private final Method mCallDrawGLFunctionMethod; | 211 private final Method mCallDrawGLFunctionMethod; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 // Avoid calling the ContextWrapper.getAssets() proxy | 359 // Avoid calling the ContextWrapper.getAssets() proxy |
358 // chain, which can return an unexpected AssetManager. | 360 // chain, which can return an unexpected AssetManager. |
359 mAddAssetPathMethod.invoke( | 361 mAddAssetPathMethod.invoke( |
360 context.getResources().getAssets(), info.applicationInfo .sourceDir); | 362 context.getResources().getAssets(), info.applicationInfo .sourceDir); |
361 } catch (Exception e) { | 363 } catch (Exception e) { |
362 throw new RuntimeException("Invalid reflection", e); | 364 throw new RuntimeException("Invalid reflection", e); |
363 } | 365 } |
364 } | 366 } |
365 } | 367 } |
366 } | 368 } |
OLD | NEW |