diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-05-10 01:14:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-10 01:14:47 +0000 |
commit | ced93f2d22bffce3b4cfb9c3bfce862b385537dd (patch) | |
tree | 2b4715070bcf45b8a8395ee0ae5c7fbb0ef8274c /java/com/android/dialer/duo | |
parent | c49c914e53500fc661ec47e365621c9d33e046ca (diff) | |
parent | 2f4a0075e9f546514359eda60a24ac9cd49ea80a (diff) |
Merge changes Ia54e3421,Id2176e6e,I0311770e,I79f99c34,I8579afff, ...
* changes:
Add some annotations that won't influence aosp.
Update answer button logic.
Hide new after call spam blocking promo behind an additional flag.
Allow the TextView for call log primary text to adjust size when recycled.
Format callback phone number.
Added getLoggingName() to CallLogDataSource and PhoneLookup interfaces.
Do not show bubble for outgoing call if it's not a background call.
Always fetch status onResume and add logging for voicemail status in OldMainPeer and
Place Duo calls with PreCall
Creating CallIntent, AutoValue builder, to replace CallIntentBuilder.
Set the DisplayNameSource to PHONE in DefaultLookupUriGenerator.
Config correct layout boundaries to accommodate long text (call log & bottom sheet)
Use info from EmergencyPhoneLookup to render UI for an emergency number.
Implement EmergencyPhoneLookup for checking if a number is an emergency number.
Add GlobalSpamListStatus and UserSpamListStatus
Move SpamStatus classes into subpackage
Delete obsolete checkSpamStatus(Listener) API
Update callers of checkSpamStatus to use Future based API
Fix bug that showing block option for private number.
Add a null check for digitsHint.
Don't commit fragment transactions if it's not safe.
Add ListenableFuture based APIs for checkSpamStatus
Pass activity between new call log's adapter/view holder.
Replace assert checks with safety checks instead.
Add SimpleSpamStatus and use it in FakeSpam and SpamStub
Show calls to/from emergency numbers as "Emergency number" in call log & call details
Diffstat (limited to 'java/com/android/dialer/duo')
-rw-r--r-- | java/com/android/dialer/duo/Duo.java | 18 | ||||
-rw-r--r-- | java/com/android/dialer/duo/DuoComponent.java | 2 | ||||
-rw-r--r-- | java/com/android/dialer/duo/PlaceDuoCallNotifier.java | 45 | ||||
-rw-r--r-- | java/com/android/dialer/duo/PlaceDuoCallReceiver.java | 77 | ||||
-rw-r--r-- | java/com/android/dialer/duo/stub/DuoStub.java | 12 | ||||
-rw-r--r-- | java/com/android/dialer/duo/stub/StubDuoModule.java | 3 |
6 files changed, 15 insertions, 142 deletions
diff --git a/java/com/android/dialer/duo/Duo.java b/java/com/android/dialer/duo/Duo.java index 06a3db063..85fe9fbc1 100644 --- a/java/com/android/dialer/duo/Duo.java +++ b/java/com/android/dialer/duo/Duo.java @@ -27,6 +27,8 @@ import android.telecom.Call; import android.telecom.PhoneAccountHandle; import com.google.auto.value.AutoValue; import com.google.common.base.Optional; +import com.google.common.collect.ImmutableMap; +import com.google.common.util.concurrent.ListenableFuture; import java.util.List; /** Interface for Duo video call integration. */ @@ -61,7 +63,8 @@ public interface Duo { /** Starts a task to update the reachability of the parameter numbers asynchronously. */ @MainThread - void updateReachability(@NonNull Context context, @NonNull List<String> numbers); + ListenableFuture<ImmutableMap<String, ReachabilityData>> updateReachability( + @NonNull Context context, @NonNull List<String> numbers); /** * Clears the current reachability data and starts a task to load the latest reachability data @@ -95,19 +98,6 @@ public interface Duo { */ Optional<Intent> getInviteIntent(String number); - /** Return value of {@link #getIntentType(Intent)} */ - enum IntentType { - /** The intent is returned by {@link #getCallIntent(String)} */ - CALL, - /** The intent is returned by {@link #getActivateIntent()} */ - ACTIVATE, - /** The intent is returned by {@link #getInviteIntent(String)} */ - INVITE - } - - /** Classifies a Duo intent. Absent if the intent is not a Duo intent. */ - Optional<IntentType> getIntentType(Intent intent); - Optional<Intent> getInstallDuoIntent(); /** Requests upgrading the parameter ongoing call to a Duo video call. */ diff --git a/java/com/android/dialer/duo/DuoComponent.java b/java/com/android/dialer/duo/DuoComponent.java index 031ee9e53..307832aaf 100644 --- a/java/com/android/dialer/duo/DuoComponent.java +++ b/java/com/android/dialer/duo/DuoComponent.java @@ -19,6 +19,7 @@ package com.android.dialer.duo; import android.content.Context; import android.support.annotation.NonNull; import com.android.dialer.inject.HasRootComponent; +import com.android.dialer.inject.IncludeInDialerRoot; import dagger.Subcomponent; /** @@ -35,6 +36,7 @@ public abstract class DuoComponent { } /** Used to refer to the root application component. */ + @IncludeInDialerRoot public interface HasComponent { DuoComponent duoComponent(); } diff --git a/java/com/android/dialer/duo/PlaceDuoCallNotifier.java b/java/com/android/dialer/duo/PlaceDuoCallNotifier.java deleted file mode 100644 index 8fde981a0..000000000 --- a/java/com/android/dialer/duo/PlaceDuoCallNotifier.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.dialer.duo; - -import android.content.Context; -import android.content.Intent; -import android.support.v4.content.LocalBroadcastManager; -import com.android.dialer.common.LogUtil; - -/** Notifies that a Duo video call should be started. */ -public final class PlaceDuoCallNotifier { - - private PlaceDuoCallNotifier() {} - - /** - * Broadcasts an intent notifying that a Duo call should be started. - * - * <p>See {@link PlaceDuoCallReceiver} for how the intent is handled. - * - * @param phoneNumber The number to start a Duo call. It can be of any format. - */ - public static void notify(Context context, String phoneNumber) { - LogUtil.enterBlock("PlaceDuoCallNotifier.notify"); - - Intent intent = new Intent(); - intent.setAction(PlaceDuoCallReceiver.ACTION_START_DUO_CALL); - intent.putExtra(PlaceDuoCallReceiver.EXTRA_PHONE_NUMBER, phoneNumber); - - LocalBroadcastManager.getInstance(context).sendBroadcast(intent); - } -} diff --git a/java/com/android/dialer/duo/PlaceDuoCallReceiver.java b/java/com/android/dialer/duo/PlaceDuoCallReceiver.java deleted file mode 100644 index f504aef57..000000000 --- a/java/com/android/dialer/duo/PlaceDuoCallReceiver.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.dialer.duo; - -import android.app.Activity; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import com.android.dialer.common.Assert; -import com.android.dialer.common.LogUtil; -import com.android.dialer.constants.ActivityRequestCodes; - -/** A {@link BroadcastReceiver} that starts a Duo video call. */ -public final class PlaceDuoCallReceiver extends BroadcastReceiver { - - static final String ACTION_START_DUO_CALL = "start_duo_call"; - static final String EXTRA_PHONE_NUMBER = "phone_number"; - - /** - * {@link Activity} needed to launch Duo. - * - * <p>A Duo call can only be placed via {@link Activity#startActivityForResult(Intent, int)}. - */ - private final Activity activity; - - /** Returns an {@link IntentFilter} containing all actions accepted by this broadcast receiver. */ - public static IntentFilter getIntentFilter() { - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(ACTION_START_DUO_CALL); - return intentFilter; - } - - public PlaceDuoCallReceiver(Activity activity) { - this.activity = activity; - } - - @Override - public void onReceive(Context context, Intent intent) { - LogUtil.enterBlock("PlaceDuoCallReceiver.onReceive"); - - String action = intent.getAction(); - - switch (Assert.isNotNull(action)) { - case ACTION_START_DUO_CALL: - startDuoCall(context, intent); - break; - default: - throw new IllegalStateException("Unsupported action: " + action); - } - } - - private void startDuoCall(Context context, Intent intent) { - LogUtil.enterBlock("PlaceDuoCallReceiver.startDuoCall"); - - Assert.checkArgument(intent.hasExtra(EXTRA_PHONE_NUMBER)); - String phoneNumber = intent.getStringExtra(EXTRA_PHONE_NUMBER); - - Duo duo = DuoComponent.get(context).getDuo(); - activity.startActivityForResult( - duo.getCallIntent(phoneNumber).orNull(), ActivityRequestCodes.DIALTACTS_DUO); - } -} diff --git a/java/com/android/dialer/duo/stub/DuoStub.java b/java/com/android/dialer/duo/stub/DuoStub.java index b0867148f..2131d16f7 100644 --- a/java/com/android/dialer/duo/stub/DuoStub.java +++ b/java/com/android/dialer/duo/stub/DuoStub.java @@ -29,6 +29,9 @@ import com.android.dialer.common.Assert; import com.android.dialer.duo.Duo; import com.android.dialer.duo.DuoListener; import com.google.common.base.Optional; +import com.google.common.collect.ImmutableMap; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; import java.util.List; import javax.inject.Inject; @@ -72,10 +75,12 @@ public class DuoStub implements Duo { } @Override - public void updateReachability(@NonNull Context context, @NonNull List<String> numbers) { + public ListenableFuture<ImmutableMap<String, ReachabilityData>> updateReachability( + @NonNull Context context, @NonNull List<String> numbers) { Assert.isMainThread(); Assert.isNotNull(context); Assert.isNotNull(numbers); + return Futures.immediateFuture(ImmutableMap.of()); } @Override @@ -115,11 +120,6 @@ public class DuoStub implements Duo { } @Override - public Optional<IntentType> getIntentType(Intent intent) { - return Optional.absent(); - } - - @Override public Optional<Intent> getInstallDuoIntent() { return null; } diff --git a/java/com/android/dialer/duo/stub/StubDuoModule.java b/java/com/android/dialer/duo/stub/StubDuoModule.java index 604406a94..8966602bb 100644 --- a/java/com/android/dialer/duo/stub/StubDuoModule.java +++ b/java/com/android/dialer/duo/stub/StubDuoModule.java @@ -17,10 +17,13 @@ package com.android.dialer.duo.stub; import com.android.dialer.duo.Duo; +import com.android.dialer.inject.DialerVariant; +import com.android.dialer.inject.InstallIn; import dagger.Binds; import dagger.Module; import javax.inject.Singleton; +@InstallIn(variants = {DialerVariant.DIALER_TEST}) @Module public abstract class StubDuoModule { |