summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-08-15 07:24:26 (GMT)
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-08-15 07:24:26 (GMT)
commitfa70611bdcfcaef33e4f376d796083860ac86258 (patch)
tree7f98300ff2318f2eefb50d84ca2701a416590fb4
parentfb4a3213222d7c472e6f32df1a82adfbd2b0b39a (diff)
parent9a6afa3ae2bfc0074f7f64a7ec3238c26e913c3c (diff)
downloadandroid_packages_apps_Dialer-staging/lineage-15.0_rebase-android-8.0.0_r23.zip
android_packages_apps_Dialer-staging/lineage-15.0_rebase-android-8.0.0_r23.tar.gz
android_packages_apps_Dialer-staging/lineage-15.0_rebase-android-8.0.0_r23.tar.bz2
release-request-4be129b1-3f50-40d3-bbd4-30899b786745-for-git_oc-dr1-release-4273712 snap-temp-L56000000093068720staging/lineage-15.0_rebase-android-8.0.0_r23
Change-Id: I17e1756ec06b4ee5a5a3a98c327eec0b1a83d319
-rw-r--r--java/com/android/contacts/common/list/PhoneNumberListAdapter.java7
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java20
-rw-r--r--java/com/android/dialer/app/list/ListsFragment.java4
-rw-r--r--java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java6
-rw-r--r--java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java5
-rw-r--r--java/com/android/dialer/lightbringer/Lightbringer.java2
-rw-r--r--java/com/android/dialer/lightbringer/stub/LightbringerStub.java5
-rw-r--r--java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java4
-rw-r--r--java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java20
-rw-r--r--java/com/android/incallui/InCallPresenter.java13
-rw-r--r--java/com/android/incallui/VideoCallPresenter.java2
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java15
12 files changed, 64 insertions, 39 deletions
diff --git a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
index d1118c3..ae15eb2 100644
--- a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
+++ b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java
@@ -27,6 +27,7 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.SipAddress;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Directory;
+import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
@@ -357,7 +358,8 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
bindPhoneNumber(view, cursor, directory.isDisplayNumber(), position);
}
- protected void bindPhoneNumber(
+ @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+ public void bindPhoneNumber(
ContactListItemView view, Cursor cursor, boolean displayNumber, int position) {
CharSequence label = null;
if (displayNumber && !cursor.isNull(PhoneQuery.PHONE_TYPE)) {
@@ -397,7 +399,8 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter {
}
}
- if (LightbringerComponent.get(mContext).getLightbringer().isReachable(mContext, number)) {
+ if (action == ContactListItemView.NONE
+ && LightbringerComponent.get(mContext).getLightbringer().isReachable(mContext, number)) {
action = ContactListItemView.LIGHTBRINGER;
}
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index 884d07d..a4a2ba2 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -551,12 +551,15 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
private void bindActionButtons() {
boolean canPlaceCallToNumber = PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation);
+ // Hide the call buttons by default. We then set it to be visible when appropriate below.
+ // This saves us having to remember to set it to GONE in multiple places.
+ callButtonView.setVisibility(View.GONE);
+ videoCallButtonView.setVisibility(View.GONE);
+
if (isFullyUndialableVoicemail()) {
// Sometimes the voicemail server will report the message is from some non phone number
// source. If the number does not contains any dialable digit treat it as it is from a unknown
// number, remove all action buttons but still show the voicemail playback layout.
- callButtonView.setVisibility(View.GONE);
- videoCallButtonView.setVisibility(View.GONE);
detailsButtonView.setVisibility(View.GONE);
createNewContactButtonView.setVisibility(View.GONE);
addToExistingContactButtonView.setVisibility(View.GONE);
@@ -582,11 +585,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
if (canPlaceCallToNumber) {
- // Set up the call button but hide it by default (the primary action is to call so it is
- // redundant). We then set it to be visible when appropriate below. This saves us having to
- // remember to set it to GONE in multiple places.
callButtonView.setTag(IntentProvider.getReturnCallIntentProvider(number));
- callButtonView.setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(voicemailUri) && canPlaceCallToNumber) {
@@ -616,8 +615,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
} else if (lightbringerReady) {
videoCallButtonView.setTag(IntentProvider.getLightbringerIntentProvider(number));
videoCallButtonView.setVisibility(View.VISIBLE);
- } else {
- videoCallButtonView.setVisibility(View.GONE);
}
// For voicemail calls, show the voicemail playback layout; hide otherwise.
@@ -944,12 +941,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
String accountLabel = mCallLogCache.getAccountLabel(accountHandle);
if (!TextUtils.isEmpty(accountLabel)) {
SimDetails.Builder simDetails = SimDetails.newBuilder().setNetwork(accountLabel);
- int color = mCallLogCache.getAccountColor(accountHandle);
- if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) {
- simDetails.setColor(R.color.secondary_text_color);
- } else {
- simDetails.setColor(color);
- }
+ simDetails.setColor(mCallLogCache.getAccountColor(accountHandle));
contact.setSimDetails(simDetails.build());
}
return contact.build();
diff --git a/java/com/android/dialer/app/list/ListsFragment.java b/java/com/android/dialer/app/list/ListsFragment.java
index 3f03db1..dbb6c8b 100644
--- a/java/com/android/dialer/app/list/ListsFragment.java
+++ b/java/com/android/dialer/app/list/ListsFragment.java
@@ -75,7 +75,6 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
private SharedPreferences mPrefs;
private boolean mHasFetchedVoicemailStatus;
private boolean mShowVoicemailTabAfterVoicemailStatusIsFetched;
- private VoicemailStatusHelper mVoicemailStatusHelper;
private final ArrayList<OnPageChangeListener> mOnPageChangeListeners = new ArrayList<>();
/** The position of the currently selected tab. */
private int mTabIndex = TAB_INDEX_SPEED_DIAL;
@@ -99,7 +98,6 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
LogUtil.d("ListsFragment.onCreate", null);
Trace.beginSection(TAG + " onCreate");
super.onCreate(savedInstanceState);
- mVoicemailStatusHelper = new VoicemailStatusHelper();
mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
Trace.endSection();
}
@@ -294,7 +292,7 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
// Update hasActiveVoicemailProvider, which controls the number of tabs displayed.
boolean hasActiveVoicemailProvider =
- mVoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0;
+ VoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0;
if (hasActiveVoicemailProvider != mAdapter.hasActiveVoicemailProvider()) {
mAdapter.setHasActiveVoicemailProvider(hasActiveVoicemailProvider);
mAdapter.notifyDataSetChanged();
diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
index 5c9bc01..6d5015a 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
@@ -57,6 +57,7 @@ import com.android.dialer.constants.Constants;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
import com.android.dialer.phonenumbercache.CallLogQuery;
+import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.PermissionsUtil;
import com.google.common.io.ByteStreams;
import java.io.File;
@@ -515,6 +516,11 @@ public class VoicemailPlaybackPresenter
mView.disableUiElements();
mIsPrepared = false;
+ if (mContext != null && TelecomUtil.isInCall(mContext)) {
+ handleError(new IllegalStateException("Cannot play voicemail when call is in progress"));
+ return;
+ }
+
try {
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setOnPreparedListener(this);
diff --git a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
index 3df3c3a..ea12c4f 100644
--- a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
+++ b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
@@ -19,6 +19,7 @@ package com.android.dialer.calldetails;
import android.content.Context;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
+import android.telecom.PhoneAccount;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
@@ -93,7 +94,9 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder
if (!TextUtils.isEmpty(contact.getSimDetails().getNetwork())) {
networkView.setVisibility(View.VISIBLE);
networkView.setText(contact.getSimDetails().getNetwork());
- networkView.setTextColor(context.getResources().getColor(contact.getSimDetails().getColor()));
+ if (contact.getSimDetails().getColor() != PhoneAccount.NO_HIGHLIGHT_COLOR) {
+ networkView.setTextColor(contact.getSimDetails().getColor());
+ }
}
if (TextUtils.isEmpty(contact.getNumber())) {
diff --git a/java/com/android/dialer/lightbringer/Lightbringer.java b/java/com/android/dialer/lightbringer/Lightbringer.java
index 669e571..8bfa773 100644
--- a/java/com/android/dialer/lightbringer/Lightbringer.java
+++ b/java/com/android/dialer/lightbringer/Lightbringer.java
@@ -27,6 +27,8 @@ import android.telecom.PhoneAccountHandle;
public interface Lightbringer {
+ boolean isEnabled();
+
@MainThread
boolean isReachable(@NonNull Context context, @Nullable String number);
diff --git a/java/com/android/dialer/lightbringer/stub/LightbringerStub.java b/java/com/android/dialer/lightbringer/stub/LightbringerStub.java
index 1cb3c1f..e691b96 100644
--- a/java/com/android/dialer/lightbringer/stub/LightbringerStub.java
+++ b/java/com/android/dialer/lightbringer/stub/LightbringerStub.java
@@ -34,6 +34,11 @@ public class LightbringerStub implements Lightbringer {
@Inject
public LightbringerStub() {}
+ @Override
+ public boolean isEnabled() {
+ return false;
+ }
+
@MainThread
@Override
public boolean isReachable(@NonNull Context context, @Nullable String number) {
diff --git a/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java b/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
index a1fc29e..3f519ad 100644
--- a/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
+++ b/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
@@ -45,7 +45,6 @@ public class VisualVoicemailEnabledChecker implements CallLogQueryHandler.Listen
private SharedPreferences mPrefs;
private boolean mHasActiveVoicemailProvider;
private CallLogQueryHandler mCallLogQueryHandler;
- private VoicemailStatusHelper mVoicemailStatusHelper;
private Context mContext;
private Callback mCallback;
@@ -53,7 +52,6 @@ public class VisualVoicemailEnabledChecker implements CallLogQueryHandler.Listen
mContext = context;
mCallback = callback;
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
- mVoicemailStatusHelper = new VoicemailStatusHelper();
mHasActiveVoicemailProvider = mPrefs.getBoolean(PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER, false);
}
@@ -77,7 +75,7 @@ public class VisualVoicemailEnabledChecker implements CallLogQueryHandler.Listen
@Override
public void onVoicemailStatusFetched(Cursor statusCursor) {
boolean hasActiveVoicemailProvider =
- mVoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0;
+ VoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0;
if (hasActiveVoicemailProvider != mHasActiveVoicemailProvider) {
mHasActiveVoicemailProvider = hasActiveVoicemailProvider;
mPrefs
diff --git a/java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java b/java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java
index 9df45c2..313fc1b 100644
--- a/java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java
+++ b/java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java
@@ -21,15 +21,17 @@ import android.provider.VoicemailContract.Status;
import com.android.dialer.database.VoicemailStatusQuery;
/**
- * Interface used by the call log UI to determine what user message, if any, related to voicemail
+ * Utility used by the call log UI to determine what user message, if any, related to voicemail
* source status needs to be shown. The messages are returned in the order of importance.
*
- * <p>The implementation of this interface interacts with the voicemail content provider to fetch
- * statuses of all the registered voicemail sources and determines if any status message needs to be
- * shown. The user of this interface must observe/listen to provider changes and invoke this class
- * to check if any message needs to be shown.
+ * <p>This class interacts with the voicemail content provider to fetch statuses of all the
+ * registered voicemail sources and determines if any status message needs to be shown. The user of
+ * this class must observe/listen to provider changes and invoke this class to check if any message
+ * needs to be shown.
*/
-public class VoicemailStatusHelper {
+public final class VoicemailStatusHelper {
+
+ private VoicemailStatusHelper() {}
/**
* Returns the number of active voicemail sources installed.
@@ -39,7 +41,7 @@ public class VoicemailStatusHelper {
* @param cursor The caller is responsible for the life cycle of the cursor and resetting the
* position
*/
- public int getNumberActivityVoicemailSources(Cursor cursor) {
+ public static int getNumberActivityVoicemailSources(Cursor cursor) {
int count = 0;
if (!cursor.moveToFirst()) {
return 0;
@@ -60,8 +62,10 @@ public class VoicemailStatusHelper {
* activation is attempted, it will transition into CONFIGURING then into OK or other error state,
* NOT_CONFIGURED is never set through an error.
*/
- private boolean isVoicemailSourceActive(Cursor cursor) {
+ private static boolean isVoicemailSourceActive(Cursor cursor) {
return cursor.getString(VoicemailStatusQuery.SOURCE_PACKAGE_INDEX) != null
+ // getInt() returns 0 when null
+ && !cursor.isNull(VoicemailStatusQuery.CONFIGURATION_STATE_INDEX)
&& cursor.getInt(VoicemailStatusQuery.CONFIGURATION_STATE_INDEX)
!= Status.CONFIGURATION_STATE_NOT_CONFIGURED;
}
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index 1528e7d..563468e 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -189,6 +189,8 @@ public class InCallPresenter implements CallList.Listener {
/** Determines if the InCall UI is in fullscreen mode or not. */
private boolean mIsFullScreen = false;
+ private boolean mScreenTimeoutEnabled = true;
+
private PhoneStateListener mPhoneStateListener =
new PhoneStateListener() {
@Override
@@ -395,6 +397,7 @@ public class InCallPresenter implements CallList.Listener {
}
private void attemptFinishActivity() {
+ mScreenTimeoutEnabled = true;
final boolean doFinish = (mInCallActivity != null && isActivityStarted());
LogUtil.i("InCallPresenter.attemptFinishActivity", "Hide in call UI: " + doFinish);
if (doFinish) {
@@ -1064,6 +1067,7 @@ public class InCallPresenter implements CallList.Listener {
// TODO - b/36649622: Investigate this redundant call
mStatusBarNotifier.updateNotification(mCallList);
}
+ applyScreenTimeout();
}
/*package*/
@@ -1577,13 +1581,18 @@ public class InCallPresenter implements CallList.Listener {
public void enableScreenTimeout(boolean enable) {
LogUtil.v("InCallPresenter.enableScreenTimeout", "enableScreenTimeout: value=" + enable);
+ mScreenTimeoutEnabled = enable;
+ applyScreenTimeout();
+ }
+
+ private void applyScreenTimeout() {
if (mInCallActivity == null) {
- LogUtil.e("InCallPresenter.enableScreenTimeout", "InCallActivity is null.");
+ LogUtil.e("InCallPresenter.applyScreenTimeout", "InCallActivity is null.");
return;
}
final Window window = mInCallActivity.getWindow();
- if (enable) {
+ if (mScreenTimeoutEnabled) {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java
index a106022..5b4178d 100644
--- a/java/com/android/incallui/VideoCallPresenter.java
+++ b/java/com/android/incallui/VideoCallPresenter.java
@@ -867,7 +867,7 @@ public class VideoCallPresenter
false /* isRemotelyHeld */);
enableCamera(mVideoCall, false);
InCallPresenter.getInstance().setFullScreen(false);
-
+ InCallPresenter.getInstance().enableScreenTimeout(false);
mIsVideoMode = false;
}
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index 502cc52..708bfab 100644
--- a/java/com/android/incallui/contactgrid/ContactGridManager.java
+++ b/java/com/android/incallui/contactgrid/ContactGridManager.java
@@ -32,6 +32,7 @@ import android.widget.ViewAnimator;
import com.android.contacts.common.compat.PhoneNumberUtilsCompat;
import com.android.contacts.common.lettertiles.LetterTileDrawable;
import com.android.dialer.common.Assert;
+import com.android.dialer.common.LogUtil;
import com.android.dialer.util.DrawableConverter;
import com.android.incallui.incall.protocol.ContactPhotoType;
import com.android.incallui.incall.protocol.PrimaryCallState;
@@ -347,12 +348,16 @@ public class ContactGridManager {
}
if (info.isTimerVisible) {
+ bottomTextSwitcher.setDisplayedChild(1);
+ bottomTimerView.setBase(
+ primaryCallState.connectTimeMillis
+ - System.currentTimeMillis()
+ + SystemClock.elapsedRealtime());
if (!isTimerStarted) {
- bottomTextSwitcher.setDisplayedChild(1);
- bottomTimerView.setBase(
- primaryCallState.connectTimeMillis
- - System.currentTimeMillis()
- + SystemClock.elapsedRealtime());
+ LogUtil.i(
+ "ContactGridManager.updateBottomRow",
+ "starting timer with base: %d",
+ bottomTimerView.getBase());
bottomTimerView.start();
isTimerStarted = true;
}