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/historyitemactions | |
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/historyitemactions')
4 files changed, 31 insertions, 75 deletions
diff --git a/java/com/android/dialer/historyitemactions/DuoCallModule.java b/java/com/android/dialer/historyitemactions/DuoCallModule.java deleted file mode 100644 index e6f31e293..000000000 --- a/java/com/android/dialer/historyitemactions/DuoCallModule.java +++ /dev/null @@ -1,56 +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.historyitemactions; - -import android.Manifest.permission; -import android.content.Context; -import android.support.annotation.RequiresPermission; -import com.android.dialer.duo.PlaceDuoCallNotifier; - -/** {@link HistoryItemActionModule} for making a Duo call. */ -public class DuoCallModule implements HistoryItemActionModule { - - private final Context context; - private final String phoneNumber; - - /** - * Creates a module for making a Duo call. - * - * @param phoneNumber The number to start a Duo call. It can be of any format. - */ - public DuoCallModule(Context context, String phoneNumber) { - this.context = context; - this.phoneNumber = phoneNumber; - } - - @Override - public int getStringId() { - return R.string.video_call; - } - - @Override - public int getDrawableId() { - return R.drawable.quantum_ic_videocam_vd_white_24; - } - - @Override - @RequiresPermission(permission.READ_PHONE_STATE) - public boolean onClick() { - PlaceDuoCallNotifier.notify(context, phoneNumber); - return true; // Close the bottom sheet. - } -} diff --git a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java index 9af08be50..e1c6c9666 100644 --- a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java +++ b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java @@ -118,6 +118,7 @@ public final class HistoryItemActionModulesBuilder { * <p>This method is a no-op if * * <ul> + * <li>the call is one made to/received from an emergency number, * <li>the call is one made to a voicemail box, * <li>the number is blocked, or * <li>the number is marked as spam. @@ -138,25 +139,24 @@ public final class HistoryItemActionModulesBuilder { * capability, and Duo is available, add a Duo video call module. */ public HistoryItemActionModulesBuilder addModuleForVideoCall() { - if (moduleInfo.getIsVoicemailCall() || moduleInfo.getIsBlocked() || moduleInfo.getIsSpam()) { + if (moduleInfo.getIsEmergencyNumber() + || moduleInfo.getIsVoicemailCall() + || moduleInfo.getIsBlocked() + || moduleInfo.getIsSpam()) { return this; } // Do not set PhoneAccountHandle so that regular PreCall logic will be used. The account used to // place or receive the call should be ignored for carrier video calls. // TODO(a bug): figure out the correct video call behavior - HistoryItemActionModule carrierVideoCallModule = - IntentModule.newCallModule( - context, - new CallIntentBuilder(moduleInfo.getNormalizedNumber(), getCallInitiationType()) - .setAllowAssistedDial(moduleInfo.getCanSupportAssistedDialing()) - .setIsVideoCall(true)); - HistoryItemActionModule duoVideoCallModule = - new DuoCallModule(context, moduleInfo.getNormalizedNumber()); + CallIntentBuilder callIntentBuilder = + new CallIntentBuilder(moduleInfo.getNormalizedNumber(), getCallInitiationType()) + .setAllowAssistedDial(moduleInfo.getCanSupportAssistedDialing()) + .setIsVideoCall(true); // If the module info is for a video call, add an appropriate video call module. if ((moduleInfo.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) { - modules.add(isDuoCall() && canPlaceDuoCall() ? duoVideoCallModule : carrierVideoCallModule); + modules.add(IntentModule.newCallModule(context, callIntentBuilder.setIsDuoCall(isDuoCall()))); return this; } @@ -165,9 +165,9 @@ public final class HistoryItemActionModulesBuilder { // // The carrier video call module takes precedence over the Duo module. if (canPlaceCarrierVideoCall()) { - modules.add(carrierVideoCallModule); + modules.add(IntentModule.newCallModule(context, callIntentBuilder)); } else if (canPlaceDuoCall()) { - modules.add(duoVideoCallModule); + modules.add(IntentModule.newCallModule(context, callIntentBuilder.setIsDuoCall(true))); } return this; } @@ -178,6 +178,7 @@ public final class HistoryItemActionModulesBuilder { * <p>The method is a no-op if * * <ul> + * <li>the call is one made to/received from an emergency number, * <li>the call is one made to a voicemail box, * <li>the number is blocked, or * <li>the number is empty. @@ -186,7 +187,8 @@ public final class HistoryItemActionModulesBuilder { public HistoryItemActionModulesBuilder addModuleForSendingTextMessage() { // TODO(zachh): There are other conditions where this module should not be shown // (e.g., business numbers). - if (moduleInfo.getIsVoicemailCall() + if (moduleInfo.getIsEmergencyNumber() + || moduleInfo.getIsVoicemailCall() || moduleInfo.getIsBlocked() || TextUtils.isEmpty(moduleInfo.getNormalizedNumber())) { return this; @@ -217,6 +219,7 @@ public final class HistoryItemActionModulesBuilder { * <p>The method is a no-op if * * <ul> + * <li>the call is one made to/received from an emergency number, * <li>the call is one made to a voicemail box, * <li>the number is blocked, * <li>the number is marked as spam, @@ -225,7 +228,8 @@ public final class HistoryItemActionModulesBuilder { * </ul> */ public HistoryItemActionModulesBuilder addModuleForAddingToContacts() { - if (moduleInfo.getIsVoicemailCall() + if (moduleInfo.getIsEmergencyNumber() + || moduleInfo.getIsVoicemailCall() || moduleInfo.getIsBlocked() || moduleInfo.getIsSpam() || isExistingContact() @@ -253,7 +257,12 @@ public final class HistoryItemActionModulesBuilder { /** * Add modules for blocking/unblocking a number and/or marking it as spam/not spam. * - * <p>The method is a no-op if the call is one made to a voicemail box. + * <p>The method is a no-op if + * + * <ul> + * <li>the call is one made to/received from an emergency number, or + * <li>the call is one made to a voicemail box. + * </ul> * * <p>If a number is marked as spam, add two modules: * @@ -267,7 +276,7 @@ public final class HistoryItemActionModulesBuilder { * <p>If a number is not blocked or marked as spam, add the "Block/Report spam" module. */ public HistoryItemActionModulesBuilder addModuleForBlockedOrSpamNumber() { - if (moduleInfo.getIsVoicemailCall()) { + if (moduleInfo.getIsEmergencyNumber() || moduleInfo.getIsVoicemailCall()) { return this; } diff --git a/java/com/android/dialer/historyitemactions/history_item_action_module_info.proto b/java/com/android/dialer/historyitemactions/history_item_action_module_info.proto index 99071a7cd..f7022c28c 100644 --- a/java/com/android/dialer/historyitemactions/history_item_action_module_info.proto +++ b/java/com/android/dialer/historyitemactions/history_item_action_module_info.proto @@ -10,7 +10,7 @@ package com.android.dialer.historyitemactions; import "java/com/android/dialer/logging/contact_source.proto"; // Contains information needed to construct items (modules) in a bottom sheet. -// Next ID: 16 +// Next ID: 17 message HistoryItemActionModuleInfo { // The dialer-normalized version of a phone number. // See DialerPhoneNumber.normalized_number. @@ -66,4 +66,7 @@ message HistoryItemActionModuleInfo { VOICEMAIL = 2; } optional Host host = 15; + + // Whether the number is an emergency number. + optional bool is_emergency_number = 16; } diff --git a/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml b/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml index 721740f97..0790cf470 100644 --- a/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml +++ b/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml @@ -20,7 +20,8 @@ android:layout_height="match_parent" android:paddingTop="12dp" android:paddingBottom="12dp" - android:paddingEnd="8dp" + android:paddingStart="10dp" + android:paddingEnd="10dp" android:gravity="center_vertical" android:orientation="horizontal" android:background="#FFFFFF"> @@ -29,7 +30,6 @@ android:id="@+id/contact_photo_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="10dp" android:layout_marginEnd="10dp" android:minHeight="@dimen/contact_actions_image_size"/> |