123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- From: csagan5 <32685696+csagan5@users.noreply.github.com>
- Date: Sun, 3 Nov 2019 08:22:29 +0100
- Subject: Remove SMS integration
- ---
- .../browser/sms/SmsUserConsentReceiver.java | 33 ++-----------------
- .../browser/sms/SmsVerificationReceiver.java | 30 ++---------------
- .../content/browser/sms/Wrappers.java | 14 +-------
- 3 files changed, 6 insertions(+), 71 deletions(-)
- diff --git 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
- --- 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;
- @@ -45,18 +40,6 @@ public class SmsUserConsentReceiver extends BroadcastReceiver {
- mSmsProviderAndroid = smsProviderAndroid;
-
- mContext = new Wrappers.SmsReceiverContext(ContextUtils.getApplicationContext());
- -
- - // A broadcast receiver is registered upon the creation of this class
- - // which happens when the SMS Retriever API is used for the first time
- - // since chrome last restarted (which, on android, happens frequently).
- - // The broadcast receiver is fairly lightweight (e.g. it responds
- - // quickly without much computation).
- - // If this broadcast receiver becomes more heavyweight, we should make
- - // 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);
- }
-
- @CalledByNative
- @@ -69,7 +52,6 @@ public class SmsUserConsentReceiver extends BroadcastReceiver {
- private void destroy() {
- if (DEBUG) Log.d(TAG, "Destroying SmsUserConsentReceiver.");
- mDestroyed = true;
- - mContext.unregisterReceiver(this);
- }
-
- @Override
- @@ -82,7 +64,7 @@ public class SmsUserConsentReceiver extends BroadcastReceiver {
- return;
- }
-
- - if (!SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) {
- + /*if (!SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) {
- return;
- }
-
- @@ -114,28 +96,19 @@ public class SmsUserConsentReceiver extends BroadcastReceiver {
- 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.");
- - }
- + Log.d(TAG, "Activity result discarded.");
- }
-
- @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;
- }
-
- diff --git 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
- --- 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;
- @@ -42,18 +37,6 @@ public class SmsVerificationReceiver extends BroadcastReceiver {
- mSmsProviderAndroid = smsProviderAndroid;
-
- mContext = new Wrappers.SmsReceiverContext(ContextUtils.getApplicationContext());
- -
- - // A broadcast receiver is registered upon the creation of this class
- - // which happens when the SMS Retriever API is used for the first time
- - // since chrome last restarted (which, on android, happens frequently).
- - // The broadcast receiver is fairly lightweight (e.g. it responds
- - // quickly without much computation).
- - // If this broadcast receiver becomes more heavyweight, we should make
- - // 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);
- }
-
- @CalledByNative
- @@ -66,7 +49,6 @@ public class SmsVerificationReceiver extends BroadcastReceiver {
- private void destroy() {
- if (DEBUG) Log.d(TAG, "Destroying SmsVerificationReceiver.");
- mDestroyed = true;
- - mContext.unregisterReceiver(this);
- }
-
- @Override
- @@ -77,7 +59,7 @@ public class SmsVerificationReceiver extends BroadcastReceiver {
- return;
- }
-
- - if (!SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) {
- +/* if (!SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) {
- return;
- }
-
- @@ -104,22 +86,14 @@ public class SmsVerificationReceiver extends BroadcastReceiver {
- 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");
- }
-
- private Wrappers.SmsRetrieverClientWrapper getClient() {
- - if (mClient != null) {
- - return mClient;
- - }
- - mClient = new Wrappers.SmsRetrieverClientWrapper(SmsRetriever.getClient(mContext));
- return mClient;
- }
-
- diff --git 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
- --- 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,9 +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.
- private Wrappers() {}
- @@ -21,11 +18,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) {
- @@ -36,13 +31,6 @@ class Wrappers {
- return mContext;
- }
-
- - public Task<Void> startSmsRetriever() {
- - return mSmsRetrieverClient.startSmsRetriever();
- - }
- -
- - public Task<Void> startSmsUserConsent(String senderAddress) {
- - return mSmsRetrieverClient.startSmsUserConsent(senderAddress);
- - }
- }
-
- /**
- --
- 2.17.1
|