diff options
Diffstat (limited to 'java/com/android/dialer/app')
17 files changed, 106 insertions, 25 deletions
diff --git a/java/com/android/dialer/app/DialtactsActivity.java b/java/com/android/dialer/app/DialtactsActivity.java index 527dbff18..1c9718e40 100644 --- a/java/com/android/dialer/app/DialtactsActivity.java +++ b/java/com/android/dialer/app/DialtactsActivity.java @@ -74,6 +74,7 @@ import com.android.dialer.app.calllog.CallLogActivity; import com.android.dialer.app.calllog.CallLogAdapter; import com.android.dialer.app.calllog.CallLogFragment; import com.android.dialer.app.calllog.CallLogNotificationsService; +import com.android.dialer.app.calllog.IntentProvider; import com.android.dialer.app.dialpad.DialpadFragment; import com.android.dialer.app.list.DialtactsPagerAdapter; import com.android.dialer.app.list.DialtactsPagerAdapter.TabIndex; @@ -90,6 +91,7 @@ import com.android.dialer.app.settings.DialerSettingsActivity; import com.android.dialer.app.widget.ActionBarController; import com.android.dialer.app.widget.SearchEditTextLayout; import com.android.dialer.callcomposer.CallComposerActivity; +import com.android.dialer.calldetails.CallDetailsActivity; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.common.Assert; @@ -173,6 +175,7 @@ public class DialtactsActivity extends TransactionSafeActivity private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1; public static final int ACTIVITY_REQUEST_CODE_CALL_COMPOSE = 2; public static final int ACTIVITY_REQUEST_CODE_LIGHTBRINGER = 3; + public static final int ACTIVITY_REQUEST_CODE_CALL_DETAILS = 4; private static final int FAB_SCALE_IN_DELAY_MS = 300; @@ -284,7 +287,7 @@ public class DialtactsActivity extends TransactionSafeActivity } mSearchQuery = newText; - // TODO: show p13n when newText is empty. + // TODO(calderwoodra): show p13n when newText is empty. // Show search fragment only when the query string is changed to non-empty text. if (!TextUtils.isEmpty(newText)) { // Call enterSearchUi only if we are switching search modes, or showing a search @@ -595,7 +598,7 @@ public class DialtactsActivity extends TransactionSafeActivity new P13nRefreshCompleteListener() { @Override public void onP13nRefreshComplete() { - // TODO: make zero-query search results visible + // TODO(strongarm): make zero-query search results visible } }); Trace.endSection(); @@ -789,6 +792,19 @@ public class DialtactsActivity extends TransactionSafeActivity } else { LogUtil.i("DialtactsActivity.onActivityResult", "returned from call composer, no error"); } + } else if (requestCode == ACTIVITY_REQUEST_CODE_CALL_DETAILS) { + if (resultCode == RESULT_OK + && data != null + && data.getBooleanExtra(CallDetailsActivity.EXTRA_HAS_ENRICHED_CALL_DATA, false)) { + String number = data.getStringExtra(CallDetailsActivity.EXTRA_PHONE_NUMBER); + int snackbarDurationMillis = 5_000; + Snackbar.make(mParentLayout, getString(R.string.ec_data_deleted), snackbarDurationMillis) + .setAction( + R.string.view_conversation, + v -> startActivity(IntentProvider.getSendSmsIntentProvider(number).getIntent(this))) + .setActionTextColor(getResources().getColor(R.color.dialer_snackbar_action_text_color)) + .show(); + } } super.onActivityResult(requestCode, resultCode, data); } @@ -1061,6 +1077,9 @@ public class DialtactsActivity extends TransactionSafeActivity // but it is quickly removed and shown the contacts tab. if (mListsFragment != null) { mListsFragment.showTab(tabIndex); + PerformanceReport.setStartingTabIndex(tabIndex); + } else { + PerformanceReport.setStartingTabIndex(DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL); } } } @@ -1152,7 +1171,7 @@ public class DialtactsActivity extends TransactionSafeActivity } transaction.add(R.id.dialtacts_frame, fragment, tag); } else { - // TODO: if this is a transition from dialpad to searchbar, animate fragment + // TODO(calderwoodra): if this is a transition from dialpad to searchbar, animate fragment // down, and vice versa. Perhaps just add a coordinator behavior with the search bar. transaction.show(fragment); } @@ -1165,7 +1184,7 @@ public class DialtactsActivity extends TransactionSafeActivity ((SearchFragment) fragment) .setShowEmptyListForNullQuery(mP13nRanker.shouldShowEmptyListForNullQuery()); } else { - // TODO: add p13n ranker to new search. + // TODO(calderwoodra): add p13n ranker to new search. } if (!smartDialSearch && !useNewSearch) { diff --git a/java/com/android/dialer/app/calllog/CallLogActivity.java b/java/com/android/dialer/app/calllog/CallLogActivity.java index 6433af9a6..35e05bc39 100644 --- a/java/com/android/dialer/app/calllog/CallLogActivity.java +++ b/java/com/android/dialer/app/calllog/CallLogActivity.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.os.Bundle; import android.provider.CallLog; import android.provider.CallLog.Calls; +import android.support.design.widget.Snackbar; import android.support.v13.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; @@ -31,7 +32,10 @@ import android.view.ViewGroup; import com.android.contacts.common.list.ViewPagerTabs; import com.android.dialer.app.DialtactsActivity; import com.android.dialer.app.R; +import com.android.dialer.app.calllog.ClearCallLogDialog.Listener; +import com.android.dialer.calldetails.CallDetailsActivity; import com.android.dialer.database.CallLogQueryHandler; +import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.logging.Logger; import com.android.dialer.logging.ScreenEvent; import com.android.dialer.logging.UiAction; @@ -42,7 +46,7 @@ import com.android.dialer.util.ViewUtil; /** Activity for viewing call history. */ public class CallLogActivity extends TransactionSafeActivity - implements ViewPager.OnPageChangeListener { + implements ViewPager.OnPageChangeListener, Listener { private static final int TAB_INDEX_ALL = 0; private static final int TAB_INDEX_MISSED = 1; @@ -144,7 +148,7 @@ public class CallLogActivity extends TransactionSafeActivity startActivity(intent); return true; } else if (item.getItemId() == R.id.delete_all) { - ClearCallLogDialog.show(getFragmentManager()); + ClearCallLogDialog.show(getFragmentManager(), this); return true; } return super.onOptionsItemSelected(item); @@ -180,6 +184,15 @@ public class CallLogActivity extends TransactionSafeActivity } @Override + public void callHistoryDeleted() { + if (EnrichedCallComponent.get(this).getEnrichedCallManager().hasStoredData()) { + Snackbar.make( + findViewById(R.id.calllog_frame), getString(R.string.multiple_ec_data_deleted), 5_000) + .show(); + } + } + + @Override public void onBackPressed() { PerformanceReport.recordClick(UiAction.Type.PRESS_ANDROID_BACK_BUTTON); super.onBackPressed(); @@ -229,4 +242,22 @@ public class CallLogActivity extends TransactionSafeActivity return TAB_INDEX_COUNT; } } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == DialtactsActivity.ACTIVITY_REQUEST_CODE_CALL_DETAILS) { + if (resultCode == RESULT_OK + && data != null + && data.getBooleanExtra(CallDetailsActivity.EXTRA_HAS_ENRICHED_CALL_DATA, false)) { + String number = data.getStringExtra(CallDetailsActivity.EXTRA_PHONE_NUMBER); + Snackbar.make(findViewById(R.id.calllog_frame), getString(R.string.ec_data_deleted), 5_000) + .setAction( + R.string.view_conversation, + v -> startActivity(IntentProvider.getSendSmsIntentProvider(number).getIntent(this))) + .setActionTextColor(getResources().getColor(R.color.dialer_snackbar_action_text_color)) + .show(); + } + } + super.onActivityResult(requestCode, resultCode, data); + } } diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index f1d051a8c..4966d7fba 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -317,6 +317,15 @@ public class CallLogAdapter extends GroupingListAdapter Logger.get(mActivity) .logImpression(DialerImpression.Type.MULTISELECT_SINGLE_PRESS_SELECT_ENTRY); checkMarkCallLogEntry(viewHolder); + // select all check box logic + if (getItemCount() == selectedItems.size()) { + LogUtil.i( + "mExpandCollapseListener.onClick", + "getitem count %d is equal to items select count %d, check select all box", + getItemCount(), + selectedItems.size()); + mMultiSelectRemoveView.tapSelectAll(); + } } return; } @@ -416,7 +425,7 @@ public class CallLogAdapter extends GroupingListAdapter * Holds a list of URIs that are pending deletion or undo. If the activity ends before the undo * timeout, all of the pending URIs will be deleted. * - * <p>TODO: move this and OnVoicemailDeletedListener to somewhere like {@link + * <p>TODO(twyen): move this and OnVoicemailDeletedListener to somewhere like {@link * VisualVoicemailCallLogFragment}. The CallLogAdapter does not need to know about what to do with * hidden item or what to hide. */ @@ -1394,5 +1403,7 @@ public class CallLogAdapter extends GroupingListAdapter void showMultiSelectRemoveView(boolean show); void setSelectAllModeToFalse(); + + void tapSelectAll(); } } diff --git a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java index 10866aae2..b1ad0d9a2 100644 --- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java +++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java @@ -110,7 +110,8 @@ public class CallLogAsyncTaskUtil { } public static void markCallAsRead(@NonNull final Context context, @NonNull final long[] callIds) { - if (!PermissionsUtil.hasPhonePermissions(context)) { + if (!PermissionsUtil.hasPhonePermissions(context) + || !PermissionsUtil.hasCallLogWritePermissions(context)) { return; } if (sAsyncTaskExecutor == null) { diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index b03a4ad64..aa765d90e 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -664,6 +664,13 @@ public class CallLogFragment extends Fragment } @Override + public void tapSelectAll() { + LogUtil.i("CallLogFragment.tapSelectAll", "imitating select all"); + selectAllMode = true; + updateSelectAllIcon(); + } + + @Override public void onClick(View v) { selectAllMode = !selectAllMode; if (selectAllMode) { diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index c59f0dd61..b8b029f7b 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -877,14 +877,13 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder // We check to see if we are starting a Lightbringer intent. The reason is Lightbringer // intents need to be started using startActivityForResult instead of the usual startActivity String packageName = intent.getPackage(); - if (getLightbringer().getPackageName().equals(packageName)) { + if (packageName != null && packageName.equals(getLightbringer().getPackageName())) { startLightbringerActivity(intent); + } else if (CallDetailsActivity.isLaunchIntent(intent)) { + PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL); + ((Activity) mContext) + .startActivityForResult(intent, DialtactsActivity.ACTIVITY_REQUEST_CODE_CALL_DETAILS); } else { - if (intent.getComponent() != null - && CallDetailsActivity.class.getName().equals(intent.getComponent().getClassName())) { - // We are going to open call detail - PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL); - } DialerUtils.startActivityWithErrorToast(mContext, intent); } } diff --git a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java index 155a91618..5c3d4d9fa 100644 --- a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java +++ b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java @@ -29,16 +29,21 @@ import android.content.DialogInterface.OnClickListener; import android.os.AsyncTask; import android.os.Bundle; import android.provider.CallLog.Calls; +import android.support.annotation.NonNull; import com.android.dialer.app.R; +import com.android.dialer.common.Assert; import com.android.dialer.phonenumbercache.CachedNumberLookupService; import com.android.dialer.phonenumbercache.PhoneNumberCache; /** Dialog that clears the call log after confirming with the user */ public class ClearCallLogDialog extends DialogFragment { + private Listener listener; + /** Preferred way to show this dialog */ - public static void show(FragmentManager fragmentManager) { + public static void show(FragmentManager fragmentManager, @NonNull Listener listener) { ClearCallLogDialog dialog = new ClearCallLogDialog(); + dialog.listener = Assert.isNotNull(listener); dialog.show(fragmentManager, "deleteCallLog"); } @@ -76,6 +81,7 @@ public class ClearCallLogDialog extends DialogFragment { return; } + listener.callHistoryDeleted(); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } @@ -96,4 +102,8 @@ public class ClearCallLogDialog extends DialogFragment { .setCancelable(true) .create(); } + + interface Listener { + void callHistoryDeleted(); + } } diff --git a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java index 82fc229af..155a6a2eb 100644 --- a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java +++ b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java @@ -163,7 +163,7 @@ public class ContactInfoCache { if (request.isLocalRequest()) { info = mContactInfoHelper.lookupNumber(request.number, request.countryIso); if (info != null && !info.contactExists) { - // TODO: Maybe skip look up if it's already available in cached number lookup + // TODO(wangqi): Maybe skip look up if it's already available in cached number lookup // service. long start = SystemClock.elapsedRealtime(); mContactInfoHelper.updateFromCequintCallerId(mCequintCallerIdManager, info, request.number); diff --git a/java/com/android/dialer/app/dialpad/DialpadFragment.java b/java/com/android/dialer/app/dialpad/DialpadFragment.java index d33943773..3cd3ac27c 100644 --- a/java/com/android/dialer/app/dialpad/DialpadFragment.java +++ b/java/com/android/dialer/app/dialpad/DialpadFragment.java @@ -1185,6 +1185,10 @@ public class DialpadFragment extends Fragment mDialpadView.setVisibility(View.GONE); } + if (mOverflowPopupMenu != null) { + mOverflowPopupMenu.dismiss(); + } + mFloatingActionButtonController.setVisible(false); mDialpadChooser.setVisibility(View.VISIBLE); diff --git a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_add_call.png b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_add_call.png Binary files differindex 4e0d5649e..4e0d5649e 100644..100755 --- a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_add_call.png +++ b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_add_call.png diff --git a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_current_call.png b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_current_call.png Binary files differindex 2cf41d598..2cf41d598 100644..100755 --- a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_current_call.png +++ b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_current_call.png diff --git a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_tt_keypad.png b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_tt_keypad.png Binary files differindex 043685fd9..043685fd9 100644..100755 --- a/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_tt_keypad.png +++ b/java/com/android/dialer/app/res/drawable-hdpi/ic_dialer_fork_tt_keypad.png diff --git a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java index a7cfc0c00..b86ce8229 100644 --- a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java +++ b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java @@ -82,10 +82,9 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { return; } - if (UserManagerCompat.isUserUnlocked(context) - && VoicemailComponent.get(context) - .getVoicemailClient() - .isActivated(context, phoneAccountHandle)) { + if (VoicemailComponent.get(context) + .getVoicemailClient() + .isActivated(context, phoneAccountHandle)) { LogUtil.i( "LegacyVoicemailNotificationReceiver.onReceive", "visual voicemail is activated, ignoring notification"); diff --git a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java index a0bae36cc..bc6ffb5a7 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java +++ b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java @@ -92,7 +92,7 @@ public class VoicemailErrorManager implements CallLogQueryHandler.Listener, Voic } } alertItem.updateStatus(statuses, this); - // TODO: b/30668323 support error from multiple sources. + // TODO(twyen): b/30668323 support error from multiple sources. return; } diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java index f160e024e..9c1e446ab 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java +++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java @@ -85,7 +85,7 @@ public class VoicemailPlaybackLayout extends LinearLayout // When the undo button is pressed, the viewHolder we have is no longer valid because when // we hide the view it is binded to something else, and the layout is not updated for // hidden items. copy the adapter position so we can update the view upon undo. - // TODO: refactor this so the view holder will always be valid. + // TODO(twyen): refactor this so the view holder will always be valid. final int adapterPosition = mViewHolder.getAdapterPosition(); mPresenter.pausePlayback(); diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java index 3f0ed1f58..cf6564a74 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java @@ -72,11 +72,11 @@ public class VoicemailTosMessageCreator { @Nullable VoicemailErrorMessage maybeCreateTosMessage() { - // TODO: add filtering based on carrier + // TODO(mdooley): add filtering based on carrier if (hasAcceptedTos()) { return null; } - // TODO: temporarily skip the terms of service for dogfood builds + // TODO(mdooley): temporarily skip the terms of service for dogfood builds if (BuildType.get() == BuildType.DOGFOOD) { LogUtil.i( "VoicemailTosMessageCreator.maybeCreateTosMessage", diff --git a/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java b/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java index e639eff23..d3024f4c5 100644 --- a/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java @@ -259,7 +259,7 @@ public class Vvm3VoicemailMessageCreator { @NonNull private static CharSequence getCustomerSupportString(Context context, int id) { - // TODO: get number based on the country the user is currently in. + // TODO(twyen): get number based on the country the user is currently in. return ContactDisplayUtils.getTtsSpannedPhoneNumber( context.getResources(), id, |