├── .gitignore
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ ├── android
│ │ └── webkit
│ │ │ ├── GeolocationPermissions.java
│ │ │ ├── TokenBindingService.java
│ │ │ ├── WebStorage.java
│ │ │ ├── WebView.java
│ │ │ ├── WebViewDelegate.java
│ │ │ ├── WebViewFactoryProvider.java
│ │ │ └── WebViewProvider.java
│ └── com
│ │ └── android
│ │ └── webview
│ │ └── chromium
│ │ ├── FakeAccessibilityNodeProvider.java
│ │ ├── FakeCookieManager.java
│ │ ├── FakeInputConnection.java
│ │ ├── FakePrintDocumentAdapter.java
│ │ ├── FakeScrollDelegate.java
│ │ ├── FakeServiceWorkerController.java
│ │ ├── FakeServiceWorkerWebSettings.java
│ │ ├── FakeStatics.java
│ │ ├── FakeTracingController.java
│ │ ├── FakeViewDelegate.java
│ │ ├── FakeWebBackForwardList.java
│ │ ├── FakeWebHistoryItem.java
│ │ ├── FakeWebIconDatabase.java
│ │ ├── FakeWebSettings.java
│ │ ├── FakeWebViewDatabase.java
│ │ ├── FakeWebViewProvider.java
│ │ ├── FakeWebViewRenderProcess.java
│ │ ├── FakeWebViewRenderProcessClient.java
│ │ ├── Lazy.java
│ │ └── WebViewChromiumFactoryProvider.java
│ └── jniLibs
│ ├── arm64-v8a
│ └── libc++_shared.so
│ └── armeabi-v7a
│ └── libc++_shared.so
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.aar
4 | *.ap_
5 | *.aab
6 |
7 | # Files for the ART/Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 | out/
17 | # Uncomment the following line in case you need and you don't have the release build type files in your app
18 | # release/
19 |
20 | # Gradle files
21 | .gradle/
22 | build/
23 |
24 | # Local configuration file (sdk path, etc)
25 | local.properties
26 |
27 | # Proguard folder generated by Eclipse
28 | proguard/
29 |
30 | # Log Files
31 | *.log
32 |
33 | # Android Studio Navigation editor temp files
34 | .navigation/
35 |
36 | # Android Studio captures folder
37 | captures/
38 |
39 | # IntelliJ
40 | *.iml
41 | .idea/workspace.xml
42 | .idea/tasks.xml
43 | .idea/gradle.xml
44 | .idea/assetWizardSettings.xml
45 | .idea/dictionaries
46 | .idea/libraries
47 | # Android Studio 3 in .gitignore file.
48 | .idea/caches
49 | .idea/modules.xml
50 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
51 | .idea/navEditor.xml
52 |
53 | # Keystore files
54 | # Uncomment the following lines if you do not want to check your keystore files in.
55 | #*.jks
56 | #*.keystore
57 |
58 | # External native build folder generated in Android Studio 2.2 and later
59 | .externalNativeBuild
60 | .cxx/
61 |
62 | # Google Services (e.g. APIs or Firebase)
63 | # google-services.json
64 |
65 | # Freeline
66 | freeline.py
67 | freeline/
68 | freeline_project_description.json
69 |
70 | # fastlane
71 | fastlane/report.xml
72 | fastlane/Preview.html
73 | fastlane/screenshots
74 | fastlane/test_output
75 | fastlane/readme.md
76 |
77 | # Version control
78 | vcs.xml
79 |
80 | # lint
81 | lint/intermediates/
82 | lint/generated/
83 | lint/outputs/
84 | lint/tmp/
85 | # lint/reports/
86 | .idea/
87 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Da Xing
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FakeWebView
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 | android {
6 | compileSdk 30
7 |
8 | defaultConfig {
9 | applicationId "com.google.android.webview"
10 | minSdk 24
11 | targetSdk 30
12 | versionCode 1048576
13 | versionName "92.0.4515.115"
14 | }
15 |
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | }
20 | }
21 | compileOptions {
22 | sourceCompatibility JavaVersion.VERSION_11
23 | targetCompatibility JavaVersion.VERSION_11
24 | }
25 | }
26 |
27 | dependencies {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/java/android/webkit/GeolocationPermissions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package android.webkit;
18 |
19 | public class GeolocationPermissions {
20 |
21 | public GeolocationPermissions() {
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/android/webkit/TokenBindingService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package android.webkit;
18 |
19 | /**
20 | * Enables the token binding procotol, and provides access to the keys. See
21 | * https://tools.ietf.org/html/draft-ietf-tokbind-protocol-03
22 | *
23 | * All methods are required to be called on the UI thread where WebView is
24 | * attached to the View hierarchy.
25 | */
26 | public abstract class TokenBindingService {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/android/webkit/WebStorage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package android.webkit;
18 |
19 | public class WebStorage {
20 |
21 | public WebStorage() {
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/android/webkit/WebView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package android.webkit;
18 |
19 | import android.content.Context;
20 | import android.util.AttributeSet;
21 | import android.widget.AbsoluteLayout;
22 |
23 | @SuppressWarnings({"deprecation", "unused", "InnerClassMayBeStatic"})
24 | public class WebView extends AbsoluteLayout {
25 |
26 | public WebView(Context context) {
27 | super(context);
28 | }
29 |
30 | public WebView(Context context, AttributeSet attrs) {
31 | super(context, attrs);
32 | }
33 |
34 | public WebView(Context context, AttributeSet attrs, int defStyleAttr) {
35 | super(context, attrs, defStyleAttr);
36 | }
37 |
38 | public WebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
39 | super(context, attrs, defStyleAttr, defStyleRes);
40 | }
41 |
42 | public class PrivateAccess {
43 |
44 | public PrivateAccess() {
45 |
46 | }
47 | }
48 |
49 | public static class HitTestResult {
50 |
51 | public HitTestResult() {
52 |
53 | }
54 | }
55 |
56 | public static abstract class VisualStateCallback {
57 |
58 | public VisualStateCallback() {
59 |
60 | }
61 | }
62 |
63 | public interface PictureListener {
64 |
65 | }
66 |
67 | public interface FindListener {
68 |
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/java/android/webkit/WebViewDelegate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package android.webkit;
18 |
19 | /**
20 | * Delegate used by the WebView provider implementation to access
21 | * the required framework functionality needed to implement a {@link WebView}.
22 | */
23 | public final class WebViewDelegate {
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/android/webkit/WebViewFactoryProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package android.webkit;
18 |
19 | import android.content.Context;
20 | import android.content.Intent;
21 | import android.net.Uri;
22 |
23 | import java.util.List;
24 |
25 | /**
26 | * This is the main entry-point into the WebView back end implementations, which the WebView
27 | * proxy class uses to instantiate all the other objects as needed. The backend must provide an
28 | * implementation of this interface, and make it available to the WebView via mechanism TBD.
29 | */
30 | @SuppressWarnings({"unused", "deprecation"})
31 | public interface WebViewFactoryProvider {
32 |
33 | /**
34 | * This Interface provides glue for implementing the backend of WebView static methods which
35 | * cannot be implemented in-situ in the proxy class.
36 | */
37 | interface Statics {
38 |
39 | /**
40 | * Implements the API method:
41 | * {@link WebView#findAddress(String)}
42 | */
43 | String findAddress(String addr);
44 |
45 | /**
46 | * Implements the API method:
47 | * {@link WebSettings#getDefaultUserAgent(Context) }
48 | */
49 | String getDefaultUserAgent(Context context);
50 |
51 | /**
52 | * Used for tests only.
53 | */
54 | void freeMemoryForTests();
55 |
56 | /**
57 | * Implements the API method:
58 | * {@link WebView#setWebContentsDebuggingEnabled(boolean) }
59 | */
60 | void setWebContentsDebuggingEnabled(boolean enable);
61 |
62 | /**
63 | * Implements the API method:
64 | * {@link WebView#clearClientCertPreferences(Runnable) }
65 | */
66 | void clearClientCertPreferences(Runnable onCleared);
67 |
68 | void enableSlowWholeDocumentDraw();
69 |
70 | /**
71 | * Implement the API method
72 | * {@link WebChromeClient.FileChooserParams#parseResult(int, Intent)}
73 | */
74 | Uri[] parseFileChooserResult(int resultCode, Intent intent);
75 |
76 | /**
77 | * Implement the API method
78 | * {@link WebView#startSafeBrowsing(Context , ValueCallback)}
79 | */
80 | void initSafeBrowsing(Context context, ValueCallback callback);
81 |
82 | void setSafeBrowsingWhitelist(List hosts, ValueCallback callback);
83 |
84 | /**
85 | * Implement the API method
86 | * {@link WebView#getSafeBrowsingPrivacyPolicyUrl()}
87 | */
88 | Uri getSafeBrowsingPrivacyPolicyUrl();
89 | }
90 |
91 | Statics getStatics();
92 |
93 | /**
94 | * Construct a new WebViewProvider.
95 | * @param webView the WebView instance bound to this implementation instance. Note it will not
96 | * necessarily be fully constructed at the point of this call: defer real initialization to
97 | * WebViewProvider.init().
98 | * @param privateAccess provides access into WebView internal methods.
99 | */
100 | WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess);
101 |
102 | /**
103 | * Gets the singleton GeolocationPermissions instance for this WebView implementation. The
104 | * implementation must return the same instance on subsequent calls.
105 | * @return the single GeolocationPermissions instance.
106 | */
107 | GeolocationPermissions getGeolocationPermissions();
108 |
109 | /**
110 | * Gets the singleton CookieManager instance for this WebView implementation. The
111 | * implementation must return the same instance on subsequent calls.
112 | *
113 | * @return the singleton CookieManager instance
114 | */
115 | CookieManager getCookieManager();
116 |
117 | /**
118 | * Gets the TokenBindingService instance for this WebView implementation. The
119 | * implementation must return the same instance on subsequent calls.
120 | */
121 | TokenBindingService getTokenBindingService();
122 |
123 | /**
124 | * Gets the TracingController instance for this WebView implementation. The
125 | * implementation must return the same instance on subsequent calls.
126 | *
127 | * @return the TracingController instance
128 | */
129 | TracingController getTracingController();
130 |
131 | /**
132 | * Gets the ServiceWorkerController instance for this WebView implementation. The
133 | * implementation must return the same instance on subsequent calls.
134 | *
135 | * @return the ServiceWorkerController instance
136 | */
137 | ServiceWorkerController getServiceWorkerController();
138 |
139 | /**
140 | * Gets the singleton WebIconDatabase instance for this WebView implementation. The
141 | * implementation must return the same instance on subsequent calls.
142 | *
143 | * @return the singleton WebIconDatabase instance
144 | */
145 | WebIconDatabase getWebIconDatabase();
146 |
147 | /**
148 | * Gets the singleton WebStorage instance for this WebView implementation. The
149 | * implementation must return the same instance on subsequent calls.
150 | *
151 | * @return the singleton WebStorage instance
152 | */
153 | WebStorage getWebStorage();
154 |
155 | /**
156 | * Gets the singleton WebViewDatabase instance for this WebView implementation. The
157 | * implementation must return the same instance on subsequent calls.
158 | *
159 | * @return the singleton WebViewDatabase instance
160 | */
161 | WebViewDatabase getWebViewDatabase(Context context);
162 |
163 | /**
164 | * Gets the classloader used to load internal WebView implementation classes. This interface
165 | * should only be used by the WebView Support Library.
166 | */
167 | ClassLoader getWebViewClassLoader();
168 | }
169 |
--------------------------------------------------------------------------------
/app/src/main/java/android/webkit/WebViewProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package android.webkit;
18 |
19 | import android.annotation.SuppressLint;
20 | import android.content.Intent;
21 | import android.content.res.Configuration;
22 | import android.graphics.Bitmap;
23 | import android.graphics.Canvas;
24 | import android.graphics.Paint;
25 | import android.graphics.Picture;
26 | import android.graphics.Rect;
27 | import android.graphics.drawable.Drawable;
28 | import android.net.Uri;
29 | import android.net.http.SslCertificate;
30 | import android.os.Bundle;
31 | import android.os.Handler;
32 | import android.os.Message;
33 | import android.print.PrintDocumentAdapter;
34 | import android.util.SparseArray;
35 | import android.view.DragEvent;
36 | import android.view.KeyEvent;
37 | import android.view.MotionEvent;
38 | import android.view.View;
39 | import android.view.ViewGroup.LayoutParams;
40 | import android.view.accessibility.AccessibilityEvent;
41 | import android.view.accessibility.AccessibilityNodeInfo;
42 | import android.view.accessibility.AccessibilityNodeProvider;
43 | import android.view.autofill.AutofillValue;
44 | import android.view.inputmethod.EditorInfo;
45 | import android.view.inputmethod.InputConnection;
46 | import android.view.textclassifier.TextClassifier;
47 | import android.webkit.WebView.HitTestResult;
48 | import android.webkit.WebView.PictureListener;
49 | import android.webkit.WebView.VisualStateCallback;
50 |
51 | import java.io.BufferedWriter;
52 | import java.io.File;
53 | import java.util.Map;
54 | import java.util.concurrent.Executor;
55 |
56 | /**
57 | * WebView backend provider interface: this interface is the abstract backend to a WebView
58 | * instance; each WebView object is bound to exactly one WebViewProvider object which implements
59 | * the runtime behavior of that WebView.
60 | *
61 | * All methods must behave as per their namesake in {@link WebView}, unless otherwise noted.
62 | */
63 | @SuppressWarnings({"unused", "deprecation"})
64 | public interface WebViewProvider {
65 |
66 | //-------------------------------------------------------------------------
67 | // Main interface for backend provider of the WebView class.
68 | //-------------------------------------------------------------------------
69 | /**
70 | * Initialize this WebViewProvider instance. Called after the WebView has fully constructed.
71 | * @param javaScriptInterfaces is a Map of interface names, as keys, and
72 | * object implementing those interfaces, as values.
73 | * @param privateBrowsing If {@code true} the web view will be initialized in private /
74 | * incognito mode.
75 | */
76 | void init(Map javaScriptInterfaces,
77 | boolean privateBrowsing);
78 |
79 | // Deprecated - should never be called
80 | void setHorizontalScrollbarOverlay(boolean overlay);
81 |
82 | // Deprecated - should never be called
83 | void setVerticalScrollbarOverlay(boolean overlay);
84 |
85 | // Deprecated - should never be called
86 | boolean overlayHorizontalScrollbar();
87 |
88 | // Deprecated - should never be called
89 | boolean overlayVerticalScrollbar();
90 |
91 | int getVisibleTitleHeight();
92 |
93 | SslCertificate getCertificate();
94 |
95 | void setCertificate(SslCertificate certificate);
96 |
97 | void savePassword(String host, String username, String password);
98 |
99 | void setHttpAuthUsernamePassword(String host, String realm,
100 | String username, String password);
101 |
102 | String[] getHttpAuthUsernamePassword(String host, String realm);
103 |
104 | /**
105 | * See {@link WebView#destroy()}.
106 | * As well as releasing the internal state and resources held by the implementation,
107 | * the provider should null all references it holds on the WebView proxy class, and ensure
108 | * no further method calls are made to it.
109 | */
110 | void destroy();
111 |
112 | void setNetworkAvailable(boolean networkUp);
113 |
114 | WebBackForwardList saveState(Bundle outState);
115 |
116 | boolean savePicture(Bundle b, final File dest);
117 |
118 | boolean restorePicture(Bundle b, File src);
119 |
120 | WebBackForwardList restoreState(Bundle inState);
121 |
122 | void loadUrl(String url, Map additionalHttpHeaders);
123 |
124 | void loadUrl(String url);
125 |
126 | void postUrl(String url, byte[] postData);
127 |
128 | void loadData(String data, String mimeType, String encoding);
129 |
130 | void loadDataWithBaseURL(String baseUrl, String data,
131 | String mimeType, String encoding, String historyUrl);
132 |
133 | void evaluateJavaScript(String script, ValueCallback resultCallback);
134 |
135 | void saveWebArchive(String filename);
136 |
137 | void saveWebArchive(String basename, boolean autoname, ValueCallback callback);
138 |
139 | void stopLoading();
140 |
141 | void reload();
142 |
143 | boolean canGoBack();
144 |
145 | void goBack();
146 |
147 | boolean canGoForward();
148 |
149 | void goForward();
150 |
151 | boolean canGoBackOrForward(int steps);
152 |
153 | void goBackOrForward(int steps);
154 |
155 | boolean isPrivateBrowsingEnabled();
156 |
157 | boolean pageUp(boolean top);
158 |
159 | boolean pageDown(boolean bottom);
160 |
161 | void insertVisualStateCallback(long requestId, VisualStateCallback callback);
162 |
163 | void clearView();
164 |
165 | Picture capturePicture();
166 |
167 | PrintDocumentAdapter createPrintDocumentAdapter(String documentName);
168 |
169 | float getScale();
170 |
171 | void setInitialScale(int scaleInPercent);
172 |
173 | void invokeZoomPicker();
174 |
175 | HitTestResult getHitTestResult();
176 |
177 | void requestFocusNodeHref(Message hrefMsg);
178 |
179 | void requestImageRef(Message msg);
180 |
181 | String getUrl();
182 |
183 | String getOriginalUrl();
184 |
185 | String getTitle();
186 |
187 | Bitmap getFavicon();
188 |
189 | String getTouchIconUrl();
190 |
191 | int getProgress();
192 |
193 | int getContentHeight();
194 |
195 | int getContentWidth();
196 |
197 | void pauseTimers();
198 |
199 | void resumeTimers();
200 |
201 | void onPause();
202 |
203 | void onResume();
204 |
205 | boolean isPaused();
206 |
207 | void freeMemory();
208 |
209 | void clearCache(boolean includeDiskFiles);
210 |
211 | void clearFormData();
212 |
213 | void clearHistory();
214 |
215 | void clearSslPreferences();
216 |
217 | WebBackForwardList copyBackForwardList();
218 |
219 | void setFindListener(WebView.FindListener listener);
220 |
221 | void findNext(boolean forward);
222 |
223 | int findAll(String find);
224 |
225 | void findAllAsync(String find);
226 |
227 | boolean showFindDialog(String text, boolean showIme);
228 |
229 | void clearMatches();
230 |
231 | void documentHasImages(Message response);
232 |
233 | void setWebViewClient(WebViewClient client);
234 |
235 | WebViewClient getWebViewClient();
236 |
237 | WebViewRenderProcess getWebViewRenderProcess();
238 |
239 | void setWebViewRenderProcessClient(
240 | Executor executor,
241 | WebViewRenderProcessClient client);
242 |
243 | WebViewRenderProcessClient getWebViewRenderProcessClient();
244 |
245 | void setDownloadListener(DownloadListener listener);
246 |
247 | void setWebChromeClient(WebChromeClient client);
248 |
249 | WebChromeClient getWebChromeClient();
250 |
251 | void setPictureListener(PictureListener listener);
252 |
253 | void addJavascriptInterface(Object obj, String interfaceName);
254 |
255 | void removeJavascriptInterface(String interfaceName);
256 |
257 | WebMessagePort[] createWebMessageChannel();
258 |
259 | void postMessageToMainFrame(WebMessage message, Uri targetOrigin);
260 |
261 | WebSettings getSettings();
262 |
263 | void setMapTrackballToArrowKeys(boolean setMap);
264 |
265 | void flingScroll(int vx, int vy);
266 |
267 | View getZoomControls();
268 |
269 | boolean canZoomIn();
270 |
271 | boolean canZoomOut();
272 |
273 | boolean zoomBy(float zoomFactor);
274 |
275 | boolean zoomIn();
276 |
277 | boolean zoomOut();
278 |
279 | void dumpViewHierarchyWithProperties(BufferedWriter out, int level);
280 |
281 | View findHierarchyView(String className, int hashCode);
282 |
283 | void setRendererPriorityPolicy(int rendererRequestedPriority, boolean waivedWhenNotVisible);
284 |
285 | int getRendererRequestedPriority();
286 |
287 | boolean getRendererPriorityWaivedWhenNotVisible();
288 |
289 | @SuppressWarnings("unused")
290 | default void setTextClassifier(TextClassifier textClassifier) {}
291 |
292 | @SuppressLint("NewApi")
293 | default TextClassifier getTextClassifier() { return TextClassifier.NO_OP; }
294 |
295 | //-------------------------------------------------------------------------
296 | // Provider internal methods
297 | //-------------------------------------------------------------------------
298 |
299 | /**
300 | * @return the ViewDelegate implementation. This provides the functionality to back all of
301 | * the name-sake functions from the View and ViewGroup base classes of WebView.
302 | */
303 | /* package */ ViewDelegate getViewDelegate();
304 |
305 | /**
306 | * @return a ScrollDelegate implementation. Normally this would be same object as is
307 | * returned by getViewDelegate().
308 | */
309 | /* package */ ScrollDelegate getScrollDelegate();
310 |
311 | /**
312 | * Only used by FindActionModeCallback to inform providers that the find dialog has
313 | * been dismissed.
314 | */
315 | void notifyFindDialogDismissed();
316 |
317 | //-------------------------------------------------------------------------
318 | // View / ViewGroup delegation methods
319 | //-------------------------------------------------------------------------
320 |
321 | /**
322 | * Provides mechanism for the name-sake methods declared in View and ViewGroup to be delegated
323 | * into the WebViewProvider instance.
324 | * NOTE: For many of these methods, the WebView will provide a super.Foo() call before or after
325 | * making the call into the provider instance. This is done for convenience in the common case
326 | * of maintaining backward compatibility. For remaining super class calls (e.g. where the
327 | * provider may need to only conditionally make the call based on some internal state) see the
328 | * WebView.PrivateAccess callback class.
329 | */
330 | // TODO: See if the pattern of the super-class calls can be rationalized at all, and document
331 | // the remainder on the methods below.
332 | interface ViewDelegate {
333 |
334 | boolean shouldDelayChildPressedState();
335 |
336 | void onProvideVirtualStructure(android.view.ViewStructure structure);
337 |
338 | default void onProvideAutofillVirtualStructure(
339 | @SuppressWarnings("unused") android.view.ViewStructure structure,
340 | @SuppressWarnings("unused") int flags) {
341 | }
342 |
343 | default void autofill(@SuppressWarnings("unused") SparseArray values) {
344 | }
345 |
346 | default boolean isVisibleToUserForAutofill(@SuppressWarnings("unused") int virtualId) {
347 | return true; // true is the default value returned by View.isVisibleToUserForAutofill()
348 | }
349 |
350 | default void onProvideContentCaptureStructure(
351 | @SuppressWarnings("unused") android.view.ViewStructure structure,
352 | @SuppressWarnings("unused") int flags) {
353 | }
354 |
355 | AccessibilityNodeProvider getAccessibilityNodeProvider();
356 |
357 | void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info);
358 |
359 | void onInitializeAccessibilityEvent(AccessibilityEvent event);
360 |
361 | boolean performAccessibilityAction(int action, Bundle arguments);
362 |
363 | void setOverScrollMode(int mode);
364 |
365 | void setScrollBarStyle(int style);
366 |
367 | void onDrawVerticalScrollBar(Canvas canvas, Drawable scrollBar, int l, int t,
368 | int r, int b);
369 |
370 | void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY);
371 |
372 | void onWindowVisibilityChanged(int visibility);
373 |
374 | void onDraw(Canvas canvas);
375 |
376 | void setLayoutParams(LayoutParams layoutParams);
377 |
378 | boolean performLongClick();
379 |
380 | void onConfigurationChanged(Configuration newConfig);
381 |
382 | InputConnection onCreateInputConnection(EditorInfo outAttrs);
383 |
384 | boolean onDragEvent(DragEvent event);
385 |
386 | boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event);
387 |
388 | boolean onKeyDown(int keyCode, KeyEvent event);
389 |
390 | boolean onKeyUp(int keyCode, KeyEvent event);
391 |
392 | void onAttachedToWindow();
393 |
394 | void onDetachedFromWindow();
395 |
396 | default void onMovedToDisplay(int displayId, Configuration config) {}
397 |
398 | void onVisibilityChanged(View changedView, int visibility);
399 |
400 | void onWindowFocusChanged(boolean hasWindowFocus);
401 |
402 | void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect);
403 |
404 | boolean setFrame(int left, int top, int right, int bottom);
405 |
406 | void onSizeChanged(int w, int h, int ow, int oh);
407 |
408 | void onScrollChanged(int l, int t, int oldl, int oldt);
409 |
410 | boolean dispatchKeyEvent(KeyEvent event);
411 |
412 | boolean onTouchEvent(MotionEvent ev);
413 |
414 | boolean onHoverEvent(MotionEvent event);
415 |
416 | boolean onGenericMotionEvent(MotionEvent event);
417 |
418 | boolean onTrackballEvent(MotionEvent ev);
419 |
420 | boolean requestFocus(int direction, Rect previouslyFocusedRect);
421 |
422 | void onMeasure(int widthMeasureSpec, int heightMeasureSpec);
423 |
424 | boolean requestChildRectangleOnScreen(View child, Rect rect, boolean immediate);
425 |
426 | void setBackgroundColor(int color);
427 |
428 | void setLayerType(int layerType, Paint paint);
429 |
430 | void preDispatchDraw(Canvas canvas);
431 |
432 | void onStartTemporaryDetach();
433 |
434 | void onFinishTemporaryDetach();
435 |
436 | void onActivityResult(int requestCode, int resultCode, Intent data);
437 |
438 | Handler getHandler(Handler originalHandler);
439 |
440 | View findFocus(View originalFocusedView);
441 |
442 | @SuppressWarnings("unused")
443 | default boolean onCheckIsTextEditor() {
444 | return false;
445 | }
446 | }
447 |
448 | interface ScrollDelegate {
449 |
450 | // These methods are declared protected in the ViewGroup base class. This interface
451 | // exists to promote them to public so they may be called by the WebView proxy class.
452 | // TODO: Combine into ViewDelegate?
453 | /**
454 | * See {@link WebView#computeHorizontalScrollRange}
455 | */
456 | int computeHorizontalScrollRange();
457 |
458 | /**
459 | * See {@link WebView#computeHorizontalScrollOffset}
460 | */
461 | int computeHorizontalScrollOffset();
462 |
463 | /**
464 | * See {@link WebView#computeVerticalScrollRange}
465 | */
466 | int computeVerticalScrollRange();
467 |
468 | /**
469 | * See {@link WebView#computeVerticalScrollOffset}
470 | */
471 | int computeVerticalScrollOffset();
472 |
473 | /**
474 | * See {@link WebView#computeVerticalScrollExtent}
475 | */
476 | int computeVerticalScrollExtent();
477 |
478 | /**
479 | * See {@link WebView#computeScroll}
480 | */
481 | void computeScroll();
482 | }
483 | }
484 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeAccessibilityNodeProvider.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.view.accessibility.AccessibilityNodeProvider;
4 |
5 | public class FakeAccessibilityNodeProvider extends AccessibilityNodeProvider {
6 | }
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeCookieManager.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.webkit.CookieManager;
4 | import android.webkit.ValueCallback;
5 | import android.webkit.WebView;
6 |
7 | @SuppressWarnings({"deprecation", "unused"})
8 | public class FakeCookieManager extends CookieManager {
9 |
10 | @Override
11 | public void setAcceptCookie(boolean accept) {
12 |
13 | }
14 |
15 | @Override
16 | public boolean acceptCookie() {
17 | return false;
18 | }
19 |
20 | @Override
21 | public void setAcceptThirdPartyCookies(WebView webview, boolean accept) {
22 |
23 | }
24 |
25 | @Override
26 | public boolean acceptThirdPartyCookies(WebView webview) {
27 | return false;
28 | }
29 |
30 | @Override
31 | public void setCookie(String url, String value) {
32 |
33 | }
34 |
35 | @Override
36 | public void setCookie(String url, String value, ValueCallback callback) {
37 |
38 | }
39 |
40 | @Override
41 | public String getCookie(String url) {
42 | return "";
43 | }
44 |
45 | public String getCookie(String url, boolean privateBrowsing) {
46 | return "";
47 | }
48 |
49 | @Override
50 | public void removeSessionCookie() {
51 |
52 | }
53 |
54 | @Override
55 | public void removeSessionCookies(ValueCallback callback) {
56 |
57 | }
58 |
59 | @Override
60 | public void removeAllCookie() {
61 |
62 | }
63 |
64 | @Override
65 | public void removeAllCookies(ValueCallback callback) {
66 |
67 | }
68 |
69 | @Override
70 | public boolean hasCookies() {
71 | return false;
72 | }
73 |
74 | public boolean hasCookies(boolean privateBrowsing) {
75 | return false;
76 | }
77 |
78 | @Override
79 | public void removeExpiredCookie() {
80 |
81 | }
82 |
83 | @Override
84 | public void flush() {
85 |
86 | }
87 |
88 | protected boolean allowFileSchemeCookiesImpl() {
89 | return false;
90 | }
91 |
92 | protected void setAcceptFileSchemeCookiesImpl(boolean accept) {
93 |
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeInputConnection.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.os.Bundle;
4 | import android.os.Handler;
5 | import android.os.Looper;
6 | import android.view.KeyEvent;
7 | import android.view.inputmethod.CompletionInfo;
8 | import android.view.inputmethod.CorrectionInfo;
9 | import android.view.inputmethod.ExtractedText;
10 | import android.view.inputmethod.ExtractedTextRequest;
11 | import android.view.inputmethod.InputConnection;
12 | import android.view.inputmethod.InputContentInfo;
13 |
14 | public class FakeInputConnection implements InputConnection {
15 |
16 | final Lazy mHandler = new Lazy<>(() -> new Handler(Looper.getMainLooper()));
17 |
18 | @Override
19 | public CharSequence getTextBeforeCursor(int n, int flags) {
20 | return "";
21 | }
22 |
23 | @Override
24 | public CharSequence getTextAfterCursor(int n, int flags) {
25 | return "";
26 | }
27 |
28 | @Override
29 | public CharSequence getSelectedText(int flags) {
30 | return "";
31 | }
32 |
33 | @Override
34 | public int getCursorCapsMode(int reqModes) {
35 | return 0;
36 | }
37 |
38 | @Override
39 | public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
40 | return new ExtractedText();
41 | }
42 |
43 | @Override
44 | public boolean deleteSurroundingText(int beforeLength, int afterLength) {
45 | return false;
46 | }
47 |
48 | @Override
49 | public boolean deleteSurroundingTextInCodePoints(int beforeLength, int afterLength) {
50 | return false;
51 | }
52 |
53 | @Override
54 | public boolean setComposingText(CharSequence text, int newCursorPosition) {
55 | return false;
56 | }
57 |
58 | @Override
59 | public boolean setComposingRegion(int start, int end) {
60 | return false;
61 | }
62 |
63 | @Override
64 | public boolean finishComposingText() {
65 | return false;
66 | }
67 |
68 | @Override
69 | public boolean commitText(CharSequence text, int newCursorPosition) {
70 | return false;
71 | }
72 |
73 | @Override
74 | public boolean commitCompletion(CompletionInfo text) {
75 | return false;
76 | }
77 |
78 | @Override
79 | public boolean commitCorrection(CorrectionInfo correctionInfo) {
80 | return false;
81 | }
82 |
83 | @Override
84 | public boolean setSelection(int start, int end) {
85 | return false;
86 | }
87 |
88 | @Override
89 | public boolean performEditorAction(int editorAction) {
90 | return false;
91 | }
92 |
93 | @Override
94 | public boolean performContextMenuAction(int id) {
95 | return false;
96 | }
97 |
98 | @Override
99 | public boolean beginBatchEdit() {
100 | return false;
101 | }
102 |
103 | @Override
104 | public boolean endBatchEdit() {
105 | return false;
106 | }
107 |
108 | @Override
109 | public boolean sendKeyEvent(KeyEvent event) {
110 | return false;
111 | }
112 |
113 | @Override
114 | public boolean clearMetaKeyStates(int states) {
115 | return false;
116 | }
117 |
118 | @Override
119 | public boolean reportFullscreenMode(boolean enabled) {
120 | return false;
121 | }
122 |
123 | @Override
124 | public boolean performPrivateCommand(String action, Bundle data) {
125 | return false;
126 | }
127 |
128 | @Override
129 | public boolean requestCursorUpdates(int cursorUpdateMode) {
130 | return false;
131 | }
132 |
133 | @Override
134 | public Handler getHandler() {
135 | return mHandler.get();
136 | }
137 |
138 | @Override
139 | public void closeConnection() {
140 |
141 | }
142 |
143 | @Override
144 | public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) {
145 | return false;
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakePrintDocumentAdapter.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.os.Bundle;
4 | import android.os.CancellationSignal;
5 | import android.os.ParcelFileDescriptor;
6 | import android.print.PageRange;
7 | import android.print.PrintAttributes;
8 | import android.print.PrintDocumentAdapter;
9 |
10 | public class FakePrintDocumentAdapter extends PrintDocumentAdapter {
11 |
12 | @Override
13 | public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras) {
14 |
15 | }
16 |
17 | @Override
18 | public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, WriteResultCallback callback) {
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeScrollDelegate.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.webkit.WebViewProvider;
4 |
5 | public class FakeScrollDelegate implements WebViewProvider.ScrollDelegate {
6 |
7 | @Override
8 | public int computeHorizontalScrollRange() {
9 | return 0;
10 | }
11 |
12 | @Override
13 | public int computeHorizontalScrollOffset() {
14 | return 0;
15 | }
16 |
17 | @Override
18 | public int computeVerticalScrollRange() {
19 | return 0;
20 | }
21 |
22 | @Override
23 | public int computeVerticalScrollOffset() {
24 | return 0;
25 | }
26 |
27 | @Override
28 | public int computeVerticalScrollExtent() {
29 | return 0;
30 | }
31 |
32 | @Override
33 | public void computeScroll() {
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeServiceWorkerController.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.webkit.ServiceWorkerClient;
4 | import android.webkit.ServiceWorkerController;
5 | import android.webkit.ServiceWorkerWebSettings;
6 |
7 | @SuppressWarnings("deprecation")
8 | public class FakeServiceWorkerController extends ServiceWorkerController {
9 |
10 | @Override
11 | public ServiceWorkerWebSettings getServiceWorkerWebSettings() {
12 | return new FakeServiceWorkerWebSettings();
13 | }
14 |
15 | @Override
16 | public void setServiceWorkerClient(ServiceWorkerClient client) {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeServiceWorkerWebSettings.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.webkit.ServiceWorkerWebSettings;
4 | import android.webkit.WebSettings;
5 |
6 | public class FakeServiceWorkerWebSettings extends ServiceWorkerWebSettings {
7 |
8 | @Override
9 | public void setCacheMode(int mode) {
10 |
11 | }
12 |
13 | @Override
14 | public int getCacheMode() {
15 | return WebSettings.LOAD_DEFAULT;
16 | }
17 |
18 | @Override
19 | public void setAllowContentAccess(boolean allow) {
20 |
21 | }
22 |
23 | @Override
24 | public boolean getAllowContentAccess() {
25 | return false;
26 | }
27 |
28 | @Override
29 | public void setAllowFileAccess(boolean allow) {
30 |
31 | }
32 |
33 | @Override
34 | public boolean getAllowFileAccess() {
35 | return false;
36 | }
37 |
38 | @Override
39 | public void setBlockNetworkLoads(boolean flag) {
40 |
41 | }
42 |
43 | @Override
44 | public boolean getBlockNetworkLoads() {
45 | return false;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeStatics.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.webkit.ValueCallback;
7 | import android.webkit.WebViewFactoryProvider;
8 |
9 | import java.util.List;
10 |
11 | public class FakeStatics implements WebViewFactoryProvider.Statics {
12 |
13 | @Override
14 | public String findAddress(String addr) {
15 | return "";
16 | }
17 |
18 | @Override
19 | public String getDefaultUserAgent(Context context) {
20 | return "";
21 | }
22 |
23 | @Override
24 | public void freeMemoryForTests() {
25 |
26 | }
27 |
28 | @Override
29 | public void setWebContentsDebuggingEnabled(boolean enable) {
30 |
31 | }
32 |
33 | @Override
34 | public void clearClientCertPreferences(Runnable onCleared) {
35 |
36 | }
37 |
38 | @Override
39 | public void enableSlowWholeDocumentDraw() {
40 |
41 | }
42 |
43 | @Override
44 | public Uri[] parseFileChooserResult(int resultCode, Intent intent) {
45 | return new Uri[0];
46 | }
47 |
48 | @Override
49 | public void initSafeBrowsing(Context context, ValueCallback callback) {
50 |
51 | }
52 |
53 | @Override
54 | public void setSafeBrowsingWhitelist(List hosts, ValueCallback callback) {
55 |
56 | }
57 |
58 | @Override
59 | public Uri getSafeBrowsingPrivacyPolicyUrl() {
60 | return Uri.EMPTY;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeTracingController.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.webkit.TracingConfig;
5 | import android.webkit.TracingController;
6 |
7 | import java.io.OutputStream;
8 | import java.util.concurrent.Executor;
9 |
10 | @SuppressLint("NewApi")
11 | @SuppressWarnings("deprecation")
12 | public class FakeTracingController extends TracingController {
13 |
14 | @Override
15 | public void start(TracingConfig tracingConfig) {
16 |
17 | }
18 |
19 | @Override
20 | public boolean stop(OutputStream outputStream, Executor executor) {
21 | return false;
22 | }
23 |
24 | @Override
25 | public boolean isTracing() {
26 | return false;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeViewDelegate.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.content.Intent;
4 | import android.content.res.Configuration;
5 | import android.graphics.Canvas;
6 | import android.graphics.Paint;
7 | import android.graphics.Rect;
8 | import android.graphics.drawable.Drawable;
9 | import android.os.Bundle;
10 | import android.os.Handler;
11 | import android.os.Looper;
12 | import android.view.DragEvent;
13 | import android.view.KeyEvent;
14 | import android.view.MotionEvent;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.view.ViewStructure;
18 | import android.view.accessibility.AccessibilityEvent;
19 | import android.view.accessibility.AccessibilityNodeInfo;
20 | import android.view.accessibility.AccessibilityNodeProvider;
21 | import android.view.inputmethod.EditorInfo;
22 | import android.view.inputmethod.InputConnection;
23 | import android.webkit.WebViewProvider;
24 |
25 | public class FakeViewDelegate implements WebViewProvider.ViewDelegate {
26 |
27 | final Lazy mHandler = new Lazy<>(() -> new Handler(Looper.getMainLooper()));
28 |
29 | @Override
30 | public boolean shouldDelayChildPressedState() {
31 | return false;
32 | }
33 |
34 | @Override
35 | public void onProvideVirtualStructure(ViewStructure structure) {
36 |
37 | }
38 |
39 | @Override
40 | public AccessibilityNodeProvider getAccessibilityNodeProvider() {
41 | return new FakeAccessibilityNodeProvider();
42 | }
43 |
44 | @Override
45 | public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
46 |
47 | }
48 |
49 | @Override
50 | public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
51 |
52 | }
53 |
54 | @Override
55 | public boolean performAccessibilityAction(int action, Bundle arguments) {
56 | return false;
57 | }
58 |
59 | @Override
60 | public void setOverScrollMode(int mode) {
61 |
62 | }
63 |
64 | @Override
65 | public void setScrollBarStyle(int style) {
66 |
67 | }
68 |
69 | @Override
70 | public void onDrawVerticalScrollBar(Canvas canvas, Drawable scrollBar, int l, int t, int r, int b) {
71 |
72 | }
73 |
74 | @Override
75 | public void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
76 |
77 | }
78 |
79 | @Override
80 | public void onWindowVisibilityChanged(int visibility) {
81 |
82 | }
83 |
84 | @Override
85 | public void onDraw(Canvas canvas) {
86 |
87 | }
88 |
89 | @Override
90 | public void setLayoutParams(ViewGroup.LayoutParams layoutParams) {
91 |
92 | }
93 |
94 | @Override
95 | public boolean performLongClick() {
96 | return false;
97 | }
98 |
99 | @Override
100 | public void onConfigurationChanged(Configuration newConfig) {
101 |
102 | }
103 |
104 | @Override
105 | public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
106 | return new FakeInputConnection();
107 | }
108 |
109 | @Override
110 | public boolean onDragEvent(DragEvent event) {
111 | return false;
112 | }
113 |
114 | @Override
115 | public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
116 | return false;
117 | }
118 |
119 | @Override
120 | public boolean onKeyDown(int keyCode, KeyEvent event) {
121 | return false;
122 | }
123 |
124 | @Override
125 | public boolean onKeyUp(int keyCode, KeyEvent event) {
126 | return false;
127 | }
128 |
129 | @Override
130 | public void onAttachedToWindow() {
131 |
132 | }
133 |
134 | @Override
135 | public void onDetachedFromWindow() {
136 |
137 | }
138 |
139 | @Override
140 | public void onVisibilityChanged(View changedView, int visibility) {
141 |
142 | }
143 |
144 | @Override
145 | public void onWindowFocusChanged(boolean hasWindowFocus) {
146 |
147 | }
148 |
149 | @Override
150 | public void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
151 |
152 | }
153 |
154 | @Override
155 | public boolean setFrame(int left, int top, int right, int bottom) {
156 | return false;
157 | }
158 |
159 | @Override
160 | public void onSizeChanged(int w, int h, int ow, int oh) {
161 |
162 | }
163 |
164 | @Override
165 | public void onScrollChanged(int l, int t, int oldl, int oldt) {
166 |
167 | }
168 |
169 | @Override
170 | public boolean dispatchKeyEvent(KeyEvent event) {
171 | return false;
172 | }
173 |
174 | @Override
175 | public boolean onTouchEvent(MotionEvent ev) {
176 | return false;
177 | }
178 |
179 | @Override
180 | public boolean onHoverEvent(MotionEvent event) {
181 | return false;
182 | }
183 |
184 | @Override
185 | public boolean onGenericMotionEvent(MotionEvent event) {
186 | return false;
187 | }
188 |
189 | @Override
190 | public boolean onTrackballEvent(MotionEvent ev) {
191 | return false;
192 | }
193 |
194 | @Override
195 | public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
196 | return false;
197 | }
198 |
199 | @Override
200 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
201 |
202 | }
203 |
204 | @Override
205 | public boolean requestChildRectangleOnScreen(View child, Rect rect, boolean immediate) {
206 | return false;
207 | }
208 |
209 | @Override
210 | public void setBackgroundColor(int color) {
211 |
212 | }
213 |
214 | @Override
215 | public void setLayerType(int layerType, Paint paint) {
216 |
217 | }
218 |
219 | @Override
220 | public void preDispatchDraw(Canvas canvas) {
221 |
222 | }
223 |
224 | @Override
225 | public void onStartTemporaryDetach() {
226 |
227 | }
228 |
229 | @Override
230 | public void onFinishTemporaryDetach() {
231 |
232 | }
233 |
234 | @Override
235 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
236 |
237 | }
238 |
239 | @Override
240 | public Handler getHandler(Handler originalHandler) {
241 | return mHandler.get();
242 | }
243 |
244 | @Override
245 | public View findFocus(View originalFocusedView) {
246 | return originalFocusedView;
247 | }
248 | }
249 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeWebBackForwardList.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.webkit.WebBackForwardList;
4 | import android.webkit.WebHistoryItem;
5 |
6 | @SuppressWarnings("NullableProblems")
7 | public class FakeWebBackForwardList extends WebBackForwardList {
8 |
9 | @Override
10 | public WebHistoryItem getCurrentItem() {
11 | return new FakeWebHistoryItem();
12 | }
13 |
14 | @Override
15 | public int getCurrentIndex() {
16 | return 0;
17 | }
18 |
19 | @Override
20 | public WebHistoryItem getItemAtIndex(int index) {
21 | return new FakeWebHistoryItem();
22 | }
23 |
24 | @Override
25 | public int getSize() {
26 | return 0;
27 | }
28 |
29 | @Override
30 | protected WebBackForwardList clone() {
31 | return this;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeWebHistoryItem.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.graphics.Bitmap;
4 | import android.webkit.WebHistoryItem;
5 |
6 | @SuppressWarnings({"NullableProblems", "unused"})
7 | public class FakeWebHistoryItem extends WebHistoryItem {
8 |
9 | public int getId() {
10 | return 0;
11 | }
12 |
13 | @Override
14 | public String getUrl() {
15 | return "";
16 | }
17 |
18 | @Override
19 | public String getOriginalUrl() {
20 | return "";
21 | }
22 |
23 | @Override
24 | public String getTitle() {
25 | return "";
26 | }
27 |
28 | @Override
29 | public Bitmap getFavicon() {
30 | return null;
31 | }
32 |
33 | @Override
34 | protected WebHistoryItem clone() {
35 | return this;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeWebIconDatabase.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.content.ContentResolver;
4 | import android.webkit.WebIconDatabase;
5 |
6 | @SuppressWarnings({"deprecation", "unused"})
7 | public class FakeWebIconDatabase extends WebIconDatabase {
8 |
9 | @Override
10 | public void open(String path) {
11 |
12 | }
13 |
14 | @Override
15 | public void close() {
16 |
17 | }
18 |
19 | @Override
20 | public void removeAllIcons() {
21 |
22 | }
23 |
24 | @Override
25 | public void requestIconForPageUrl(String url, IconListener listener) {
26 |
27 | }
28 |
29 | public void bulkRequestIconForPageUrl(ContentResolver cr, String where, IconListener listener) {
30 |
31 | }
32 |
33 | @Override
34 | public void retainIconForPageUrl(String url) {
35 |
36 | }
37 |
38 | @Override
39 | public void releaseIconForPageUrl(String url) {
40 |
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeWebSettings.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.webkit.WebSettings;
4 |
5 | @SuppressWarnings("unused")
6 | public class FakeWebSettings extends WebSettings {
7 |
8 | public void setNavDump(boolean enabled) {
9 |
10 | }
11 |
12 | public boolean getNavDump() {
13 | return false;
14 | }
15 |
16 | @Override
17 | public void setSupportZoom(boolean support) {
18 |
19 | }
20 |
21 | @Override
22 | public boolean supportZoom() {
23 | return false;
24 | }
25 |
26 | @Override
27 | public void setMediaPlaybackRequiresUserGesture(boolean require) {
28 |
29 | }
30 |
31 | @Override
32 | public boolean getMediaPlaybackRequiresUserGesture() {
33 | return false;
34 | }
35 |
36 | @Override
37 | public void setBuiltInZoomControls(boolean enabled) {
38 |
39 | }
40 |
41 | @Override
42 | public boolean getBuiltInZoomControls() {
43 | return false;
44 | }
45 |
46 | @Override
47 | public void setDisplayZoomControls(boolean enabled) {
48 |
49 | }
50 |
51 | @Override
52 | public boolean getDisplayZoomControls() {
53 | return false;
54 | }
55 |
56 | @Override
57 | public void setAllowFileAccess(boolean allow) {
58 |
59 | }
60 |
61 | @Override
62 | public boolean getAllowFileAccess() {
63 | return false;
64 | }
65 |
66 | @Override
67 | public void setAllowContentAccess(boolean allow) {
68 |
69 | }
70 |
71 | @Override
72 | public boolean getAllowContentAccess() {
73 | return false;
74 | }
75 |
76 | @Override
77 | public void setLoadWithOverviewMode(boolean overview) {
78 |
79 | }
80 |
81 | @Override
82 | public boolean getLoadWithOverviewMode() {
83 | return false;
84 | }
85 |
86 | @Override
87 | public void setEnableSmoothTransition(boolean enable) {
88 |
89 | }
90 |
91 | @Override
92 | public boolean enableSmoothTransition() {
93 | return false;
94 | }
95 |
96 | public void setUseWebViewBackgroundForOverscrollBackground(boolean view) {
97 |
98 | }
99 |
100 | public boolean getUseWebViewBackgroundForOverscrollBackground() {
101 | return false;
102 | }
103 |
104 | @Override
105 | public void setSaveFormData(boolean save) {
106 |
107 | }
108 |
109 | @Override
110 | public boolean getSaveFormData() {
111 | return false;
112 | }
113 |
114 | @Override
115 | public void setSavePassword(boolean save) {
116 |
117 | }
118 |
119 | @Override
120 | public boolean getSavePassword() {
121 | return false;
122 | }
123 |
124 | @Override
125 | public void setTextZoom(int textZoom) {
126 |
127 | }
128 |
129 | @Override
130 | public int getTextZoom() {
131 | return 0;
132 | }
133 |
134 | public void setAcceptThirdPartyCookies(boolean accept) {
135 |
136 | }
137 |
138 | public boolean getAcceptThirdPartyCookies() {
139 | return false;
140 | }
141 |
142 | @Override
143 | public void setDefaultZoom(ZoomDensity zoom) {
144 |
145 | }
146 |
147 | @Override
148 | public ZoomDensity getDefaultZoom() {
149 | return ZoomDensity.MEDIUM;
150 | }
151 |
152 | @Override
153 | public void setLightTouchEnabled(boolean enabled) {
154 |
155 | }
156 |
157 | @Override
158 | public boolean getLightTouchEnabled() {
159 | return false;
160 | }
161 |
162 | public void setUserAgent(int ua) {
163 |
164 | }
165 |
166 | public int getUserAgent() {
167 | return 0;
168 | }
169 |
170 | @Override
171 | public void setUseWideViewPort(boolean use) {
172 |
173 | }
174 |
175 | @Override
176 | public boolean getUseWideViewPort() {
177 | return false;
178 | }
179 |
180 | @Override
181 | public void setSupportMultipleWindows(boolean support) {
182 |
183 | }
184 |
185 | @Override
186 | public boolean supportMultipleWindows() {
187 | return false;
188 | }
189 |
190 | @Override
191 | public void setLayoutAlgorithm(LayoutAlgorithm l) {
192 |
193 | }
194 |
195 | @Override
196 | public LayoutAlgorithm getLayoutAlgorithm() {
197 | return LayoutAlgorithm.NORMAL;
198 | }
199 |
200 | @Override
201 | public void setStandardFontFamily(String font) {
202 |
203 | }
204 |
205 | @Override
206 | public String getStandardFontFamily() {
207 | return "";
208 | }
209 |
210 | @Override
211 | public void setFixedFontFamily(String font) {
212 |
213 | }
214 |
215 | @Override
216 | public String getFixedFontFamily() {
217 | return "";
218 | }
219 |
220 | @Override
221 | public void setSansSerifFontFamily(String font) {
222 |
223 | }
224 |
225 | @Override
226 | public String getSansSerifFontFamily() {
227 | return "";
228 | }
229 |
230 | @Override
231 | public void setSerifFontFamily(String font) {
232 |
233 | }
234 |
235 | @Override
236 | public String getSerifFontFamily() {
237 | return "";
238 | }
239 |
240 | @Override
241 | public void setCursiveFontFamily(String font) {
242 |
243 | }
244 |
245 | @Override
246 | public String getCursiveFontFamily() {
247 | return "";
248 | }
249 |
250 | @Override
251 | public void setFantasyFontFamily(String font) {
252 |
253 | }
254 |
255 | @Override
256 | public String getFantasyFontFamily() {
257 | return "";
258 | }
259 |
260 | @Override
261 | public void setMinimumFontSize(int size) {
262 |
263 | }
264 |
265 | @Override
266 | public int getMinimumFontSize() {
267 | return 0;
268 | }
269 |
270 | @Override
271 | public void setMinimumLogicalFontSize(int size) {
272 |
273 | }
274 |
275 | @Override
276 | public int getMinimumLogicalFontSize() {
277 | return 0;
278 | }
279 |
280 | @Override
281 | public void setDefaultFontSize(int size) {
282 |
283 | }
284 |
285 | @Override
286 | public int getDefaultFontSize() {
287 | return 0;
288 | }
289 |
290 | @Override
291 | public void setDefaultFixedFontSize(int size) {
292 |
293 | }
294 |
295 | @Override
296 | public int getDefaultFixedFontSize() {
297 | return 0;
298 | }
299 |
300 | @Override
301 | public void setLoadsImagesAutomatically(boolean flag) {
302 |
303 | }
304 |
305 | @Override
306 | public boolean getLoadsImagesAutomatically() {
307 | return false;
308 | }
309 |
310 | @Override
311 | public void setBlockNetworkImage(boolean flag) {
312 |
313 | }
314 |
315 | @Override
316 | public boolean getBlockNetworkImage() {
317 | return false;
318 | }
319 |
320 | @Override
321 | public void setBlockNetworkLoads(boolean flag) {
322 |
323 | }
324 |
325 | @Override
326 | public boolean getBlockNetworkLoads() {
327 | return false;
328 | }
329 |
330 | @Override
331 | public void setJavaScriptEnabled(boolean flag) {
332 |
333 | }
334 |
335 | @Override
336 | public void setAllowUniversalAccessFromFileURLs(boolean flag) {
337 |
338 | }
339 |
340 | @Override
341 | public void setAllowFileAccessFromFileURLs(boolean flag) {
342 |
343 | }
344 |
345 | public void setPluginsEnabled(boolean flag) {
346 |
347 | }
348 |
349 | @Override
350 | public void setPluginState(PluginState state) {
351 |
352 | }
353 |
354 | @Override
355 | public void setDatabasePath(String databasePath) {
356 |
357 | }
358 |
359 | @Override
360 | public void setGeolocationDatabasePath(String databasePath) {
361 |
362 | }
363 |
364 | @Override
365 | public void setAppCacheEnabled(boolean flag) {
366 |
367 | }
368 |
369 | @Override
370 | public void setAppCachePath(String appCachePath) {
371 |
372 | }
373 |
374 | @Override
375 | public void setAppCacheMaxSize(long appCacheMaxSize) {
376 |
377 | }
378 |
379 | @Override
380 | public void setDatabaseEnabled(boolean flag) {
381 |
382 | }
383 |
384 | @Override
385 | public void setDomStorageEnabled(boolean flag) {
386 |
387 | }
388 |
389 | @Override
390 | public boolean getDomStorageEnabled() {
391 | return false;
392 | }
393 |
394 | @Override
395 | public String getDatabasePath() {
396 | return "";
397 | }
398 |
399 | @Override
400 | public boolean getDatabaseEnabled() {
401 | return false;
402 | }
403 |
404 | @Override
405 | public void setGeolocationEnabled(boolean flag) {
406 |
407 | }
408 |
409 | @Override
410 | public boolean getJavaScriptEnabled() {
411 | return false;
412 | }
413 |
414 | @Override
415 | public boolean getAllowUniversalAccessFromFileURLs() {
416 | return false;
417 | }
418 |
419 | @Override
420 | public boolean getAllowFileAccessFromFileURLs() {
421 | return false;
422 | }
423 |
424 | public boolean getPluginsEnabled() {
425 | return false;
426 | }
427 |
428 | @Override
429 | public PluginState getPluginState() {
430 | return PluginState.ON_DEMAND;
431 | }
432 |
433 | @Override
434 | public void setJavaScriptCanOpenWindowsAutomatically(boolean flag) {
435 |
436 | }
437 |
438 | @Override
439 | public boolean getJavaScriptCanOpenWindowsAutomatically() {
440 | return false;
441 | }
442 |
443 | @Override
444 | public void setDefaultTextEncodingName(String encoding) {
445 |
446 | }
447 |
448 | @Override
449 | public String getDefaultTextEncodingName() {
450 | return "";
451 | }
452 |
453 | @Override
454 | public void setUserAgentString(String ua) {
455 |
456 | }
457 |
458 | @Override
459 | public String getUserAgentString() {
460 | return "";
461 | }
462 |
463 | @Override
464 | public void setNeedInitialFocus(boolean flag) {
465 |
466 | }
467 |
468 | @Override
469 | public void setRenderPriority(RenderPriority priority) {
470 |
471 | }
472 |
473 | @Override
474 | public void setCacheMode(int mode) {
475 |
476 | }
477 |
478 | @Override
479 | public int getCacheMode() {
480 | return WebSettings.LOAD_DEFAULT;
481 | }
482 |
483 | @Override
484 | public void setMixedContentMode(int mode) {
485 |
486 | }
487 |
488 | @Override
489 | public int getMixedContentMode() {
490 | return 0;
491 | }
492 |
493 | public void setVideoOverlayForEmbeddedEncryptedVideoEnabled(boolean flag) {
494 |
495 | }
496 |
497 | public boolean getVideoOverlayForEmbeddedEncryptedVideoEnabled() {
498 | return false;
499 | }
500 |
501 | @Override
502 | public void setOffscreenPreRaster(boolean enabled) {
503 |
504 | }
505 |
506 | @Override
507 | public boolean getOffscreenPreRaster() {
508 | return false;
509 | }
510 |
511 | @Override
512 | public void setSafeBrowsingEnabled(boolean enabled) {
513 |
514 | }
515 |
516 | @Override
517 | public boolean getSafeBrowsingEnabled() {
518 | return false;
519 | }
520 |
521 | @Override
522 | public void setDisabledActionModeMenuItems(int menuItems) {
523 |
524 | }
525 |
526 | @Override
527 | public int getDisabledActionModeMenuItems() {
528 | return 0;
529 | }
530 | }
531 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeWebViewDatabase.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.webkit.WebViewDatabase;
4 |
5 | @SuppressWarnings("deprecation")
6 | public class FakeWebViewDatabase extends WebViewDatabase {
7 |
8 | @Override
9 | public boolean hasUsernamePassword() {
10 | return false;
11 | }
12 |
13 | @Override
14 | public void clearUsernamePassword() {
15 |
16 | }
17 |
18 | @Override
19 | public boolean hasHttpAuthUsernamePassword() {
20 | return false;
21 | }
22 |
23 | @Override
24 | public void clearHttpAuthUsernamePassword() {
25 |
26 | }
27 |
28 | @Override
29 | public void setHttpAuthUsernamePassword(String host, String realm, String username, String password) {
30 |
31 | }
32 |
33 | @Override
34 | public String[] getHttpAuthUsernamePassword(String host, String realm) {
35 | return new String[0];
36 | }
37 |
38 | @Override
39 | public boolean hasFormData() {
40 | return false;
41 | }
42 |
43 | @Override
44 | public void clearFormData() {
45 |
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeWebViewProvider.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Picture;
5 | import android.net.Uri;
6 | import android.net.http.SslCertificate;
7 | import android.os.Bundle;
8 | import android.os.Message;
9 | import android.print.PrintDocumentAdapter;
10 | import android.view.View;
11 | import android.webkit.DownloadListener;
12 | import android.webkit.ValueCallback;
13 | import android.webkit.WebBackForwardList;
14 | import android.webkit.WebChromeClient;
15 | import android.webkit.WebMessage;
16 | import android.webkit.WebMessagePort;
17 | import android.webkit.WebSettings;
18 | import android.webkit.WebView;
19 | import android.webkit.WebViewClient;
20 | import android.webkit.WebViewProvider;
21 | import android.webkit.WebViewRenderProcess;
22 | import android.webkit.WebViewRenderProcessClient;
23 |
24 | import java.io.BufferedWriter;
25 | import java.io.File;
26 | import java.util.Date;
27 | import java.util.Map;
28 | import java.util.concurrent.Executor;
29 |
30 | @SuppressWarnings("deprecation")
31 | public class FakeWebViewProvider implements WebViewProvider {
32 |
33 | WebView mWebView;
34 |
35 | public FakeWebViewProvider(WebView webView) {
36 | mWebView = webView;
37 | }
38 |
39 | @Override
40 | public void init(Map javaScriptInterfaces, boolean privateBrowsing) {
41 |
42 | }
43 |
44 | @Override
45 | public void setHorizontalScrollbarOverlay(boolean overlay) {
46 |
47 | }
48 |
49 | @Override
50 | public void setVerticalScrollbarOverlay(boolean overlay) {
51 |
52 | }
53 |
54 | @Override
55 | public boolean overlayHorizontalScrollbar() {
56 | return false;
57 | }
58 |
59 | @Override
60 | public boolean overlayVerticalScrollbar() {
61 | return false;
62 | }
63 |
64 | @Override
65 | public int getVisibleTitleHeight() {
66 | return 0;
67 | }
68 |
69 | @Override
70 | public SslCertificate getCertificate() {
71 | return new SslCertificate(null, null, (Date) null, null);
72 | }
73 |
74 | @Override
75 | public void setCertificate(SslCertificate certificate) {
76 |
77 | }
78 |
79 | @Override
80 | public void savePassword(String host, String username, String password) {
81 |
82 | }
83 |
84 | @Override
85 | public void setHttpAuthUsernamePassword(String host, String realm, String username, String password) {
86 |
87 | }
88 |
89 | @Override
90 | public String[] getHttpAuthUsernamePassword(String host, String realm) {
91 | return new String[0];
92 | }
93 |
94 | @Override
95 | public void destroy() {
96 | mWebView = null;
97 | }
98 |
99 | @Override
100 | public void setNetworkAvailable(boolean networkUp) {
101 |
102 | }
103 |
104 | @Override
105 | public WebBackForwardList saveState(Bundle outState) {
106 | return new FakeWebBackForwardList();
107 | }
108 |
109 | @Override
110 | public boolean savePicture(Bundle b, File dest) {
111 | return false;
112 | }
113 |
114 | @Override
115 | public boolean restorePicture(Bundle b, File src) {
116 | return false;
117 | }
118 |
119 | @Override
120 | public WebBackForwardList restoreState(Bundle inState) {
121 | return new FakeWebBackForwardList();
122 | }
123 |
124 | @Override
125 | public void loadUrl(String url, Map additionalHttpHeaders) {
126 |
127 | }
128 |
129 | @Override
130 | public void loadUrl(String url) {
131 |
132 | }
133 |
134 | @Override
135 | public void postUrl(String url, byte[] postData) {
136 |
137 | }
138 |
139 | @Override
140 | public void loadData(String data, String mimeType, String encoding) {
141 |
142 | }
143 |
144 | @Override
145 | public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl) {
146 |
147 | }
148 |
149 | @Override
150 | public void evaluateJavaScript(String script, ValueCallback resultCallback) {
151 |
152 | }
153 |
154 | @Override
155 | public void saveWebArchive(String filename) {
156 |
157 | }
158 |
159 | @Override
160 | public void saveWebArchive(String basename, boolean autoname, ValueCallback callback) {
161 |
162 | }
163 |
164 | @Override
165 | public void stopLoading() {
166 |
167 | }
168 |
169 | @Override
170 | public void reload() {
171 |
172 | }
173 |
174 | @Override
175 | public boolean canGoBack() {
176 | return false;
177 | }
178 |
179 | @Override
180 | public void goBack() {
181 |
182 | }
183 |
184 | @Override
185 | public boolean canGoForward() {
186 | return false;
187 | }
188 |
189 | @Override
190 | public void goForward() {
191 |
192 | }
193 |
194 | @Override
195 | public boolean canGoBackOrForward(int steps) {
196 | return false;
197 | }
198 |
199 | @Override
200 | public void goBackOrForward(int steps) {
201 |
202 | }
203 |
204 | @Override
205 | public boolean isPrivateBrowsingEnabled() {
206 | return false;
207 | }
208 |
209 | @Override
210 | public boolean pageUp(boolean top) {
211 | return false;
212 | }
213 |
214 | @Override
215 | public boolean pageDown(boolean bottom) {
216 | return false;
217 | }
218 |
219 | @Override
220 | public void insertVisualStateCallback(long requestId, WebView.VisualStateCallback callback) {
221 |
222 | }
223 |
224 | @Override
225 | public void clearView() {
226 |
227 | }
228 |
229 | @Override
230 | public Picture capturePicture() {
231 | return new Picture();
232 | }
233 |
234 | @Override
235 | public PrintDocumentAdapter createPrintDocumentAdapter(String documentName) {
236 | return new FakePrintDocumentAdapter();
237 | }
238 |
239 | @Override
240 | public float getScale() {
241 | return 0;
242 | }
243 |
244 | @Override
245 | public void setInitialScale(int scaleInPercent) {
246 |
247 | }
248 |
249 | @Override
250 | public void invokeZoomPicker() {
251 |
252 | }
253 |
254 | @Override
255 | public WebView.HitTestResult getHitTestResult() {
256 | return new WebView.HitTestResult();
257 | }
258 |
259 | @Override
260 | public void requestFocusNodeHref(Message hrefMsg) {
261 |
262 | }
263 |
264 | @Override
265 | public void requestImageRef(Message msg) {
266 |
267 | }
268 |
269 | @Override
270 | public String getUrl() {
271 | return "";
272 | }
273 |
274 | @Override
275 | public String getOriginalUrl() {
276 | return "";
277 | }
278 |
279 | @Override
280 | public String getTitle() {
281 | return "";
282 | }
283 |
284 | @Override
285 | public Bitmap getFavicon() {
286 | return null;
287 | }
288 |
289 | @Override
290 | public String getTouchIconUrl() {
291 | return "";
292 | }
293 |
294 | @Override
295 | public int getProgress() {
296 | return 0;
297 | }
298 |
299 | @Override
300 | public int getContentHeight() {
301 | return 0;
302 | }
303 |
304 | @Override
305 | public int getContentWidth() {
306 | return 0;
307 | }
308 |
309 | @Override
310 | public void pauseTimers() {
311 |
312 | }
313 |
314 | @Override
315 | public void resumeTimers() {
316 |
317 | }
318 |
319 | @Override
320 | public void onPause() {
321 |
322 | }
323 |
324 | @Override
325 | public void onResume() {
326 |
327 | }
328 |
329 | @Override
330 | public boolean isPaused() {
331 | return false;
332 | }
333 |
334 | @Override
335 | public void freeMemory() {
336 |
337 | }
338 |
339 | @Override
340 | public void clearCache(boolean includeDiskFiles) {
341 |
342 | }
343 |
344 | @Override
345 | public void clearFormData() {
346 |
347 | }
348 |
349 | @Override
350 | public void clearHistory() {
351 |
352 | }
353 |
354 | @Override
355 | public void clearSslPreferences() {
356 |
357 | }
358 |
359 | @Override
360 | public WebBackForwardList copyBackForwardList() {
361 | return new FakeWebBackForwardList();
362 | }
363 |
364 | @Override
365 | public void setFindListener(WebView.FindListener listener) {
366 |
367 | }
368 |
369 | @Override
370 | public void findNext(boolean forward) {
371 |
372 | }
373 |
374 | @Override
375 | public int findAll(String find) {
376 | return 0;
377 | }
378 |
379 | @Override
380 | public void findAllAsync(String find) {
381 |
382 | }
383 |
384 | @Override
385 | public boolean showFindDialog(String text, boolean showIme) {
386 | return false;
387 | }
388 |
389 | @Override
390 | public void clearMatches() {
391 |
392 | }
393 |
394 | @Override
395 | public void documentHasImages(Message response) {
396 |
397 | }
398 |
399 | @Override
400 | public void setWebViewClient(WebViewClient client) {
401 |
402 | }
403 |
404 | @Override
405 | public WebViewClient getWebViewClient() {
406 | return new WebViewClient();
407 | }
408 |
409 | @Override
410 | public WebViewRenderProcess getWebViewRenderProcess() {
411 | return new FakeWebViewRenderProcess();
412 | }
413 |
414 | @Override
415 | public void setWebViewRenderProcessClient(Executor executor, WebViewRenderProcessClient client) {
416 |
417 | }
418 |
419 | @Override
420 | public WebViewRenderProcessClient getWebViewRenderProcessClient() {
421 | return new FakeWebViewRenderProcessClient();
422 | }
423 |
424 | @Override
425 | public void setDownloadListener(DownloadListener listener) {
426 |
427 | }
428 |
429 | @Override
430 | public void setWebChromeClient(WebChromeClient client) {
431 |
432 | }
433 |
434 | @Override
435 | public WebChromeClient getWebChromeClient() {
436 | return new WebChromeClient();
437 | }
438 |
439 | @Override
440 | public void setPictureListener(WebView.PictureListener listener) {
441 |
442 | }
443 |
444 | @Override
445 | public void addJavascriptInterface(Object obj, String interfaceName) {
446 |
447 | }
448 |
449 | @Override
450 | public void removeJavascriptInterface(String interfaceName) {
451 |
452 | }
453 |
454 | @Override
455 | public WebMessagePort[] createWebMessageChannel() {
456 | return new WebMessagePort[0];
457 | }
458 |
459 | @Override
460 | public void postMessageToMainFrame(WebMessage message, Uri targetOrigin) {
461 |
462 | }
463 |
464 | @Override
465 | public WebSettings getSettings() {
466 | return new FakeWebSettings();
467 | }
468 |
469 | @Override
470 | public void setMapTrackballToArrowKeys(boolean setMap) {
471 |
472 | }
473 |
474 | @Override
475 | public void flingScroll(int vx, int vy) {
476 |
477 | }
478 |
479 | @Override
480 | public View getZoomControls() {
481 | return mWebView;
482 | }
483 |
484 | @Override
485 | public boolean canZoomIn() {
486 | return false;
487 | }
488 |
489 | @Override
490 | public boolean canZoomOut() {
491 | return false;
492 | }
493 |
494 | @Override
495 | public boolean zoomBy(float zoomFactor) {
496 | return false;
497 | }
498 |
499 | @Override
500 | public boolean zoomIn() {
501 | return false;
502 | }
503 |
504 | @Override
505 | public boolean zoomOut() {
506 | return false;
507 | }
508 |
509 | @Override
510 | public void dumpViewHierarchyWithProperties(BufferedWriter out, int level) {
511 |
512 | }
513 |
514 | @Override
515 | public View findHierarchyView(String className, int hashCode) {
516 | return mWebView;
517 | }
518 |
519 | @Override
520 | public void setRendererPriorityPolicy(int rendererRequestedPriority, boolean waivedWhenNotVisible) {
521 |
522 | }
523 |
524 | @Override
525 | public int getRendererRequestedPriority() {
526 | return 0;
527 | }
528 |
529 | @Override
530 | public boolean getRendererPriorityWaivedWhenNotVisible() {
531 | return false;
532 | }
533 |
534 | @Override
535 | public ViewDelegate getViewDelegate() {
536 | return new FakeViewDelegate();
537 | }
538 |
539 | @Override
540 | public ScrollDelegate getScrollDelegate() {
541 | return new FakeScrollDelegate();
542 | }
543 |
544 | @Override
545 | public void notifyFindDialogDismissed() {
546 |
547 | }
548 | }
549 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeWebViewRenderProcess.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.webkit.WebViewRenderProcess;
5 |
6 | @SuppressLint("NewApi")
7 | public class FakeWebViewRenderProcess extends WebViewRenderProcess {
8 |
9 | @Override
10 | public boolean terminate() {
11 | return false;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/FakeWebViewRenderProcessClient.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.webkit.WebView;
5 | import android.webkit.WebViewRenderProcess;
6 | import android.webkit.WebViewRenderProcessClient;
7 |
8 | @SuppressLint("NewApi")
9 | public class FakeWebViewRenderProcessClient extends WebViewRenderProcessClient {
10 |
11 | @Override
12 | public void onRenderProcessUnresponsive(WebView view, WebViewRenderProcess renderer) {
13 |
14 | }
15 |
16 | @Override
17 | public void onRenderProcessResponsive(WebView view, WebViewRenderProcess renderer) {
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/Lazy.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import java.util.function.Supplier;
4 |
5 | final class Lazy {
6 |
7 | final Supplier mSupplier;
8 | T mValue;
9 |
10 | Lazy(Supplier supplier) {
11 | mSupplier = supplier;
12 | }
13 |
14 | final T get() {
15 | if (mValue == null) mValue = mSupplier.get();
16 | return mValue;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java:
--------------------------------------------------------------------------------
1 | package com.android.webview.chromium;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.view.Gravity;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.view.ViewParent;
9 | import android.webkit.CookieManager;
10 | import android.webkit.GeolocationPermissions;
11 | import android.webkit.ServiceWorkerController;
12 | import android.webkit.TokenBindingService;
13 | import android.webkit.TracingController;
14 | import android.webkit.WebIconDatabase;
15 | import android.webkit.WebStorage;
16 | import android.webkit.WebView;
17 | import android.webkit.WebViewDatabase;
18 | import android.webkit.WebViewDelegate;
19 | import android.webkit.WebViewFactoryProvider;
20 | import android.webkit.WebViewProvider;
21 | import android.widget.FrameLayout;
22 | import android.widget.LinearLayout;
23 | import android.widget.RelativeLayout;
24 |
25 | import java.lang.reflect.Field;
26 |
27 | @SuppressWarnings({"unused", "deprecation", "JavaReflectionMemberAccess"})
28 | @SuppressLint("SoonBlockedPrivateApi")
29 | public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
30 |
31 | final Lazy mField = new Lazy<>(() -> {
32 | try {
33 | final var f = View.class.getDeclaredField("mLayoutParams");
34 | f.setAccessible(true);
35 | return f;
36 | } catch (ReflectiveOperationException e) {
37 | e.printStackTrace();
38 | return null;
39 | }
40 | });
41 |
42 | final Lazy mLinearLayoutParams = new Lazy<>(() -> new LinearLayout
43 | .LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
44 |
45 | final Lazy mRelativeLayoutParams = new Lazy<>(() -> new RelativeLayout
46 | .LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
47 |
48 | final Lazy mFrameLayoutParams = new Lazy<>(() -> new FrameLayout
49 | .LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
50 | Gravity.CENTER));
51 |
52 | public WebViewChromiumFactoryProvider(WebViewDelegate delegate) {
53 |
54 | }
55 |
56 | @Override
57 | public Statics getStatics() {
58 | return new FakeStatics();
59 | }
60 |
61 | void setLayoutParams(WebView webView) {
62 | if (mField.get() == null) return;
63 | final var parent = webView.getParent();
64 | final ViewGroup.MarginLayoutParams layoutParams;
65 | if (parent instanceof LinearLayout) {
66 | layoutParams = mLinearLayoutParams.get();
67 | } else if (parent instanceof RelativeLayout) {
68 | layoutParams = mRelativeLayoutParams.get();
69 | } else {
70 | layoutParams = mFrameLayoutParams.get();
71 | }
72 | try {
73 | mField.get().set(webView, layoutParams);
74 | } catch (ReflectiveOperationException e) {
75 | e.printStackTrace();
76 | }
77 | }
78 |
79 | @Override
80 | public WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess) {
81 | webView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
82 | @Override
83 | public void onViewAttachedToWindow(View v) {
84 | webView.removeOnAttachStateChangeListener(this);
85 | setLayoutParams(webView);
86 | }
87 |
88 | @Override
89 | public void onViewDetachedFromWindow(View v) {
90 | webView.removeOnAttachStateChangeListener(this);
91 | }
92 | });
93 | setLayoutParams(webView);
94 | webView.setVisibility(View.GONE);
95 | return new FakeWebViewProvider(webView);
96 | }
97 |
98 | @Override
99 | public GeolocationPermissions getGeolocationPermissions() {
100 | return new GeolocationPermissions();
101 | }
102 |
103 | @Override
104 | public CookieManager getCookieManager() {
105 | return new FakeCookieManager();
106 | }
107 |
108 | @Override
109 | public TokenBindingService getTokenBindingService() {
110 | return null;
111 | }
112 |
113 | @Override
114 | public TracingController getTracingController() {
115 | return new FakeTracingController();
116 | }
117 |
118 | @Override
119 | public ServiceWorkerController getServiceWorkerController() {
120 | return new FakeServiceWorkerController();
121 | }
122 |
123 | @Override
124 | public WebIconDatabase getWebIconDatabase() {
125 | return new FakeWebIconDatabase();
126 | }
127 |
128 | @Override
129 | public WebStorage getWebStorage() {
130 | return new WebStorage();
131 | }
132 |
133 | @Override
134 | public WebViewDatabase getWebViewDatabase(Context context) {
135 | return new FakeWebViewDatabase();
136 | }
137 |
138 | @Override
139 | public ClassLoader getWebViewClassLoader() {
140 | return getClass().getClassLoader();
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/arm64-v8a/libc++_shared.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingda920813/FakeWebView/9db58b8c66440597e36e47ae9cc114d7db775c1c/app/src/main/jniLibs/arm64-v8a/libc++_shared.so
--------------------------------------------------------------------------------
/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingda920813/FakeWebView/9db58b8c66440597e36e47ae9cc114d7db775c1c/app/src/main/jniLibs/armeabi-v7a/libc++_shared.so
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:7.0.0-rc01'
8 | }
9 | }
10 |
11 | task clean(type: Delete) {
12 | delete rootProject.buildDir
13 | }
14 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingda920813/FakeWebView/9db58b8c66440597e36e47ae9cc114d7db775c1c/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jul 09 22:16:46 CST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | dependencyResolutionManagement {
2 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
3 | repositories {
4 | google()
5 | mavenCentral()
6 | jcenter() // Warning: this repository is going to shut down soon
7 | }
8 | }
9 | rootProject.name = "FakeWebView"
10 | include ':app'
11 |
--------------------------------------------------------------------------------