Android build for ungoogled-chromium. https://uc.droidware.info
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

393 lines
17 KiB

From: Wengling Chen <[email protected]>
Date: Sat, 2 Nov 2019 09:22:31 +0100
Subject: Remove dependency on com.google.android.gms.auth
---
chrome/android/BUILD.gn | 1
components/background_task_scheduler/BUILD.gn | 1
components/signin/core/browser/android/BUILD.gn | 1
components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java | 34 -------
content/public/android/BUILD.gn | 1
content/public/android/java/src/org/chromium/content/browser/sms/SmsUserConsentReceiver.java | 45 ---------
content/public/android/java/src/org/chromium/content/browser/sms/SmsVerificationReceiver.java | 34 -------
content/public/android/java/src/org/chromium/content/browser/sms/Wrappers.java | 14 --
content/test/BUILD.gn | 1
third_party/android_deps/BUILD.gn | 47 ----------
third_party/robolectric/BUILD.gn | 1
11 files changed, 6 insertions(+), 174 deletions(-)
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -275,7 +275,6 @@ android_library("chrome_java") {
":partner_location_descriptor_proto_java",
":update_proto_java",
":usage_stats_proto_java",
- "$google_play_services_package:google_play_services_auth_base_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_cast_framework_java",
--- a/components/signin/core/browser/android/BUILD.gn
+++ b/components/signin/core/browser/android/BUILD.gn
@@ -14,7 +14,6 @@ generate_jni("jni_headers") {
android_library("java") {
deps = [
- "$google_play_services_package:google_play_services_auth_base_java",
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
"//base:base_java",
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
@@ -83,17 +83,7 @@ public class SystemAccountManagerDelegat
}
protected void checkCanUseGooglePlayServices() throws AccountManagerDelegateException {
- Context context = ContextUtils.getApplicationContext();
- final int resultCode =
- GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
- if (resultCode == ConnectionResult.SUCCESS) {
- return;
- }
-
- throw new GmsAvailabilityException(
- String.format("Can't use Google Play Services: %s",
- GoogleApiAvailability.getInstance().getErrorString(resultCode)),
- resultCode);
+ throw new GmsAvailabilityException("Can't use Google Play Services", 1);
}
@Override
@@ -127,15 +117,6 @@ public class SystemAccountManagerDelegat
@Override
public void invalidateAuthToken(String authToken) throws AuthException {
- try {
- GoogleAuthUtil.clearToken(ContextUtils.getApplicationContext(), authToken);
- } catch (GooglePlayServicesAvailabilityException ex) {
- throw new AuthException(AuthException.NONTRANSIENT, ex);
- } catch (GoogleAuthException ex) {
- throw new AuthException(AuthException.NONTRANSIENT, ex);
- } catch (IOException ex) {
- throw new AuthException(AuthException.TRANSIENT, ex);
- }
}
@Override
@@ -214,22 +195,13 @@ public class SystemAccountManagerDelegat
@Nullable
@Override
public String getAccountGaiaId(String accountEmail) {
- try {
- return GoogleAuthUtil.getAccountId(ContextUtils.getApplicationContext(), accountEmail);
- } catch (IOException | GoogleAuthException ex) {
- Log.e(TAG, "SystemAccountManagerDelegate.getAccountGaiaId", ex);
- return null;
- }
+ return null;
}
@Override
public boolean isGooglePlayServicesAvailable() {
// TODO(http://crbug.com/577190): Remove StrictMode override.
- try (StrictModeContext ignored = StrictModeContext.allowDiskWrites()) {
- int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
- ContextUtils.getApplicationContext());
- return resultCode == ConnectionResult.SUCCESS;
- }
+ return false;
}
protected boolean hasGetAccountsPermission() {
--- a/content/public/android/BUILD.gn
+++ b/content/public/android/BUILD.gn
@@ -75,7 +75,6 @@ action("generate_sandboxed_service_srcja
android_library("content_java") {
deps = [
":content_java_resources",
- "$google_play_services_package:google_play_services_auth_api_phone_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",
--- a/third_party/android_deps/BUILD.gn
+++ b/third_party/android_deps/BUILD.gn
@@ -972,53 +972,6 @@ java_prebuilt("com_android_tools_build_j
}
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
-android_aar_prebuilt("google_play_services_auth_java") {
- aar_path = "libs/com_google_android_gms_play_services_auth/play-services-auth-17.0.0.aar"
- info_path = "libs/com_google_android_gms_play_services_auth/com_google_android_gms_play_services_auth.info"
- deps = [
- ":androidx_fragment_fragment_java",
- ":androidx_loader_loader_java",
- ":google_play_services_auth_api_phone_java",
- ":google_play_services_auth_base_java",
- ":google_play_services_base_java",
- ":google_play_services_basement_java",
- ":google_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("google_play_services_auth_api_phone_java") {
- aar_path = "libs/com_google_android_gms_play_services_auth_api_phone/play-services-auth-api-phone-17.1.0.aar"
- info_path = "libs/com_google_android_gms_play_services_auth_api_phone/com_google_android_gms_play_services_auth_api_phone.info"
- deps = [
- ":google_play_services_base_java",
- ":google_play_services_basement_java",
- ":google_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("google_play_services_auth_base_java") {
- aar_path = "libs/com_google_android_gms_play_services_auth_base/play-services-auth-base-17.0.0.aar"
- info_path = "libs/com_google_android_gms_play_services_auth_base/com_google_android_gms_play_services_auth_base.info"
- deps = [
- ":androidx_collection_collection_java",
- ":google_play_services_base_java",
- ":google_play_services_basement_java",
- ":google_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("google_play_services_base_java") {
aar_path = "libs/com_google_android_gms_play_services_base/play-services-base-17.0.0.aar"
info_path = "libs/com_google_android_gms_play_services_base/com_google_android_gms_play_services_base.info"
--- a/third_party/robolectric/BUILD.gn
+++ b/third_party/robolectric/BUILD.gn
@@ -1162,7 +1162,6 @@ java_library("shadows_play_services_java
":robolectric_shadowapi_java",
":robolectric_utils_java",
":shadows_core_java",
- "$google_play_services_package:google_play_services_auth_base_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",
--- a/content/public/android/java/src/org/chromium/content/browser/sms/Wrappers.java
+++ b/content/public/android/java/src/org/chromium/content/browser/sms/Wrappers.java
@@ -10,8 +10,6 @@ import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
-import com.google.android.gms.auth.api.phone.SmsRetrieverClient;
-import com.google.android.gms.tasks.Task;
class Wrappers {
// Prevent instantiation.
@@ -21,11 +19,9 @@ class Wrappers {
* Wraps com.google.android.gms.auth.api.phone.SmsRetrieverClient.
*/
static class SmsRetrieverClientWrapper {
- private final SmsRetrieverClient mSmsRetrieverClient;
private SmsReceiverContext mContext;
- public SmsRetrieverClientWrapper(SmsRetrieverClient smsRetrieverClient) {
- mSmsRetrieverClient = smsRetrieverClient;
+ public SmsRetrieverClientWrapper() {
}
public void setContext(SmsReceiverContext context) {
@@ -35,14 +31,6 @@ class Wrappers {
public SmsReceiverContext getContext() {
return mContext;
}
-
- public Task<Void> startSmsRetriever() {
- return mSmsRetrieverClient.startSmsRetriever();
- }
-
- public Task<Void> startSmsUserConsent(String senderAddress) {
- return mSmsRetrieverClient.startSmsUserConsent(senderAddress);
- }
}
/**
--- a/components/background_task_scheduler/BUILD.gn
+++ b/components/background_task_scheduler/BUILD.gn
@@ -119,7 +119,6 @@ if (is_android) {
]
deps = [
- "$google_play_services_package:google_play_services_auth_base_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",
--- a/content/public/android/java/src/org/chromium/content/browser/sms/SmsUserConsentReceiver.java
+++ b/content/public/android/java/src/org/chromium/content/browser/sms/SmsUserConsentReceiver.java
@@ -12,11 +12,6 @@ import android.content.IntentFilter;
import androidx.annotation.VisibleForTesting;
-import com.google.android.gms.auth.api.phone.SmsRetriever;
-import com.google.android.gms.common.api.CommonStatusCodes;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.tasks.Task;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
@@ -55,7 +50,6 @@ public class SmsUserConsentReceiver exte
// this registration expire after the SMS message is received.
if (DEBUG) Log.d(TAG, "Registering intent filters.");
IntentFilter filter = new IntentFilter();
- filter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION);
mContext.registerReceiver(this, filter);
}
@@ -82,61 +76,24 @@ public class SmsUserConsentReceiver exte
return;
}
- if (!SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) {
- return;
- }
-
if (intent.getExtras() == null) {
return;
}
- final Status status;
-
- try {
- status = (Status) intent.getParcelableExtra(SmsRetriever.EXTRA_STATUS);
- } catch (Throwable e) {
- if (DEBUG) Log.d(TAG, "Error getting parceable.");
- return;
- }
-
- switch (status.getStatusCode()) {
- case CommonStatusCodes.SUCCESS:
- Intent consentIntent =
- intent.getExtras().getParcelable(SmsRetriever.EXTRA_CONSENT_INTENT);
- try {
- mWindowAndroid.showIntent(consentIntent,
- (window, resultCode, data) -> onConsentResult(resultCode, data), null);
- } catch (android.content.ActivityNotFoundException e) {
- if (DEBUG) Log.d(TAG, "Error starting activity for result.");
- }
- break;
- case CommonStatusCodes.TIMEOUT:
- if (DEBUG) Log.d(TAG, "Timeout");
- SmsUserConsentReceiverJni.get().onTimeout(mSmsProviderAndroid);
- break;
- }
}
void onConsentResult(int resultCode, Intent data) {
- if (resultCode == Activity.RESULT_OK) {
- String message = data.getStringExtra(SmsRetriever.EXTRA_SMS_MESSAGE);
- SmsUserConsentReceiverJni.get().onReceive(mSmsProviderAndroid, message);
- } else if (resultCode == Activity.RESULT_CANCELED) {
if (DEBUG) Log.d(TAG, "Activity result cancelled.");
- }
}
@CalledByNative
private void listen(WindowAndroid windowAndroid) {
mWindowAndroid = windowAndroid;
- Task<Void> task = getClient().startSmsUserConsent(null);
if (DEBUG) Log.d(TAG, "Installed task");
}
private Wrappers.SmsRetrieverClientWrapper getClient() {
- if (mClient != null) return mClient;
- mClient = new Wrappers.SmsRetrieverClientWrapper(SmsRetriever.getClient(mContext));
- return mClient;
+ return null;
}
@VisibleForTesting
--- a/content/public/android/java/src/org/chromium/content/browser/sms/SmsVerificationReceiver.java
+++ b/content/public/android/java/src/org/chromium/content/browser/sms/SmsVerificationReceiver.java
@@ -11,11 +11,6 @@ import android.content.IntentFilter;
import androidx.annotation.VisibleForTesting;
-import com.google.android.gms.auth.api.phone.SmsRetriever;
-import com.google.android.gms.common.api.CommonStatusCodes;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.tasks.Task;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
@@ -52,7 +47,6 @@ public class SmsVerificationReceiver ext
// this registration expire after the SMS message is received.
if (DEBUG) Log.d(TAG, "Registering intent filters.");
IntentFilter filter = new IntentFilter();
- filter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION);
mContext.registerReceiver(this, filter);
}
@@ -77,40 +71,15 @@ public class SmsVerificationReceiver ext
return;
}
- if (!SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) {
- return;
- }
-
if (intent.getExtras() == null) {
return;
}
- final Status status;
-
- try {
- status = (Status) intent.getParcelableExtra(SmsRetriever.EXTRA_STATUS);
- } catch (Throwable e) {
- if (DEBUG) Log.d(TAG, "Error getting parceable");
- return;
- }
-
- switch (status.getStatusCode()) {
- case CommonStatusCodes.SUCCESS:
- String message = intent.getExtras().getString(SmsRetriever.EXTRA_SMS_MESSAGE);
- if (DEBUG) Log.d(TAG, "Got message: %s!", message);
- SmsVerificationReceiverJni.get().onReceive(mSmsProviderAndroid, message);
- break;
- case CommonStatusCodes.TIMEOUT:
- if (DEBUG) Log.d(TAG, "Timeout");
- SmsVerificationReceiverJni.get().onTimeout(mSmsProviderAndroid);
- break;
- }
}
@CalledByNative
private void listen() {
Wrappers.SmsRetrieverClientWrapper client = getClient();
- Task<Void> task = client.startSmsRetriever();
if (DEBUG) Log.d(TAG, "Installed task");
}
@@ -119,8 +88,7 @@ public class SmsVerificationReceiver ext
if (mClient != null) {
return mClient;
}
- mClient = new Wrappers.SmsRetrieverClientWrapper(SmsRetriever.getClient(mContext));
- return mClient;
+ return null;
}
@VisibleForTesting
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -2424,7 +2424,6 @@ if (is_android) {
testonly = true
sources = content_java_sources_needing_jni
deps = [
- "$google_play_services_package:google_play_services_auth_api_phone_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",