Browse Source

Remove dependency on remaining Google Play aars

tags/75.0.3770.142-2
wchen342 1 year ago
parent
commit
497e5a2090
Signed by untrusted user: wchen342 GPG Key ID: 720B70365E800508
8 changed files with 2551 additions and 25 deletions
  1. +2
    -3
      README.md
  2. +0
    -21
      binary_dependencies
  3. +6
    -1
      patches/ungoogled-chromium-android/patches.list
  4. +823
    -0
      patches/ungoogled-chromium-android/remove-gms-base-tasks.patch
  5. +582
    -0
      patches/ungoogled-chromium-android/remove-gms-fido-iid-instantapps-location.patch
  6. +67
    -0
      patches/ungoogled-chromium-android/remove-gms-flags-places-stats.patch
  7. +580
    -0
      patches/ungoogled-chromium-android/remove-gms-vision-clearcut-phenotype.patch
  8. +491
    -0
      patches/ungoogled-chromium-android/remove-play-core.patch

+ 2
- 3
README.md View File

@ -66,9 +66,8 @@ You can use f-Droid client and add [this repository](https://www.droidware.info/
- [x] Remove dependencies on SDK tools and extras
- [x] Domain substitution in java files
- [x] Prune binaries (*Note: haven't found a way to build desugar-runtime without bazel. Please let me know if you know how.*)
- [ ] Remove Play Services [WIP]
* GCM removed
- [ ] Java patches (low priority)
- [x] Remove Play Services
- [ ] Java patches
## Credits


+ 0
- 21
binary_dependencies View File

@ -6,10 +6,6 @@ jar/aar:
"src/third_party/android_deps/libs/com_android_support_preference_leanback_v17": None,
"src/third_party/android_deps/libs/com_android_support_preference_v14": None,
"src/third_party/android_deps/libs/com_android_support_preference_v7": None,
"src/third_party/android_deps/libs/com_google_android_gms_play_services_auth": None,
"src/third_party/android_deps/libs/com_google_android_gms_play_services_auth_api_phone": None,
"src/third_party/android_deps/libs/com_google_android_gms_play_services_fido": None,
"src/third_party/android_deps/libs/com_google_android_gms_play_services_instantapps": None,
"src/third_party/android_deps/libs/com_google_ar_core": None,
"src/third_party/android_deps/libs/com_google_code_findbugs_jsr305": None,
"src/third_party/android_deps/libs/com_google_dagger_dagger_spi": None,
@ -32,18 +28,12 @@ jar/aar:
"src/third_party/android_deps/libs/com_android_support_support_vector_drawable": None,34
"src/third_party/android_deps/libs/com_android_support_appcompat_v7": None,14
"src/third_party/android_deps/libs/com_android_support_recyclerview_v7": None,25
"src/third_party/android_deps/libs/com_google_android_gms_play_services_base": None,39
"src/third_party/android_deps/libs/com_google_android_gms_play_services_basement": None,40
"src/third_party/android_deps/libs/com_android_support_design": None,16
"src/third_party/android_deps/libs/com_android_support_transition": None,35
"src/third_party/android_deps/libs/com_android_support_gridlayout_v7": None,17
"src/third_party/android_deps/libs/com_google_android_gms_play_services_gcm": None,46
"src/third_party/android_deps/libs/com_google_android_gms_play_services_iid": None,47
"src/third_party/android_deps/libs/com_android_support_support_v13": None,32
"src/third_party/android_deps/libs/com_android_support_mediarouter_v7": None,19
"src/third_party/android_deps/libs/com_android_support_palette_v7": None,21
"src/third_party/android_deps/libs/com_google_android_gms_play_services_cast_framework": None,42
"src/third_party/android_deps/libs/com_google_android_gms_play_services_cast": None,41
"src/third_party/android_deps/libs/com_android_support_cardview_v7": None,15
"src/third_party/bazel": None,83
"src/third_party/r8": None,98
@ -55,22 +45,11 @@ jar/aar:
"src/third_party/android_deps/libs/android_arch_core_common": None,5
"src/third_party/android_deps/libs/android_arch_lifecycle_common": None,6
"src/third_party/android_deps/libs/com_google_protobuf_protobuf_lite": None,67
"src/third_party/android_deps/libs/com_google_android_gms_play_services_tasks": None,53
"src/third_party/android_deps/libs/com_google_android_gms_play_services_location": None,49
"src/third_party/android_deps/libs/com_google_android_gms_play_services_places_placereport": None,51
"src/third_party/android_deps/libs/com_google_android_gms_play_services_vision_common": None,55
"src/third_party/android_deps/libs/com_google_android_gms_play_services_clearcut": None,43
"src/third_party/android_deps/libs/com_google_android_gms_play_services_phenotype": None,50
"src/third_party/android_deps/libs/com_google_android_gms_play_services_flags": None,45
"src/third_party/android_deps/libs/com_google_android_gms_play_services_vision": None,54
"src/third_party/android_system_sdk": None,80
"src/third_party/android_deps/libs/com_google_android_gms_play_services_stats": None,52
"src/third_party/android_deps/libs/com_google_android_gms_play_services_auth_base": None,38
"src/third_party/android_deps/libs/com_google_dagger_dagger": None,58
"src/third_party/android_deps/libs/javax_inject_javax_inject": None,70
"src/third_party/android_deps/libs/com_google_dagger_dagger_compiler": None,59
"src/third_party/android_deps/libs/com_google_dagger_dagger_producers": None,60
"src/third_party/google_android_play_core": None,88
"src/third_party/android_deps/libs/androidx_annotation_annotation": None,8
"src/third_party/android_deps/libs/androidx_lifecycle_lifecycle_common": None,9
"src/third_party/custom_tabs_client/src": None,gradle-wrapper.jar

+ 6
- 1
patches/ungoogled-chromium-android/patches.list View File

@ -1,4 +1,9 @@
remove-gcm-client.patch
remove-gms-gcm.patch
remove-gms-auth.patch
remove-gms-cast.patch
remove-gms-cast.patch
remove-gms-fido-iid-instantapps-location.patch
remove-gms-vision-clearcut-phenotype.patch
remove-gms-flags-places-stats.patch
remove-gms-base-tasks.patch
remove-play-core.patch

+ 823
- 0
patches/ungoogled-chromium-android/remove-gms-base-tasks.patch View File

@ -0,0 +1,823 @@
Remove dependency on com.google.android.gms.common/auth/signin/dynamic, com.google.android.gms.tasks (play-services-base-15.0.1.aar, play-services-basement-15.0.1.aar, play-services-tasks-15.0.1.aar).
author: Wengling Chen <[email protected]>
---
chrome/android/BUILD.gn | 8 ---
chrome/android/features/media_router/BUILD.gn | 2 -
.../browser/media/router/ChromeMediaRouter.java | 7 +-
chrome/android/java/AndroidManifest.xml | 9 ---
.../src/org/chromium/chrome/browser/AppHooks.java | 14 +---
.../chromium/chrome/browser/ChromeVersionInfo.java | 12 +---
.../browser/component_updater/UpdateScheduler.java | 8 +--
.../browser/externalauth/ExternalAuthUtils.java | 15 ++--
.../externalauth/UserRecoverableErrorHandler.java | 7 --
.../browser/gcore/ChromeGoogleApiClientImpl.java | 25 +------
.../browser/gcore/GoogleApiClientHelper.java | 82 +---------------------
.../chrome/browser/omaha/UpdateStatusProvider.java | 10 +--
.../browser/preferences/PreferencesLauncher.java | 5 +-
chrome/test/android/BUILD.gn | 2 -
components/background_task_scheduler/BUILD.gn | 9 ---
components/signin/core/browser/android/BUILD.gn | 2 -
.../signin/GmsAvailabilityException.java | 4 +-
device/BUILD.gn | 2 -
remoting/android/client_java_tmpl.gni | 3 -
services/BUILD.gn | 4 --
services/device/geolocation/BUILD.gn | 2 -
services/shape_detection/BUILD.gn | 2 -
.../shape_detection/FaceDetectionProviderImpl.java | 8 +--
third_party/android_deps/BUILD.gn | 53 --------------
third_party/cacheinvalidation/BUILD.gn | 1 -
third_party/robolectric/BUILD.gn | 2 -
26 files changed, 18 insertions(+), 280 deletions(-)
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -249,9 +249,6 @@ android_library("chrome_java") {
":partner_location_descriptor_proto_java",
":thumbnail_cache_entry_proto_java",
":usage_stats_proto_java",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_tasks_java",
"//base:base_java",
"//base:jni_java",
"//chrome/android/third_party/compositor_animator:compositor_animator_java",
@@ -611,8 +608,6 @@ junit_binary("chrome_junit_tests") {
":chrome_java",
":chrome_junit_test_support",
":partner_location_descriptor_proto_java",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
@@ -706,9 +701,6 @@ android_library("chrome_test_java") {
":browser_java_test_support",
":chrome_test_util_java",
":partner_location_descriptor_proto_java",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_tasks_java",
"//base:base_java",
"//base:base_java_test_support",
"//chrome/android:app_hooks_java",
diff --git a/chrome/android/features/media_router/BUILD.gn b/chrome/android/features/media_router/BUILD.gn
--- a/chrome/android/features/media_router/BUILD.gn
+++ b/chrome/android/features/media_router/BUILD.gn
@@ -9,8 +9,6 @@ import("//chrome/common/features.gni")
android_library("java") {
deps = [
":java_resources",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//chrome/android:chrome_java",
"//services/media_session/public/cpp/android:media_session_java",
diff --git a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
--- a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
+++ b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
@@ -7,9 +7,6 @@ package org.chromium.chrome.browser.media.router;
import android.support.annotation.Nullable;
import android.support.v7.media.MediaRouter;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.StrictModeContext;
@@ -42,9 +39,7 @@ public class ChromeMediaRouter implements MediaRouteManager {
int googleApiAvailabilityResult =
AppHooks.get().isGoogleApiAvailableWithMinApkVersion(
MIN_GOOGLE_PLAY_SERVICES_APK_VERSION);
- if (googleApiAvailabilityResult != ConnectionResult.SUCCESS) {
- GoogleApiAvailability.getInstance().showErrorNotification(
- ContextUtils.getApplicationContext(), googleApiAvailabilityResult);
+ if (true) {
return;
}
MediaRouteProvider cafProvider = CafMediaRouteProvider.create(manager);
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -886,15 +886,6 @@ by a child template that "extends" this file.
</intent-filter>
</activity>
- <!-- Activity for dispatching intents to Instant Apps. -->
- <activity
- android:name="org.chromium.chrome.browser.instantapps.AuthenticatedProxyActivity"
- android:exported="false"
- android:theme="@android:style/Theme.NoDisplay"
- android:noHistory="true"
- android:excludeFromRecents="true">
- </activity>
-
<activity
android:name="org.chromium.chrome.browser.vr.VrCancelAnimationActivity"
android:exported="false"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java
@@ -15,9 +15,6 @@ import android.support.annotation.Nullable;
import android.view.View;
import android.view.inputmethod.InputConnection;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-
import org.chromium.base.Callback;
import org.chromium.base.CommandLine;
import org.chromium.base.ContextUtils;
@@ -409,16 +406,7 @@ public abstract class AppHooks {
* same as {@link GoogleApiAvailability#isGooglePlayServicesAvailable()}.
*/
public int isGoogleApiAvailableWithMinApkVersion(int minApkVersion) {
- try {
- PackageInfo gmsPackageInfo =
- ContextUtils.getApplicationContext().getPackageManager().getPackageInfo(
- GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE, /* flags= */ 0);
- int apkVersion = gmsPackageInfo.versionCode;
- if (apkVersion >= minApkVersion) return ConnectionResult.SUCCESS;
- } catch (PackageManager.NameNotFoundException e) {
- return ConnectionResult.SERVICE_MISSING;
- }
- return ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED;
+ return 1; /* SERVICE_MISSING*/
}
/**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java
@@ -7,8 +7,6 @@ package org.chromium.chrome.browser;
import android.content.Context;
import android.content.pm.PackageManager;
-import com.google.android.gms.common.GoogleApiAvailability;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
@@ -88,7 +86,7 @@ public class ChromeVersionInfo {
public static String getGmsInfo() {
Context context = ContextUtils.getApplicationContext();
- final long sdkVersion = GoogleApiAvailability.GOOGLE_PLAY_SERVICES_VERSION_CODE;
+ final long sdkVersion = 12600000;
final long installedGmsVersion = getPlayServicesApkVersionNumber(context);
final String accessType;
@@ -105,12 +103,6 @@ public class ChromeVersionInfo {
}
private static long getPlayServicesApkVersionNumber(Context context) {
- try {
- return context.getPackageManager()
- .getPackageInfo(GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE, 0)
- .versionCode;
- } catch (PackageManager.NameNotFoundException e) {
- return 0;
- }
+ return 0;
}
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/component_updater/UpdateScheduler.java b/chrome/android/java/src/org/chromium/chrome/browser/component_updater/UpdateScheduler.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/component_updater/UpdateScheduler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/component_updater/UpdateScheduler.java
@@ -6,9 +6,6 @@ package org.chromium.chrome.browser.component_updater;
import android.os.Build;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
@@ -35,10 +32,7 @@ public class UpdateScheduler {
@CalledByNative
/* package */ static boolean isAvailable() {
- return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
- || GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
- ContextUtils.getApplicationContext())
- == ConnectionResult.SUCCESS;
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
}
/* package */ void onStartTaskBeforeNativeLoaded(TaskFinishedCallback callback) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
@@ -15,9 +15,6 @@ import android.os.SystemClock;
import android.support.annotation.WorkerThread;
import android.text.TextUtils;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-
import org.chromium.base.CommandLine;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
@@ -165,9 +162,7 @@ public class ExternalAuthUtils {
* when it is updating.
*/
public boolean isGooglePlayServicesMissing(final Context context) {
- final int resultCode = checkGooglePlayServicesAvailable(context);
- return (resultCode == ConnectionResult.SERVICE_MISSING
- || resultCode == ConnectionResult.SERVICE_INVALID);
+ return true;
}
/**
@@ -190,7 +185,6 @@ public class ExternalAuthUtils {
Context context = ContextUtils.getApplicationContext();
final int resultCode = checkGooglePlayServicesAvailable(context);
recordConnectionResult(resultCode);
- if (resultCode == ConnectionResult.SUCCESS) return true;
// resultCode is some kind of error.
Log.v(TAG, "Unable to use Google Play Services: %s", describeError(resultCode));
if (isUserRecoverableError(resultCode)) {
@@ -271,8 +265,7 @@ public class ExternalAuthUtils {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
try {
long time = SystemClock.elapsedRealtime();
- int isAvailable =
- GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
+ int isAvailable = 1; /*SERVICE_MISSING*/
mRegistrationTimeHistogramSample.record(SystemClock.elapsedRealtime() - time);
return isAvailable;
} finally {
@@ -288,7 +281,7 @@ public class ExternalAuthUtils {
* @return true If the code represents a user-recoverable error
*/
protected boolean isUserRecoverableError(final int errorCode) {
- return GoogleApiAvailability.getInstance().isUserResolvableError(errorCode);
+ return false;
}
/**
@@ -298,6 +291,6 @@ public class ExternalAuthUtils {
* @return a textual description of the error code
*/
protected String describeError(final int errorCode) {
- return GoogleApiAvailability.getInstance().getErrorString(errorCode);
+ return "";
}
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
@@ -10,8 +10,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.IntDef;
-import com.google.android.gms.common.GoogleApiAvailability;
-
import org.chromium.base.ThreadUtils;
import org.chromium.base.metrics.CachedMetrics.ActionEvent;
import org.chromium.base.metrics.CachedMetrics.EnumeratedHistogramSample;
@@ -120,7 +118,6 @@ public abstract class UserRecoverableErrorHandler {
sErrorHandlerActionHistogramSample.record(ErrorHandlerAction.IGNORED_AS_REDUNDANT);
return;
}
- GoogleApiAvailability.getInstance().showErrorNotification(context, errorCode);
sErrorHandlerActionHistogramSample.record(ErrorHandlerAction.SYSTEM_NOTIFICATION);
}
}
@@ -214,11 +211,7 @@ public abstract class UserRecoverableErrorHandler {
cancelDialog();
}
if (mDialog == null) {
- mDialog = GoogleApiAvailability.getInstance().getErrorDialog(
- mActivity, errorCode, NO_RESPONSE_REQUIRED);
mErrorCode = errorCode;
-
- DialogUserActionRecorder.createAndAttachToDialog(mDialog);
}
// This can happen if |errorCode| is ConnectionResult.SERVICE_INVALID.
if (mDialog != null && !mDialog.isShowing()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java
@@ -6,9 +6,6 @@ package org.chromium.chrome.browser.gcore;
import android.content.Context;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.api.GoogleApiClient;
-
import org.chromium.base.Log;
import org.chromium.base.TraceEvent;
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
@@ -22,7 +19,6 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
private static final String TAG = "Icing";
private final Context mApplicationContext;
- private final GoogleApiClient mClient;
/**
* @param context its application context will be exposed through
@@ -31,10 +27,9 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
* @param requireFirstPartyBuild true if the given client can only be used in a first-party
* build.
*/
- public ChromeGoogleApiClientImpl(Context context, GoogleApiClient client,
+ public ChromeGoogleApiClientImpl(Context context,
boolean requireFirstPartyBuild) {
mApplicationContext = context.getApplicationContext();
- mClient = client;
if (requireFirstPartyBuild && !ExternalAuthUtils.getInstance().isChromeGoogleSigned()) {
throw new IllegalStateException("GoogleApiClient requires first-party build");
}
@@ -42,7 +37,6 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
@Override
public void disconnect() {
- mClient.disconnect();
}
@Override
@@ -58,24 +52,11 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
@Override
public boolean connectWithTimeout(long timeout) {
TraceEvent.begin("ChromeGoogleApiClientImpl:connectWithTimeout");
- try {
- ConnectionResult result = mClient.blockingConnect(timeout, TimeUnit.MILLISECONDS);
- if (!result.isSuccess()) {
- Log.e(TAG, "Connection to GmsCore unsuccessful. Error %d", result.getErrorCode());
- } else {
- Log.d(TAG, "Connection to GmsCore successful.");
- }
- return result.isSuccess();
- } finally {
- TraceEvent.end("ChromeGoogleApiClientImpl:connectWithTimeout");
- }
+ TraceEvent.end("ChromeGoogleApiClientImpl:connectWithTimeout");
+ return false;
}
public Context getApplicationContext() {
return mApplicationContext;
}
-
- public GoogleApiClient getApiClient() {
- return mClient;
- }
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gcore/GoogleApiClientHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/gcore/GoogleApiClientHelper.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/gcore/GoogleApiClientHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/gcore/GoogleApiClientHelper.java
@@ -7,11 +7,6 @@ package org.chromium.chrome.browser.gcore;
import android.os.Bundle;
import android.os.Handler;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
-import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
-
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ApplicationStatus.ApplicationStateListener;
import org.chromium.base.Log;
@@ -67,29 +62,15 @@ import org.chromium.base.ThreadUtils;
* }
* </pre>
*/
-public class GoogleApiClientHelper
- implements OnConnectionFailedListener, ConnectionCallbacks {
+public class GoogleApiClientHelper {
private static final String TAG = "GCore";
private int mResolutionAttempts;
private boolean mWasConnectedBefore;
private final Handler mHandler = new Handler(ThreadUtils.getUiThreadLooper());
- private final GoogleApiClient mClient;
private long mDisconnectionDelayMs;
private Runnable mPendingDisconnect;
- /**
- * Creates a helper and enrolls it in the various connection management features.
- * See the class documentation for {@link GoogleApiClientHelper} for more information.
- *
- * @param client The client to wrap.
- */
- public GoogleApiClientHelper(GoogleApiClient client) {
- mClient = client;
- enableConnectionRetrying(true);
- enableLifecycleManagement(true);
- }
-
/**
* Opts in or out of lifecycle management. The client's connection will be closed and reopened
* when Chrome goes in and out of background.
@@ -116,13 +97,6 @@ public class GoogleApiClientHelper
* Enabling or disabling it while it is already enabled or disabled has no effect.
*/
public void enableConnectionRetrying(boolean enabled) {
- if (enabled) {
- mClient.registerConnectionCallbacks(this);
- mClient.registerConnectionFailedListener(this);
- } else {
- mClient.unregisterConnectionCallbacks(this);
- mClient.unregisterConnectionFailedListener(this);
- }
}
/**
@@ -155,21 +129,11 @@ public class GoogleApiClientHelper
// Cancel and reschedule the disconnection if we are in the background. We do it early to
// avoid race conditions between a disconnect on the UI thread and the connect below.
if (!ApplicationStatus.hasVisibleActivities()) scheduleDisconnection();
-
- // The client might be disconnected if we were idle in the background for too long.
- if (!mClient.isConnected() && !mClient.isConnecting()) {
- Log.d(TAG, "Reconnecting the client.");
- mClient.connect();
- }
}
void restoreConnectedState() {
// If we go back to the foreground before a delayed disconnect happens, cancel it.
cancelPendingDisconnection();
-
- if (mWasConnectedBefore) {
- mClient.connect();
- }
}
/**
@@ -192,12 +156,6 @@ public class GoogleApiClientHelper
}
private void disconnect() {
- if (mClient.isConnected() || mClient.isConnecting()) {
- mWasConnectedBefore = true;
- }
-
- // We always call disconnect to abort possibly pending connection requests.
- mClient.disconnect();
}
private void cancelPendingDisconnection() {
@@ -207,43 +165,7 @@ public class GoogleApiClientHelper
mPendingDisconnect = null;
}
- @Override
- public void onConnectionFailed(ConnectionResult result) {
- if (!isErrorRecoverableByRetrying(result.getErrorCode())) {
- Log.d(TAG, "Not retrying managed client connection. Unrecoverable error: %d",
- result.getErrorCode());
- return;
- }
-
- if (mResolutionAttempts < ConnectedTask.RETRY_NUMBER_LIMIT) {
- Log.d(TAG, "Retrying managed client connection. attempt %d/%d - errorCode: %d",
- mResolutionAttempts, ConnectedTask.RETRY_NUMBER_LIMIT, result.getErrorCode());
- mResolutionAttempts += 1;
-
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- mClient.connect();
- }
- }, ConnectedTask.CONNECTION_RETRY_TIME_MS);
- }
- }
-
- @Override
- public void onConnected(Bundle connectionHint) {
- mResolutionAttempts = 0;
- }
-
- @Override
- public void onConnectionSuspended(int cause) {
- // GoogleApiClient handles retrying on suspension itself. Logging in case it didn't succeed
- // for some reason.
- Log.w(TAG, "Managed client connection suspended. Cause: %d", cause);
- }
-
private static boolean isErrorRecoverableByRetrying(int errorCode) {
- return errorCode == ConnectionResult.INTERNAL_ERROR
- || errorCode == ConnectionResult.NETWORK_ERROR
- || errorCode == ConnectionResult.SERVICE_UPDATING;
+ return false;
}
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java
@@ -16,8 +16,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
-import com.google.android.gms.common.GooglePlayServicesUtil;
-
import org.chromium.base.ActivityState;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ApplicationStatus.ActivityStateListener;
@@ -428,13 +426,7 @@ public class UpdateStatusProvider implements ActivityStateListener {
}
private boolean isGooglePlayStoreAvailable(Context context) {
- try {
- context.getPackageManager().getPackageInfo(
- GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE, 0);
- } catch (PackageManager.NameNotFoundException e) {
- return false;
- }
- return true;
+ return false;
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PreferencesLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PreferencesLauncher.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PreferencesLauncher.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PreferencesLauncher.java
@@ -12,8 +12,6 @@ import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
-import com.google.android.gms.common.ConnectionResult;
-
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.RecordUserAction;
@@ -202,8 +200,7 @@ public class PreferencesLauncher {
int minGooglePlayServicesVersion = ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
GOOGLE_ACCOUNT_PWM_UI, MIN_GOOGLE_PLAY_SERVICES_VERSION_PARAM,
DEFAULT_MIN_GOOGLE_PLAY_SERVICES_APK_VERSION);
- if (AppHooks.get().isGoogleApiAvailableWithMinApkVersion(minGooglePlayServicesVersion)
- != ConnectionResult.SUCCESS)
+ if (true)
return false;
if (!ChromeFeatureList.isEnabled(GOOGLE_ACCOUNT_PWM_UI)) return false;
diff --git a/chrome/test/android/BUILD.gn b/chrome/test/android/BUILD.gn
--- a/chrome/test/android/BUILD.gn
+++ b/chrome/test/android/BUILD.gn
@@ -67,8 +67,6 @@ android_library("chrome_java_test_support") {
"javatests/src/org/chromium/chrome/test/util/TranslateUtil.java",
]
deps = [
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//base:base_java_test_support",
"//chrome/android:chrome_java",
diff --git a/components/background_task_scheduler/BUILD.gn b/components/background_task_scheduler/BUILD.gn
--- a/components/background_task_scheduler/BUILD.gn
+++ b/components/background_task_scheduler/BUILD.gn
@@ -51,9 +51,6 @@ if (is_android) {
deps = [
":background_task_scheduler_task_ids_java",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_tasks_java",
"//base:base_java",
"//third_party/android_deps:com_android_support_support_annotations_java",
]
@@ -70,9 +67,6 @@ if (is_android) {
deps = [
":background_task_scheduler_java",
":background_task_scheduler_task_ids_java",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_tasks_java",
"//base:base_java",
"//base:base_java_test_support",
"//third_party/android_support_test_runner:runner_java",
@@ -93,9 +87,6 @@ if (is_android) {
deps = [
":background_task_scheduler_java",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_tasks_java",
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
diff --git a/components/signin/core/browser/android/BUILD.gn b/components/signin/core/browser/android/BUILD.gn
--- a/components/signin/core/browser/android/BUILD.gn
+++ b/components/signin/core/browser/android/BUILD.gn
@@ -16,8 +16,6 @@ generate_jni("jni_headers") {
android_library("java") {
deps = [
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//base:jni_java",
"//net/android:net_java",
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/GmsAvailabilityException.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/GmsAvailabilityException.java
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/GmsAvailabilityException.java
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/GmsAvailabilityException.java
@@ -4,8 +4,6 @@
package org.chromium.components.signin;
-import com.google.android.gms.common.GoogleApiAvailability;
-
/**
* This class encapsulates return code if GMSCore package is not available.
*/
@@ -27,6 +25,6 @@ public class GmsAvailabilityException extends AccountManagerDelegateException {
}
public boolean isUserResolvableError() {
- return GoogleApiAvailability.getInstance().isUserResolvableError(mResultCode);
+ return false;
}
}
diff --git a/device/BUILD.gn b/device/BUILD.gn
--- a/device/BUILD.gn
+++ b/device/BUILD.gn
@@ -430,8 +430,6 @@ if (is_android) {
junit_binary("device_junit_tests") {
java_files = [ "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java" ]
deps = [
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
diff --git a/remoting/android/client_java_tmpl.gni b/remoting/android/client_java_tmpl.gni
--- a/remoting/android/client_java_tmpl.gni
+++ b/remoting/android/client_java_tmpl.gni
@@ -95,9 +95,6 @@ template("remoting_android_client_java_tmpl") {
if (defined(invoker.play_services_package)) {
deps += [
- "${invoker.play_services_package}:google_play_services_auth_base_java",
- "${invoker.play_services_package}:google_play_services_base_java",
- "${invoker.play_services_package}:google_play_services_basement_java",
]
}
diff --git a/services/BUILD.gn b/services/BUILD.gn
--- a/services/BUILD.gn
+++ b/services/BUILD.gn
@@ -100,8 +100,6 @@ if (is_android) {
"shape_detection/android/junit/src/org/chromium/shape_detection/BitmapUtilsTest.java",
]
deps = [
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
@@ -129,8 +127,6 @@ if (is_android) {
"shape_detection/android/javatests/src/org/chromium/shape_detection/TextDetectionImplTest.java",
]
deps = [
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//base:base_java_test_support",
"//mojo/public/java:base_java",
diff --git a/services/device/geolocation/BUILD.gn b/services/device/geolocation/BUILD.gn
--- a/services/device/geolocation/BUILD.gn
+++ b/services/device/geolocation/BUILD.gn
@@ -143,8 +143,6 @@ if (is_android) {
deps = [
":geolocation",
":geolocation_jni_headers",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//components/location/android:location_java",
"//services/device/public/java:geolocation_java",
diff --git a/services/shape_detection/BUILD.gn b/services/shape_detection/BUILD.gn
--- a/services/shape_detection/BUILD.gn
+++ b/services/shape_detection/BUILD.gn
@@ -97,8 +97,6 @@ if (is_android) {
]
deps = [
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
"//mojo/public/java:base_java",
"//mojo/public/java:bindings_java",
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionProviderImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionProviderImpl.java
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionProviderImpl.java
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionProviderImpl.java
@@ -4,9 +4,6 @@
package org.chromium.shape_detection;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-
import org.chromium.base.ContextUtils;
import org.chromium.mojo.bindings.InterfaceRequest;
import org.chromium.mojo.system.MojoException;
@@ -24,10 +21,7 @@ public class FaceDetectionProviderImpl implements FaceDetectionProvider {
@Override
public void createFaceDetection(
InterfaceRequest<FaceDetection> request, FaceDetectorOptions options) {
- final boolean isGmsCoreSupported =
- GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
- ContextUtils.getApplicationContext())
- == ConnectionResult.SUCCESS;
+ final boolean isGmsCoreSupported = false;
if (isGmsCoreSupported) {
FaceDetection.MANAGER.bind(new FaceDetectionImplGmsCore(options), request);
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
--- a/third_party/android_deps/BUILD.gn
+++ b/third_party/android_deps/BUILD.gn
@@ -25,21 +25,6 @@ java_group("android_support_v7_appcompat_java") {
}
# Aliases
-java_group("google_play_services_basement_java") {
- deps = [
- ":com_google_android_gms_play_services_basement_java",
- ]
-}
-java_group("google_play_services_tasks_java") {
- deps = [
- ":com_google_android_gms_play_services_tasks_java",
- ]
-}
-java_group("google_play_services_base_java") {
- deps = [
- ":com_google_android_gms_play_services_base_java",
- ]
-}
# The dependencies below are used by chromecast internal.
java_group("android_support_v7_preference_java") {
@@ -318,44 +303,6 @@ android_aar_prebuilt("com_android_support_support_v4_java") {
]
}
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_base_java") {
- aar_path = "libs/com_google_android_gms_play_services_base/play-services-base-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_base/com_google_android_gms_play_services_base.info"
- deps = [
- ":com_google_android_gms_play_services_basement_java",
- ":com_google_android_gms_play_services_tasks_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_basement_java") {
- aar_path = "libs/com_google_android_gms_play_services_basement/play-services-basement-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_basement/com_google_android_gms_play_services_basement.info"
- deps = [
- ":com_android_support_support_v4_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
- input_jars_paths = [ "$android_sdk/optional/org.apache.http.legacy.jar" ]
-}
-
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_tasks_java") {
- aar_path = "libs/com_google_android_gms_play_services_tasks/play-services-tasks-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_tasks/com_google_android_gms_play_services_tasks.info"
- deps = [
- ":com_google_android_gms_play_services_basement_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
android_aar_prebuilt("com_google_ar_core_java") {
aar_path = "libs/com_google_ar_core/core-1.8.0.aar"
diff --git a/third_party/cacheinvalidation/BUILD.gn b/third_party/cacheinvalidation/BUILD.gn
--- a/third_party/cacheinvalidation/BUILD.gn
+++ b/third_party/cacheinvalidation/BUILD.gn
@@ -137,7 +137,6 @@ if (is_android) {
emma_never_instrument = true
deps = [
":cacheinvalidation_proto_java",
- "$google_play_services_package:google_play_services_tasks_java",
"//third_party/android_protobuf:protobuf_nano_javalib",
]
diff --git a/third_party/robolectric/BUILD.gn b/third_party/robolectric/BUILD.gn
--- a/third_party/robolectric/BUILD.gn
+++ b/third_party/robolectric/BUILD.gn
@@ -944,8 +944,6 @@ java_library("shadows_play_services_java") {
":robolectric_shadowapi_java",
":robolectric_utils_java",
":shadows_core_java",
- "$google_play_services_package:google_play_services_base_java",
- "$google_play_services_package:google_play_services_basement_java",
"//third_party/android_deps:android_support_v4_java",
"//third_party/gson:gson_java",
"//third_party/guava:guava_java",

+ 582
- 0
patches/ungoogled-chromium-android/remove-gms-fido-iid-instantapps-location.patch View File

@ -0,0 +1,582 @@
Remove dependency on com.google.android.gms.fido, com.google.android.gms.iid, com.google.android.gms.instantapps, com.google.android.gms.location (play-services-fido-15.0.1.aar, play-services-iid-15.0.1.aar, play-services-instantapps-16.0.0.aar, play-services-location-15.0.1.aar).
author: Wengling Chen <[email protected]>
---
chrome/android/BUILD.gn | 5 -
.../externalnav/ExternalNavigationHandler.java | 3 -
.../browser/instantapps/InstantAppsHandler.java | 59 +-----------
components/gcm_driver/instance_id/android/BUILD.gn | 2 -
.../instance_id/InstanceIDWithSubtype.java | 28 +-----
device/BUILD.gn | 1 -
services/device/geolocation/BUILD.gn | 1 -
.../geolocation/LocationProviderGmsCore.java | 103 +--------------------
third_party/android_deps/BUILD.gn | 78 ----------------
third_party/cacheinvalidation/BUILD.gn | 1 -
.../client/android2/AndroidManifestUpdatedGcm.xml | 3 -
11 files changed, 9 insertions(+), 275 deletions(-)
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -251,8 +251,6 @@ android_library("chrome_java") {
":usage_stats_proto_java",
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_fido_java",
- "$google_play_services_package:google_play_services_iid_java",
"$google_play_services_package:google_play_services_tasks_java",
"//base:base_java",
"//base:jni_java",
@@ -615,7 +613,6 @@ junit_binary("chrome_junit_tests") {
":partner_location_descriptor_proto_java",
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_fido_java",
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
@@ -711,8 +708,6 @@ android_library("chrome_test_java") {
":partner_location_descriptor_proto_java",
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_fido_java",
- "$google_play_services_package:google_play_services_iid_java",
"$google_play_services_package:google_play_services_tasks_java",
"//base:base_java",
"//base:base_java_test_support",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
@@ -572,7 +572,6 @@ public class ExternalNavigationHandler {
if (shouldProxyForInstantApps) {
RecordHistogram.recordEnumeratedHistogram("Android.InstantApps.DirectInstantAppsIntent",
AiaIntent.SERP, AiaIntent.NUM_ENTRIES);
- intent.putExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER, true);
} else if (isDirectInstantAppsIntent) {
// For security reasons, we disable all intent:// URLs to Instant Apps that are
// not coming from SERP.
@@ -581,8 +580,6 @@ public class ExternalNavigationHandler {
AiaIntent.OTHER, AiaIntent.NUM_ENTRIES);
return OverrideUrlLoadingResult.NO_OVERRIDE;
} else {
- // Make sure this extra is not sent unless we've done the verification.
- intent.removeExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER);
}
boolean deviceCanHandleIntent = deviceCanHandleIntent(intent);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java
@@ -42,36 +42,6 @@ public class InstantAppsHandler {
// TODO(mariakhomenko): Use system once we roll to O SDK.
private static final int FLAG_DO_NOT_LAUNCH = 0x00000200;
- // TODO(mariakhomenko): Depend directly on the constants once we roll to v8 libraries.
- private static final String DO_NOT_LAUNCH_EXTRA =
- "com.google.android.gms.instantapps.DO_NOT_LAUNCH_INSTANT_APP";
-
- protected static final String IS_REFERRER_TRUSTED_EXTRA =
- "com.google.android.gms.instantapps.IS_REFERRER_TRUSTED";
-
- protected static final String IS_USER_CONFIRMED_LAUNCH_EXTRA =
- "com.google.android.gms.instantapps.IS_USER_CONFIRMED_LAUNCH";
-
- protected static final String TRUSTED_REFERRER_PKG_EXTRA =
- "com.google.android.gms.instantapps.TRUSTED_REFERRER_PKG";
-
- public static final String IS_GOOGLE_SEARCH_REFERRER =
- "com.google.android.gms.instantapps.IS_GOOGLE_SEARCH_REFERRER";
-
- private static final String BROWSER_LAUNCH_REASON =
- "com.google.android.gms.instantapps.BROWSER_LAUNCH_REASON";
-
- private static final String SUPERVISOR_PKG = "com.google.android.instantapps.supervisor";
-
- private static final String[] SUPERVISOR_START_ACTIONS = {
- "com.google.android.instantapps.START", "com.google.android.instantapps.nmr1.INSTALL",
- "com.google.android.instantapps.nmr1.VIEW"};
-
- // Instant Apps system resolver activity on N-MR1+.
- @VisibleForTesting
- public static final String EPHEMERAL_INSTALLER_CLASS =
- "com.google.android.gms.instantapps.routing.EphemeralInstallerActivity";
-
/** Finch experiment name. */
private static final String INSTANT_APPS_EXPERIMENT_NAME = "InstantApps";
@@ -123,14 +93,6 @@ public class InstantAppsHandler {
* @return Whether the given intent is going to open an Instant App.
*/
public static boolean isIntentToInstantApp(Intent intent) {
- if (SUPERVISOR_PKG.equals(intent.getPackage())) return true;
-
- String intentAction = intent.getAction();
- for (String action : SUPERVISOR_START_ACTIONS) {
- if (action.equals(intentAction)) {
- return true;
- }
- }
return false;
}
@@ -167,13 +129,7 @@ public class InstantAppsHandler {
sFallbackIntentTimes.record(SystemClock.elapsedRealtime() - startTime);
intent.removeExtra(INSTANT_APP_START_TIME_EXTRA);
}
- int callSource = IntentUtils.safeGetIntExtra(intent, BROWSER_LAUNCH_REASON, 0);
- if (callSource > 0 && callSource < SOURCE_BOUNDARY) {
- sFallbackCallSource.record(callSource);
- intent.removeExtra(BROWSER_LAUNCH_REASON);
- } else if (callSource >= SOURCE_BOUNDARY) {
- Log.e(TAG, "Unexpected call source constant for Instant Apps: " + callSource);
- }
+ Log.e(TAG, "Unexpected call source constant for Instant Apps");
}
/**
@@ -208,14 +164,6 @@ public class InstantAppsHandler {
return false;
}
- if (IntentUtils.safeGetBooleanExtra(intent, DO_NOT_LAUNCH_EXTRA, false)
- || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
- && (intent.getFlags() & FLAG_DO_NOT_LAUNCH) != 0)) {
- maybeRecordFallbackStats(intent);
- Log.i(TAG, "Not handling with Instant Apps (DO_NOT_LAUNCH_EXTRA)");
- return false;
- }
-
if (IntentUtils.safeGetBooleanExtra(
intent, IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, false)
|| IntentUtils.safeHasExtra(intent, ShortcutHelper.EXTRA_SOURCE)
@@ -240,7 +188,6 @@ public class InstantAppsHandler {
}
Intent callbackIntent = new Intent(intent);
- callbackIntent.putExtra(DO_NOT_LAUNCH_EXTRA, true);
callbackIntent.putExtra(INSTANT_APP_START_TIME_EXTRA, startTime);
return tryLaunchingInstantApp(context, intent, isCustomTabsIntent, callbackIntent);
@@ -343,12 +290,9 @@ public class InstantAppsHandler {
Intent iaIntent = data.getIntent();
if (data.getReferrer() != null) {
iaIntent.putExtra(Intent.EXTRA_REFERRER, data.getReferrer());
- iaIntent.putExtra(IS_REFERRER_TRUSTED_EXTRA, true);
}
Context appContext = ContextUtils.getApplicationContext();
- iaIntent.putExtra(TRUSTED_REFERRER_PKG_EXTRA, appContext.getPackageName());
- iaIntent.putExtra(IS_USER_CONFIRMED_LAUNCH_EXTRA, true);
try {
appContext.startActivity(iaIntent);
@@ -394,7 +338,6 @@ public class InstantAppsHandler {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return info.isInstantAppAvailable;
} else if (info.activityInfo != null) {
- return EPHEMERAL_INSTALLER_CLASS.equals(info.activityInfo.name);
}
return false;
diff --git a/components/gcm_driver/instance_id/android/BUILD.gn b/components/gcm_driver/instance_id/android/BUILD.gn
--- a/components/gcm_driver/instance_id/android/BUILD.gn
+++ b/components/gcm_driver/instance_id/android/BUILD.gn
@@ -20,7 +20,6 @@ generate_jni("test_support_jni_headers") {
android_library("instance_id_driver_java") {
deps = [
- "$google_play_services_package:google_play_services_iid_java",
"//base:base_java",
"//components/gcm_driver/android:gcm_driver_java",
]
@@ -34,7 +33,6 @@ android_library("instance_id_driver_java") {
android_library("instance_id_driver_test_support_java") {
deps = [
":instance_id_driver_java",
- "$google_play_services_package:google_play_services_iid_java",
"//base:base_java",
]
diff --git a/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDWithSubtype.java b/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDWithSubtype.java
--- a/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDWithSubtype.java
+++ b/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDWithSubtype.java
@@ -8,8 +8,6 @@ import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
-import com.google.android.gms.iid.InstanceID;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.VisibleForTesting;
@@ -25,8 +23,6 @@ public class InstanceIDWithSubtype {
// Must match the private InstanceID.OPTION_SUBTYPE, which is guaranteed to not change.
private static final String OPTION_SUBTYPE = "subtype";
- private final InstanceID mInstanceID;
-
/**
* Cached instances. May be accessed from multiple threads; synchronize on sSubtypeInstancesLock
*/
@@ -38,10 +34,6 @@ public class InstanceIDWithSubtype {
@VisibleForTesting
protected static FakeFactory sFakeFactoryForTesting;
- protected InstanceIDWithSubtype(InstanceID instanceID) {
- mInstanceID = instanceID;
- }
-
/**
* Returns an instance of this class. Unlike {@link InstanceID#getInstance(Context)}, it is not
* a singleton, but instead a different instance will be returned for each {@code subtype}.
@@ -57,11 +49,6 @@ public class InstanceIDWithSubtype {
if (sFakeFactoryForTesting != null) {
existing = sFakeFactoryForTesting.create(subtype);
} else {
- Bundle options = new Bundle();
- options.putCharSequence(OPTION_SUBTYPE, subtype);
- InstanceID instanceID =
- InstanceID.getInstance(ContextUtils.getApplicationContext(), options);
- existing = new InstanceIDWithSubtype(instanceID);
}
sSubtypeInstances.put(subtype, existing);
}
@@ -70,35 +57,30 @@ public class InstanceIDWithSubtype {
}
public String getSubtype() {
- return mInstanceID.getSubtype();
+ return "";
}
public String getId() {
- return mInstanceID.getId();
+ return "";
}
public long getCreationTime() {
- return mInstanceID.getCreationTime();
+ return 0;
}
public void deleteInstanceID() throws IOException {
- synchronized (sSubtypeInstancesLock) {
- sSubtypeInstances.remove(mInstanceID.getSubtype());
- mInstanceID.deleteInstanceID();
- }
}
public void deleteToken(String authorizedEntity, String scope) throws IOException {
- mInstanceID.deleteToken(authorizedEntity, scope);
}
public String getToken(String authorizedEntity, String scope) throws IOException {
- return mInstanceID.getToken(authorizedEntity, scope);
+ return "";
}
public String getToken(String authorizedEntity, String scope, Bundle extras)
throws IOException {
- return mInstanceID.getToken(authorizedEntity, scope, extras);
+ return "";
}
/** Fake subclasses can set {@link #sFakeFactoryForTesting} to an implementation of this. */
diff --git a/device/BUILD.gn b/device/BUILD.gn
--- a/device/BUILD.gn
+++ b/device/BUILD.gn
@@ -432,7 +432,6 @@ if (is_android) {
deps = [
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_location_java",
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
diff --git a/services/device/geolocation/BUILD.gn b/services/device/geolocation/BUILD.gn
--- a/services/device/geolocation/BUILD.gn
+++ b/services/device/geolocation/BUILD.gn
@@ -145,7 +145,6 @@ if (is_android) {
":geolocation_jni_headers",
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_location_java",
"//base:base_java",
"//components/location/android:location_java",
"//services/device/public/java:geolocation_java",
diff --git a/services/device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java b/services/device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java
--- a/services/device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java
+++ b/services/device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java
@@ -8,16 +8,6 @@ import android.content.Context;
import android.location.Location;
import android.os.Bundle;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
-import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
-import com.google.android.gms.location.FusedLocationProviderApi;
-import com.google.android.gms.location.LocationListener;
-import com.google.android.gms.location.LocationRequest;
-import com.google.android.gms.location.LocationServices;
-
import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.components.location.LocationUtils;
@@ -27,126 +17,39 @@ import org.chromium.components.location.LocationUtils;
*
* https://developers.9oo91e.qjz9zk/android/reference/com/google/android/gms/location/package-summary
*/
-public class LocationProviderGmsCore implements ConnectionCallbacks, OnConnectionFailedListener,
- LocationListener, LocationProvider {
+public class LocationProviderGmsCore implements LocationProvider {
private static final String TAG = "cr_LocationProvider";
// Values for the LocationRequest's setInterval for normal and high accuracy, respectively.
private static final long UPDATE_INTERVAL_MS = 1000;
private static final long UPDATE_INTERVAL_FAST_MS = 500;
- private final GoogleApiClient mGoogleApiClient;
- private FusedLocationProviderApi mLocationProviderApi = LocationServices.FusedLocationApi;
-
private boolean mEnablehighAccuracy;
- private LocationRequest mLocationRequest;
public static boolean isGooglePlayServicesAvailable(Context context) {
- return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)
- == ConnectionResult.SUCCESS;
+ return false;
}
LocationProviderGmsCore(Context context) {
Log.i(TAG, "Google Play Services");
- mGoogleApiClient = new GoogleApiClient.Builder(context)
- .addApi(LocationServices.API)
- .addConnectionCallbacks(this)
- .addOnConnectionFailedListener(this)
- .build();
- assert mGoogleApiClient != null;
- }
-
- LocationProviderGmsCore(GoogleApiClient client, FusedLocationProviderApi locationApi) {
- mGoogleApiClient = client;
- mLocationProviderApi = locationApi;
- }
-
- // ConnectionCallbacks implementation
- @Override
- public void onConnected(Bundle connectionHint) {
- ThreadUtils.assertOnUiThread();
-
- mLocationRequest = LocationRequest.create();
- if (mEnablehighAccuracy) {
- // With enableHighAccuracy, request a faster update interval and configure the provider
- // for high accuracy mode.
- mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
- .setInterval(UPDATE_INTERVAL_FAST_MS);
- } else {
- // Use balanced mode by default. In this mode, the API will prefer the network provider
- // but may use sensor data (for instance, GPS) if high accuracy is requested by another
- // app.
- //
- // If location is configured for sensors-only then elevate the priority to ensure GPS
- // and other sensors are used.
- if (LocationUtils.getInstance().isSystemLocationSettingSensorsOnly()) {
- mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
- } else {
- mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
- }
- mLocationRequest.setInterval(UPDATE_INTERVAL_MS);
- }
-
- final Location location = mLocationProviderApi.getLastLocation(mGoogleApiClient);
- if (location != null) {
- LocationProviderAdapter.onNewLocationAvailable(location);
- }
-
- try {
- // Request updates on UI Thread replicating LocationProviderAndroid's behaviour.
- mLocationProviderApi.requestLocationUpdates(
- mGoogleApiClient, mLocationRequest, this, ThreadUtils.getUiThreadLooper());
- } catch (IllegalStateException | SecurityException e) {
- // IllegalStateException is thrown "If this method is executed in a thread that has not
- // called Looper.prepare()". SecurityException is thrown if there is no permission, see
- // https://crbug.com/731271.
- Log.e(TAG, " mLocationProviderApi.requestLocationUpdates() " + e);
- LocationProviderAdapter.newErrorAvailable(
- "Failed to request location updates: " + e.toString());
- assert false;
- }
- }
-
- @Override
- public void onConnectionSuspended(int cause) {}
-
- // OnConnectionFailedListener implementation
- @Override
- public void onConnectionFailed(ConnectionResult result) {
- LocationProviderAdapter.newErrorAvailable(
- "Failed to connect to Google Play Services: " + result.toString());
}
// LocationProvider implementation
@Override
public void start(boolean enableHighAccuracy) {
ThreadUtils.assertOnUiThread();
- if (mGoogleApiClient.isConnected()) mGoogleApiClient.disconnect();
mEnablehighAccuracy = enableHighAccuracy;
- mGoogleApiClient.connect(); // Should return via onConnected().
}
@Override
public void stop() {
ThreadUtils.assertOnUiThread();
- if (!mGoogleApiClient.isConnected()) return;
-
- mLocationProviderApi.removeLocationUpdates(mGoogleApiClient, this);
-
- mGoogleApiClient.disconnect();
}
@Override
public boolean isRunning() {
assert ThreadUtils.runningOnUiThread();
- if (mGoogleApiClient == null) return false;
- return mGoogleApiClient.isConnecting() || mGoogleApiClient.isConnected();
- }
-
- // LocationListener implementation
- @Override
- public void onLocationChanged(Location location) {
- LocationProviderAdapter.onNewLocationAvailable(location);
+ return false;
}
}
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
--- a/third_party/android_deps/BUILD.gn
+++ b/third_party/android_deps/BUILD.gn
@@ -40,21 +40,6 @@ java_group("google_play_services_base_java") {
":com_google_android_gms_play_services_base_java",
]
}
-java_group("google_play_services_iid_java") {
- deps = [
- ":com_google_android_gms_play_services_iid_java",
- ]
-}
-java_group("google_play_services_instantapps_java") {
- deps = [
- ":com_google_android_gms_play_services_instantapps_java",
- ]
-}
-java_group("google_play_services_location_java") {
- deps = [
- ":com_google_android_gms_play_services_location_java",
- ]
-}
java_group("google_play_services_vision_java") {
deps = [
":com_google_android_gms_play_services_vision_java",
@@ -65,11 +50,6 @@ java_group("google_play_services_vision_common_java") {
":com_google_android_gms_play_services_vision_common_java",
]
}
-java_group("google_play_services_fido_java") {
- deps = [
- ":com_google_android_gms_play_services_fido_java",
- ]
-}
# The dependencies below are used by chromecast internal.
java_group("android_support_v7_preference_java") {
@@ -374,64 +354,6 @@ android_aar_prebuilt("com_google_android_gms_play_services_basement_java") {
input_jars_paths = [ "$android_sdk/optional/org.apache.http.legacy.jar" ]
}
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_fido_java") {
- aar_path = "libs/com_google_android_gms_play_services_fido/play-services-fido-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_fido/com_google_android_gms_play_services_fido.info"
- deps = [
- ":com_google_android_gms_play_services_base_java",
- ":com_google_android_gms_play_services_basement_java",
- ":com_google_android_gms_play_services_tasks_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_iid_java") {
- aar_path = "libs/com_google_android_gms_play_services_iid/play-services-iid-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_iid/com_google_android_gms_play_services_iid.info"
- deps = [
- ":com_google_android_gms_play_services_base_java",
- ":com_google_android_gms_play_services_basement_java",
- ":com_google_android_gms_play_services_stats_java",
- ":com_google_android_gms_play_services_tasks_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_instantapps_java") {
- aar_path = "libs/com_google_android_gms_play_services_instantapps/play-services-instantapps-16.0.0.aar"
- info_path = "libs/com_google_android_gms_play_services_instantapps/com_google_android_gms_play_services_instantapps.info"
- deps = [
- ":com_google_android_gms_play_services_base_java",
- ":com_google_android_gms_play_services_basement_java",
- ":com_google_android_gms_play_services_tasks_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_location_java") {
- aar_path = "libs/com_google_android_gms_play_services_location/play-services-location-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_location/com_google_android_gms_play_services_location.info"
- deps = [
- ":com_google_android_gms_play_services_base_java",
- ":com_google_android_gms_play_services_basement_java",
- ":com_google_android_gms_play_services_places_placereport_java",
- ":com_google_android_gms_play_services_tasks_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
android_aar_prebuilt("com_google_android_gms_play_services_tasks_java") {
aar_path = "libs/com_google_android_gms_play_services_tasks/play-services-tasks-15.0.1.aar"
diff --git a/third_party/cacheinvalidation/BUILD.gn b/third_party/cacheinvalidation/BUILD.gn
--- a/third_party/cacheinvalidation/BUILD.gn
+++ b/third_party/cacheinvalidation/BUILD.gn
@@ -137,7 +137,6 @@ if (is_android) {
emma_never_instrument = true
deps = [
":cacheinvalidation_proto_java",
- "$google_play_services_package:google_play_services_iid_java",
"$google_play_services_package:google_play_services_tasks_java",
"//third_party/android_protobuf:protobuf_nano_javalib",
]
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
@@ -27,9 +27,6 @@
<!-- InstanceID Listener Service -->
<service android:exported="false"
android:name="com.google.ipc.invalidation.ticl2.android2.channel.AndroidInstanceIDListenerService">
- <intent-filter>
- <action android:name="com.google.android.gms.iid.InstanceID"/>
- </intent-filter>
</service>
</application>
</manifest>

+ 67
- 0
patches/ungoogled-chromium-android/remove-gms-flags-places-stats.patch View File

@ -0,0 +1,67 @@
Remove dependency on com.google.android.gms.flags, com.google.android.gms.location.places, com.google.android.gms.stats (play-services-flags-15.0.1.aar, play-services-places-placereport-15.0.1.aar, play-services-stats-15.0.1.aar).
author: Wengling Chen <[email protected]>
---
third_party/android_deps/BUILD.gn | 50 ---------------------------------------
1 file changed, 50 deletions(-)
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
--- a/third_party/android_deps/BUILD.gn
+++ b/third_party/android_deps/BUILD.gn
@@ -591,56 +591,6 @@ android_aar_prebuilt("com_android_support_transition_java") {
deps += [ ":com_android_support_support_fragment_java" ]
}
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_flags_java") {
- aar_path = "libs/com_google_android_gms_play_services_flags/play-services-flags-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_flags/com_google_android_gms_play_services_flags.info"
-
- # To remove visibility constraint, add this dependency to
- # //tools/android/roll/android_deps/build.gradle.
- visibility = [ ":*" ]
- deps = [
- ":com_google_android_gms_play_services_base_java",
- ":com_google_android_gms_play_services_basement_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt(
- "com_google_android_gms_play_services_places_placereport_java") {
- aar_path = "libs/com_google_android_gms_play_services_places_placereport/play-services-places-placereport-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_places_placereport/com_google_android_gms_play_services_places_placereport.info"
-
- # To remove visibility constraint, add this dependency to
- # //tools/android/roll/android_deps/build.gradle.
- visibility = [ ":*" ]
- deps = [
- ":com_google_android_gms_play_services_basement_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("com_google_android_gms_play_services_stats_java") {
- aar_path = "libs/com_google_android_gms_play_services_stats/play-services-stats-15.0.1.aar"
- info_path = "libs/com_google_android_gms_play_services_stats/com_google_android_gms_play_services_stats.info"
-
- # To remove visibility constraint, add this dependency to
- # //tools/android/roll/android_deps/build.gradle.
- visibility = [ ":*" ]
- deps = [
- ":com_google_android_gms_play_services_basement_java",
- ]
-
- # Removing drawables from GMS .aars as they are unused bloat.
- strip_drawables = true
-}
-
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
java_prebuilt("com_google_code_findbugs_jsr305_java") {
jar_path = "libs/com_google_code_findbugs_jsr305/jsr305-1.3.9.jar"

+ 580
- 0
patches/ungoogled-chromium-android/remove-gms-vision-clearcut-phenotype.patch View File

@ -0,0 +1,580 @@
Remove dependency on com.google.android.gms.vision, com.google.android.gms.clearcut, com.google.android.gms.phenotype (play-services-vision-15.0.1.aar, play-services-vision-common-15.0.1.aar, play-services-clearcut-15.0.1.aar, play-services-phenotype-15.0.1.aar).
author: Wengling Chen <[email protected]>
---
services/BUILD.gn | 4 -
services/shape_detection/BUILD.gn | 2 -
.../shape_detection/BarcodeDetectionImpl.java | 82 +-------------
.../BarcodeDetectionProviderImpl.java | 16 +--
.../org/chromium/shape_detection/BitmapUtils.java | 12 --
.../shape_detection/FaceDetectionImplGmsCore.java | 122 +--------------------
.../shape_detection/TextDetectionImpl.java | 59 +---------
third_party/android_deps/BUILD.gn | 77 -------------
8 files changed, 8 insertions(+), 366 deletions(-)
diff --git a/services/BUILD.gn b/services/BUILD.gn
--- a/services/BUILD.gn
+++ b/services/BUILD.gn
@@ -102,8 +102,6 @@ if (is_android) {
deps = [
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_vision_common_java",
- "$google_play_services_package:google_play_services_vision_java",
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
@@ -133,8 +131,6 @@ if (is_android) {
deps = [
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_vision_common_java",
- "$google_play_services_package:google_play_services_vision_java",
"//base:base_java",
"//base:base_java_test_support",
"//mojo/public/java:base_java",
diff --git a/services/shape_detection/BUILD.gn b/services/shape_detection/BUILD.gn
--- a/services/shape_detection/BUILD.gn
+++ b/services/shape_detection/BUILD.gn
@@ -99,8 +99,6 @@ if (is_android) {
deps = [
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
- "$google_play_services_package:google_play_services_vision_common_java",
- "$google_play_services_package:google_play_services_vision_java",
"//base:base_java",
"//mojo/public/java:base_java",
"//mojo/public/java:bindings_java",
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
@@ -8,10 +8,6 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.util.SparseArray;
-import com.google.android.gms.vision.Frame;
-import com.google.android.gms.vision.barcode.Barcode;
-import com.google.android.gms.vision.barcode.BarcodeDetector;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.gfx.mojom.PointF;
@@ -28,63 +24,17 @@ import org.chromium.shape_detection.mojom.BarcodeFormat;
public class BarcodeDetectionImpl implements BarcodeDetection {
private static final String TAG = "BarcodeDetectionImpl";
- private BarcodeDetector mBarcodeDetector;
-
public BarcodeDetectionImpl(BarcodeDetectorOptions options) {
- // TODO(mcasas): extract the barcode formats to hunt for out of
- // |options| and use them for building |mBarcodeDetector|.
- // https://crbug.com/582266.
- mBarcodeDetector =
- new BarcodeDetector.Builder(ContextUtils.getApplicationContext()).build();
}
@Override
public void detect(org.chromium.skia.mojom.Bitmap bitmapData, DetectResponse callback) {
- // The vision library will be downloaded the first time the API is used
- // on the device; this happens "fast", but it might have not completed,
- // bail in this case. Also, the API was disabled between and v.9.0 and
- // v.9.2, see https://developers.9oo91e.qjz9zk/android/guides/releases.
- if (!mBarcodeDetector.isOperational()) {
- Log.e(TAG, "BarcodeDetector is not operational");
- callback.call(new BarcodeDetectionResult[0]);
- return;
- }
-
- Frame frame = BitmapUtils.convertToFrame(bitmapData);
- if (frame == null) {
- Log.e(TAG, "Error converting Mojom Bitmap to Frame");
- callback.call(new BarcodeDetectionResult[0]);
- return;
- }
-
- final SparseArray<Barcode> barcodes = mBarcodeDetector.detect(frame);
-
- BarcodeDetectionResult[] barcodeArray = new BarcodeDetectionResult[barcodes.size()];
- for (int i = 0; i < barcodes.size(); i++) {
- barcodeArray[i] = new BarcodeDetectionResult();
- final Barcode barcode = barcodes.valueAt(i);
- barcodeArray[i].rawValue = barcode.rawValue;
- final Rect rect = barcode.getBoundingBox();
- barcodeArray[i].boundingBox = new RectF();
- barcodeArray[i].boundingBox.x = rect.left;
- barcodeArray[i].boundingBox.y = rect.top;
- barcodeArray[i].boundingBox.width = rect.width();
- barcodeArray[i].boundingBox.height = rect.height();
- final Point[] corners = barcode.cornerPoints;
- barcodeArray[i].cornerPoints = new PointF[corners.length];
- for (int j = 0; j < corners.length; j++) {
- barcodeArray[i].cornerPoints[j] = new PointF();
- barcodeArray[i].cornerPoints[j].x = corners[j].x;
- barcodeArray[i].cornerPoints[j].y = corners[j].y;
- }
- barcodeArray[i].format = toBarcodeFormat(barcode.format);
- }
- callback.call(barcodeArray);
+ Log.e(TAG, "BarcodeDetector is not operational");
+ callback.call(new BarcodeDetectionResult[0]);
}
@Override
public void close() {
- mBarcodeDetector.release();
}
@Override
@@ -93,34 +43,6 @@ public class BarcodeDetectionImpl implements BarcodeDetection {
}
private int toBarcodeFormat(int format) {
- switch (format) {
- case Barcode.CODE_128:
- return BarcodeFormat.CODE_128;
- case Barcode.CODE_39:
- return BarcodeFormat.CODE_39;
- case Barcode.CODE_93:
- return BarcodeFormat.CODE_93;
- case Barcode.CODABAR:
- return BarcodeFormat.CODABAR;
- case Barcode.DATA_MATRIX:
- return BarcodeFormat.DATA_MATRIX;
- case Barcode.EAN_13:
- return BarcodeFormat.EAN_13;
- case Barcode.EAN_8:
- return BarcodeFormat.CODE_128;
- case Barcode.ITF:
- return BarcodeFormat.EAN_8;
- case Barcode.QR_CODE:
- return BarcodeFormat.QR_CODE;
- case Barcode.UPC_A:
- return BarcodeFormat.UPC_A;
- case Barcode.UPC_E:
- return BarcodeFormat.UPC_E;
- case Barcode.PDF417:
- return BarcodeFormat.PDF417;
- case Barcode.AZTEC:
- return BarcodeFormat.AZTEC;
- }
return BarcodeFormat.UNKNOWN;
}
}
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
@@ -4,10 +4,6 @@
package org.chromium.shape_detection;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-import com.google.android.gms.vision.barcode.Barcode;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.mojo.bindings.InterfaceRequest;
@@ -33,10 +29,6 @@ public class BarcodeDetectionProviderImpl implements BarcodeDetectionProvider {
@Override
public void enumerateSupportedFormats(EnumerateSupportedFormatsResponse callback) {
- int[] supportedFormats = {Barcode.AZTEC, Barcode.CODE_128, Barcode.CODE_39, Barcode.CODE_93,
- Barcode.CODABAR, Barcode.DATA_MATRIX, Barcode.EAN_13, Barcode.EAN_8, Barcode.ITF,
- Barcode.PDF417, Barcode.QR_CODE, Barcode.UPC_A, Barcode.UPC_E};
- callback.call(supportedFormats);
}
@Override
@@ -53,13 +45,7 @@ public class BarcodeDetectionProviderImpl implements BarcodeDetectionProvider {
@Override
public BarcodeDetectionProvider createImpl() {
- if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
- ContextUtils.getApplicationContext())
- != ConnectionResult.SUCCESS) {
- Log.e(TAG, "Google Play Services not available");
- return null;
- }
- return new BarcodeDetectionProviderImpl();
+ return null;
}
}
}
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/BitmapUtils.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/BitmapUtils.java
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BitmapUtils.java
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BitmapUtils.java
@@ -6,8 +6,6 @@ package org.chromium.shape_detection;
import android.graphics.Bitmap;
-import com.google.android.gms.vision.Frame;
-
import org.chromium.mojo_base.BigBufferUtil;
import org.chromium.skia.mojom.ColorType;
@@ -44,14 +42,4 @@ public class BitmapUtils {
return bitmap;
}
-
- public static Frame convertToFrame(org.chromium.skia.mojom.Bitmap bitmapData) {
- Bitmap bitmap = convertToBitmap(bitmapData);
- if (bitmap == null) {
- return null;
- }
-
- // This constructor implies a pixel format conversion to YUV.
- return new Frame.Builder().setBitmap(bitmap).build();
- }
}
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java
@@ -7,11 +7,6 @@ package org.chromium.shape_detection;
import android.graphics.PointF;
import android.util.SparseArray;
-import com.google.android.gms.vision.Frame;
-import com.google.android.gms.vision.face.Face;
-import com.google.android.gms.vision.face.FaceDetector;
-import com.google.android.gms.vision.face.Landmark;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.gfx.mojom.RectF;
@@ -36,133 +31,20 @@ public class FaceDetectionImplGmsCore implements FaceDetection {
private static final int MAX_EULER_Z = 15;
private final int mMaxFaces;
private final boolean mFastMode;
- private final FaceDetector mFaceDetector;
FaceDetectionImplGmsCore(FaceDetectorOptions options) {
- FaceDetector.Builder builder =
- new FaceDetector.Builder(ContextUtils.getApplicationContext());
mMaxFaces = Math.min(options.maxDetectedFaces, MAX_FACES);
mFastMode = options.fastMode;
-
- try {
- builder.setMode(mFastMode ? FaceDetector.FAST_MODE : FaceDetector.ACCURATE_MODE);
- builder.setLandmarkType(FaceDetector.ALL_LANDMARKS);
- if (mMaxFaces == 1) {
- builder.setProminentFaceOnly(true);
- }
- } catch (IllegalArgumentException e) {
- Log.e(TAG, "Unexpected exception " + e);
- assert false;
- }
-
- mFaceDetector = builder.build();
}
@Override
public void detect(org.chromium.skia.mojom.Bitmap bitmapData, DetectResponse callback) {
- // The vision library will be downloaded the first time the API is used
- // on the device; this happens "fast", but it might have not completed,
- // bail in this case.
- if (!mFaceDetector.isOperational()) {
- Log.e(TAG, "FaceDetector is not operational");
-
- // Fallback to Android's FaceDetectionImpl.
- FaceDetectorOptions options = new FaceDetectorOptions();
- options.fastMode = mFastMode;
- options.maxDetectedFaces = mMaxFaces;
- FaceDetectionImpl detector = new FaceDetectionImpl(options);
- detector.detect(bitmapData, callback);
- return;
- }
-
- Frame frame = BitmapUtils.convertToFrame(bitmapData);
- if (frame == null) {
- Log.e(TAG, "Error converting Mojom Bitmap to Frame");
- callback.call(new FaceDetectionResult[0]);
- return;
- }
-
- final SparseArray<Face> faces = mFaceDetector.detect(frame);
-
- FaceDetectionResult[] faceArray = new FaceDetectionResult[faces.size()];
- for (int i = 0; i < faces.size(); i++) {
- faceArray[i] = new FaceDetectionResult();
- final Face face = faces.valueAt(i);
-
- final List<Landmark> landmarks = face.getLandmarks();
- ArrayList<org.chromium.shape_detection.mojom.Landmark> mojoLandmarks =
- new ArrayList<org.chromium.shape_detection.mojom.Landmark>(landmarks.size());
-
- int leftEyeIndex = -1;
- int rightEyeIndex = -1;
- int bottomMouthIndex = -1;
- for (int j = 0; j < landmarks.size(); j++) {
- final Landmark landmark = landmarks.get(j);
- final int landmarkType = landmark.getType();
- if (landmarkType != Landmark.LEFT_EYE && landmarkType != Landmark.RIGHT_EYE
- && landmarkType != Landmark.BOTTOM_MOUTH
- && landmarkType != Landmark.NOSE_BASE) {
- continue;
- }
-
- org.chromium.shape_detection.mojom.Landmark mojoLandmark =
- new org.chromium.shape_detection.mojom.Landmark();
- mojoLandmark.locations = new org.chromium.gfx.mojom.PointF[1];
- mojoLandmark.locations[0] = new org.chromium.gfx.mojom.PointF();
- mojoLandmark.locations[0].x = landmark.getPosition().x;
- mojoLandmark.locations[0].y = landmark.getPosition().y;
-
- if (landmarkType == Landmark.LEFT_EYE) {
- mojoLandmark.type = LandmarkType.EYE;
- leftEyeIndex = j;
- } else if (landmarkType == Landmark.RIGHT_EYE) {
- mojoLandmark.type = LandmarkType.EYE;
- rightEyeIndex = j;
- } else if (landmarkType == Landmark.BOTTOM_MOUTH) {
- mojoLandmark.type = LandmarkType.MOUTH;
- bottomMouthIndex = j;
- } else {
- assert landmarkType == Landmark.NOSE_BASE;
- mojoLandmark.type = LandmarkType.NOSE;
- }
- mojoLandmarks.add(mojoLandmark);
- }
- faceArray[i].landmarks = mojoLandmarks.toArray(
- new org.chromium.shape_detection.mojom.Landmark[mojoLandmarks.size()]);
-
- final PointF corner = face.getPosition();
- faceArray[i].boundingBox = new RectF();
- if (leftEyeIndex != -1 && rightEyeIndex != -1
- && Math.abs(face.getEulerZ()) < MAX_EULER_Z) {
- // Tighter calculation of the bounding box because the GMScore
- // and Android Face APIs give different results.
- final PointF leftEyePoint = landmarks.get(leftEyeIndex).getPosition();
- final PointF rightEyePoint = landmarks.get(rightEyeIndex).getPosition();
- final float eyesDistance = leftEyePoint.x - rightEyePoint.x;
- final float eyeMouthDistance = bottomMouthIndex != -1
- ? landmarks.get(bottomMouthIndex).getPosition().y - leftEyePoint.y
- : -1;
- final PointF midEyePoint =
- new PointF(corner.x + face.getWidth() / 2, leftEyePoint.y);
- faceArray[i].boundingBox.x = 2 * rightEyePoint.x - midEyePoint.x;
- faceArray[i].boundingBox.y = midEyePoint.y - eyesDistance;
- faceArray[i].boundingBox.width = 2 * eyesDistance;
- faceArray[i].boundingBox.height = eyeMouthDistance > eyesDistance
- ? eyeMouthDistance + eyesDistance
- : 2 * eyesDistance;
- } else {
- faceArray[i].boundingBox.x = corner.x;
- faceArray[i].boundingBox.y = corner.y;
- faceArray[i].boundingBox.width = face.getWidth();
- faceArray[i].boundingBox.height = face.getHeight();
- }
- }
- callback.call(faceArray);
+ Log.e(TAG, "FaceDetector is not operational");
+ callback.call(new FaceDetectionResult[0]);