Skip to content

Commit 951fcab

Browse files
joth76Selim Gurun
authored andcommitted
Small tidy up to getDefaultUserAgent. DO NOT MERGE
- no need for WebSettings to bounce via WebView to get to the factory - move this static (non-factory) method into the Statics inner class. Bug: 6329117 Clean cherry pick: d1c4faa Change-Id: I96807df0171c7308421ca8811cfcb1bf710cb007
1 parent df5c3a5 commit 951fcab

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

core/java/android/webkit/WebSettings.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package android.webkit;
1818

1919
import android.content.Context;
20-
import android.os.Message;
21-
import android.os.Build;
2220

2321
/**
2422
* Manages settings state for a WebView. When a WebView is first created, it
@@ -1235,7 +1233,7 @@ public synchronized String getUserAgentString() {
12351233
* @param context a Context object used to access application assets
12361234
*/
12371235
public static String getDefaultUserAgent(Context context) {
1238-
return WebView.getFactory().getDefaultUserAgent(context);
1236+
return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context);
12391237
}
12401238

12411239
/**

core/java/android/webkit/WebView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ private void ensureProviderCreated() {
18211821
}
18221822
}
18231823

1824-
static synchronized WebViewFactoryProvider getFactory() {
1824+
private static synchronized WebViewFactoryProvider getFactory() {
18251825
// For now the main purpose of this function (and the factory abstration) is to keep
18261826
// us honest and minimize usage of WebViewClassic internals when binding the proxy.
18271827
checkThread();

core/java/android/webkit/WebViewFactoryProvider.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ interface Statics {
4242
* {@link android.webkit.WebView#disablePlatformNotifications()}
4343
*/
4444
void setPlatformNotificationsEnabled(boolean enable);
45+
46+
/**
47+
* Implements the API method:
48+
* {@link android.webkit.WebSettings#getDefaultUserAgent(Context) }
49+
*/
50+
String getDefaultUserAgent(Context context);
4551
}
4652

4753
Statics getStatics();
@@ -93,14 +99,4 @@ interface Statics {
9399
* @return the singleton WebViewDatabase instance
94100
*/
95101
WebViewDatabase getWebViewDatabase(Context context);
96-
97-
/**
98-
* Returns the default User-Agent used by a WebView.
99-
* An instance of WebView could use a different User-Agent if a call
100-
* is made to {@link WebSettings#setUserAgent(int)} or
101-
* {@link WebSettings#setUserAgentString(String)}.
102-
*
103-
* @param context a Context object used to access application assets
104-
*/
105-
String getDefaultUserAgent(Context context);
106102
}

0 commit comments

Comments
 (0)