mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
204 lines
8.0 KiB
Diff
204 lines
8.0 KiB
Diff
From 664f95d59cc672fb8b8ea3068a92530b08114f95 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Micay <danielmicay@gmail.com>
|
|
Date: Tue, 7 Apr 2015 03:23:22 -0400
|
|
Subject: [PATCH] remove RLZ tracking
|
|
|
|
---
|
|
AndroidManifest.xml | 8 --
|
|
res/values/strings.xml | 3 -
|
|
src/com/android/browser/UrlHandler.java | 129 --------------------------------
|
|
3 files changed, 140 deletions(-)
|
|
|
|
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
|
|
index 0ffdec4..7152192 100644
|
|
--- a/AndroidManifest.xml
|
|
+++ b/AndroidManifest.xml
|
|
@@ -239,14 +239,6 @@
|
|
<!-- Makes .BrowserActivity the search target for any activity in Browser -->
|
|
<meta-data android:name="android.app.default_searchable" android:value=".BrowserActivity" />
|
|
|
|
- <!-- Application code for RLZ tracking. RLZ assigns non-unique, non-personally identifiable
|
|
- tracking labels to client products; these labels sometimes appear in Google search
|
|
- queries. See http://code.google.com/p/rlz for more info.
|
|
-
|
|
- This value signifies to the RLZ client that this application uses RLZ tracking. -->
|
|
- <meta-data android:name="com.google.android.partnersetup.RLZ_ACCESS_POINT"
|
|
- android:value="@string/rlz_access_point" />
|
|
-
|
|
<receiver android:name=".OpenDownloadReceiver">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"/>
|
|
diff --git a/res/values/strings.xml b/res/values/strings.xml
|
|
index 9012511..d9023ec 100644
|
|
--- a/res/values/strings.xml
|
|
+++ b/res/values/strings.xml
|
|
@@ -875,9 +875,6 @@
|
|
<!-- The folder name for the special "Other Bookmarks" folder created by Chrome [CHAR LIMIT=24] -->
|
|
<string name="other_bookmarks">Other Bookmarks</string>
|
|
|
|
- <!-- Access point for RLZ tracking. -->
|
|
- <string name="rlz_access_point">Y1</string>
|
|
-
|
|
<!-- Title for a dialog asking the user which account to sync their bookmarks to [CHAR LIMIT=32] -->
|
|
<string name="account_chooser_dialog_title" msgid="4833571985009544332">Choose account</string>
|
|
|
|
diff --git a/src/com/android/browser/UrlHandler.java b/src/com/android/browser/UrlHandler.java
|
|
index 084a479..52919c8 100644
|
|
--- a/src/com/android/browser/UrlHandler.java
|
|
+++ b/src/com/android/browser/UrlHandler.java
|
|
@@ -38,9 +38,6 @@
|
|
*/
|
|
public class UrlHandler {
|
|
|
|
- static final String RLZ_PROVIDER = "com.google.android.partnersetup.rlzappprovider";
|
|
- static final Uri RLZ_PROVIDER_URI = Uri.parse("content://" + RLZ_PROVIDER + "/");
|
|
-
|
|
// Use in overrideUrlLoading
|
|
/* package */ final static String SCHEME_WTAI = "wtai://wp/";
|
|
/* package */ final static String SCHEME_WTAI_MC = "wtai://wp/mc;";
|
|
@@ -50,9 +47,6 @@
|
|
Controller mController;
|
|
Activity mActivity;
|
|
|
|
- private Boolean mIsProviderPresent = null;
|
|
- private Uri mRlzUri = null;
|
|
-
|
|
public UrlHandler(Controller controller) {
|
|
mController = controller;
|
|
mActivity = mController.getActivity();
|
|
@@ -101,20 +95,6 @@ boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url) {
|
|
return false;
|
|
}
|
|
|
|
- // If this is a Google search, attempt to add an RLZ string
|
|
- // (if one isn't already present).
|
|
- if (rlzProviderPresent()) {
|
|
- Uri siteUri = Uri.parse(url);
|
|
- if (needsRlzString(siteUri)) {
|
|
- // Need to look up the RLZ info from a database, so do it in an
|
|
- // AsyncTask. Although we are not overriding the URL load synchronously,
|
|
- // we guarantee that we will handle this URL load after the task executes,
|
|
- // so it's safe to just return true to WebCore now to stop its own loading.
|
|
- new RLZTask(tab, siteUri, view).execute();
|
|
- return true;
|
|
- }
|
|
- }
|
|
-
|
|
if (startActivityForUrl(tab, url)) {
|
|
return true;
|
|
}
|
|
@@ -248,113 +228,4 @@ boolean handleMenuClick(Tab tab, String url) {
|
|
|
|
return false;
|
|
}
|
|
-
|
|
- // TODO: Move this class into Tab, where it can be properly stopped upon
|
|
- // closure of the tab
|
|
- private class RLZTask extends AsyncTask<Void, Void, String> {
|
|
- private Tab mTab;
|
|
- private Uri mSiteUri;
|
|
- private WebView mWebView;
|
|
-
|
|
- public RLZTask(Tab tab, Uri uri, WebView webView) {
|
|
- mTab = tab;
|
|
- mSiteUri = uri;
|
|
- mWebView = webView;
|
|
- }
|
|
-
|
|
- protected String doInBackground(Void... unused) {
|
|
- String result = mSiteUri.toString();
|
|
- Cursor cur = null;
|
|
- try {
|
|
- cur = mActivity.getContentResolver()
|
|
- .query(getRlzUri(), null, null, null, null);
|
|
- if (cur != null && cur.moveToFirst() && !cur.isNull(0)) {
|
|
- result = mSiteUri.buildUpon()
|
|
- .appendQueryParameter("rlz", cur.getString(0))
|
|
- .build().toString();
|
|
- }
|
|
- } finally {
|
|
- if (cur != null) {
|
|
- cur.close();
|
|
- }
|
|
- }
|
|
- return result;
|
|
- }
|
|
-
|
|
- protected void onPostExecute(String result) {
|
|
- // abort if we left browser already
|
|
- if (mController.isActivityPaused()) return;
|
|
- // Make sure the Tab was not closed while handling the task
|
|
- if (mController.getTabControl().getTabPosition(mTab) != -1) {
|
|
- // If the Activity Manager is not invoked, load the URL directly
|
|
- if (!startActivityForUrl(mTab, result)) {
|
|
- if (!handleMenuClick(mTab, result)) {
|
|
- mController.loadUrl(mTab, result);
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- // Determine whether the RLZ provider is present on the system.
|
|
- private boolean rlzProviderPresent() {
|
|
- if (mIsProviderPresent == null) {
|
|
- PackageManager pm = mActivity.getPackageManager();
|
|
- mIsProviderPresent = pm.resolveContentProvider(RLZ_PROVIDER, 0) != null;
|
|
- }
|
|
- return mIsProviderPresent;
|
|
- }
|
|
-
|
|
- // Retrieve the RLZ access point string and cache the URI used to
|
|
- // retrieve RLZ values.
|
|
- private Uri getRlzUri() {
|
|
- if (mRlzUri == null) {
|
|
- String ap = mActivity.getResources()
|
|
- .getString(R.string.rlz_access_point);
|
|
- mRlzUri = Uri.withAppendedPath(RLZ_PROVIDER_URI, ap);
|
|
- }
|
|
- return mRlzUri;
|
|
- }
|
|
-
|
|
- // Determine if this URI appears to be for a Google search
|
|
- // and does not have an RLZ parameter.
|
|
- // Taken largely from Chrome source, src/chrome/browser/google_url_tracker.cc
|
|
- private static boolean needsRlzString(Uri uri) {
|
|
- String scheme = uri.getScheme();
|
|
- if (("http".equals(scheme) || "https".equals(scheme)) &&
|
|
- (uri.getQueryParameter("q") != null) &&
|
|
- (uri.getQueryParameter("rlz") == null)) {
|
|
- String host = uri.getHost();
|
|
- if (host == null) {
|
|
- return false;
|
|
- }
|
|
- String[] hostComponents = host.split("\\.");
|
|
-
|
|
- if (hostComponents.length < 2) {
|
|
- return false;
|
|
- }
|
|
- int googleComponent = hostComponents.length - 2;
|
|
- String component = hostComponents[googleComponent];
|
|
- if (!"google".equals(component)) {
|
|
- if (hostComponents.length < 3 ||
|
|
- (!"co".equals(component) && !"com".equals(component))) {
|
|
- return false;
|
|
- }
|
|
- googleComponent = hostComponents.length - 3;
|
|
- if (!"google".equals(hostComponents[googleComponent])) {
|
|
- return false;
|
|
- }
|
|
- }
|
|
-
|
|
- // Google corp network handling.
|
|
- if (googleComponent > 0 && "corp".equals(
|
|
- hostComponents[googleComponent - 1])) {
|
|
- return false;
|
|
- }
|
|
-
|
|
- return true;
|
|
- }
|
|
- return false;
|
|
- }
|
|
-
|
|
}
|