summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2017-10-12 23:08:35 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-10-12 23:08:35 +0000
commit957b00914c4727b03784ffef573c34fdd405b663 (patch)
tree457c9f3d377b3839c24f2e099b842ebcd3d6fb53 /java
parent306bb488847ebd58c31e2144ba8c558544403048 (diff)
parent5f57e30484848b7b0b8d3fbdfe8b32338aa641a5 (diff)
Merge changes I14a2c0b6,Ic67566c2,Id0ef9164,Iec48f030,Ibe1f9de6, ...
am: 5f57e30484 Change-Id: Iabe5ea0bad0851164161c3552ee5354789292e83
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/app/calllog/MissedCallNotifier.java8
-rw-r--r--java/com/android/dialer/app/res/layout/search_edittext.xml1
-rw-r--r--java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java34
-rw-r--r--java/com/android/dialer/app/widget/SearchEditTextLayout.java1
-rw-r--r--java/com/android/dialer/assisteddialing/TransformationInfo.java15
-rw-r--r--java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java3
-rw-r--r--java/com/android/dialer/location/GeoUtil.java6
-rw-r--r--java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java3
-rw-r--r--java/com/android/incallui/CallButtonPresenter.java2
-rw-r--r--java/com/android/incallui/CallCardPresenter.java5
-rw-r--r--java/com/android/incallui/CallerInfoAsyncQuery.java4
-rw-r--r--java/com/android/incallui/CallerInfoUtils.java22
-rw-r--r--java/com/android/incallui/ContactInfoCache.java4
-rw-r--r--java/com/android/incallui/InCallActivity.java7
-rw-r--r--java/com/android/incallui/InCallActivityCommon.java5
-rw-r--r--java/com/android/incallui/InCallPresenter.java5
-rw-r--r--java/com/android/incallui/InCallServiceImpl.java2
-rw-r--r--java/com/android/incallui/ProximitySensor.java3
-rw-r--r--java/com/android/incallui/StatusBarNotifier.java24
-rw-r--r--java/com/android/incallui/answer/impl/AnswerFragment.java10
-rw-r--r--java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java9
-rw-r--r--java/com/android/incallui/answer/impl/classifier/FalsingManager.java7
-rw-r--r--java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java11
-rw-r--r--java/com/android/incallui/call/CallList.java13
-rw-r--r--java/com/android/incallui/call/DialerCall.java58
-rw-r--r--java/com/android/incallui/contactgrid/BottomRow.java9
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java6
-rw-r--r--java/com/android/incallui/contactgrid/TopRow.java9
-rw-r--r--java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml4
-rw-r--r--java/com/android/incallui/contactgrid/res/values/strings.xml3
-rw-r--r--java/com/android/incallui/incall/protocol/PrimaryCallState.java9
-rw-r--r--java/com/android/incallui/spam/SpamCallListListener.java2
32 files changed, 200 insertions, 104 deletions
diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java
index 8a986dc41..f50751e2b 100644
--- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java
+++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java
@@ -260,9 +260,11 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {
if (call.accountComponentName == null || call.accountId == null) {
continue;
}
- PhoneAccountHandle phoneAccountHandle =
- new PhoneAccountHandle(
- ComponentName.unflattenFromString(call.accountComponentName), call.accountId);
+ ComponentName componentName = ComponentName.unflattenFromString(call.accountComponentName);
+ if (componentName == null) {
+ continue;
+ }
+ PhoneAccountHandle phoneAccountHandle = new PhoneAccountHandle(componentName, call.accountId);
PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle);
if (phoneAccount == null) {
continue;
diff --git a/java/com/android/dialer/app/res/layout/search_edittext.xml b/java/com/android/dialer/app/res/layout/search_edittext.xml
index 63786dfb0..5fc492d29 100644
--- a/java/com/android/dialer/app/res/layout/search_edittext.xml
+++ b/java/com/android/dialer/app/res/layout/search_edittext.xml
@@ -39,6 +39,7 @@
android:layout_width="@dimen/search_box_icon_size"
android:layout_height="@dimen/search_box_icon_size"
android:layout_marginStart="8dp"
+ android:layout_centerVertical="true"
android:importantForAccessibility="no"
android:scaleType="center"
android:src="@drawable/quantum_ic_search_vd_theme_24"
diff --git a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java
index 74ddff245..0a6f2c156 100644
--- a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java
+++ b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java
@@ -32,6 +32,7 @@ import com.android.dialer.app.calllog.LegacyVoicemailNotifier;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.PerAccountSharedPreferences;
+import com.android.dialer.compat.telephony.TelephonyManagerCompat;
import com.android.dialer.util.DialerUtils;
import com.android.voicemail.VoicemailClient;
import com.android.voicemail.VoicemailComponent;
@@ -44,16 +45,8 @@ import com.android.voicemail.VoicemailComponent;
@TargetApi(VERSION_CODES.O)
public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver {
- private static final String LEGACY_VOICEMAIL_COUNT = "legacy_voicemail_count";
@VisibleForTesting static final String LEGACY_VOICEMAIL_DISMISSED = "legacy_voicemail_dismissed";
- /**
- * Whether the notification is just a refresh or for a new voicemail. The phone should not play a
- * ringtone or vibrate during a refresh if the notification is already showing. This is Hidden in
- * O and public in O MR1.
- */
- @VisibleForTesting static final String EXTRA_IS_REFRESH = "is_refresh";
-
@Override
public void onReceive(Context context, Intent intent) {
@@ -79,7 +72,8 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver {
PhoneAccountHandle phoneAccountHandle =
Assert.isNotNull(intent.getParcelableExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE));
int count = intent.getIntExtra(TelephonyManager.EXTRA_NOTIFICATION_COUNT, -1);
- boolean isRefresh = intent.getBooleanExtra(EXTRA_IS_REFRESH, false);
+
+ boolean isRefresh = intent.getBooleanExtra(TelephonyManagerCompat.EXTRA_IS_REFRESH, false);
LogUtil.i("LegacyVoicemailNotificationReceiver.onReceive", "isRefresh: " + isRefresh);
PerAccountSharedPreferences preferences = getSharedPreferences(context, phoneAccountHandle);
if (isRefresh) {
@@ -93,13 +87,6 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver {
setDismissed(context, phoneAccountHandle, false);
}
- if (!hasVoicemailCountChanged(preferences, count)) {
- LogUtil.i(
- "LegacyVoicemailNotificationReceiver.onReceive",
- "voicemail count hasn't changed, ignoring");
- return;
- }
-
if (count == -1) {
// Carrier might not send voicemail count. Missing extra means there are unknown numbers of
// voicemails (One or more). Treat it as 1 so the generic version will be shown. ("Voicemail"
@@ -149,21 +136,6 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver {
.apply();
}
- private static boolean hasVoicemailCountChanged(
- PerAccountSharedPreferences preferences, int newCount) {
- if (newCount == -1) {
- // Carrier does not report voicemail count
- return true;
- }
-
- // Carriers may send multiple notifications for the same voicemail.
- if (newCount != 0 && newCount == preferences.getInt(LEGACY_VOICEMAIL_COUNT, -1)) {
- return false;
- }
- preferences.edit().putInt(LEGACY_VOICEMAIL_COUNT, newCount).apply();
- return true;
- }
-
@VisibleForTesting
static PerAccountSharedPreferences getSharedPreferences(
Context context, PhoneAccountHandle phoneAccountHandle) {
diff --git a/java/com/android/dialer/app/widget/SearchEditTextLayout.java b/java/com/android/dialer/app/widget/SearchEditTextLayout.java
index 95bd12aa1..9da0e245f 100644
--- a/java/com/android/dialer/app/widget/SearchEditTextLayout.java
+++ b/java/com/android/dialer/app/widget/SearchEditTextLayout.java
@@ -274,7 +274,6 @@ public class SearchEditTextLayout extends FrameLayout {
mCollapsedSearchBox.setVisibility(collapsedViewVisibility);
mVoiceSearchButtonView.setVisibility(collapsedViewVisibility);
mOverflowButtonView.setVisibility(collapsedViewVisibility);
- mBackButtonView.setVisibility(expandedViewVisibility);
// TODO: Prevents keyboard from jumping up in landscape mode after exiting the
// SearchFragment when the query string is empty. More elegant fix?
//mExpandedSearchBox.setVisibility(expandedViewVisibility);
diff --git a/java/com/android/dialer/assisteddialing/TransformationInfo.java b/java/com/android/dialer/assisteddialing/TransformationInfo.java
index 03e565c51..de8f27d01 100644
--- a/java/com/android/dialer/assisteddialing/TransformationInfo.java
+++ b/java/com/android/dialer/assisteddialing/TransformationInfo.java
@@ -57,19 +57,20 @@ public abstract class TransformationInfo {
return new AutoValue_TransformationInfo.Builder();
}
+ /** A builder for TransformationInfo. */
@AutoValue.Builder
- abstract static class Builder {
- abstract Builder setOriginalNumber(String value);
+ public abstract static class Builder {
+ public abstract Builder setOriginalNumber(String value);
- abstract Builder setTransformedNumber(String value);
+ public abstract Builder setTransformedNumber(String value);
- abstract Builder setUserHomeCountryCode(String value);
+ public abstract Builder setUserHomeCountryCode(String value);
- abstract Builder setUserRoamingCountryCode(String value);
+ public abstract Builder setUserRoamingCountryCode(String value);
- abstract Builder setTransformedNumberCountryCallingCode(int value);
+ public abstract Builder setTransformedNumberCountryCallingCode(int value);
- abstract TransformationInfo build();
+ public abstract TransformationInfo build();
}
public static TransformationInfo newInstanceFromBundle(@NonNull Bundle transformationInfoBundle) {
diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
index 61c44b9f4..fbc789900 100644
--- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
+++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
@@ -73,6 +73,9 @@ public class TelephonyManagerCompat {
public static final String ASSISTED_DIALING_EXTRAS =
"android.telecom.extra.ASSISTED_DIALING_EXTRAS";
+ public static final String EXTRA_IS_REFRESH =
+ BuildCompat.isAtLeastOMR1() ? "android.telephony.extra.IS_REFRESH" : "is_refresh";
+
/**
* Returns the number of phones available. Returns 1 for Single standby mode (Single SIM
* functionality) Returns 2 for Dual standby mode.(Dual SIM functionality)
diff --git a/java/com/android/dialer/location/GeoUtil.java b/java/com/android/dialer/location/GeoUtil.java
index b39256d32..27fbf2315 100644
--- a/java/com/android/dialer/location/GeoUtil.java
+++ b/java/com/android/dialer/location/GeoUtil.java
@@ -17,6 +17,7 @@
package com.android.dialer.location;
import android.content.Context;
+import android.os.Trace;
/** Static methods related to Geo. */
public class GeoUtil {
@@ -24,6 +25,9 @@ public class GeoUtil {
/** @return the ISO 3166-1 two letters country code of the country the user is in. */
public static String getCurrentCountryIso(Context context) {
// The {@link CountryDetector} should never return null so this is safe to return as-is.
- return CountryDetector.getInstance(context).getCurrentCountryIso();
+ Trace.beginSection("GeoUtil.getCurrentCountryIso");
+ String countryIso = CountryDetector.getInstance(context).getCurrentCountryIso();
+ Trace.endSection();
+ return countryIso;
}
}
diff --git a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
index b25e4d7fe..cc9b73081 100644
--- a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
+++ b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
@@ -17,6 +17,7 @@
package com.android.dialer.phonenumberutil;
import android.content.Context;
+import android.os.Trace;
import android.provider.CallLog;
import android.support.annotation.Nullable;
import android.telecom.PhoneAccountHandle;
@@ -113,6 +114,7 @@ public class PhoneNumberHelper {
*/
public static String getCurrentCountryIso(
Context context, @Nullable PhoneAccountHandle phoneAccountHandle) {
+ Trace.beginSection("PhoneNumberHelper.getCurrentCountryIso");
// Without framework function calls, this seems to be the most accurate location service
// we can rely on.
String countryIso =
@@ -125,6 +127,7 @@ public class PhoneNumberHelper {
"No CountryDetector; falling back to countryIso based on locale: " + countryIso);
}
countryIso = countryIso.toUpperCase();
+ Trace.endSection();
return countryIso;
}
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index b3fb97fad..aa17dc4eb 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -118,7 +118,7 @@ public class CallButtonPresenter
// OUTGOING. We may want to do that once we start showing "Voice mail" label on
// the dialpad too.)
if (oldState == InCallState.OUTGOING && mCall != null) {
- if (CallerInfoUtils.isVoiceMailNumber(mContext, mCall) && getActivity() != null) {
+ if (mCall.isVoiceMailNumber() && getActivity() != null) {
getActivity().showDialpadFragment(true /* show */, true /* animate */);
}
}
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index d49d556a6..871243c7d 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -478,13 +478,14 @@ public class CallCardPresenter
!TextUtils.isEmpty(mPrimary.getLastForwardedNumber()),
shouldShowContactPhoto,
mPrimary.getConnectTimeMillis(),
- CallerInfoUtils.isVoiceMailNumber(mContext, mPrimary),
+ mPrimary.isVoiceMailNumber(),
mPrimary.isRemotelyHeld(),
isBusiness,
supports2ndCallOnHold(),
getSwapToSecondaryButtonState(),
mPrimary.isAssistedDialed(),
- null));
+ null,
+ mPrimary.getAssistedDialingExtras()));
InCallActivity activity =
(InCallActivity) (mInCallScreen.getInCallScreenFragment().getActivity());
diff --git a/java/com/android/incallui/CallerInfoAsyncQuery.java b/java/com/android/incallui/CallerInfoAsyncQuery.java
index 09752c71f..8fc9c4f14 100644
--- a/java/com/android/incallui/CallerInfoAsyncQuery.java
+++ b/java/com/android/incallui/CallerInfoAsyncQuery.java
@@ -29,6 +29,7 @@ import android.os.Build.VERSION_CODES;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.os.Trace;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Directory;
import android.support.annotation.MainThread;
@@ -191,9 +192,11 @@ public class CallerInfoAsyncQuery {
CallerInfo info,
OnQueryCompleteListener listener,
Object cookie) {
+ Trace.beginSection("CallerInfoAsyncQuery.startOtherDirectoriesQuery");
long[] directoryIds = StrictModeUtils.bypass(() -> getDirectoryIds(context));
int size = directoryIds.length;
if (size == 0) {
+ Trace.endSection();
return false;
}
@@ -213,6 +216,7 @@ public class CallerInfoAsyncQuery {
OnQueryCompleteListener intermediateListener = listenerFactory.newListener(directoryId);
startQueryInternal(token, context, info, intermediateListener, cookie, uri);
}
+ Trace.endSection();
return true;
}
diff --git a/java/com/android/incallui/CallerInfoUtils.java b/java/com/android/incallui/CallerInfoUtils.java
index bf586f504..38043eda8 100644
--- a/java/com/android/incallui/CallerInfoUtils.java
+++ b/java/com/android/incallui/CallerInfoUtils.java
@@ -16,15 +16,10 @@
package com.android.incallui;
-import android.Manifest.permission;
import android.content.Context;
import android.content.Loader;
import android.content.Loader.OnLoadCompleteListener;
-import android.content.pm.PackageManager;
import android.net.Uri;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
-import android.telecom.PhoneAccount;
import android.telecom.TelecomManager;
import android.text.TextUtils;
import com.android.contacts.common.model.Contact;
@@ -34,7 +29,6 @@ import com.android.dialer.phonenumbercache.CachedNumberLookupService;
import com.android.dialer.phonenumbercache.CachedNumberLookupService.CachedContactInfo;
import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
-import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.PermissionsUtil;
import com.android.incallui.call.DialerCall;
import java.util.Arrays;
@@ -112,7 +106,7 @@ public class CallerInfoUtils {
// Because the InCallUI is immediately launched before the call is connected, occasionally
// a voicemail call will be passed to InCallUI as a "voicemail:" URI without a number.
// This call should still be handled as a voicemail call.
- if (isVoiceMailNumber(context, call)) {
+ if (call.isVoiceMailNumber()) {
info.markAsVoiceMail(context);
}
@@ -146,20 +140,6 @@ public class CallerInfoUtils {
return cacheInfo;
}
- public static boolean isVoiceMailNumber(Context context, @NonNull DialerCall call) {
- if (call.getHandle() != null
- && PhoneAccount.SCHEME_VOICEMAIL.equals(call.getHandle().getScheme())) {
- return true;
- }
-
- if (ContextCompat.checkSelfPermission(context, permission.READ_PHONE_STATE)
- != PackageManager.PERMISSION_GRANTED) {
- return false;
- }
-
- return TelecomUtil.isVoicemailNumber(context, call.getAccountHandle(), call.getNumber());
- }
-
/**
* Handles certain "corner cases" for CNAP. When we receive weird phone numbers from the network
* to indicate different number presentations, convert them to expected number and presentation
diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java
index 2a9394526..2fb18b8d7 100644
--- a/java/com/android/incallui/ContactInfoCache.java
+++ b/java/com/android/incallui/ContactInfoCache.java
@@ -807,10 +807,12 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
@Override
public void onQueryComplete(int token, Object cookie, CallerInfo callerInfo) {
+ Trace.beginSection("ContactInfoCache.FindInfoCallback.onQueryComplete");
Assert.isMainThread();
DialerCallCookieWrapper cw = (DialerCallCookieWrapper) cookie;
String callId = cw.callId;
if (!isWaitingForThisQuery(cw.callId, mQueryToken.mQueryId)) {
+ Trace.endSection();
return;
}
ContactCacheEntry cacheEntry = mInfoMap.get(callId);
@@ -818,6 +820,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
if (cacheEntry == null) {
Log.w(TAG, "Contact lookup done, but cache entry is not found.");
clearCallbacks(callId);
+ Trace.endSection();
return;
}
// Before issuing a request for more data from other services, we only check that the
@@ -842,6 +845,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
}
clearCallbacks(callId);
}
+ Trace.endSection();
}
}
diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java
index 2ba4d98a1..2e3d721df 100644
--- a/java/com/android/incallui/InCallActivity.java
+++ b/java/com/android/incallui/InCallActivity.java
@@ -95,6 +95,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity
private boolean touchDownWhenPseudoScreenOff;
private boolean isInShowMainInCallFragment;
private boolean needDismissPendingDialogs;
+ private boolean allowOrientationChange;
public InCallActivity() {
common = new InCallActivityCommon(this);
@@ -161,7 +162,9 @@ public class InCallActivity extends TransactionSafeFragmentActivity
protected void onStart() {
Trace.beginSection("InCallActivity.onStart");
LogUtil.i("InCallActivity.onStart", "");
+ Trace.beginSection("call super");
super.onStart();
+ Trace.endSection();
isVisible = true;
showMainInCallFragment();
common.onStart();
@@ -514,6 +517,10 @@ public class InCallActivity extends TransactionSafeFragmentActivity
}
public void setAllowOrientationChange(boolean allowOrientationChange) {
+ if (this.allowOrientationChange == allowOrientationChange) {
+ return;
+ }
+ this.allowOrientationChange = allowOrientationChange;
if (!allowOrientationChange) {
setRequestedOrientation(InCallOrientationEventListener.ACTIVITY_PREFERENCE_DISALLOW_ROTATION);
} else {
diff --git a/java/com/android/incallui/InCallActivityCommon.java b/java/com/android/incallui/InCallActivityCommon.java
index 9ccda3251..0a7c2689b 100644
--- a/java/com/android/incallui/InCallActivityCommon.java
+++ b/java/com/android/incallui/InCallActivityCommon.java
@@ -29,6 +29,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
+import android.os.Trace;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@@ -257,6 +258,7 @@ public class InCallActivityCommon {
}
public void onStart() {
+ Trace.beginSection("InCallActivityCommon.onStart");
// setting activity should be last thing in setup process
InCallPresenter.getInstance().setActivity(inCallActivity);
enableInCallOrientationEventListener(
@@ -267,9 +269,11 @@ public class InCallActivityCommon {
if (!isRecreating) {
InCallPresenter.getInstance().onUiShowing(true);
}
+ Trace.endSection();
}
public void onResume() {
+ Trace.beginSection("InCallActivityCommon.onResume");
if (InCallPresenter.getInstance().isReadyForTearDown()) {
LogUtil.i(
"InCallActivityCommon.onResume",
@@ -309,6 +313,7 @@ public class InCallActivityCommon {
CallList.getInstance()
.onInCallUiShown(
inCallActivity.getIntent().getBooleanExtra(INTENT_EXTRA_FOR_FULL_SCREEN, false));
+ Trace.endSection();
}
// onPause is guaranteed to be called when the InCallActivity goes
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index a0069a629..70fe88be8 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -444,6 +444,7 @@ public class InCallPresenter implements CallList.Listener {
* activity is provided, it means that the activity was finished and we should attempt to cleanup.
*/
private void updateActivity(InCallActivity inCallActivity) {
+ Trace.beginSection("InCallPresenter.updateActivity");
boolean updateListeners = false;
boolean doAttemptCleanup = false;
@@ -475,6 +476,7 @@ public class InCallPresenter implements CallList.Listener {
if (mInCallState == InCallState.NO_CALLS) {
LogUtil.i("InCallPresenter.updateActivity", "UI Initialized, but no calls left. Shut down");
attemptFinishActivity();
+ Trace.endSection();
return;
}
} else {
@@ -510,6 +512,7 @@ public class InCallPresenter implements CallList.Listener {
if (doAttemptCleanup) {
attemptCleanup();
}
+ Trace.endSection();
}
public void setManageConferenceActivity(
@@ -842,7 +845,7 @@ public class InCallPresenter implements CallList.Listener {
if (!mCallList.hasLiveCall()
&& !call.getLogState().isIncoming
&& !isSecretCode(call.getNumber())
- && !CallerInfoUtils.isVoiceMailNumber(mContext, call)) {
+ && !call.isVoiceMailNumber()) {
PostCall.onCallDisconnected(mContext, call.getNumber(), call.getConnectTimeMillis());
}
}
diff --git a/java/com/android/incallui/InCallServiceImpl.java b/java/com/android/incallui/InCallServiceImpl.java
index a08ee0aa5..8570c58c4 100644
--- a/java/com/android/incallui/InCallServiceImpl.java
+++ b/java/com/android/incallui/InCallServiceImpl.java
@@ -41,7 +41,9 @@ public class InCallServiceImpl extends InCallService {
@Override
public void onCallAudioStateChanged(CallAudioState audioState) {
+ Trace.beginSection("InCallServiceImpl.onCallAudioStateChanged");
AudioModeProvider.getInstance().onAudioStateChanged(audioState);
+ Trace.endSection();
}
@Override
diff --git a/java/com/android/incallui/ProximitySensor.java b/java/com/android/incallui/ProximitySensor.java
index db538abdc..339a2e941 100644
--- a/java/com/android/incallui/ProximitySensor.java
+++ b/java/com/android/incallui/ProximitySensor.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager.DisplayListener;
import android.os.PowerManager;
+import android.os.Trace;
import android.support.annotation.NonNull;
import android.telecom.CallAudioState;
import android.view.Display;
@@ -206,6 +207,7 @@ public class ProximitySensor
* request for, or is in a video call; or the phone is horizontal while in a call.
*/
private synchronized void updateProximitySensorMode() {
+ Trace.beginSection("ProximitySensor.updateProximitySensorMode");
final int audioRoute = mAudioModeProvider.getAudioState().getRoute();
boolean screenOnImmediately =
@@ -249,6 +251,7 @@ public class ProximitySensor
// behavior in either case.
turnOffProximitySensor(screenOnImmediately);
}
+ Trace.endSection();
}
/**
diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java
index 7146c7235..e5908f12e 100644
--- a/java/com/android/incallui/StatusBarNotifier.java
+++ b/java/com/android/incallui/StatusBarNotifier.java
@@ -541,6 +541,18 @@ public class StatusBarNotifier
|| !Objects.equals(mRingtone, ringtone)
|| !Objects.equals(savedCallAudioState, callAudioState);
+ LogUtil.d(
+ "StatusBarNotifier.checkForChangeAndSaveData",
+ "data changed: icon: %b, content: %b, state: %b, largeIcon: %b, title: %b, ringtone: %b, "
+ + "audioState: %b, type: %b",
+ (mSavedIcon != icon),
+ !Objects.equals(mSavedContent, content),
+ (mCallState != state),
+ largeIconChanged,
+ contentTitleChanged,
+ !Objects.equals(mRingtone, ringtone),
+ !Objects.equals(savedCallAudioState, callAudioState),
+ mCurrentNotification != notificationType);
// If we aren't showing a notification right now or the notification type is changing,
// definitely do an update.
if (mCurrentNotification != notificationType) {
@@ -614,7 +626,7 @@ public class StatusBarNotifier
@ContactType
int contactType =
LetterTileDrawable.getContactTypeFromPrimitives(
- CallerInfoUtils.isVoiceMailNumber(context, call),
+ call.isVoiceMailNumber(),
call.isSpam(),
contactInfo.isBusiness,
call.getNumberPresentation(),
@@ -709,7 +721,7 @@ public class StatusBarNotifier
resId = getECIncomingCallText(call.getEnrichedCallSession());
} else if (call.hasProperty(Details.PROPERTY_WIFI)) {
resId = R.string.notification_incoming_call_wifi_template;
- } else if (call.getAccountHandle() != null && hasMultiplePhoneAccounts()) {
+ } else if (call.getAccountHandle() != null && hasMultiplePhoneAccounts(call)) {
return getMultiSimIncomingText(call);
} else if (call.isVideoCall()) {
resId = R.string.notification_incoming_video_call;
@@ -1043,9 +1055,11 @@ public class StatusBarNotifier
mStatusBarCallListener = listener;
}
- @SuppressWarnings("MissingPermission")
- private boolean hasMultiplePhoneAccounts() {
- return mContext.getSystemService(TelecomManager.class).getCallCapablePhoneAccounts().size() > 1;
+ private boolean hasMultiplePhoneAccounts(DialerCall call) {
+ if (call.getCallCapableAccounts() == null) {
+ return false;
+ }
+ return call.getCallCapableAccounts().size() > 1;
}
@Override
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index 3476557ba..f0b0c0fde 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -744,6 +744,7 @@ public class AnswerFragment extends Fragment
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
+ Trace.beginSection("AnswerFragment.onViewCreated");
super.onViewCreated(view, savedInstanceState);
createInCallScreenDelegate();
updateUI();
@@ -751,18 +752,22 @@ public class AnswerFragment extends Fragment
if (savedInstanceState == null || !savedInstanceState.getBoolean(STATE_HAS_ANIMATED_ENTRY)) {
ViewUtil.doOnGlobalLayout(view, this::animateEntry);
}
+ Trace.endSection();
}
@Override
public void onResume() {
+ Trace.beginSection("AnswerFragment.onResume");
super.onResume();
LogUtil.i("AnswerFragment.onResume", null);
restoreSwipeHintTexts();
inCallScreenDelegate.onInCallScreenResumed();
+ Trace.endSection();
}
@Override
public void onStart() {
+ Trace.beginSection("AnswerFragment.onStart");
super.onStart();
LogUtil.i("AnswerFragment.onStart", null);
@@ -770,10 +775,12 @@ public class AnswerFragment extends Fragment
if (answerVideoCallScreen != null) {
answerVideoCallScreen.onVideoScreenStart();
}
+ Trace.endSection();
}
@Override
public void onStop() {
+ Trace.beginSection("AnswerFragment.onStop");
super.onStop();
LogUtil.i("AnswerFragment.onStop", null);
@@ -781,13 +788,16 @@ public class AnswerFragment extends Fragment
if (answerVideoCallScreen != null) {
answerVideoCallScreen.onVideoScreenStop();
}
+ Trace.endSection();
}
@Override
public void onPause() {
+ Trace.beginSection("AnswerFragment.onPause");
super.onPause();
LogUtil.i("AnswerFragment.onPause", null);
inCallScreenDelegate.onInCallScreenPaused();
+ Trace.endSection();
}
@Override
diff --git a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
index 5c1ee47e6..ea5956c8c 100644
--- a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
+++ b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java
@@ -28,6 +28,7 @@ import android.content.res.ColorStateList;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.os.Trace;
import android.support.annotation.ColorInt;
import android.support.annotation.FloatRange;
import android.support.annotation.IntDef;
@@ -157,6 +158,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
@Override
public void onStart() {
+ Trace.beginSection("FlingUpDownMethod.onStart");
super.onStart();
falsingManager.onScreenOn();
if (getView() != null) {
@@ -170,22 +172,26 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
startSwipeToAnswerEntryAnimation();
}
}
+ Trace.endSection();
}
@Override
public void onStop() {
+ Trace.beginSection("FlingUpDownMethod.onStop");
endAnimation();
falsingManager.onScreenOff();
if (getActivity().isFinishing()) {
setAnimationState(AnimationState.COMPLETED);
}
super.onStop();
+ Trace.endSection();
}
@Nullable
@Override
public View onCreateView(
LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
+ Trace.beginSection("FlingUpDownMethod.onCreateView");
View view = layoutInflater.inflate(R.layout.swipe_up_down_method, viewGroup, false);
contactPuckContainer = view.findViewById(R.id.incoming_call_puck_container);
@@ -242,6 +248,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
(ViewGroup) view.findViewById(R.id.hint_container),
contactPuckContainer,
swipeToAnswerText);
+ Trace.endSection();
return view;
}
@@ -400,6 +407,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
}
private void updateSwipeTextAndPuckForTouch() {
+ Trace.beginSection("FlingUpDownMethod.updateSwipeTextAndPuckForTouch");
// Clamp progress value between -1 and 1.
final float clampedProgress = MathUtil.clamp(swipeProgress, -1 /* min */, 1 /* max */);
final float positiveAdjustedProgress = Math.abs(clampedProgress);
@@ -473,6 +481,7 @@ public class FlingUpDownMethod extends AnswerMethod implements OnProgressChanged
}
getParent().onAnswerProgressUpdate(clampedProgress);
+ Trace.endSection();
}
private void startSwipeToAnswerSwipeAnimation() {
diff --git a/java/com/android/incallui/answer/impl/classifier/FalsingManager.java b/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
index fdcc0a3f9..9cdd888d1 100644
--- a/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
+++ b/java/com/android/incallui/answer/impl/classifier/FalsingManager.java
@@ -22,6 +22,7 @@ import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.PowerManager;
+import android.os.Trace;
import android.view.MotionEvent;
import android.view.accessibility.AccessibilityManager;
@@ -130,11 +131,17 @@ public class FalsingManager implements SensorEventListener {
}
private void registerSensors(int[] sensors) {
+ Trace.beginSection("FalsingManager.registerSensors");
for (int sensorType : sensors) {
+ Trace.beginSection("get sensor " + sensorType);
Sensor s = mSensorManager.getDefaultSensor(sensorType);
+ Trace.endSection();
if (s != null) {
+ Trace.beginSection("register");
mSensorManager.registerListener(this, s, SensorManager.SENSOR_DELAY_GAME);
+ Trace.endSection();
}
}
+ Trace.endSection();
}
}
diff --git a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
index 16fad8b17..113144b7f 100644
--- a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
+++ b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
@@ -19,6 +19,7 @@ package com.android.incallui.answerproximitysensor;
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.PowerManager;
+import android.os.Trace;
import android.view.Display;
import com.android.dialer.common.LogUtil;
import com.android.dialer.configprovider.ConfigProviderBindings;
@@ -43,16 +44,19 @@ public class AnswerProximitySensor
private final AnswerProximityWakeLock answerProximityWakeLock;
public static boolean shouldUse(Context context, DialerCall call) {
+ Trace.beginSection("AnswerProximitySensor.shouldUse");
// Don't use the AnswerProximitySensor for call waiting and other states. Those states are
// handled by the general ProximitySensor code.
if (call.getState() != State.INCOMING) {
LogUtil.i("AnswerProximitySensor.shouldUse", "call state is not incoming");
+ Trace.endSection();
return false;
}
if (!ConfigProviderBindings.get(context)
.getBoolean(CONFIG_ANSWER_PROXIMITY_SENSOR_ENABLED, true)) {
LogUtil.i("AnswerProximitySensor.shouldUse", "disabled by config");
+ Trace.endSection();
return false;
}
@@ -60,19 +64,23 @@ public class AnswerProximitySensor
.getSystemService(PowerManager.class)
.isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) {
LogUtil.i("AnswerProximitySensor.shouldUse", "wake lock level not supported");
+ Trace.endSection();
return false;
}
if (isDefaultDisplayOn(context)) {
LogUtil.i("AnswerProximitySensor.shouldUse", "display is already on");
+ Trace.endSection();
return false;
}
+ Trace.endSection();
return true;
}
public AnswerProximitySensor(
Context context, DialerCall call, PseudoScreenState pseudoScreenState) {
+ Trace.beginSection("AnswerProximitySensor Constructor");
this.call = call;
LogUtil.i("AnswerProximitySensor.constructor", "acquiring lock");
@@ -90,11 +98,14 @@ public class AnswerProximitySensor
answerProximityWakeLock.acquire();
call.addListener(this);
+ Trace.endSection();
}
private void cleanup() {
+ Trace.beginSection("AnswerProximitySensor.Cleanup");
call.removeListener(this);
releaseProximityWakeLock();
+ Trace.endSection();
}
private void releaseProximityWakeLock() {
diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java
index 8d6620628..7c35e4b92 100644
--- a/java/com/android/incallui/call/CallList.java
+++ b/java/com/android/incallui/call/CallList.java
@@ -34,7 +34,6 @@ import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.enrichedcall.EnrichedCallComponent;
import com.android.dialer.enrichedcall.EnrichedCallManager;
-import com.android.dialer.location.GeoUtil;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
import com.android.dialer.shortcuts.ShortcutUsageReporter;
@@ -139,7 +138,7 @@ public class CallList implements DialerCallDelegate {
Spam.get(context)
.checkSpamStatus(
number,
- null,
+ call.getCountryIso(),
new SpamBindings.Listener() {
@Override
public void onComplete(boolean isSpam) {
@@ -196,7 +195,7 @@ public class CallList implements DialerCallDelegate {
}
},
call.getNumber(),
- GeoUtil.getCurrentCountryIso(context));
+ call.getCountryIso());
Trace.endSection();
if (call.getState() == DialerCall.State.INCOMING
@@ -257,7 +256,7 @@ public class CallList implements DialerCallDelegate {
Spam.get(context)
.checkUserMarkedNonSpamStatus(
number,
- null,
+ call.getCountryIso(),
new SpamBindings.Listener() {
@Override
public void onComplete(boolean isInUserWhiteList) {
@@ -268,7 +267,7 @@ public class CallList implements DialerCallDelegate {
Spam.get(context)
.checkGlobalSpamListStatus(
number,
- null,
+ call.getCountryIso(),
new SpamBindings.Listener() {
@Override
public void onComplete(boolean isInGlobalSpamList) {
@@ -279,7 +278,7 @@ public class CallList implements DialerCallDelegate {
Spam.get(context)
.checkUserMarkedSpamStatus(
number,
- null,
+ call.getCountryIso(),
new SpamBindings.Listener() {
@Override
public void onComplete(boolean isInUserSpamList) {
@@ -626,9 +625,11 @@ public class CallList implements DialerCallDelegate {
* listeners to call back to determine what changed.
*/
private void notifyGenericListeners() {
+ Trace.beginSection("CallList.notifyGenericListeners");
for (Listener listener : mListeners) {
listener.onCallListChange(this);
}
+ Trace.endSection();
}
private void notifyListenersOfDisconnect(DialerCall call) {
diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java
index 2511bb8ca..47a4a70f5 100644
--- a/java/com/android/incallui/call/DialerCall.java
+++ b/java/com/android/incallui/call/DialerCall.java
@@ -16,6 +16,7 @@
package com.android.incallui.call;
+import android.Manifest.permission;
import android.content.Context;
import android.hardware.camera2.CameraCharacteristics;
import android.net.Uri;
@@ -42,6 +43,7 @@ import android.telecom.VideoProfile;
import android.text.TextUtils;
import com.android.contacts.common.compat.CallCompat;
import com.android.contacts.common.compat.telecom.TelecomManagerCompat;
+import com.android.dialer.assisteddialing.TransformationInfo;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallIntentParser;
import com.android.dialer.callintent.CallSpecificAppData;
@@ -57,11 +59,14 @@ import com.android.dialer.enrichedcall.EnrichedCallManager.Filter;
import com.android.dialer.enrichedcall.EnrichedCallManager.StateChangedListener;
import com.android.dialer.enrichedcall.Session;
import com.android.dialer.lightbringer.LightbringerComponent;
+import com.android.dialer.location.GeoUtil;
import com.android.dialer.logging.ContactLookupResult;
import com.android.dialer.logging.ContactLookupResult.Type;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
+import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.theme.R;
+import com.android.dialer.util.PermissionsUtil;
import com.android.incallui.audiomode.AudioModeProvider;
import com.android.incallui.latencyreport.LatencyReport;
import com.android.incallui.util.TelecomCallUtil;
@@ -157,6 +162,9 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
private com.android.dialer.logging.VideoTech.Type selectedAvailableVideoTechType =
com.android.dialer.logging.VideoTech.Type.NONE;
+ private boolean isVoicemailNumber;
+ private List<PhoneAccountHandle> callCapableAccounts;
+ private String countryIso;
public static String getNumberFromHandle(Uri handle) {
return handle == null ? "" : handle.getSchemeSpecificPart();
@@ -449,6 +457,30 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
return mLogState.conferencedCalls != 0;
}
+ public boolean isVoiceMailNumber() {
+ return isVoicemailNumber;
+ }
+
+ public List<PhoneAccountHandle> getCallCapableAccounts() {
+ return callCapableAccounts;
+ }
+
+ public String getCountryIso() {
+ return countryIso;
+ }
+
+ private void updateIsVoiceMailNumber() {
+ if (getHandle() != null && PhoneAccount.SCHEME_VOICEMAIL.equals(getHandle().getScheme())) {
+ isVoicemailNumber = true;
+ }
+
+ if (!PermissionsUtil.hasPermission(mContext, permission.READ_PHONE_STATE)) {
+ isVoicemailNumber = false;
+ }
+
+ isVoicemailNumber = TelecomUtil.isVoicemailNumber(mContext, getAccountHandle(), getNumber());
+ }
+
private void update() {
Trace.beginSection("DialerCall.update");
int oldState = getState();
@@ -474,6 +506,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
Trace.endSection();
}
+ @SuppressWarnings("MissingPermission")
private void updateFromTelecomCall() {
Trace.beginSection("DialerCall.updateFromTelecomCall");
LogUtil.v("DialerCall.updateFromTelecomCall", mTelecomCall.toString());
@@ -509,6 +542,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
updateEmergencyCallState();
}
+ TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
// If the phone account handle of the call is set, cache capability bit indicating whether
// the phone account supports call subjects.
PhoneAccountHandle newPhoneAccountHandle = mTelecomCall.getDetails().getAccountHandle();
@@ -516,14 +550,18 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
mPhoneAccountHandle = newPhoneAccountHandle;
if (mPhoneAccountHandle != null) {
- PhoneAccount phoneAccount =
- mContext.getSystemService(TelecomManager.class).getPhoneAccount(mPhoneAccountHandle);
+ PhoneAccount phoneAccount = telecomManager.getPhoneAccount(mPhoneAccountHandle);
if (phoneAccount != null) {
mIsCallSubjectSupported =
phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_CALL_SUBJECT);
}
}
}
+ if (PermissionsUtil.hasPermission(mContext, permission.READ_PHONE_STATE)) {
+ updateIsVoiceMailNumber();
+ callCapableAccounts = telecomManager.getCallCapablePhoneAccounts();
+ countryIso = GeoUtil.getCurrentCountryIso(mContext);
+ }
Trace.endSection();
}
@@ -856,7 +894,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
}
public boolean isVideoCall() {
- return getVideoTech().isTransmittingOrReceiving();
+ return getVideoTech().isTransmittingOrReceiving() || VideoProfile.isVideo(getVideoState());
}
public boolean hasReceivedVideoUpgradeRequest() {
@@ -1036,6 +1074,14 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
return false;
}
+ public TransformationInfo getAssistedDialingExtras() {
+ if (isAssistedDialed()) {
+ return TransformationInfo.newInstanceFromBundle(
+ getIntentExtras().getBundle(TelephonyManagerCompat.ASSISTED_DIALING_EXTRAS));
+ }
+ return null;
+ }
+
public LatencyReport getLatencyReport() {
return mLatencyReport;
}
@@ -1139,9 +1185,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
if (callProviderLabel == null) {
PhoneAccount account = getPhoneAccount();
if (account != null && !TextUtils.isEmpty(account.getLabel())) {
- List<PhoneAccountHandle> accounts =
- mContext.getSystemService(TelecomManager.class).getCallCapablePhoneAccounts();
- if (accounts != null && accounts.size() > 1) {
+ if (callCapableAccounts != null && callCapableAccounts.size() > 1) {
callProviderLabel = account.getLabel().toString();
}
}
@@ -1211,9 +1255,11 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa
@Override
public void onSessionModificationStateChanged() {
+ Trace.beginSection("DialerCall.onSessionModificationStateChanged");
for (DialerCallListener listener : mListeners) {
listener.onDialerCallSessionModificationStateChange();
}
+ Trace.endSection();
}
@Override
diff --git a/java/com/android/incallui/contactgrid/BottomRow.java b/java/com/android/incallui/contactgrid/BottomRow.java
index 91f08ef3e..a0d118552 100644
--- a/java/com/android/incallui/contactgrid/BottomRow.java
+++ b/java/com/android/incallui/contactgrid/BottomRow.java
@@ -49,7 +49,6 @@ public class BottomRow {
public final boolean isForwardIconVisible;
public final boolean isSpamIconVisible;
public final boolean shouldPopulateAccessibilityEvent;
- public final boolean isAssistedDialedVisisble;
public Info(
@Nullable CharSequence label,
@@ -59,8 +58,7 @@ public class BottomRow {
boolean isHdIconVisible,
boolean isForwardIconVisible,
boolean isSpamIconVisible,
- boolean shouldPopulateAccessibilityEvent,
- boolean isAssistedDialedVisisble) {
+ boolean shouldPopulateAccessibilityEvent) {
this.label = label;
this.isTimerVisible = isTimerVisible;
this.isWorkIconVisible = isWorkIconVisible;
@@ -69,7 +67,6 @@ public class BottomRow {
this.isForwardIconVisible = isForwardIconVisible;
this.isSpamIconVisible = isSpamIconVisible;
this.shouldPopulateAccessibilityEvent = shouldPopulateAccessibilityEvent;
- this.isAssistedDialedVisisble = isAssistedDialedVisisble;
}
}
@@ -84,7 +81,6 @@ public class BottomRow {
boolean isHdAttemptingIconVisible = state.isHdAttempting;
boolean isSpamIconVisible = false;
boolean shouldPopulateAccessibilityEvent = true;
- boolean isAssistedDialedVisisble = state.isAssistedDialed;
if (isIncoming(state) && primaryInfo.isSpam) {
label = context.getString(R.string.contact_grid_incoming_suspected_spam);
@@ -118,8 +114,7 @@ public class BottomRow {
isHdIconVisible,
isForwardIconVisible,
isSpamIconVisible,
- shouldPopulateAccessibilityEvent,
- isAssistedDialedVisisble);
+ shouldPopulateAccessibilityEvent);
}
private static CharSequence getLabelForPhoneNumber(PrimaryInfo primaryInfo) {
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index c0ab9609f..8deee8263 100644
--- a/java/com/android/incallui/contactgrid/ContactGridManager.java
+++ b/java/com/android/incallui/contactgrid/ContactGridManager.java
@@ -61,7 +61,7 @@ public class ContactGridManager {
@Nullable private ImageView avatarImageView;
// Row 2: Mobile +1 (650) 253-0000
- // Row 2: [HD attempting icon]/[HD icon] [Assisted Dialing Icon] 00:15
+ // Row 2: [HD attempting icon]/[HD icon] 00:15
// Row 2: Call ended
// Row 2: Hanging up
// Row 2: [Alert sign] Suspected spam caller
@@ -69,7 +69,6 @@ public class ContactGridManager {
private final ImageView workIconImageView;
private final ImageView hdIconImageView;
private final ImageView forwardIconImageView;
- private final ImageView assistedDialingImageView;
private final TextView forwardedNumberView;
private final ImageView spamIconImageView;
private final ViewAnimator bottomTextSwitcher;
@@ -101,7 +100,6 @@ public class ContactGridManager {
hdIconImageView = view.findViewById(R.id.contactgrid_hdIcon);
forwardIconImageView = view.findViewById(R.id.contactgrid_forwardIcon);
forwardedNumberView = view.findViewById(R.id.contactgrid_forwardNumber);
- assistedDialingImageView = view.findViewById(R.id.contactgrid_assistedDialingIcon);
spamIconImageView = view.findViewById(R.id.contactgrid_spamIcon);
bottomTextSwitcher = view.findViewById(R.id.contactgrid_bottom_text_switcher);
bottomTextView = view.findViewById(R.id.contactgrid_bottom_text);
@@ -321,8 +319,6 @@ public class ContactGridManager {
bottomTextView.setText(info.label);
bottomTextView.setAllCaps(info.isSpamIconVisible);
workIconImageView.setVisibility(info.isWorkIconVisible ? View.VISIBLE : View.GONE);
- assistedDialingImageView.setVisibility(
- info.isAssistedDialedVisisble ? View.VISIBLE : View.GONE);
if (hdIconImageView.getVisibility() == View.GONE) {
if (info.isHdAttemptingIconVisible) {
hdIconImageView.setImageResource(R.drawable.asd_hd_icon);
diff --git a/java/com/android/incallui/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java
index 3593c991d..cfa7e1b86 100644
--- a/java/com/android/incallui/contactgrid/TopRow.java
+++ b/java/com/android/incallui/contactgrid/TopRow.java
@@ -173,6 +173,15 @@ public class TopRow {
return context.getString(R.string.incall_video_call_requesting);
}
}
+
+ if (state.isAssistedDialed) {
+ String countryCode =
+ String.valueOf(state.assistedDialingExtras.transformedNumberCountryCallingCode());
+ return context.getString(
+ R.string.incall_connecting_assited_dialed,
+ countryCode,
+ state.assistedDialingExtras.userHomeCountryCode());
+ }
return context.getString(R.string.incall_connecting);
}
}
diff --git a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml
index c545c25cd..ce355ea2d 100644
--- a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml
+++ b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml
@@ -31,10 +31,6 @@
style="@style/BottomRowIcon"
android:visibility="gone"/>
<ImageView
- android:id="@+id/contactgrid_assistedDialingIcon"
- style="@style/BottomRowIcon"
- android:src="@drawable/quantum_ic_language_vd_theme_24"/>
- <ImageView
android:id="@id/contactgrid_forwardIcon"
style="@style/BottomRowIcon"
android:src="@drawable/quantum_ic_forward_vd_theme_24"/>
diff --git a/java/com/android/incallui/contactgrid/res/values/strings.xml b/java/com/android/incallui/contactgrid/res/values/strings.xml
index eba4abf30..c6bdb11ba 100644
--- a/java/com/android/incallui/contactgrid/res/values/strings.xml
+++ b/java/com/android/incallui/contactgrid/res/values/strings.xml
@@ -24,6 +24,9 @@
in the connecting stage. -->
<string name="incall_connecting">Calling…</string>
+ <!-- Display information related to assisted dialing, for example Calling using +1 (US)… -->
+ <string name="incall_connecting_assited_dialed">Calling using +<xliff:g example="1" id="ad_country_code">%1$s</xliff:g> (<xliff:g example="1" id="ad_user_home_locale">%2$s</xliff:g>)\u2026</string>
+
<!-- Displayed above the contact name when an external call is being pulled to the local
device. -->
<string name="incall_transferring">Transferring…</string>
diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
index fe80276c9..4a50fbeaf 100644
--- a/java/com/android/incallui/incall/protocol/PrimaryCallState.java
+++ b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
@@ -21,6 +21,7 @@ import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.telecom.DisconnectCause;
import android.text.TextUtils;
+import com.android.dialer.assisteddialing.TransformationInfo;
import com.android.dialer.common.Assert;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCall.State;
@@ -68,6 +69,7 @@ public class PrimaryCallState {
public final @ButtonState int swapToSecondaryButtonState;
public final boolean isAssistedDialed;
@Nullable public final String customLabel;
+ @Nullable public final TransformationInfo assistedDialingExtras;
// TODO: Convert to autovalue. b/34502119
public static PrimaryCallState createEmptyPrimaryCallState() {
@@ -100,7 +102,8 @@ public class PrimaryCallState {
true /* supportsCallOnHold */,
ButtonState.NOT_SUPPORT /* swapToSecondaryButtonState */,
false /* isAssistedDialed */,
- customLabel);
+ customLabel,
+ null /* assistedDialingExtras */);
}
public PrimaryCallState(
@@ -127,7 +130,8 @@ public class PrimaryCallState {
boolean supportsCallOnHold,
@ButtonState int swapToSecondaryButtonState,
boolean isAssistedDialed,
- @Nullable String customLabel) {
+ @Nullable String customLabel,
+ @Nullable TransformationInfo assistedDialingExtras) {
this.state = state;
this.isVideoCall = isVideoCall;
this.sessionModificationState = sessionModificationState;
@@ -155,6 +159,7 @@ public class PrimaryCallState {
Assert.checkArgument(state == State.CALL_PENDING);
}
this.customLabel = customLabel;
+ this.assistedDialingExtras = assistedDialingExtras;
}
@Override
diff --git a/java/com/android/incallui/spam/SpamCallListListener.java b/java/com/android/incallui/spam/SpamCallListListener.java
index 6b2bdcef6..cf545c071 100644
--- a/java/com/android/incallui/spam/SpamCallListListener.java
+++ b/java/com/android/incallui/spam/SpamCallListListener.java
@@ -150,7 +150,7 @@ public class SpamCallListListener implements CallList.Listener {
}
NumberInCallHistoryWorker historyTask =
- new NumberInCallHistoryWorker(context, number, GeoUtil.getCurrentCountryIso(context));
+ new NumberInCallHistoryWorker(context, number, call.getCountryIso());
dialerExecutorFactory
.createNonUiTaskBuilder(historyTask)
.onSuccess((result) -> call.setCallHistoryStatus(result))