(The behavior is undefined if the resource or package doesn't exist.) */ - @VisibleForTesting - static CharSequence getResourceText( + private static CharSequence getResourceText( Context context, String packageName, int resId, String defaultValue) { if (resId != -1 && packageName != null) { final PackageManager pm = context.getPackageManager(); @@ -139,10 +132,6 @@ public abstract class AccountType { return true; } - public boolean isExtension() { - return false; - } - /** * @return True if contacts can be created and edited using this app. If false, there could still * be an external editor as provided by {@link #getEditContactActivityClassName()} or {@link @@ -150,26 +139,6 @@ public abstract class AccountType { */ public abstract boolean areContactsWritable(); - /** - * Returns an optional custom edit activity. - * - *
Only makes sense for non-embedded account types. The activity class should reside in the - * sync adapter package as determined by {@link #syncAdapterPackageName}. - */ - public String getEditContactActivityClassName() { - return null; - } - - /** - * Returns an optional custom new contact activity. - * - *
Only makes sense for non-embedded account types. The activity class should reside in the
- * sync adapter package as determined by {@link #syncAdapterPackageName}.
- */
- public String getCreateContactActivityClassName() {
- return null;
- }
-
/**
* Returns an optional custom invite contact activity.
*
diff --git a/java/com/android/contacts/common/model/account/AccountWithDataSet.java b/java/com/android/contacts/common/model/account/AccountWithDataSet.java
index 71faf509cf98557afe4cef8054cae2b02730eab1..54e9a3cea05f3a1089e3167df55e42ed45e7069b 100644
--- a/java/com/android/contacts/common/model/account/AccountWithDataSet.java
+++ b/java/com/android/contacts/common/model/account/AccountWithDataSet.java
@@ -45,18 +45,7 @@ public class AccountWithDataSet implements Parcelable {
return new AccountWithDataSet[size];
}
};
- private static final String STRINGIFY_SEPARATOR = "\u0001";
- private static final String ARRAY_STRINGIFY_SEPARATOR = "\u0002";
- private static final Pattern STRINGIFY_SEPARATOR_PAT =
- Pattern.compile(Pattern.quote(STRINGIFY_SEPARATOR));
- private static final Pattern ARRAY_STRINGIFY_SEPARATOR_PAT =
- Pattern.compile(Pattern.quote(ARRAY_STRINGIFY_SEPARATOR));
- private static final String[] ID_PROJECTION = new String[] {BaseColumns._ID};
- private static final Uri RAW_CONTACTS_URI_LIMIT_1 =
- RawContacts.CONTENT_URI
- .buildUpon()
- .appendQueryParameter(ContactsContract.LIMIT_PARAM_KEY, "1")
- .build();
+
public final String name;
public final String type;
public final String dataSet;
@@ -80,81 +69,6 @@ public class AccountWithDataSet implements Parcelable {
return TextUtils.isEmpty(text) ? null : text;
}
- private static StringBuilder addStringified(StringBuilder sb, AccountWithDataSet account) {
- if (!TextUtils.isEmpty(account.name)) {
- sb.append(account.name);
- }
- sb.append(STRINGIFY_SEPARATOR);
- if (!TextUtils.isEmpty(account.type)) {
- sb.append(account.type);
- }
- sb.append(STRINGIFY_SEPARATOR);
- if (!TextUtils.isEmpty(account.dataSet)) {
- sb.append(account.dataSet);
- }
-
- return sb;
- }
-
- /**
- * Unpack a string created by {@link #stringify}.
- *
- * @throws IllegalArgumentException if it's an invalid string.
- */
- public static AccountWithDataSet unstringify(String s) {
- final String[] array = STRINGIFY_SEPARATOR_PAT.split(s, 3);
- if (array.length < 3) {
- throw new IllegalArgumentException("Invalid string " + s);
- }
- return new AccountWithDataSet(
- array[0], array[1], TextUtils.isEmpty(array[2]) ? null : array[2]);
- }
-
- /** Pack a list of {@link AccountWithDataSet} into a string. */
- public static String stringifyList(List 1) Only searches token prefixes. A token is defined as any combination of letters or
- * numbers.
- *
- * 2) Returns the starting index where the substring is found.
- *
- * @param value The string to search.
- * @param substring The substring to look for.
- * @return The starting index where the substring is found. {@literal -1} if substring is not
- * found in value.
- */
- @VisibleForTesting
- static int contains(String value, String substring) {
- if (value.length() < substring.length()) {
- return -1;
- }
-
- // i18n support
- // Generate the code points for the substring once.
- // There will be a maximum of substring.length code points. But may be fewer.
- // Since the array length is not an accurate size, we need to keep a separate variable.
- final int[] substringCodePoints = new int[substring.length()];
- int substringLength = 0; // may not equal substring.length()!!
- for (int i = 0; i < substring.length(); ) {
- final int codePoint = Character.codePointAt(substring, i);
- substringCodePoints[substringLength] = codePoint;
- substringLength++;
- i += Character.charCount(codePoint);
- }
-
- for (int i = 0; i < value.length(); i = findNextTokenStart(value, i)) {
- int numMatch = 0;
- for (int j = i; j < value.length() && numMatch < substringLength; ++numMatch) {
- int valueCp = Character.toLowerCase(value.codePointAt(j));
- int substringCp = substringCodePoints[numMatch];
- if (valueCp != substringCp) {
- break;
- }
- j += Character.charCount(valueCp);
- }
- if (numMatch == substringLength) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Find the start of the next token. A token is composed of letters and numbers. Any other
- * character are considered delimiters.
- *
- * @param line The string to search for the next token.
- * @param startIndex The index to start searching. 0 based indexing.
- * @return The index for the start of the next token. line.length() if next token not found.
- */
- @VisibleForTesting
- static int findNextTokenStart(String line, int startIndex) {
- int index = startIndex;
-
- // If already in token, eat remainder of token.
- while (index <= line.length()) {
- if (index == line.length()) {
- // No more tokens.
- return index;
- }
- final int codePoint = line.codePointAt(index);
- if (!Character.isLetterOrDigit(codePoint)) {
- break;
- }
- index += Character.charCount(codePoint);
- }
-
- // Out of token, eat all consecutive delimiters.
- while (index <= line.length()) {
- if (index == line.length()) {
- return index;
- }
- final int codePoint = line.codePointAt(index);
- if (Character.isLetterOrDigit(codePoint)) {
- break;
- }
- index += Character.charCount(codePoint);
- }
-
- return index;
- }
-
- /**
- * Anything other than letter and numbers are considered delimiters. Remove start and end
- * delimiters since they are not relevant to search.
- *
- * @param query The query string to clean.
- * @return The cleaned query. Empty string if all characters are cleaned out.
- */
- public static String cleanStartAndEndOfSearchQuery(String query) {
- int start = 0;
- while (start < query.length()) {
- int codePoint = query.codePointAt(start);
- if (Character.isLetterOrDigit(codePoint)) {
- break;
- }
- start += Character.charCount(codePoint);
- }
-
- if (start == query.length()) {
- // All characters are delimiters.
- return "";
- }
-
- int end = query.length() - 1;
- while (end > -1) {
- if (Character.isLowSurrogate(query.charAt(end))) {
- // Assume valid i18n string. There should be a matching high surrogate before it.
- end--;
- }
- int codePoint = query.codePointAt(end);
- if (Character.isLetterOrDigit(codePoint)) {
- break;
- }
- end--;
- }
-
- // end is a letter or digit.
- return query.substring(start, end + 1);
- }
-
- public static class MatchedLine {
-
- public int startIndex = -1;
- public String line;
-
- @Override
- public String toString() {
- return "MatchedLine{" + "line='" + line + '\'' + ", startIndex=" + startIndex + '}';
- }
- }
-}
diff --git a/java/com/android/contacts/common/util/StopWatch.java b/java/com/android/contacts/common/util/StopWatch.java
deleted file mode 100644
index 7986d1081a29b595fcd1cd0d5b2a7664b562b108..0000000000000000000000000000000000000000
--- a/java/com/android/contacts/common/util/StopWatch.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.contacts.common.util;
-
-import com.android.dialer.common.LogUtil;
-import java.util.ArrayList;
-
-/** A {@link StopWatch} records start, laps and stop, and print them to logcat. */
-public class StopWatch {
-
- private final String mLabel;
-
- private final ArrayList Note that this has to be a {@link ConcurrentMap} as the match info for each row in the UI is
- * loaded in a background thread spawned when the ViewHolder is bound.
- */
- private final ConcurrentMap This method should be called in tests to disable such processing of requests when not
- * needed.
- */
- @VisibleForTesting
- void disableRequestProcessingForTest() {
- // TODO: Remove this and test the cache directly.
- contactInfoCache.disableRequestProcessing();
- }
-
- @VisibleForTesting
- void injectContactInfoForTest(String number, String countryIso, ContactInfo contactInfo) {
- // TODO: Remove this and test the cache directly.
- contactInfoCache.injectContactInfoForTest(number, countryIso, contactInfo);
- }
-
/**
* Stores the callback action associated with a call in the call log.
*
@@ -1430,21 +1240,6 @@ public class CallLogAdapter extends GroupingListAdapter
}
}
- @NonNull
- private EnrichedCallManager getEnrichedCallManager() {
- return EnrichedCallComponent.get(activity).getEnrichedCallManager();
- }
-
- @NonNull
- private Duo getDuo() {
- return DuoComponent.get(activity).getDuo();
- }
-
- @Override
- public void onDuoStateChanged() {
- notifyDataSetChanged();
- }
-
public void onAllSelected() {
selectAllMode = true;
deselectAllMode = false;
@@ -1469,45 +1264,6 @@ public class CallLogAdapter extends GroupingListAdapter
notifyDataSetChanged();
}
- @WorkerThread
- private void logCp2Metrics(PhoneCallDetails details, ContactInfo contactInfo) {
- if (details == null) {
- return;
- }
- CharSequence inputNumber = details.number;
- if (inputNumber == null) {
- return;
- }
-
- ContactsProviderMatchInfo.Builder matchInfo =
- ContactsProviderMatchInfo.builder()
- .setInputNumberLength(PhoneNumberUtils.normalizeNumber(inputNumber.toString()).length())
- .setInputNumberHasPostdialDigits(
- !PhoneNumberUtils.extractPostDialPortion(inputNumber.toString()).isEmpty()
- || (details.postDialDigits != null && !details.postDialDigits.isEmpty()));
-
- PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
- try {
- PhoneNumber phoneNumber = phoneNumberUtil.parse(inputNumber, details.countryIso);
- matchInfo.setInputNumberValid(phoneNumberUtil.isValidNumber(phoneNumber));
- } catch (NumberParseException e) {
- // Do nothing
- matchInfo.setInputNumberValid(false);
- }
-
- if (contactInfo != null
- && contactInfo.number != null
- && contactInfo.sourceType == Type.SOURCE_TYPE_DIRECTORY) {
- matchInfo
- .setMatchedContact(true)
- .setMatchedNumberLength(PhoneNumberUtils.normalizeNumber(contactInfo.number).length())
- .setMatchedNumberHasPostdialDigits(
- !PhoneNumberUtils.extractPostDialPortion(contactInfo.number).isEmpty());
- }
-
- contactsProviderMatchInfos.put(inputNumber.toString(), matchInfo.build());
- }
-
/** Interface used to initiate a refresh of the content. */
public interface CallFetcher {
diff --git a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java
index f54ea79dcfef2ea86fe7f2457d23419cedf6f40c..d285848af106849bb52921445458a198f6b4dade 100644
--- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java
+++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java
@@ -23,9 +23,11 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.provider.CallLog;
import android.provider.VoicemailContract.Voicemails;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
import android.text.TextUtils;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.AsyncTaskExecutor;
import com.android.dialer.common.concurrent.AsyncTaskExecutors;
@@ -43,7 +45,7 @@ public class CallLogAsyncTaskUtil {
}
public static void markVoicemailAsRead(
- @NonNull final Context context, @NonNull final Uri voicemailUri) {
+ @NonNull final Context context, @NonNull final Uri voicemailUri) {
LogUtil.enterBlock("CallLogAsyncTaskUtil.markVoicemailAsRead, voicemailUri: " + voicemailUri);
if (asyncTaskExecutor == null) {
initTaskExecutor();
@@ -146,11 +148,8 @@ public class CallLogAsyncTaskUtil {
/** The enumeration of {@link AsyncTask} objects used in this class. */
public enum Tasks {
DELETE_VOICEMAIL,
- DELETE_CALL,
MARK_VOICEMAIL_READ,
MARK_CALL_READ,
- GET_CALL_DETAILS,
- UPDATE_DURATION,
}
/** TODO(calderwoodra): documentation */
diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java
index a6d7f1ead11993e2577059b9777330e40fa33b7e..058dba8f7d33522ab3773ed956b9af0b937c67f2 100644
--- a/java/com/android/dialer/app/calllog/CallLogFragment.java
+++ b/java/com/android/dialer/app/calllog/CallLogFragment.java
@@ -32,8 +32,6 @@ import android.os.Message;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract;
-import android.support.annotation.CallSuper;
-import android.support.annotation.Nullable;
import android.support.v13.app.FragmentCompat;
import android.support.v13.app.FragmentCompat.OnRequestPermissionsResultCallback;
import android.support.v7.app.AppCompatActivity;
@@ -45,7 +43,10 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
-import com.android.dialer.app.Bindings;
+
+import androidx.annotation.CallSuper;
+import androidx.annotation.Nullable;
+
import com.android.dialer.app.R;
import com.android.dialer.app.calllog.CallLogAdapter.CallFetcher;
import com.android.dialer.app.calllog.CallLogAdapter.MultiSelectRemoveView;
@@ -58,17 +59,10 @@ import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler;
import com.android.dialer.common.Assert;
import com.android.dialer.common.FragmentUtils;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.configprovider.ConfigProviderComponent;
import com.android.dialer.database.CallLogQueryHandler;
import com.android.dialer.database.CallLogQueryHandler.Listener;
import com.android.dialer.location.GeoUtil;
-import com.android.dialer.logging.DialerImpression;
-import com.android.dialer.logging.Logger;
-import com.android.dialer.metrics.Metrics;
-import com.android.dialer.metrics.MetricsComponent;
-import com.android.dialer.metrics.jank.RecyclerViewJankLogger;
import com.android.dialer.oem.CequintCallerIdManager;
-import com.android.dialer.performancereport.PerformanceReport;
import com.android.dialer.phonenumbercache.ContactInfoHelper;
import com.android.dialer.util.PermissionsUtil;
import com.android.dialer.widget.EmptyContentView;
@@ -297,18 +291,9 @@ public class CallLogFragment extends Fragment
protected void setupView(View view) {
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
- if (ConfigProviderComponent.get(getContext())
- .getConfigProvider()
- .getBoolean("is_call_log_item_anim_null", false)) {
- recyclerView.setItemAnimator(null);
- }
recyclerView.setHasFixedSize(true);
- recyclerView.addOnScrollListener(
- new RecyclerViewJankLogger(
- MetricsComponent.get(getContext()).metrics(), Metrics.OLD_CALL_LOG_JANK_EVENT_NAME));
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
- PerformanceReport.logOnScrollStateChange(recyclerView);
emptyListView = (EmptyContentView) view.findViewById(R.id.empty_list_view);
emptyListView.setImage(R.drawable.empty_call_log);
emptyListView.setActionClickedListener(this);
@@ -337,22 +322,20 @@ public class CallLogFragment extends Fragment
.getRetainedCache(),
new ContactInfoHelper(getActivity(), currentCountryIso),
onContactInfoChangedListener);
- adapter =
- Bindings.getLegacy(getActivity())
- .newCallLogAdapter(
- getActivity(),
- recyclerView,
- this,
- this,
- // We aren't calling getParentUnsafe because CallLogActivity doesn't need to
- // implement this listener
- FragmentUtils.getParent(
+ adapter = new CallLogAdapter(
+ getActivity(),
+ recyclerView,
+ this,
+ this,
+ // We aren't calling getParentUnsafe because CallLogActivity doesn't need to
+ // implement this listener
+ FragmentUtils.getParent(
this, CallLogAdapter.OnActionModeStateChangedListener.class),
- new CallLogCache(getActivity()),
- contactInfoCache,
- getVoicemailPlaybackPresenter(),
- new FilteredNumberAsyncQueryHandler(getActivity()),
- activityType);
+ new CallLogCache(getActivity()),
+ contactInfoCache,
+ getVoicemailPlaybackPresenter(),
+ new FilteredNumberAsyncQueryHandler(getActivity()),
+ activityType);
recyclerView.setAdapter(adapter);
if (adapter.getOnScrollListener() != null) {
recyclerView.addOnScrollListener(adapter.getOnScrollListener());
@@ -417,11 +400,6 @@ public class CallLogFragment extends Fragment
this.hasReadCallLogPermission = hasReadCallLogPermission;
- /*
- * Always clear the filtered numbers cache since users could have blocked/unblocked numbers
- * from the settings page
- */
- adapter.clearFilteredNumbersCache();
refreshData();
adapter.onResume();
@@ -708,11 +686,6 @@ public class CallLogFragment extends Fragment
@Override
public void onClick(View v) {
selectAllMode = !selectAllMode;
- if (selectAllMode) {
- Logger.get(v.getContext()).logImpression(DialerImpression.Type.MULTISELECT_SELECT_ALL);
- } else {
- Logger.get(v.getContext()).logImpression(DialerImpression.Type.MULTISELECT_UNSELECT_ALL);
- }
updateSelectAllIcon();
}
diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
index e5259117404e69563c576622109cc2e2184478c7..db3f284001b8f55c92e832dd54a139583ccc93f9 100644
--- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
+++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
@@ -16,19 +16,18 @@
package com.android.dialer.app.calllog;
-import android.content.Context;
import android.database.Cursor;
import android.provider.CallLog.Calls;
-import android.support.annotation.Nullable;
-import android.support.annotation.VisibleForTesting;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.text.format.Time;
+
+import androidx.annotation.Nullable;
+
import com.android.contacts.common.util.DateUtils;
import com.android.dialer.calllogutils.CallbackActionHelper;
import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction;
import com.android.dialer.compat.telephony.TelephonyManagerCompat;
-import com.android.dialer.inject.ApplicationContext;
import com.android.dialer.phonenumbercache.CallLogQuery;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import java.util.Objects;
@@ -58,12 +57,10 @@ public class CallLogGroupBuilder {
/** Instance of the time object used for time calculations. */
private static final Time TIME = new Time();
- private final Context appContext;
/** The object on which the groups are created. */
private final GroupCreator groupCreator;
- public CallLogGroupBuilder(@ApplicationContext Context appContext, GroupCreator groupCreator) {
- this.appContext = appContext;
+ public CallLogGroupBuilder(GroupCreator groupCreator) {
this.groupCreator = groupCreator;
}
@@ -100,9 +97,7 @@ public class CallLogGroupBuilder {
String groupNumber = cursor.getString(CallLogQuery.NUMBER);
String groupAccountComponentName = cursor.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME);
int groupFeatures = cursor.getInt(CallLogQuery.FEATURES);
- int groupCallbackAction =
- CallbackActionHelper.getCallbackAction(
- appContext, groupNumber, groupFeatures, groupAccountComponentName);
+ int groupCallbackAction = CallbackActionHelper.getCallbackAction(groupNumber, groupFeatures);
groupCreator.setCallbackAction(firstRowId, groupCallbackAction);
// Instantiate other group values to those of the first call in the cursor.
@@ -130,9 +125,7 @@ public class CallLogGroupBuilder {
callFeatures = cursor.getInt(CallLogQuery.FEATURES);
accountComponentName = cursor.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME);
accountId = cursor.getString(CallLogQuery.ACCOUNT_ID);
- callbackAction =
- CallbackActionHelper.getCallbackAction(
- appContext, number, callFeatures, accountComponentName);
+ callbackAction = CallbackActionHelper.getCallbackAction(number, callFeatures);
final boolean isSameNumber = equalNumbers(groupNumber, number);
final boolean isSamePostDialDigits = groupPostDialDigits.equals(numberPostDialDigits);
@@ -194,8 +187,7 @@ public class CallLogGroupBuilder {
* Returns true when the two input numbers can be considered identical enough for caller ID
* purposes and put in a call log group.
*/
- @VisibleForTesting
- boolean equalNumbers(@Nullable String number1, @Nullable String number2) {
+ private boolean equalNumbers(@Nullable String number1, @Nullable String number2) {
if (PhoneNumberHelper.isUriNumber(number1) || PhoneNumberHelper.isUriNumber(number2)) {
return compareSipAddresses(number1, number2);
}
@@ -216,8 +208,7 @@ public class CallLogGroupBuilder {
return TextUtils.equals(name1, name2) && TextUtils.equals(id1, id2);
}
- @VisibleForTesting
- boolean compareSipAddresses(@Nullable String number1, @Nullable String number2) {
+ private boolean compareSipAddresses(@Nullable String number1, @Nullable String number2) {
if (number1 == null || number2 == null) {
return Objects.equals(number1, number2);
}
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemHelper.java b/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
index a30d4d76e3533dc1a3a6bb354b91789f11a553b6..87bba52b9060f7ecfd65de6a693eba6f2bfa8243 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
@@ -18,9 +18,11 @@ package com.android.dialer.app.calllog;
import android.content.res.Resources;
import android.provider.CallLog.Calls;
-import android.support.annotation.WorkerThread;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
+
+import androidx.annotation.WorkerThread;
+
import com.android.dialer.app.R;
import com.android.dialer.app.calllog.calllogcache.CallLogCache;
import com.android.dialer.calllogutils.PhoneCallDetails;
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index af4fb297b5490ba2aacea72196d522a13919d992..53cc4b70677bcda444f7ccc7c2d86daf4d41a246 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -17,6 +17,12 @@
package com.android.dialer.app.calllog;
import android.Manifest.permission;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ArgbEvaluator;
+import android.animation.TimeInterpolator;
+import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
@@ -24,13 +30,10 @@ import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
+import android.provider.BlockedNumberContract;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.support.annotation.IntDef;
-import android.support.annotation.Nullable;
-import android.support.annotation.RequiresPermission;
-import android.support.annotation.VisibleForTesting;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.telecom.PhoneAccount;
@@ -43,48 +46,40 @@ import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
import android.view.ContextMenu;
-import android.view.LayoutInflater;
+import android.transition.TransitionManager;
+import android.view.animation.AccelerateDecelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup;
import android.view.ViewStub;
-import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
+
+import androidx.annotation.IntDef;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresPermission;
+
import com.android.contacts.common.dialog.CallSubjectDialog;
import com.android.dialer.app.R;
import com.android.dialer.app.calllog.CallLogAdapter.OnActionModeStateChangedListener;
import com.android.dialer.app.calllog.calllogcache.CallLogCache;
import com.android.dialer.app.voicemail.VoicemailPlaybackLayout;
import com.android.dialer.app.voicemail.VoicemailPlaybackPresenter;
-import com.android.dialer.blocking.BlockedNumbersMigrator;
-import com.android.dialer.blocking.FilteredNumberCompat;
-import com.android.dialer.blocking.FilteredNumbersUtil;
-import com.android.dialer.callcomposer.CallComposerActivity;
import com.android.dialer.calldetails.CallDetailsEntries;
import com.android.dialer.calldetails.OldCallDetailsActivity;
-import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction;
import com.android.dialer.clipboard.ClipboardUtils;
-import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.AsyncTaskExecutors;
-import com.android.dialer.configprovider.ConfigProviderComponent;
import com.android.dialer.constants.ActivityRequestCodes;
import com.android.dialer.contactphoto.ContactPhotoManager;
import com.android.dialer.dialercontact.DialerContact;
import com.android.dialer.dialercontact.SimDetails;
-import com.android.dialer.duo.Duo;
-import com.android.dialer.duo.DuoComponent;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.lettertile.LetterTileDrawable.ContactType;
import com.android.dialer.logging.ContactSource;
import com.android.dialer.logging.ContactSource.Type;
-import com.android.dialer.logging.DialerImpression;
-import com.android.dialer.logging.InteractionEvent;
-import com.android.dialer.logging.Logger;
-import com.android.dialer.logging.ScreenEvent;
-import com.android.dialer.logging.UiAction;
-import com.android.dialer.performancereport.PerformanceReport;
import com.android.dialer.phonenumbercache.CachedNumberLookupService;
import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.phonenumbercache.PhoneNumberCache;
@@ -128,7 +123,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
public final ImageView primaryActionButtonView;
private final Context context;
- @Nullable private final PhoneAccountHandle defaultPhoneAccountHandle;
+ @Nullable
+ private final PhoneAccountHandle defaultPhoneAccountHandle;
private final CallLogCache callLogCache;
private final CallLogListItemHelper callLogListItemHelper;
private final CachedNumberLookupService cachedNumberLookupService;
@@ -144,8 +140,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
public View callButtonView;
public View videoCallButtonView;
- public View setUpVideoButtonView;
- public View inviteVideoButtonView;
public View createNewContactButtonView;
public View addToExistingContactButtonView;
public View sendMessageView;
@@ -155,7 +149,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
public View reportNotSpamView;
public View detailsButtonView;
public View callWithNoteButtonView;
- public View callComposeButtonView;
public View sendVoicemailButtonView;
public ImageView workIconView;
public ImageView checkBoxView;
@@ -196,9 +189,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
*/
public int callType;
/**
- * ID for blocked numbers database. Set when context menu is created, if the number is blocked.
+ * Set when context menu is created, if the number is blocked.
*/
- public Integer blockId;
+ public boolean isBlocked;
/**
* The account for the current call log entry. Cached here as the call back intent is set only
* when the actions ViewStub is inflated.
@@ -221,13 +214,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
public CharSequence callTypeOrLocation;
/** The contact info for the contact displayed in this list item. */
public volatile ContactInfo info;
- /** Whether spam feature is enabled, which affects UI. */
- public boolean isSpamFeatureEnabled;
/** Whether the current log entry is a spam number or not. */
public boolean isSpam;
- public boolean isCallComposerCapable;
-
private View.OnClickListener expandCollapseListener;
private final OnActionModeStateChangedListener onActionModeStateChangedListener;
private final View.OnLongClickListener longPressListener;
@@ -289,19 +278,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
if (this.context instanceof CallLogActivity) {
hostUi = HostUi.CALL_HISTORY;
- Logger.get(this.context)
- .logQuickContactOnTouch(
- quickContactView, InteractionEvent.Type.OPEN_QUICK_CONTACT_FROM_CALL_HISTORY, true);
} else if (this.voicemailPlaybackPresenter == null) {
hostUi = HostUi.CALL_LOG;
- Logger.get(this.context)
- .logQuickContactOnTouch(
- quickContactView, InteractionEvent.Type.OPEN_QUICK_CONTACT_FROM_CALL_LOG, true);
} else {
hostUi = HostUi.VOICEMAIL;
- Logger.get(this.context)
- .logQuickContactOnTouch(
- quickContactView, InteractionEvent.Type.OPEN_QUICK_CONTACT_FROM_VOICEMAIL, false);
}
quickContactView.setOverlay(null);
@@ -309,12 +289,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
primaryActionButtonView.setOnClickListener(this);
primaryActionButtonView.setOnLongClickListener(this);
primaryActionView.setOnClickListener(this.expandCollapseListener);
- if (this.voicemailPlaybackPresenter != null
- && ConfigProviderComponent.get(this.context)
- .getConfigProvider()
- .getBoolean(
- CallLogAdapter.ENABLE_CALL_LOG_MULTI_SELECT,
- CallLogAdapter.ENABLE_CALL_LOG_MULTI_SELECT_FLAG)) {
+ if (this.voicemailPlaybackPresenter != null) {
primaryActionView.setOnLongClickListener(longPressListener);
quickContactView.setOnLongClickListener(longPressListener);
quickContactView.setMulitSelectListeners(
@@ -353,90 +328,29 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
(ImageView) view.findViewById(R.id.primary_action_button));
}
- public static CallLogListItemViewHolder createForTest(Context context) {
- return createForTest(context, null, null, new CallLogCache(context));
- }
-
- public static CallLogListItemViewHolder createForTest(
- Context context,
- View.OnClickListener expandCollapseListener,
- VoicemailPlaybackPresenter voicemailPlaybackPresenter,
- CallLogCache callLogCache) {
- Resources resources = context.getResources();
- PhoneCallDetailsHelper phoneCallDetailsHelper =
- new PhoneCallDetailsHelper(context, resources, callLogCache);
-
- CallLogListItemViewHolder viewHolder =
- new CallLogListItemViewHolder(
- context,
- null,
- expandCollapseListener /* expandCollapseListener */,
- null,
- null,
- callLogCache,
- new CallLogListItemHelper(phoneCallDetailsHelper, resources, callLogCache),
- voicemailPlaybackPresenter,
- LayoutInflater.from(context).inflate(R.layout.call_log_list_item, null),
- new DialerQuickContactBadge(context),
- new View(context),
- PhoneCallDetailsViews.createForTest(context),
- new CardView(context),
- new TextView(context),
- new ImageView(context));
- viewHolder.detailsButtonView = new TextView(context);
- viewHolder.actionsView = new View(context);
- viewHolder.voicemailPlaybackView = new VoicemailPlaybackLayout(context);
- viewHolder.workIconView = new ImageButton(context);
- viewHolder.checkBoxView = new ImageButton(context);
- return viewHolder;
- }
-
@Override
public boolean onMenuItemClick(MenuItem item) {
int resId = item.getItemId();
if (resId == R.id.context_menu_copy_to_clipboard) {
ClipboardUtils.copyText(context, null, number, true);
return true;
- } else if (resId == R.id.context_menu_copy_transcript_to_clipboard) {
- ClipboardUtils.copyText(
- context, null, phoneCallDetailsViews.voicemailTranscriptionView.getText(), true);
- return true;
} else if (resId == R.id.context_menu_edit_before_call) {
final Intent intent = new Intent(Intent.ACTION_DIAL, CallUtil.getCallUri(number));
DialerUtils.startActivityWithErrorToast(context, intent);
return true;
} else if (resId == R.id.context_menu_block_report_spam) {
- Logger.get(context)
- .logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_BLOCK_REPORT_SPAM);
- maybeShowBlockNumberMigrationDialog(
- new BlockedNumbersMigrator.Listener() {
- @Override
- public void onComplete() {
- blockReportListener.onBlockReportSpam(
- displayNumber, number, countryIso, callType, info.sourceType);
- }
- });
+ blockReportListener.onBlockReportSpam(
+ displayNumber, number, countryIso, callType, info.sourceType);
} else if (resId == R.id.context_menu_block) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_BLOCK_NUMBER);
- maybeShowBlockNumberMigrationDialog(
- new BlockedNumbersMigrator.Listener() {
- @Override
- public void onComplete() {
- blockReportListener.onBlock(
- displayNumber, number, countryIso, callType, info.sourceType);
- }
- });
+ blockReportListener.onBlock(
+ displayNumber, number, countryIso, callType, info.sourceType);
} else if (resId == R.id.context_menu_unblock) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_UNBLOCK_NUMBER);
blockReportListener.onUnblock(
- displayNumber, number, countryIso, callType, info.sourceType, isSpam, blockId);
+ displayNumber, number, countryIso, callType, info.sourceType, isSpam);
} else if (resId == R.id.context_menu_report_not_spam) {
- Logger.get(context)
- .logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_REPORT_AS_NOT_SPAM);
blockReportListener.onReportNotSpam(
displayNumber, number, countryIso, callType, info.sourceType);
} else if (resId == R.id.context_menu_delete) {
- Logger.get(context).logImpression(DialerImpression.Type.USER_DELETED_CALL_LOG_ITEM);
AsyncTaskExecutors.createAsyncTaskExecutor()
.submit(TASK_DELETE, new DeleteCallTask(context, callIds));
}
@@ -463,12 +377,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
videoCallButtonView = actionsView.findViewById(R.id.video_call_action);
videoCallButtonView.setOnClickListener(this);
- setUpVideoButtonView = actionsView.findViewById(R.id.set_up_video_action);
- setUpVideoButtonView.setOnClickListener(this);
-
- inviteVideoButtonView = actionsView.findViewById(R.id.invite_video_action);
- inviteVideoButtonView.setOnClickListener(this);
-
createNewContactButtonView = actionsView.findViewById(R.id.create_new_contact_action);
createNewContactButtonView.setOnClickListener(this);
@@ -497,11 +405,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
callWithNoteButtonView = actionsView.findViewById(R.id.call_with_note_action);
callWithNoteButtonView.setOnClickListener(this);
- callComposeButtonView = actionsView.findViewById(R.id.call_compose_action);
- callComposeButtonView.setOnClickListener(this);
-
sendVoicemailButtonView = actionsView.findViewById(R.id.share_voicemail);
sendVoicemailButtonView.setOnClickListener(this);
+
+ actionsView.setVisibility(View.GONE);
}
}
@@ -517,7 +424,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
if (!TextUtils.isEmpty(voicemailUri)) {
// Treat as voicemail list item; show play button if not expanded.
if (!isExpanded) {
- primaryActionButtonView.setImageResource(R.drawable.quantum_ic_play_arrow_white_24);
+ primaryActionButtonView.setImageResource(R.drawable.quantum_ic_play_arrow_vd_theme_24);
primaryActionButtonView.setContentDescription(
TextUtils.expandTemplate(
context.getString(R.string.description_voicemail_action), validNameOrNumber));
@@ -546,20 +453,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
primaryActionButtonView.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24);
primaryActionButtonView.setVisibility(View.VISIBLE);
break;
- case CallbackAction.DUO:
- if (showDuoPrimaryButton()) {
- CallIntentBuilder.increaseLightbringerCallButtonAppearInCollapsedCallLogItemCount();
- primaryActionButtonView.setTag(
- IntentProvider.getDuoVideoIntentProvider(number, isNonContactEntry(info)));
- } else {
- primaryActionButtonView.setTag(IntentProvider.getReturnVideoCallIntentProvider(number));
- }
- primaryActionButtonView.setContentDescription(
- TextUtils.expandTemplate(
- context.getString(R.string.description_video_call_action), validNameOrNumber));
- primaryActionButtonView.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24);
- primaryActionButtonView.setVisibility(View.VISIBLE);
- break;
case CallbackAction.VOICE:
if (callLogCache.isVoicemailNumber(accountHandle, number)) {
// Call to generic voicemail number, in case there are multiple accounts
@@ -598,8 +491,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
// This saves us having to remember to set it to GONE in multiple places.
callButtonView.setVisibility(View.GONE);
videoCallButtonView.setVisibility(View.GONE);
- setUpVideoButtonView.setVisibility(View.GONE);
- inviteVideoButtonView.setVisibility(View.GONE);
// For an emergency number, show "Call details" only.
if (PhoneNumberHelper.isLocalEmergencyNumber(context, number)) {
@@ -607,7 +498,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
addToExistingContactButtonView.setVisibility(View.GONE);
sendMessageView.setVisibility(View.GONE);
callWithNoteButtonView.setVisibility(View.GONE);
- callComposeButtonView.setVisibility(View.GONE);
blockReportView.setVisibility(View.GONE);
blockView.setVisibility(View.GONE);
unblockView.setVisibility(View.GONE);
@@ -633,7 +523,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
addToExistingContactButtonView.setVisibility(View.GONE);
sendMessageView.setVisibility(View.GONE);
callWithNoteButtonView.setVisibility(View.GONE);
- callComposeButtonView.setVisibility(View.GONE);
blockReportView.setVisibility(View.GONE);
blockView.setVisibility(View.GONE);
unblockView.setVisibility(View.GONE);
@@ -684,14 +573,12 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
switch (callbackAction) {
case CallbackAction.IMS_VIDEO:
- case CallbackAction.DUO:
- // For an IMS video call or a Duo call, the secondary action should always be a
+ // For an IMS video call, the secondary action should always be a
// voice callback.
callButtonView.setVisibility(View.VISIBLE);
videoCallButtonView.setVisibility(View.GONE);
break;
case CallbackAction.VOICE:
- Duo duo = DuoComponent.get(context).getDuo();
// For a voice call, set the secondary callback action to be an IMS video call if it is
// available. Otherwise try to set it as a Duo call.
if (CallUtil.isVideoEnabled(context)
@@ -704,45 +591,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
if (isVoicemailNumber) {
break;
}
-
- boolean identifiedSpamCall = isSpamFeatureEnabled && isSpam;
- if (duo.isReachable(context, number)) {
- videoCallButtonView.setTag(
- IntentProvider.getDuoVideoIntentProvider(number, isNonContactEntry(info)));
- videoCallButtonView.setVisibility(View.VISIBLE);
- CallIntentBuilder.increaseLightbringerCallButtonAppearInExpandedCallLogItemCount();
- } else if (duo.isActivated(context) && !identifiedSpamCall) {
- if (ConfigProviderComponent.get(context)
- .getConfigProvider()
- .getBoolean("enable_call_log_duo_invite_button", false)) {
- inviteVideoButtonView.setTag(IntentProvider.getDuoInviteIntentProvider(number));
- inviteVideoButtonView.setVisibility(View.VISIBLE);
- Logger.get(context).logImpression(DialerImpression.Type.DUO_CALL_LOG_INVITE_SHOWN);
- CallIntentBuilder.increaseLightbringerCallButtonAppearInExpandedCallLogItemCount();
- }
- } else if (duo.isEnabled(context) && !identifiedSpamCall) {
- if (!duo.isInstalled(context)) {
- if (ConfigProviderComponent.get(context)
- .getConfigProvider()
- .getBoolean("enable_call_log_install_duo_button", false)) {
- setUpVideoButtonView.setTag(IntentProvider.getInstallDuoIntentProvider());
- setUpVideoButtonView.setVisibility(View.VISIBLE);
- Logger.get(context)
- .logImpression(DialerImpression.Type.DUO_CALL_LOG_SET_UP_INSTALL_SHOWN);
- CallIntentBuilder.increaseLightbringerCallButtonAppearInExpandedCallLogItemCount();
- }
- } else {
- if (ConfigProviderComponent.get(context)
- .getConfigProvider()
- .getBoolean("enable_call_log_activate_duo_button", false)) {
- setUpVideoButtonView.setTag(IntentProvider.getSetUpDuoIntentProvider());
- setUpVideoButtonView.setVisibility(View.VISIBLE);
- Logger.get(context)
- .logImpression(DialerImpression.Type.DUO_CALL_LOG_SET_UP_ACTIVATE_SHOWN);
- CallIntentBuilder.increaseLightbringerCallButtonAppearInExpandedCallLogItemCount();
- }
- }
- }
break;
default:
callButtonView.setVisibility(View.GONE);
@@ -781,7 +629,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
callDetailsEntries, buildContact(), canReportCallerId, canSupportAssistedDialing()));
}
- boolean isBlockedOrSpam = blockId != null || (isSpamFeatureEnabled && isSpam);
+ boolean isBlockedOrSpam = isBlocked || isSpam;
if (!isBlockedOrSpam && info != null && UriUtils.isEncodedContactUri(info.lookupUri)) {
createNewContactButtonView.setTag(
@@ -811,8 +659,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
callWithNoteButtonView.setVisibility(
supportsCallSubject && !isVoicemailNumber && info != null ? View.VISIBLE : View.GONE);
- callComposeButtonView.setVisibility(isCallComposerCapable ? View.VISIBLE : View.GONE);
-
updateBlockReportActions(canPlaceCallToNumber, isVoicemailNumber);
}
@@ -825,13 +671,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
return false;
}
- private boolean showDuoPrimaryButton() {
- Duo duo = DuoComponent.get(context).getDuo();
- return accountHandle != null
- && duo.isDuoAccount(accountHandle)
- && duo.isReachable(context, number);
- }
-
private static boolean hasDialableChar(CharSequence number) {
if (TextUtils.isEmpty(number)) {
return false;
@@ -873,8 +712,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
* If the action views have never been shown yet for this view, inflate the view stub.
*/
public void showActions(boolean show) {
- showOrHideVoicemailTranscriptionView(show);
-
if (show) {
if (!isLoaded) {
// a bug for some unidentified reason showActions() can be called before the item is
@@ -887,63 +724,91 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
return;
}
+ TransitionManager.beginDelayedTransition((ViewGroup) rootView);
// Inflate the view stub if necessary, and wire up the event handlers.
inflateActionViewStub();
bindActionButtons();
- actionsView.setVisibility(View.VISIBLE);
- actionsView.setAlpha(1.0f);
+ animateActions(true);
+ TransitionManager.endTransitions((ViewGroup) rootView);
} else {
+ TransitionManager.beginDelayedTransition((ViewGroup) rootView);
// When recycling a view, it is possible the actionsView ViewStub was previously
// inflated so we should hide it in this case.
if (actionsView != null) {
- actionsView.setVisibility(View.GONE);
+ animateActions(false);
}
+ TransitionManager.endTransitions((ViewGroup) rootView);
}
-
updatePrimaryActionButton(show);
}
- private void showOrHideVoicemailTranscriptionView(boolean isExpanded) {
- if (callType != Calls.VOICEMAIL_TYPE) {
- return;
- }
-
- View transcriptContainerView = phoneCallDetailsViews.transcriptionView;
- TextView transcriptView = phoneCallDetailsViews.voicemailTranscriptionView;
- TextView transcriptBrandingView = phoneCallDetailsViews.voicemailTranscriptionBrandingView;
- if (!isExpanded) {
- transcriptContainerView.setVisibility(View.GONE);
+ private void animateActions(boolean shouldExpand) {
+ boolean isExpanded = actionsView.getVisibility() == View.VISIBLE;
+ if (shouldExpand == isExpanded) {
return;
}
-
- boolean show = false;
- if (TextUtils.isEmpty(transcriptView.getText())) {
- transcriptView.setVisibility(View.GONE);
- } else {
- transcriptView.setVisibility(View.VISIBLE);
- show = true;
- }
- if (TextUtils.isEmpty(transcriptBrandingView.getText())) {
- transcriptBrandingView.setVisibility(View.GONE);
+ Resources res = context.getResources();
+ actionsView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
+ int currentHeight = callLogEntryView.getMeasuredHeight();
+ int additionalHeight = actionsView.getMeasuredHeight();
+
+ int targetHeight;
+ int colorFrom, colorTo;
+ TimeInterpolator interpolator;
+ int targetVisibility;
+ float targetElevation;
+ if (shouldExpand) {
+ targetHeight = currentHeight + additionalHeight;
+ colorFrom = res.getColor(android.R.color.transparent, context.getTheme());
+ colorTo = res.getColor(R.color.cardBackgroundColor, context.getTheme());
+ interpolator = new AccelerateDecelerateInterpolator();
+ targetVisibility = View.VISIBLE;
+ targetElevation = 4f;
} else {
- transcriptBrandingView.setVisibility(View.VISIBLE);
- show = true;
- }
- if (show) {
- transcriptContainerView.setVisibility(View.VISIBLE);
- } else {
- transcriptContainerView.setVisibility(View.GONE);
- }
+ targetHeight = currentHeight - additionalHeight;
+ colorFrom = res.getColor(R.color.cardBackgroundColor, context.getTheme());
+ colorTo = res.getColor(android.R.color.transparent, context.getTheme());
+ interpolator = new DecelerateInterpolator();
+ targetVisibility = View.GONE;
+ targetElevation = 0f;
+ // need to do this before animating, otherwise the color changes are weird
+ callLogEntryView.setCardElevation(targetElevation);
+ }
+
+ ValueAnimator heightAnimator = ValueAnimator.ofInt(currentHeight, targetHeight);
+ heightAnimator.addUpdateListener(animation -> {
+ callLogEntryView.getLayoutParams().height = (int) animation.getAnimatedValue();
+ callLogEntryView.requestLayout();
+ });
+ heightAnimator.setInterpolator(interpolator);
+ heightAnimator.setDuration(200);
+
+ ValueAnimator colorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
+ colorAnimator.setDuration(200);
+ colorAnimator.addUpdateListener(animator -> callLogEntryView.setCardBackgroundColor(
+ (int) animator.getAnimatedValue()));
+
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.playTogether(heightAnimator, colorAnimator);
+ animatorSet.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ super.onAnimationEnd(animation);
+ actionsView.setVisibility(targetVisibility);
+ callLogEntryView.setCardElevation(targetElevation);
+
+ // we need to set this so we can expand again
+ ViewGroup.LayoutParams params = callLogEntryView.getLayoutParams();
+ params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ callLogEntryView.setLayoutParams(params);
+ }
+ });
+ animatorSet.start();
}
public void updatePhoto() {
quickContactView.assignContactUri(info.lookupUri);
- if (isSpamFeatureEnabled && isSpam) {
- quickContactView.setImageDrawable(context.getDrawable(R.drawable.blocked_contact));
- return;
- }
-
final String displayName = TextUtils.isEmpty(info.name) ? displayNumber : info.name;
ContactPhotoManager.getInstance(context)
.loadDialerThumbnailOrPhoto(
@@ -971,7 +836,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
if (view.getId() == R.id.primary_action_button && !TextUtils.isEmpty(voicemailUri)) {
- Logger.get(context).logImpression(DialerImpression.Type.VOICEMAIL_PLAY_AUDIO_DIRECTLY);
voicemailPrimaryActionButtonClicked = true;
expandCollapseListener.onClick(primaryActionView);
return;
@@ -994,68 +858,38 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
if (view.getId() == R.id.block_report_action) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_BLOCK_REPORT_SPAM);
- maybeShowBlockNumberMigrationDialog(
- new BlockedNumbersMigrator.Listener() {
- @Override
- public void onComplete() {
- blockReportListener.onBlockReportSpam(
- displayNumber, number, countryIso, callType, info.sourceType);
- }
- });
+ blockReportListener.onBlockReportSpam(
+ displayNumber, number, countryIso, callType, info.sourceType);
return;
}
if (view.getId() == R.id.block_action) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_BLOCK_NUMBER);
- maybeShowBlockNumberMigrationDialog(
- new BlockedNumbersMigrator.Listener() {
- @Override
- public void onComplete() {
- blockReportListener.onBlock(
- displayNumber, number, countryIso, callType, info.sourceType);
- }
- });
+ blockReportListener.onBlock(
+ displayNumber, number, countryIso, callType, info.sourceType);
return;
}
if (view.getId() == R.id.unblock_action) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_UNBLOCK_NUMBER);
blockReportListener.onUnblock(
- displayNumber, number, countryIso, callType, info.sourceType, isSpam, blockId);
+ displayNumber, number, countryIso, callType, info.sourceType, isSpam);
return;
}
if (view.getId() == R.id.report_not_spam_action) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_REPORT_AS_NOT_SPAM);
blockReportListener.onReportNotSpam(
displayNumber, number, countryIso, callType, info.sourceType);
return;
}
- if (view.getId() == R.id.call_compose_action) {
- LogUtil.i("CallLogListItemViewHolder.onClick", "share and call pressed");
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_SHARE_AND_CALL);
- Activity activity = (Activity) context;
- activity.startActivityForResult(
- CallComposerActivity.newIntent(activity, buildContact()),
- ActivityRequestCodes.DIALTACTS_CALL_COMPOSER);
- return;
- }
-
if (view.getId() == R.id.share_voicemail) {
- Logger.get(context).logImpression(DialerImpression.Type.VVM_SHARE_PRESSED);
voicemailPlaybackPresenter.shareVoicemail();
return;
}
- logCallLogAction(view.getId());
-
final IntentProvider intentProvider = (IntentProvider) view.getTag();
if (intentProvider == null) {
return;
}
- intentProvider.logInteraction(context);
final Intent intent = intentProvider.getClickIntent(context);
// See IntentProvider.getCallDetailIntentProvider() for why this may be null.
@@ -1063,14 +897,12 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
return;
}
if (OldCallDetailsActivity.isLaunchIntent(intent)) {
- PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL);
((Activity) context)
.startActivityForResult(intent, ActivityRequestCodes.DIALTACTS_CALL_DETAILS);
} else {
if (Intent.ACTION_CALL.equals(intent.getAction())
&& intent.getIntExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, -1)
== VideoProfile.STATE_BIDIRECTIONAL) {
- Logger.get(context).logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_CALL_LOG);
}
DialerUtils.startActivityWithErrorToast(context, intent);
@@ -1089,13 +921,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
return false;
}
- private static boolean isNonContactEntry(ContactInfo info) {
- if (info == null || info.sourceType != Type.SOURCE_TYPE_DIRECTORY) {
- return true;
- }
- return false;
- }
-
private DialerContact buildContact() {
DialerContact.Builder contact = DialerContact.newBuilder();
contact.setPhotoId(info.photoId);
@@ -1134,52 +959,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
return contact.build();
}
- private void logCallLogAction(int id) {
- if (id == R.id.send_message_action) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_SEND_MESSAGE);
- } else if (id == R.id.add_to_existing_contact_action) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_ADD_TO_CONTACT);
- switch (hostUi) {
- case HostUi.CALL_HISTORY:
- Logger.get(context)
- .logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_CALL_HISTORY);
- break;
- case HostUi.CALL_LOG:
- Logger.get(context).logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_CALL_LOG);
- break;
- case HostUi.VOICEMAIL:
- Logger.get(context).logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_VOICEMAIL);
- break;
- default:
- throw Assert.createIllegalStateFailException();
- }
- } else if (id == R.id.create_new_contact_action) {
- Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_CREATE_NEW_CONTACT);
- switch (hostUi) {
- case HostUi.CALL_HISTORY:
- Logger.get(context)
- .logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_CALL_HISTORY);
- break;
- case HostUi.CALL_LOG:
- Logger.get(context).logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_CALL_LOG);
- break;
- case HostUi.VOICEMAIL:
- Logger.get(context)
- .logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_VOICEMAIL);
- break;
- default:
- throw Assert.createIllegalStateFailException();
- }
- }
- }
-
- private void maybeShowBlockNumberMigrationDialog(BlockedNumbersMigrator.Listener listener) {
- if (!FilteredNumberCompat.maybeShowBlockNumberMigrationDialog(
- context, ((Activity) context).getFragmentManager(), listener)) {
- listener.onComplete();
- }
- }
-
private void updateBlockReportActions(boolean canPlaceCallToNumber, boolean isVoicemailNumber) {
// Set block/spam actions.
blockReportView.setVisibility(View.GONE);
@@ -1189,24 +968,15 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso);
if (!canPlaceCallToNumber
|| isVoicemailNumber
- || !FilteredNumbersUtil.canBlockNumber(context, e164Number, number)
- || !FilteredNumberCompat.canAttemptBlockOperations(context)) {
+ || !BlockedNumberContract.canCurrentUserBlockNumbers(context)
+ || PhoneNumberUtils.isEmergencyNumber(e164Number)) {
return;
}
- boolean isBlocked = blockId != null;
+
if (isBlocked) {
unblockView.setVisibility(View.VISIBLE);
} else {
- if (isSpamFeatureEnabled) {
- if (isSpam) {
- blockView.setVisibility(View.VISIBLE);
- reportNotSpamView.setVisibility(View.VISIBLE);
- } else {
- blockReportView.setVisibility(View.VISIBLE);
- }
- } else {
- blockView.setVisibility(View.VISIBLE);
- }
+ blockView.setVisibility(View.VISIBLE);
}
}
@@ -1214,11 +984,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
this.callDetailsEntries = callDetailsEntries;
}
- @VisibleForTesting
- public CallDetailsEntries getDetailedPhoneDetails() {
- return callDetailsEntries;
- }
-
@Override
public void onCreateContextMenu(
final ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
@@ -1257,24 +1022,13 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
.setOnMenuItemClickListener(this);
}
- if (callType == CallLog.Calls.VOICEMAIL_TYPE
- && phoneCallDetailsViews.voicemailTranscriptionView.length() > 0) {
- menu.add(
- ContextMenu.NONE,
- R.id.context_menu_copy_transcript_to_clipboard,
- ContextMenu.NONE,
- R.string.copy_transcript_text)
- .setOnMenuItemClickListener(this);
- }
-
String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso);
boolean isVoicemailNumber = callLogCache.isVoicemailNumber(accountHandle, number);
boolean canPlaceCallToNumber = PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation);
if (canPlaceCallToNumber
&& !isVoicemailNumber
- && FilteredNumbersUtil.canBlockNumber(context, e164Number, number)
- && FilteredNumberCompat.canAttemptBlockOperations(context)) {
- boolean isBlocked = blockId != null;
+ && BlockedNumberContract.canCurrentUserBlockNumbers(context)
+ && !PhoneNumberUtils.isEmergencyNumber(e164Number)) {
if (isBlocked) {
menu.add(
ContextMenu.NONE,
@@ -1283,36 +1037,12 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
R.string.call_log_action_unblock_number)
.setOnMenuItemClickListener(this);
} else {
- if (isSpamFeatureEnabled) {
- if (isSpam) {
- menu.add(
- ContextMenu.NONE,
- R.id.context_menu_report_not_spam,
- ContextMenu.NONE,
- R.string.call_log_action_remove_spam)
- .setOnMenuItemClickListener(this);
- menu.add(
- ContextMenu.NONE,
- R.id.context_menu_block,
- ContextMenu.NONE,
- R.string.call_log_action_block_number)
- .setOnMenuItemClickListener(this);
- } else {
- menu.add(
- ContextMenu.NONE,
- R.id.context_menu_block_report_spam,
- ContextMenu.NONE,
- R.string.call_log_action_block_report_number)
- .setOnMenuItemClickListener(this);
- }
- } else {
- menu.add(
- ContextMenu.NONE,
- R.id.context_menu_block,
- ContextMenu.NONE,
- R.string.call_log_action_block_number)
- .setOnMenuItemClickListener(this);
- }
+ menu.add(
+ ContextMenu.NONE,
+ R.id.context_menu_block,
+ ContextMenu.NONE,
+ R.string.call_log_action_block_number)
+ .setOnMenuItemClickListener(this);
}
}
@@ -1320,8 +1050,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
menu.add(ContextMenu.NONE, R.id.context_menu_delete, ContextMenu.NONE, R.string.delete)
.setOnMenuItemClickListener(this);
}
-
- Logger.get(context).logScreenView(ScreenEvent.Type.CALL_LOG_CONTEXT_MENU, (Activity) context);
}
/** Specifies where the view holder belongs. */
@@ -1355,8 +1083,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
String countryIso,
int callType,
ContactSource.Type contactSourceType,
- boolean isSpam,
- Integer blockId);
+ boolean isSpam);
void onReportNotSpam(
String displayNumber,
diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java
index 03b824eb6344f281712abf4032f386a89607b8c0..60d82f69bc3572bbaa6df8555d81fd9bbd0eaf7f 100644
--- a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java
+++ b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java
@@ -23,39 +23,31 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
-import android.os.Build;
import android.provider.CallLog.Calls;
import android.provider.VoicemailContract.Voicemails;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.annotation.VisibleForTesting;
-import android.support.annotation.WorkerThread;
import android.support.v4.os.UserManagerCompat;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.WorkerThread;
+
import com.android.dialer.app.R;
import com.android.dialer.calllogutils.PhoneNumberDisplayUtil;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.database.Selection;
-import com.android.dialer.compat.android.provider.VoicemailCompat;
-import com.android.dialer.configprovider.ConfigProviderComponent;
import com.android.dialer.location.GeoUtil;
import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.phonenumbercache.ContactInfoHelper;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.util.PermissionsUtil;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
/** Helper class operating on call log notifications. */
public class CallLogNotificationsQueryHelper {
-
- @VisibleForTesting
- static final String CONFIG_NEW_VOICEMAIL_NOTIFICATION_THRESHOLD_OFFSET =
- "new_voicemail_notification_threshold";
-
private final Context context;
private final NewCallsQuery newCallsQuery;
private final ContactInfoHelper contactInfoHelper;
@@ -164,11 +156,7 @@ public class CallLogNotificationsQueryHelper {
public List It can be injected in tests using {@link #setCurrentTimeForTest(long)}.
*/
private long getCurrentTimeMillis() {
- if (currentTimeMillisForTest == null) {
- return System.currentTimeMillis();
- } else {
- return currentTimeMillisForTest;
- }
+ return System.currentTimeMillis();
}
/** Sets the call count, date, and if it is a voicemail, sets the duration. */
diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java
index 71cbc8c12b692e42d3253f01f84b3913120be3aa..8ba34938d57dc92ac8f3a76754b4af859604b4e2 100644
--- a/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java
+++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java
@@ -16,7 +16,6 @@
package com.android.dialer.app.calllog;
-import android.content.Context;
import android.view.View;
import android.widget.TextView;
import com.android.dialer.app.R;
@@ -30,10 +29,6 @@ public final class PhoneCallDetailsViews {
public final View callTypeView;
public final CallTypeIconsView callTypeIcons;
public final TextView callLocationAndDate;
- public final View transcriptionView;
- public final TextView voicemailTranscriptionView;
- public final TextView voicemailTranscriptionBrandingView;
- public final View voicemailTranscriptionRatingView;
public final TextView callAccountLabel;
private PhoneCallDetailsViews(
@@ -41,19 +36,11 @@ public final class PhoneCallDetailsViews {
View callTypeView,
CallTypeIconsView callTypeIcons,
TextView callLocationAndDate,
- View transcriptionView,
- TextView voicemailTranscriptionView,
- TextView voicemailTranscriptionBrandingView,
- View voicemailTranscriptionRatingView,
TextView callAccountLabel) {
this.nameView = nameView;
this.callTypeView = callTypeView;
this.callTypeIcons = callTypeIcons;
this.callLocationAndDate = callLocationAndDate;
- this.transcriptionView = transcriptionView;
- this.voicemailTranscriptionView = voicemailTranscriptionView;
- this.voicemailTranscriptionBrandingView = voicemailTranscriptionBrandingView;
- this.voicemailTranscriptionRatingView = voicemailTranscriptionRatingView;
this.callAccountLabel = callAccountLabel;
}
@@ -70,23 +57,6 @@ public final class PhoneCallDetailsViews {
view.findViewById(R.id.call_type),
(CallTypeIconsView) view.findViewById(R.id.call_type_icons),
(TextView) view.findViewById(R.id.call_location_and_date),
- view.findViewById(R.id.transcription),
- (TextView) view.findViewById(R.id.voicemail_transcription),
- (TextView) view.findViewById(R.id.voicemail_transcription_branding),
- view.findViewById(R.id.voicemail_transcription_rating),
(TextView) view.findViewById(R.id.call_account_label));
}
-
- public static PhoneCallDetailsViews createForTest(Context context) {
- return new PhoneCallDetailsViews(
- new BidiTextView(context),
- new View(context),
- new CallTypeIconsView(context),
- new TextView(context),
- new View(context),
- new TextView(context),
- new TextView(context),
- new View(context),
- new TextView(context));
- }
}
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
index 5575cacc5703953ed37f33a3d9f1d073bf52e519..1a21b79b49f59ea3b64ada5b8c0fd00009c463be 100644
--- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
+++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
@@ -24,7 +24,6 @@ import android.media.AudioManager;
import android.os.Bundle;
import android.provider.CallLog;
import android.provider.VoicemailContract;
-import android.support.annotation.VisibleForTesting;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -36,8 +35,6 @@ import com.android.dialer.common.FragmentUtils;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutor;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
-import com.android.dialer.logging.DialerImpression;
-import com.android.dialer.logging.Logger;
import com.android.dialer.util.PermissionsUtil;
import com.android.dialer.voicemail.listui.error.VoicemailErrorMessageCreator;
import com.android.dialer.voicemail.listui.error.VoicemailStatus;
@@ -171,7 +168,6 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
super.onVisible();
if (getActivity() != null && preSyncVoicemailStatusCheckExecutor != null) {
preSyncVoicemailStatusCheckExecutor.executeParallel(getActivity());
- Logger.get(getActivity()).logImpression(DialerImpression.Type.VVM_TAB_VIEWED);
getActivity().setVolumeControlStream(VoicemailAudioManager.PLAYBACK_STREAM);
}
}
@@ -186,8 +182,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
getActivity().sendBroadcast(intent);
}
- @VisibleForTesting
- boolean shouldAutoSync(
+ private boolean shouldAutoSync(
VoicemailErrorMessageCreator errorMessageCreator, List Contains a ViewPager that contains various contact lists like the Speed Dial list and the All
- * Contacts list. This will also eventually contain the logic that allows sliding the ViewPager
- * containing the lists up above the search bar and pin it against the top of the screen.
- */
-public class ListsFragment extends Fragment
- implements OnPageChangeListener, Listener, CallLogFragmentListener {
-
- private static final String TAG = "ListsFragment";
-
- private DialerViewPager viewPager;
- private ViewPagerTabs viewPagerTabs;
- private DialtactsPagerAdapter adapter;
- private RemoveView removeView;
- private View removeViewContent;
- private Fragment currentPage;
- private SharedPreferences prefs;
- private boolean hasFetchedVoicemailStatus;
- private boolean showVoicemailTabAfterVoicemailStatusIsFetched;
- private final ArrayList This is only effective for elements provided by {@link #contactTileAdapter}. {@link
- * #contactTileAdapter} has its own logic for click events.
- */
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- final int contactTileAdapterCount = contactTileAdapter.getCount();
- if (position <= contactTileAdapterCount) {
- LogUtil.e(
- "OldSpeedDialFragment.onItemClick",
- "event for unexpected position. The position "
- + position
- + " is before \"all\" section. Ignored.");
- }
- }
-
- /**
- * Cache the current view offsets into memory. Once a relayout of views in the ListView has
- * happened due to a dataset change, the cached offsets are used to create animations that slide
- * views from their previous positions to their new ones, to give the appearance that the views
- * are sliding into their new positions.
- */
- private void saveOffsets(int removedItemHeight) {
- final int firstVisiblePosition = listView.getFirstVisiblePosition();
- for (int i = 0; i < listView.getChildCount(); i++) {
- final View child = listView.getChildAt(i);
- final int position = firstVisiblePosition + i;
- // Since we are getting the position from mListView and then querying
- // mContactTileAdapter, its very possible that things are out of sync
- // and we might index out of bounds. Let's make sure that this doesn't happen.
- if (!contactTileAdapter.isIndexInBound(position)) {
- continue;
- }
- final long itemId = contactTileAdapter.getItemId(position);
- itemIdTopMap.put(itemId, child.getTop());
- itemIdLeftMap.put(itemId, child.getLeft());
- }
- itemIdTopMap.put(KEY_REMOVED_ITEM_HEIGHT, removedItemHeight);
- }
-
- /*
- * Performs animations for the gridView
- */
- private void animateGridView(final long... idsInPlace) {
- if (itemIdTopMap.size() == 0) {
- // Don't do animations if the database is being queried for the first time and
- // the previous item offsets have not been cached, or the user hasn't done anything
- // (dragging, swiping etc) that requires an animation.
- return;
- }
-
- ViewUtil.doOnPreDraw(
- listView,
- true,
- new Runnable() {
- @Override
- public void run() {
-
- final int firstVisiblePosition = listView.getFirstVisiblePosition();
- final AnimatorSet animSet = new AnimatorSet();
- final ArrayList This methods is needed so the GroupMemberTileAdapter can override this.
- *
- * @param cursor The cursor to get number of frequents from.
- */
- private void saveNumFrequentsFromCursor(Cursor cursor) {
- numFrequents = cursor.getCount() - numStarred;
- }
-
- /**
- * Creates {@link ContactTileView}s for each item in {@link Cursor}.
- *
- * Else use {@link ContactTileLoaderFactory}
- */
- void setContactCursor(Cursor cursor) {
- if (!delayCursorUpdates && cursor != null && !cursor.isClosed()) {
- numStarred = getNumStarredContacts(cursor);
- if (awaitingRemove) {
- dataSetChangedListener.cacheOffsetsForDatasetChange();
- }
-
- saveNumFrequentsFromCursor(cursor);
- saveCursorToCache(cursor);
- // cause a refresh of any views that rely on this data
- notifyDataSetChanged();
- // about to start redraw
- dataSetChangedListener.onDataSetChangedForAnimation();
- }
- }
-
- /**
- * Saves the cursor data to the cache, to speed up UI changes.
- *
- * @param cursor Returned cursor from {@link ContactTileLoaderFactory} with data to populate the
- * view.
- */
- private void saveCursorToCache(Cursor cursor) {
- contactEntries.clear();
-
- if (cursor == null) {
- return;
- }
-
- final LongSparseArray --flag will be interpreted as --flag=true, and --noflag as --flag=false
- *
- * Grammar: Example usage:
- *
- * Note: the base multiplier can be calculated using {@code ExponentialBaseCalculator}
- */
-public final class ExponentialBackoff {
- public final long initialDelayMillis;
- public final double baseMultiplier;
- public final int maximumBackoffs;
- private double nextBackoff;
- private int backoffCount;
-
- /**
- * Setup an exponential backoff with an initial delay, a base multiplier and a maximum number of
- * backoff steps.
- *
- * @throws IllegalArgumentException for negative argument values
- */
- public ExponentialBackoff(long initialDelayMillis, double baseMultiplier, int maximumBackoffs) {
- Assert.checkArgument(initialDelayMillis > 0);
- Assert.checkArgument(baseMultiplier > 0);
- Assert.checkArgument(maximumBackoffs > 0);
- this.initialDelayMillis = initialDelayMillis;
- this.baseMultiplier = baseMultiplier;
- this.maximumBackoffs = maximumBackoffs;
- reset();
- }
-
- /**
- * @return the next backoff time in the exponential sequence. Specifically, if D is the initial
- * delay, B is the base multiplier and N is the total number of backoffs, then the return
- * values will be: D, D*B, D*B^2, ... D*B^(N-1), ...
- */
- public long getNextBackoff() {
- long backoff = Math.round(nextBackoff);
- backoffCount++;
- nextBackoff *= baseMultiplier;
- return backoff;
- }
-
- /** @return the number of times getNextBackoff() has been called */
- public int getBackoffCount() {
- return backoffCount;
- }
-
- /**
- * @return {@code true} if getNextBackoff() has been called less than the maximumBackoffs value
- * specified in the constructor.
- */
- public boolean isInRange() {
- return backoffCount < maximumBackoffs;
- }
-
- /**
- * Reset the sequence of backoff values so the next call to getNextBackoff() will return the
- * initial delay and getBackoffCount() will return 0
- */
- public void reset() {
- nextBackoff = initialDelayMillis;
- backoffCount = 0;
- }
-}
diff --git a/java/com/android/dialer/common/backoff/ExponentialBaseCalculator.java b/java/com/android/dialer/common/backoff/ExponentialBaseCalculator.java
deleted file mode 100644
index a1ae8a0534807311c29b03069a789b66ca8f7c93..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/common/backoff/ExponentialBaseCalculator.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.common.backoff;
-
-import com.android.dialer.common.Assert;
-
-/**
- * Given an initial delay, D, a maximum total backoff time, T, and a maximum number of backoffs, N,
- * this class calculates a base multiplier, b, and a scaling factor, g, such that the initial
- * backoff is g*b = D and the sum of the scaled backoffs is T = g*b + g*b^2 + g*b^3 + ... g*b^N
- *
- * T/D = (1 - b^N)/(1 - b) but this cannot be written as a simple equation for b in terms of T, N
- * and D so instead use Newton's method (https://en.wikipedia.org/wiki/Newton%27s_method) to find an
- * approximate value for b.
- *
- * Example usage using the {@code ExponentialBackoff} would be:
- *
- * Let f(b) = (1 - b^N)/(1 - b) - T/D then we want to find b* such that f(b*) = 0, or more
- * precisely |f(b*)| < tolerance
- *
- * Using Newton's method we can interatively find b* as follows: b1 = b0 - f(b0)/f'(b0), where
- * b0 is the current best guess for b* and b1 is the next best guess.
- *
- * f'(b) = (f(b) + T/D - N*b^(N - 1))/(1 - b)
- *
- * so
- *
- * b1 = b0 - f(b0)(1 - b0)/(f(b0) + T/D - N*b0^(N - 1))
- */
- private static double getBaseImpl(long t, int n, double tolerance) {
- double b0 = 2; // Initial guess for b*
- double b0n = Math.pow(b0, n);
- double fb0 = f(b0, t, b0n);
- if (Math.abs(fb0) < tolerance) {
- // Initial guess was pretty good
- return b0;
- }
-
- for (int i = 0; i < MAX_STEPS; i++) {
- double fpb0 = fp(b0, t, n, fb0, b0n);
- double b1 = b0 - fb0 / fpb0;
- double b1n = Math.pow(b1, n);
- double fb1 = f(b1, t, b1n);
-
- if (Math.abs(fb1) < tolerance) {
- // Found an acceptable value
- return b1;
- }
-
- b0 = b1;
- b0n = b1n;
- fb0 = fb1;
- }
-
- throw new IllegalStateException("Failed to find base. Too many iterations.");
- }
-
- // Evaluate f(b), the function we are trying to find the zero for.
- // Note: passing b^N as a parameter so it only has to be calculated once
- private static double f(double b, long t, double bn) {
- return (1 - bn) / (1 - b) - t;
- }
-
- // Evaluate f'(b), the derivative of the function we are trying to find the zero for.
- // Note: passing f(b) and b^N as parameters for efficiency
- private static double fp(double b, long t, int n, double fb, double bn) {
- return (fb + t - n * bn / b) / (1 - b);
- }
-}
diff --git a/java/com/android/dialer/common/concurrent/AsyncTaskExecutor.java b/java/com/android/dialer/common/concurrent/AsyncTaskExecutor.java
index 3bdcd035b996a57fcbcb59bfdb9edd301d52b82a..6def1283a62dda9c6ff253fd5370e1d2bac360f7 100644
--- a/java/com/android/dialer/common/concurrent/AsyncTaskExecutor.java
+++ b/java/com/android/dialer/common/concurrent/AsyncTaskExecutor.java
@@ -17,7 +17,9 @@
package com.android.dialer.common.concurrent;
import android.os.AsyncTask;
-import android.support.annotation.MainThread;
+
+import androidx.annotation.MainThread;
+
import java.util.concurrent.Executor;
/**
diff --git a/java/com/android/dialer/common/concurrent/AsyncTaskExecutors.java b/java/com/android/dialer/common/concurrent/AsyncTaskExecutors.java
index 5beae4de895f8fdf677070b62bd46751ee8d55e3..7c437dfdf25f6652aca20691bb7f913d2d784725 100644
--- a/java/com/android/dialer/common/concurrent/AsyncTaskExecutors.java
+++ b/java/com/android/dialer/common/concurrent/AsyncTaskExecutors.java
@@ -17,34 +17,22 @@
package com.android.dialer.common.concurrent;
import android.os.AsyncTask;
-import android.support.annotation.MainThread;
+
+import androidx.annotation.MainThread;
+
import com.android.dialer.common.Assert;
import java.util.concurrent.Executor;
/**
* Factory methods for creating AsyncTaskExecutors.
- *
- * All of the factory methods on this class check first to see if you have set a static {@link
- * AsyncTaskExecutorFactory} set through the {@link #setFactoryForTest(AsyncTaskExecutorFactory)}
- * method, and if so delegate to that instead, which is one way of injecting dependencies for
- * testing classes whose construction cannot be controlled such as {@link android.app.Activity}.
*/
public final class AsyncTaskExecutors {
- /**
- * A single instance of the {@link AsyncTaskExecutorFactory}, to which we delegate if it is
- * non-null, for injecting when testing.
- */
- private static AsyncTaskExecutorFactory injectedAsyncTaskExecutorFactory = null;
-
/**
* Creates an AsyncTaskExecutor that submits tasks to run with {@link AsyncTask#SERIAL_EXECUTOR}.
*/
public static AsyncTaskExecutor createAsyncTaskExecutor() {
synchronized (AsyncTaskExecutors.class) {
- if (injectedAsyncTaskExecutorFactory != null) {
- return injectedAsyncTaskExecutorFactory.createAsyncTaskExeuctor();
- }
return new SimpleAsyncTaskExecutor(AsyncTask.SERIAL_EXECUTOR);
}
}
@@ -55,25 +43,10 @@ public final class AsyncTaskExecutors {
*/
public static AsyncTaskExecutor createThreadPoolExecutor() {
synchronized (AsyncTaskExecutors.class) {
- if (injectedAsyncTaskExecutorFactory != null) {
- return injectedAsyncTaskExecutorFactory.createAsyncTaskExeuctor();
- }
return new SimpleAsyncTaskExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
- public static void setFactoryForTest(AsyncTaskExecutorFactory factory) {
- synchronized (AsyncTaskExecutors.class) {
- injectedAsyncTaskExecutorFactory = factory;
- }
- }
-
- /** Interface for creating AsyncTaskExecutor objects. */
- public interface AsyncTaskExecutorFactory {
-
- AsyncTaskExecutor createAsyncTaskExeuctor();
- }
-
static class SimpleAsyncTaskExecutor implements AsyncTaskExecutor {
private final Executor executor;
diff --git a/java/com/android/dialer/common/concurrent/DefaultDialerExecutorFactory.java b/java/com/android/dialer/common/concurrent/DefaultDialerExecutorFactory.java
index 317807b1d826b134ec79bf3e6f27869ef334e940..c31c5239d0bd94252bd8ef9ab683ab11b74c4c91 100644
--- a/java/com/android/dialer/common/concurrent/DefaultDialerExecutorFactory.java
+++ b/java/com/android/dialer/common/concurrent/DefaultDialerExecutorFactory.java
@@ -17,8 +17,10 @@
package com.android.dialer.common.concurrent;
import android.app.FragmentManager;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.NonUiParallel;
@@ -85,7 +87,8 @@ public class DefaultDialerExecutorFactory implements DialerExecutorFactory {
throwable -> {
throw new RuntimeException(throwable);
};
- @Nullable final ScheduledExecutorService serialExecutorService;
+ @Nullable
+ final ScheduledExecutorService serialExecutorService;
@Nullable final Executor parallelExecutor;
BaseTaskBuilder(
diff --git a/java/com/android/dialer/common/concurrent/DialerExecutor.java b/java/com/android/dialer/common/concurrent/DialerExecutor.java
index 3ee06445fc045140dd468bbfd065361015d75dda..79c469472ada3cdb95f97d23c4b6f61f3a73a60a 100644
--- a/java/com/android/dialer/common/concurrent/DialerExecutor.java
+++ b/java/com/android/dialer/common/concurrent/DialerExecutor.java
@@ -16,10 +16,11 @@
package com.android.dialer.common.concurrent;
-import android.support.annotation.MainThread;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.annotation.WorkerThread;
+import androidx.annotation.MainThread;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.WorkerThread;
+
import java.util.concurrent.ExecutorService;
/**
diff --git a/java/com/android/dialer/common/concurrent/DialerExecutorFactory.java b/java/com/android/dialer/common/concurrent/DialerExecutorFactory.java
index 82f8c7c3d96060d69d6c3018c3d6bdd5007b45e9..cfde3e34a89c3e2c9211097ff85534119b9c90ac 100644
--- a/java/com/android/dialer/common/concurrent/DialerExecutorFactory.java
+++ b/java/com/android/dialer/common/concurrent/DialerExecutorFactory.java
@@ -17,7 +17,9 @@
package com.android.dialer.common.concurrent;
import android.app.FragmentManager;
-import android.support.annotation.NonNull;
+
+import androidx.annotation.NonNull;
+
import com.android.dialer.common.concurrent.DialerExecutor.Worker;
/**
diff --git a/java/com/android/dialer/common/concurrent/DialerExecutors.java b/java/com/android/dialer/common/concurrent/DialerExecutors.java
index b29bf5d3b3b0be63712d5f43d58e0c895f4ef865..91c77aeea30f5d4e9e50f97a6da84f6596f1ddd1 100644
--- a/java/com/android/dialer/common/concurrent/DialerExecutors.java
+++ b/java/com/android/dialer/common/concurrent/DialerExecutors.java
@@ -17,7 +17,9 @@
package com.android.dialer.common.concurrent;
import android.content.Context;
-import android.support.annotation.NonNull;
+
+import androidx.annotation.NonNull;
+
import com.android.dialer.common.Assert;
import java.util.concurrent.ExecutorService;
diff --git a/java/com/android/dialer/common/concurrent/DialerUiTaskFragment.java b/java/com/android/dialer/common/concurrent/DialerUiTaskFragment.java
index f0b75375894053a1a5ab909c9199bd49948eb207..f502a0166415bc70e93ce3b273c99062a4b4146f 100644
--- a/java/com/android/dialer/common/concurrent/DialerUiTaskFragment.java
+++ b/java/com/android/dialer/common/concurrent/DialerUiTaskFragment.java
@@ -19,10 +19,12 @@ package com.android.dialer.common.concurrent;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
-import android.support.annotation.MainThread;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.annotation.WorkerThread;
+
+import androidx.annotation.MainThread;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.WorkerThread;
+
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutor.FailureListener;
diff --git a/java/com/android/dialer/common/concurrent/FallibleAsyncTask.java b/java/com/android/dialer/common/concurrent/FallibleAsyncTask.java
deleted file mode 100644
index c7a7f36a6bab469b8ee17de09b7d7b4405357cfd..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/common/concurrent/FallibleAsyncTask.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.common.concurrent;
-
-import android.os.AsyncTask;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import com.android.dialer.common.concurrent.FallibleAsyncTask.FallibleTaskResult;
-import com.google.auto.value.AutoValue;
-
-/**
- * A task that runs work in the background, passing Throwables from {@link
- * #doInBackground(Object[])} to {@link #onPostExecute(Object)} through a {@link
- * FallibleTaskResult}.
- *
- * @param Use {@link #isFailure()} to determine if a {@code null} return is the result of a
- * Throwable from the background work.
- */
- @Nullable
- public abstract ResultT getResult();
-
- /**
- * Returns {@code true} if this object is the result of background work that threw a Throwable.
- */
- public boolean isFailure() {
- //noinspection ThrowableResultOfMethodCallIgnored
- return getThrowable() != null;
- }
- }
-}
diff --git a/java/com/android/dialer/common/concurrent/SupportUiListener.java b/java/com/android/dialer/common/concurrent/SupportUiListener.java
index 5e3958619b66005b346849b9fefc169f112c790e..a7269d965aa80d3b17aaa1fd5702a8611cfd3d75 100644
--- a/java/com/android/dialer/common/concurrent/SupportUiListener.java
+++ b/java/com/android/dialer/common/concurrent/SupportUiListener.java
@@ -18,11 +18,13 @@ package com.android.dialer.common.concurrent;
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.MainThread;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
+
+import androidx.annotation.MainThread;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutor.FailureListener;
diff --git a/java/com/android/dialer/common/concurrent/UiListener.java b/java/com/android/dialer/common/concurrent/UiListener.java
index a2d976f3bd23a3a7aa0104a5cbe3764ac4b681fb..e6fb9835edea47f8e2274aeb904811be04c9d32a 100644
--- a/java/com/android/dialer/common/concurrent/UiListener.java
+++ b/java/com/android/dialer/common/concurrent/UiListener.java
@@ -20,9 +20,11 @@ import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.MainThread;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+
+import androidx.annotation.MainThread;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutor.FailureListener;
diff --git a/java/com/android/dialer/common/database/Selection.java b/java/com/android/dialer/common/database/Selection.java
index e449fd9f6f514d28dca49578af145cef642dc108..f1b6191be21359c8662d6f90749e778d53f37044 100644
--- a/java/com/android/dialer/common/database/Selection.java
+++ b/java/com/android/dialer/common/database/Selection.java
@@ -16,9 +16,11 @@
package com.android.dialer.common.database;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
import android.text.TextUtils;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import com.android.dialer.common.Assert;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/java/com/android/dialer/common/preference/AndroidManifest.xml b/java/com/android/dialer/common/preference/AndroidManifest.xml
deleted file mode 100644
index 3e8062216f0e99d6dcd18dc4323d2e7c63f2b019..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/common/preference/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
- Example usage:
- *
- * Copied from android.provider.VoicemailContract.Voicemails. These do not plan to become public
- * in O-MR1 or in the near future.
- */
-public class VoicemailCompat {
-
- /**
- * The state of the voicemail transcription.
- *
- * Possible values: {@link #TRANSCRIPTION_NOT_STARTED}, {@link #TRANSCRIPTION_IN_PROGRESS},
- * {@link #TRANSCRIPTION_FAILED}, {@link #TRANSCRIPTION_AVAILABLE}.
- *
- * Type: INTEGER
- */
- public static final String TRANSCRIPTION_STATE = "transcription_state";
-
- /**
- * Value of {@link #TRANSCRIPTION_STATE} when the voicemail transcription has not yet been
- * attempted.
- */
- public static final int TRANSCRIPTION_NOT_STARTED = 0;
-
- /**
- * Value of {@link #TRANSCRIPTION_STATE} when the voicemail transcription has begun but is not yet
- * complete.
- */
- public static final int TRANSCRIPTION_IN_PROGRESS = 1;
-
- /**
- * Value of {@link #TRANSCRIPTION_STATE} when the voicemail transcription has been attempted and
- * failed for an unspecified reason.
- */
- public static final int TRANSCRIPTION_FAILED = 2;
-
- /**
- * Value of {@link #TRANSCRIPTION_STATE} when the voicemail transcription has completed and the
- * result has been stored in the {@link #TRANSCRIPTION} column.
- */
- public static final int TRANSCRIPTION_AVAILABLE = 3;
-
- /**
- * Value of {@link #TRANSCRIPTION_STATE} when the voicemail transcription has been attempted and
- * failed because no speech was detected.
- *
- * Internal dialer use only, not part of the public SDK.
- */
- public static final int TRANSCRIPTION_FAILED_NO_SPEECH_DETECTED = -1;
-
- /**
- * Value of {@link #TRANSCRIPTION_STATE} when the voicemail transcription has been attempted and
- * failed because the language was not supported.
- *
- * Internal dialer use only, not part of the public SDK.
- */
- public static final int TRANSCRIPTION_FAILED_LANGUAGE_NOT_SUPPORTED = -2;
-
- /**
- * Value of {@link #TRANSCRIPTION_STATE} when the voicemail transcription has completed and the
- * result has been stored in the {@link #TRANSCRIPTION} column of the database, and the user has
- * provided a quality rating for the transcription.
- */
- public static final int TRANSCRIPTION_AVAILABLE_AND_RATED = -3;
-
- /**
- * Voicemail transcription quality rating value sent to the server indicating a good transcription
- */
- public static final int TRANSCRIPTION_QUALITY_RATING_GOOD = 1;
-
- /**
- * Voicemail transcription quality rating value sent to the server indicating a bad transcription
- */
- public static final int TRANSCRIPTION_QUALITY_RATING_BAD = 2;
-}
diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
index 41e5be29ff5b635efe695b5a946a871d0559b5c5..4519ba1ce5165485c12feb8effca267b2228e5bb 100644
--- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
+++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
@@ -17,14 +17,12 @@
package com.android.dialer.compat.telephony;
import android.content.Context;
-import android.content.Intent;
import android.net.Uri;
-import android.os.Build.VERSION;
-import android.os.Build.VERSION_CODES;
-import android.support.annotation.Nullable;
-import android.support.v4.os.BuildCompat;
import android.telecom.PhoneAccountHandle;
import android.telephony.TelephonyManager;
+
+import androidx.annotation.Nullable;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.telecom.TelecomUtil;
import java.lang.reflect.InvocationTargetException;
@@ -69,8 +67,7 @@ public class TelephonyManagerCompat {
/** Indicates the Connection/Call used assisted dialing. */
public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9;
- public static final String EXTRA_IS_REFRESH =
- BuildCompat.isAtLeastOMR1() ? "android.telephony.extra.IS_REFRESH" : "is_refresh";
+ public static final String EXTRA_IS_REFRESH = "android.telephony.extra.IS_REFRESH";
/**
* Indicates the call underwent Assisted Dialing; typically set as a feature available from the
@@ -189,21 +186,13 @@ public class TelephonyManagerCompat {
* @param secretCode the secret code without the "*#*#" prefix and "#*#*" suffix
*/
public static void handleSecretCode(Context context, String secretCode) {
- // Must use system service on O+ to avoid using broadcasts, which are not allowed on O+.
- if (BuildCompat.isAtLeastO()) {
- if (!TelecomUtil.isDefaultDialer(context)) {
- LogUtil.e(
- "TelephonyManagerCompat.handleSecretCode",
- "not default dialer, cannot send special code");
- return;
- }
- context.getSystemService(TelephonyManager.class).sendDialerSpecialCode(secretCode);
- } else {
- // System service call is not supported pre-O, so must use a broadcast for N-.
- Intent intent =
- new Intent(SECRET_CODE_ACTION, Uri.parse("android_secret_code://" + secretCode));
- context.sendBroadcast(intent);
+ if (!TelecomUtil.isDefaultDialer(context)) {
+ LogUtil.e(
+ "TelephonyManagerCompat.handleSecretCode",
+ "not default dialer, cannot send special code");
+ return;
}
+ context.getSystemService(TelephonyManager.class).sendDialerSpecialCode(secretCode);
}
/**
@@ -226,12 +215,10 @@ public class TelephonyManagerCompat {
if (phoneAccountHandle == null) {
return telephonyManager;
}
- if (VERSION.SDK_INT >= VERSION_CODES.O) {
- TelephonyManager telephonyManagerForPhoneAccount =
- telephonyManager.createForPhoneAccountHandle(phoneAccountHandle);
- if (telephonyManagerForPhoneAccount != null) {
- return telephonyManagerForPhoneAccount;
- }
+ TelephonyManager telephonyManagerForPhoneAccount =
+ telephonyManager.createForPhoneAccountHandle(phoneAccountHandle);
+ if (telephonyManagerForPhoneAccount != null) {
+ return telephonyManagerForPhoneAccount;
}
return telephonyManager;
}
diff --git a/java/com/android/dialer/configprovider/AndroidManifest.xml b/java/com/android/dialer/configprovider/AndroidManifest.xml
deleted file mode 100644
index 772997153c54b6c063580e4c89ae88ba31576d5e..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/configprovider/AndroidManifest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
- Config flags can be written using adb (with root access), for example:
- *
- * (For longs use --el and for strings use --es.)
- *
- * Flags can be viewed with:
- *
- * Do not change any existing IDs.
*/
public final class ScheduledJobIds {
- public static final int SPAM_JOB_WIFI = 50;
- public static final int SPAM_JOB_ANY_NETWORK = 51;
-
- /** Spam job type including all spam job IDs. */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({SPAM_JOB_WIFI, SPAM_JOB_ANY_NETWORK})
- public @interface SpamJobType {}
-
// This job refreshes dynamic launcher shortcuts.
public static final int SHORTCUT_PERIODIC_JOB = 100;
public static final int VVM_TASK_SCHEDULER_JOB = 200;
public static final int VVM_STATUS_CHECK_JOB = 201;
public static final int VVM_DEVICE_PROVISIONED_JOB = 202;
- public static final int VVM_TRANSCRIPTION_JOB = 203;
- public static final int VVM_TRANSCRIPTION_BACKFILL_JOB = 204;
public static final int VVM_NOTIFICATION_JOB = 205;
- public static final int VVM_TRANSCRIPTION_RATING_JOB = 206;
-
- public static final int VOIP_REGISTRATION = 300;
-
- public static final int CALL_LOG_CONFIG_POLLING_JOB = 400;
-
- // Job Ids from 10_000 to 10_100 should be reserved for proto upload jobs.
- public static final int PROTO_UPLOAD_JOB_MIN_ID = 10_000;
- public static final int PROTO_UPLOAD_JOB_MAX_ID = 10_100;
}
diff --git a/java/com/android/dialer/constants/aospdialer/ConstantsImpl.java b/java/com/android/dialer/constants/aospdialer/ConstantsImpl.java
deleted file mode 100644
index 312b3f58a962eb7a4b3af970127a2bf170d69fbe..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/constants/aospdialer/ConstantsImpl.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.constants;
-
-import android.content.Context;
-import android.support.annotation.NonNull;
-import com.android.dialer.proguard.UsedByReflection;
-
-/** Provider config values for AOSP Dialer. */
-@UsedByReflection(value = "Constants.java")
-public class ConstantsImpl extends Constants {
-
- @Override
- @NonNull
- public String getFilteredNumberProviderAuthority() {
- return "com.android.dialer.blocking.filterednumberprovider";
- }
-
- @Override
- @NonNull
- public String getFileProviderAuthority() {
- return "com.android.dialer.files";
- }
-
- @NonNull
- @Override
- public String getAnnotatedCallLogProviderAuthority() {
- return "com.android.dialer.annotatedcalllog";
- }
-
- @NonNull
- @Override
- public String getPhoneLookupHistoryProviderAuthority() {
- return "com.android.dialer.phonelookuphistory";
- }
-
- @NonNull
- @Override
- public String getPreferredSimFallbackProviderAuthority() {
- return "com.android.dialer.preferredsimfallback";
- }
-
- @Override
- public String getUserAgent(Context context) {
- return null;
- }
-
- @NonNull
- @Override
- public String getSettingsActivity() {
- return "com.android.dialer.app.settings.DialerSettingsActivity";
- }
-}
diff --git a/java/com/android/dialer/constants/googledialer/ConstantsImpl.java b/java/com/android/dialer/constants/googledialer/ConstantsImpl.java
deleted file mode 100644
index e4a96feb94e2080bc5d4163a1cda2e4b56927457..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/constants/googledialer/ConstantsImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.constants;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.os.Build;
-import android.support.annotation.NonNull;
-import com.android.dialer.proguard.UsedByReflection;
-
-/** Provider config values for Google Dialer. */
-@UsedByReflection(value = "Constants.java")
-public class ConstantsImpl extends Constants {
-
- @Override
- @NonNull
- public String getFilteredNumberProviderAuthority() {
- return "com.google.android.dialer.blocking.filterednumberprovider";
- }
-
- @Override
- @NonNull
- public String getFileProviderAuthority() {
- return "com.google.android.dialer.files";
- }
-
- @NonNull
- @Override
- public String getAnnotatedCallLogProviderAuthority() {
- return "com.google.android.dialer.annotatedcalllog";
- }
-
- @NonNull
- @Override
- public String getPhoneLookupHistoryProviderAuthority() {
- return "com.google.android.dialer.phonelookuphistory";
- }
-
- @NonNull
- @Override
- public String getPreferredSimFallbackProviderAuthority() {
- return "com.google.android.dialer.preferredsimfallback";
- }
-
- @Override
- public String getUserAgent(Context context) {
- StringBuilder userAgent = new StringBuilder("GoogleDialer ");
- try {
- String versionName =
- context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
- userAgent.append(versionName).append(" ");
- } catch (PackageManager.NameNotFoundException e) {
- // ignore
- }
- userAgent.append(Build.FINGERPRINT);
-
- return userAgent.toString();
- }
-
- @NonNull
- @Override
- public String getSettingsActivity() {
- return "com.google.android.apps.dialer.settings.GoogleDialerSettingsActivity";
- }
-}
diff --git a/java/com/android/dialer/contactphoto/ContactPhotoManager.java b/java/com/android/dialer/contactphoto/ContactPhotoManager.java
index 353c1ee331eacea9603342ec4f193cffbe929d25..4bac8867a73b6cc02e551cf20a71ecb9fa4a745c 100644
--- a/java/com/android/dialer/contactphoto/ContactPhotoManager.java
+++ b/java/com/android/dialer/contactphoto/ContactPhotoManager.java
@@ -23,7 +23,6 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.net.Uri.Builder;
-import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
@@ -40,7 +39,6 @@ public abstract class ContactPhotoManager implements ComponentCallbacks2 {
public static final float SCALE_DEFAULT = 1.0f;
public static final float OFFSET_DEFAULT = 0.0f;
- public static final boolean IS_CIRCULAR_DEFAULT = false;
// TODO: Use LogUtil.isVerboseEnabled for DEBUG branches instead of a lint check.
// LINT.DoNotSubmitIf(true)
static final boolean DEBUG = false;
@@ -55,61 +53,9 @@ public abstract class ContactPhotoManager implements ComponentCallbacks2 {
private static final String OFFSET_PARAM_KEY = "offset";
private static final String IS_CIRCULAR_PARAM_KEY = "is_circular";
private static final String DEFAULT_IMAGE_URI_SCHEME = "defaultimage";
- private static final Uri DEFAULT_IMAGE_URI = Uri.parse(DEFAULT_IMAGE_URI_SCHEME + "://");
public static final DefaultImageProvider DEFAULT_AVATAR = new LetterTileDefaultImageProvider();
private static ContactPhotoManager instance;
- /**
- * Given a {@link DefaultImageRequest}, returns an Uri that can be used to request a letter tile
- * avatar when passed to the {@link ContactPhotoManager}. The internal implementation of this uri
- * is not guaranteed to remain the same across application versions, so the actual uri should
- * never be persisted in long-term storage and reused.
- *
- * @param request A {@link DefaultImageRequest} object with the fields configured to return a
- * @return A Uri that when later passed to the {@link ContactPhotoManager} via {@link
- * #loadPhoto(ImageView, Uri, int, boolean, boolean, DefaultImageRequest)}, can be used to
- * request a default contact image, drawn as a letter tile using the parameters as configured
- * in the provided {@link DefaultImageRequest}
- */
- public static Uri getDefaultAvatarUriForContact(DefaultImageRequest request) {
- final Builder builder = DEFAULT_IMAGE_URI.buildUpon();
- if (request != null) {
- if (!TextUtils.isEmpty(request.displayName)) {
- builder.appendQueryParameter(DISPLAY_NAME_PARAM_KEY, request.displayName);
- }
- if (!TextUtils.isEmpty(request.identifier)) {
- builder.appendQueryParameter(IDENTIFIER_PARAM_KEY, request.identifier);
- }
- if (request.contactType != LetterTileDrawable.TYPE_DEFAULT) {
- builder.appendQueryParameter(CONTACT_TYPE_PARAM_KEY, String.valueOf(request.contactType));
- }
- if (request.scale != SCALE_DEFAULT) {
- builder.appendQueryParameter(SCALE_PARAM_KEY, String.valueOf(request.scale));
- }
- if (request.offset != OFFSET_DEFAULT) {
- builder.appendQueryParameter(OFFSET_PARAM_KEY, String.valueOf(request.offset));
- }
- if (request.isCircular != IS_CIRCULAR_DEFAULT) {
- builder.appendQueryParameter(IS_CIRCULAR_PARAM_KEY, String.valueOf(request.isCircular));
- }
- }
- return builder.build();
- }
-
- /**
- * Adds a business contact type encoded fragment to the URL. Used to ensure photo URLS from Nearby
- * Places can be identified as business photo URLs rather than URLs for personal contact photos.
- *
- * @param photoUrl The photo URL to modify.
- * @return URL with the contact type parameter added and set to TYPE_BUSINESS.
- */
- public static String appendBusinessContactType(String photoUrl) {
- Uri uri = Uri.parse(photoUrl);
- Builder builder = uri.buildUpon();
- builder.encodedFragment(String.valueOf(LetterTileDrawable.TYPE_BUSINESS));
- return builder.build().toString();
- }
-
/**
* Removes the contact type information stored in the photo URI encoded fragment.
*
@@ -194,11 +140,6 @@ public abstract class ContactPhotoManager implements ComponentCallbacks2 {
return new ContactPhotoManagerImpl(context);
}
- @VisibleForTesting
- public static void injectContactPhotoManagerForTesting(ContactPhotoManager photoManager) {
- instance = photoManager;
- }
-
protected boolean isDefaultImageUri(Uri uri) {
return DEFAULT_IMAGE_URI_SCHEME.equals(uri.getScheme());
}
diff --git a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
index f7f79e17f55adcf35ded0317602252a68547092a..97e984bb8eab3f86bdfc3471c5300c63169adadf 100644
--- a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
+++ b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
@@ -43,8 +43,6 @@ import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Contacts.Photo;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.Directory;
-import android.support.annotation.UiThread;
-import android.support.annotation.WorkerThread;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import android.text.TextUtils;
@@ -52,6 +50,11 @@ import android.util.LruCache;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
+
+import androidx.annotation.UiThread;
+import androidx.annotation.WorkerThread;
+
+import com.android.dialer.R;
import com.android.dialer.common.LogUtil;
import com.android.dialer.constants.Constants;
import com.android.dialer.constants.TrafficStatsTags;
@@ -198,10 +201,7 @@ class ContactPhotoManagerImpl extends ContactPhotoManager implements Callback {
context.getResources().getDimensionPixelSize(R.dimen.contact_browser_list_item_photo_size);
// Get a user agent string to use for URI photo requests.
- userAgent = Constants.get().getUserAgent(context);
- if (userAgent == null) {
- userAgent = "";
- }
+ userAgent = "";
}
/** Converts bytes to K bytes, rounding up. Used only for debug log. */
diff --git a/java/com/android/dialer/contacts/ContactsModule.java b/java/com/android/dialer/contacts/ContactsModule.java
index 2a27b766b83bd8b3f1af31552b5aabde9ece45c0..9cbb6ae8f7f49b5d1ad2613e122323dac6285182 100644
--- a/java/com/android/dialer/contacts/ContactsModule.java
+++ b/java/com/android/dialer/contacts/ContactsModule.java
@@ -24,15 +24,12 @@ import com.android.dialer.contacts.displaypreference.ContactDisplayPreferencesSt
import com.android.dialer.contacts.hiresphoto.HighResolutionPhotoRequester;
import com.android.dialer.contacts.hiresphoto.HighResolutionPhotoRequesterImpl;
import com.android.dialer.inject.ApplicationContext;
-import com.android.dialer.inject.DialerVariant;
-import com.android.dialer.inject.InstallIn;
import dagger.Binds;
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;
/** Module for standard {@link ContactsComponent} */
-@InstallIn(variants = {DialerVariant.DIALER_TEST})
@Module
public abstract class ContactsModule {
@Provides
diff --git a/java/com/android/dialer/contacts/displaypreference/ContactDisplayPreferences.java b/java/com/android/dialer/contacts/displaypreference/ContactDisplayPreferences.java
index dca466ebf59d4806a7a3396e67926382bcf759ed..ea520e880997efb96ef9afd1db5d96861fab7293 100644
--- a/java/com/android/dialer/contacts/displaypreference/ContactDisplayPreferences.java
+++ b/java/com/android/dialer/contacts/displaypreference/ContactDisplayPreferences.java
@@ -17,9 +17,13 @@
package com.android.dialer.contacts.displaypreference;
import android.content.Context;
-import android.support.annotation.Nullable;
-import android.support.annotation.StringRes;
import android.text.TextUtils;
+
+import androidx.annotation.Nullable;
+import androidx.annotation.StringRes;
+
+import com.android.dialer.R;
+
import java.util.Arrays;
/** Handles name ordering of a contact (Given name first or family name first.) */
diff --git a/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java b/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
index 0c14613139794fea7b64f82e13d95eccd23727c6..64eab60c59a5622829cd22f4355abc27d80c7ec7 100644
--- a/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
+++ b/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
@@ -24,7 +24,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.RawContacts;
-import android.support.annotation.VisibleForTesting;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
import com.android.dialer.common.database.Selection;
@@ -48,8 +47,7 @@ public class HighResolutionPhotoRequesterImpl implements HighResolutionPhotoRequ
}
}
- @VisibleForTesting
- static final ComponentName SYNC_HIGH_RESOLUTION_PHOTO_SERVICE =
+ private static final ComponentName SYNC_HIGH_RESOLUTION_PHOTO_SERVICE =
new ComponentName(
"com.google.android.gms",
"com.google.android.gms.people.sync.focus.SyncHighResPhotoIntentOperation");
diff --git a/java/com/android/dialer/contacts/resources/res/drawable-hdpi/ic_phone_attach.png b/java/com/android/dialer/contacts/resources/res/drawable-hdpi/ic_phone_attach.png
deleted file mode 100644
index 0137d75a363e0943ef28a787f8bc675fe60ad6e0..0000000000000000000000000000000000000000
Binary files a/java/com/android/dialer/contacts/resources/res/drawable-hdpi/ic_phone_attach.png and /dev/null differ
diff --git a/java/com/android/dialer/contacts/resources/res/drawable-mdpi/ic_phone_attach.png b/java/com/android/dialer/contacts/resources/res/drawable-mdpi/ic_phone_attach.png
deleted file mode 100644
index b02379956e459b6ba0314e59a3fed17eee5dc5c0..0000000000000000000000000000000000000000
Binary files a/java/com/android/dialer/contacts/resources/res/drawable-mdpi/ic_phone_attach.png and /dev/null differ
diff --git a/java/com/android/dialer/contacts/resources/res/drawable-xhdpi/ic_phone_attach.png b/java/com/android/dialer/contacts/resources/res/drawable-xhdpi/ic_phone_attach.png
deleted file mode 100644
index 6bd3237d0d8bdf3ec1bef58790375ac5a9c471d7..0000000000000000000000000000000000000000
Binary files a/java/com/android/dialer/contacts/resources/res/drawable-xhdpi/ic_phone_attach.png and /dev/null differ
diff --git a/java/com/android/dialer/contacts/resources/res/drawable-xxhdpi/ic_phone_attach.png b/java/com/android/dialer/contacts/resources/res/drawable-xxhdpi/ic_phone_attach.png
deleted file mode 100644
index dd58d1c30598b0e02c4144ef2c198373a8aeda42..0000000000000000000000000000000000000000
Binary files a/java/com/android/dialer/contacts/resources/res/drawable-xxhdpi/ic_phone_attach.png and /dev/null differ
diff --git a/java/com/android/dialer/contacts/resources/res/drawable-xxxhdpi/ic_phone_attach.png b/java/com/android/dialer/contacts/resources/res/drawable-xxxhdpi/ic_phone_attach.png
deleted file mode 100644
index e238c9915dd13c0543aaf84e99786565a02365f1..0000000000000000000000000000000000000000
Binary files a/java/com/android/dialer/contacts/resources/res/drawable-xxxhdpi/ic_phone_attach.png and /dev/null differ
diff --git a/java/com/android/dialer/contacts/resources/res/drawable/back_arrow.xml b/java/com/android/dialer/contacts/resources/res/drawable/back_arrow.xml
deleted file mode 100644
index 34fa3d7fcf60238de66cd5952ec0103d8688c7cd..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/contacts/resources/res/drawable/back_arrow.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
- Unless otherwise set, all fields will default to false.
- */
- public static Builder builder() {
- return new AutoValue_EnrichedCallCapabilities.Builder()
- .setCallComposerCapable(false)
- .setPostCallCapable(false)
- .setVideoShareCapable(false)
- .setTemporarilyUnavailable(false);
- }
-
- /** Creates instances of {@link EnrichedCallCapabilities}. */
- @AutoValue.Builder
- public abstract static class Builder {
- public abstract Builder setCallComposerCapable(boolean isCapable);
-
- public abstract Builder setPostCallCapable(boolean isCapable);
-
- public abstract Builder setVideoShareCapable(boolean isCapable);
-
- public abstract Builder setTemporarilyUnavailable(boolean temporarilyUnavailable);
-
- public abstract EnrichedCallCapabilities build();
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/EnrichedCallComponent.java b/java/com/android/dialer/enrichedcall/EnrichedCallComponent.java
deleted file mode 100644
index 46afd848ddace1b32175b4c2497d8ee55bba8ad4..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/EnrichedCallComponent.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.enrichedcall;
-
-import android.content.Context;
-import android.support.annotation.NonNull;
-import com.android.dialer.inject.HasRootComponent;
-import com.android.dialer.inject.IncludeInDialerRoot;
-import dagger.Subcomponent;
-
-/** Subcomponent that can be used to access the enriched call implementation. */
-@Subcomponent
-public abstract class EnrichedCallComponent {
-
- @NonNull
- public abstract EnrichedCallManager getEnrichedCallManager();
-
- @NonNull
- public abstract RcsVideoShareFactory getRcsVideoShareFactory();
-
- public static EnrichedCallComponent get(Context context) {
- return ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component())
- .enrichedCallComponent();
- }
-
- /** Used to refer to the root application component. */
- @IncludeInDialerRoot
- public interface HasComponent {
- EnrichedCallComponent enrichedCallComponent();
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/EnrichedCallManager.java b/java/com/android/dialer/enrichedcall/EnrichedCallManager.java
deleted file mode 100644
index 681193c5283c38d8a849437ca2da3efc60affb37..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/EnrichedCallManager.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.enrichedcall;
-
-import android.content.BroadcastReceiver.PendingResult;
-import android.support.annotation.MainThread;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import com.android.dialer.calldetails.CallDetailsEntries;
-import com.android.dialer.calldetails.CallDetailsEntries.CallDetailsEntry;
-import com.android.dialer.enrichedcall.historyquery.proto.HistoryResult;
-import com.android.dialer.enrichedcall.videoshare.VideoShareListener;
-import com.android.dialer.enrichedcall.videoshare.VideoShareSession;
-import com.android.dialer.multimedia.MultimediaData;
-import java.util.List;
-import java.util.Map;
-
-/** Performs all enriched calling logic. */
-public interface EnrichedCallManager {
-
- int POST_CALL_NOTE_MAX_CHAR = 60;
-
- /** Receives updates when enriched call capabilities are ready. */
- interface CapabilitiesListener {
-
- /** Callback fired when the capabilities are updated. */
- @MainThread
- void onCapabilitiesUpdated();
- }
-
- /**
- * Registers the given {@link CapabilitiesListener}.
- *
- * As a result of this method, the listener will receive a call to {@link
- * CapabilitiesListener#onCapabilitiesUpdated()} after a call to {@link
- * #requestCapabilities(String)}.
- */
- @MainThread
- void registerCapabilitiesListener(@NonNull CapabilitiesListener listener);
-
- /**
- * Starts an asynchronous process to get enriched call capabilities of the given number.
- *
- * Registered listeners will receive a call to {@link
- * CapabilitiesListener#onCapabilitiesUpdated()} on completion.
- *
- * @param number the remote number in any format
- */
- @MainThread
- void requestCapabilities(@NonNull String number);
-
- /**
- * Unregisters the given {@link CapabilitiesListener}.
- *
- * As a result of this method, the listener will not receive capabilities of the given number.
- */
- @MainThread
- void unregisterCapabilitiesListener(@NonNull CapabilitiesListener listener);
-
- /** Gets the cached capabilities for the given number, else null */
- @MainThread
- @Nullable
- EnrichedCallCapabilities getCapabilities(@NonNull String number);
-
- /** Clears any cached data, such as capabilities. */
- @MainThread
- void clearCachedData();
-
- /**
- * Starts a call composer session with the given remote number.
- *
- * @param number the remote number in any format
- * @return the id for the started session, or {@link Session#NO_SESSION_ID} if the session fails
- */
- @MainThread
- long startCallComposerSession(@NonNull String number);
-
- /**
- * Sends the given information through an open enriched call session. As per the enriched calling
- * spec, up to two messages are sent: the first is an enriched call data message that optionally
- * includes the subject and the second is the optional image data message.
- *
- * @param sessionId the id for the session. See {@link #startCallComposerSession(String)}
- * @param data the {@link MultimediaData}
- * @throws IllegalArgumentException if there's no open session with the given number
- * @throws IllegalStateException if the session isn't in the {@link Session#STATE_STARTED} state
- */
- @MainThread
- void sendCallComposerData(long sessionId, @NonNull MultimediaData data);
-
- /**
- * Ends the given call composer session. Ending a session means that the call composer session
- * will be closed.
- *
- * @param sessionId the id of the session to end
- */
- @MainThread
- void endCallComposerSession(long sessionId);
-
- /**
- * Sends a post call note to the given number.
- *
- * @throws IllegalArgumentException if message is longer than {@link #POST_CALL_NOTE_MAX_CHAR}
- * characters
- */
- @MainThread
- void sendPostCallNote(@NonNull String number, @NonNull String message);
-
- /**
- * Called once the capabilities are available for a corresponding call to {@link
- * #requestCapabilities(String)}.
- *
- * @param number the remote number in any format
- * @param capabilities the supported capabilities
- */
- @MainThread
- void onCapabilitiesReceived(
- @NonNull String number, @NonNull EnrichedCallCapabilities capabilities);
-
- /** Receives updates when the state of an enriched call changes. */
- interface StateChangedListener {
-
- /**
- * Callback fired when state changes. Listeners should call {@link #getSession(long)} or {@link
- * #getSession(String, String, Filter)} to retrieve the new state.
- */
- void onEnrichedCallStateChanged();
- }
-
- /**
- * Registers the given {@link StateChangedListener}.
- *
- * As a result of this method, the listener will receive updates when the state of any enriched
- * call changes.
- */
- @MainThread
- void registerStateChangedListener(@NonNull StateChangedListener listener);
-
- /**
- * Returns the {@link Session} for the given unique call id, falling back to the number. If a
- * filter is provided, it will be applied to both the uniqueCalId and number lookups.
- */
- @MainThread
- @Nullable
- Session getSession(@NonNull String uniqueCallId, @NonNull String number, @Nullable Filter filter);
-
- /** Returns the {@link Session} for the given sessionId, or {@code null} if no session exists. */
- @MainThread
- @Nullable
- Session getSession(long sessionId);
-
- /**
- * Returns a list containing viewable string representations of all existing sessions.
- *
- * Intended for debug display purposes only.
- */
- @MainThread
- @NonNull
- List As a result of this method, the listener will receive updates when the state of any enriched
- * call historical data changes.
- */
- @MainThread
- void registerHistoricalDataChangedListener(@NonNull HistoricalDataChangedListener listener);
-
- /**
- * Unregisters the given {@link HistoricalDataChangedListener}.
- *
- * As a result of this method, the listener will not receive updates when the state of enriched
- * call historical data changes.
- */
- @MainThread
- void unregisterHistoricalDataChangedListener(@NonNull HistoricalDataChangedListener listener);
-
- /**
- * Starts an asynchronous process to get all historical data for the given number and set of
- * {@link CallDetailsEntries}.
- */
- @MainThread
- void requestAllHistoricalData(@NonNull String number, @NonNull CallDetailsEntries entries);
-
- /**
- * Returns a mapping of enriched call data for all of the given {@link CallDetailsEntries}, which
- * should not be modified. A {@code null} return indicates that clients should call {@link
- * #requestAllHistoricalData(String, CallDetailsEntries)}.
- *
- * The mapping is created by finding the HistoryResults whose timestamps occurred during or
- * close after a CallDetailsEntry. A CallDetailsEntry can have multiple HistoryResults in the
- * event that both a CallComposer message and PostCall message were sent for the same call.
- */
- @Nullable
- @MainThread
- Map As a result of this method, the listener will not receive updates when the state of enriched
- * calls changes.
- */
- @MainThread
- void unregisterStateChangedListener(@NonNull StateChangedListener listener);
-
- /**
- * Called when the status of an enriched call session changes.
- *
- *
- * @throws IllegalArgumentException if the state is invalid
- */
- @MainThread
- void onSessionStatusUpdate(long sessionId, @NonNull String number, int state);
-
- /**
- * Called when the status of an enriched call message updates.
- *
- *
- * @throws IllegalArgumentException if the state is invalid
- * @throws IllegalStateException if there's no session for the given id
- */
- @MainThread
- void onMessageUpdate(long sessionId, @NonNull String messageId, int state);
-
- /**
- * Called when call composer data arrives for the given session.
- *
- * @throws IllegalStateException if there's no session for the given id
- */
- @MainThread
- void onIncomingCallComposerData(long sessionId, @NonNull MultimediaData multimediaData);
-
- /**
- * Called when post call data arrives for the given session.
- *
- * @param pendingResult PendingResult form a broadcast receiver. The broadcast might be received
- * when dialer is not in the foreground, and can not start {@link
- * com.android.dialer.app.calllog.CallLogNotificationsService} to handle the event. The
- * pendingResult allows dialer to hold on to resources when the event is handled in a
- * background thread. TODO(a bug): migrate CallLogNotificationsService to a
- * JobIntentService so it can be used in the background.
- * @throws IllegalStateException if there's no session for the given id
- */
- @MainThread
- void onIncomingPostCallData(
- @NonNull PendingResult pendingResult, long sessionId, @NonNull MultimediaData multimediaData);
-
- /**
- * Registers the given {@link VideoShareListener}.
- *
- * As a result of this method, the listener will receive updates when any video share state
- * changes.
- */
- @MainThread
- void registerVideoShareListener(@NonNull VideoShareListener listener);
-
- /**
- * Unregisters the given {@link VideoShareListener}.
- *
- * As a result of this method, the listener will not receive updates when any video share state
- * changes.
- */
- @MainThread
- void unregisterVideoShareListener(@NonNull VideoShareListener listener);
-
- /**
- * Called when an incoming video share invite is received.
- *
- * @return whether or not the invite was accepted by the manager (rejected when disabled)
- */
- @MainThread
- boolean onIncomingVideoShareInvite(long sessionId, @NonNull String number);
-
- /**
- * Starts a video share session with the given remote number.
- *
- * @param number the remote number in any format
- * @return the id for the started session, or {@link Session#NO_SESSION_ID} if the session fails
- */
- @MainThread
- long startVideoShareSession(@NonNull String number);
-
- /**
- * Accepts a video share session invite.
- *
- * @param sessionId the session to accept
- * @return whether or not accepting the session succeeded
- */
- @MainThread
- boolean acceptVideoShareSession(long sessionId);
-
- /**
- * Retrieve the session id for an incoming video share invite.
- *
- * @param number the remote number in any format
- * @return the id for the session invite, or {@link Session#NO_SESSION_ID} if there is no invite
- */
- @MainThread
- long getVideoShareInviteSessionId(@NonNull String number);
-
- /**
- * Returns the {@link VideoShareSession} for the given sessionId, or {@code null} if no session
- * exists.
- */
- @MainThread
- @Nullable
- VideoShareSession getVideoShareSession(long sessionId);
-
- /**
- * Ends the given video share session.
- *
- * @param sessionId the id of the session to end
- */
- @MainThread
- void endVideoShareSession(long sessionId);
-
- /** Interface for filtering sessions (compatible with Predicate from Java 8) */
- interface Filter {
- boolean test(Session session);
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/FuzzyPhoneNumberMatcher.java b/java/com/android/dialer/enrichedcall/FuzzyPhoneNumberMatcher.java
deleted file mode 100644
index 6f4d9752188d6c6b7d6bcff7d1c2fdab11123b57..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/FuzzyPhoneNumberMatcher.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.dialer.enrichedcall;
-
-import android.support.annotation.NonNull;
-
-/** Utility for comparing phone numbers. */
-public class FuzzyPhoneNumberMatcher {
-
- private static final int REQUIRED_MATCHED_DIGITS = 7;
-
- /**
- * Returns {@code true} if the given numbers can be interpreted to be the same.
- *
- * This method is called numerous times when rendering the call log. Using string methods is
- * too slow, so character by character matching is used instead.
- */
- public static boolean matches(@NonNull String lhs, @NonNull String rhs) {
- return lastSevenDigitsCharacterByCharacterMatches(lhs, rhs);
- }
-
- /**
- * This strategy examines the numbers character by character starting from the end. If the last
- * {@link #REQUIRED_MATCHED_DIGITS} match, it returns {@code true}.
- */
- private static boolean lastSevenDigitsCharacterByCharacterMatches(
- @NonNull String lhs, @NonNull String rhs) {
- int lhsIndex = lhs.length() - 1;
- int rhsIndex = rhs.length() - 1;
-
- int matchedDigits = 0;
-
- while (lhsIndex >= 0 && rhsIndex >= 0) {
- if (!Character.isDigit(lhs.charAt(lhsIndex))) {
- --lhsIndex;
- continue;
- }
- if (!Character.isDigit(rhs.charAt(rhsIndex))) {
- --rhsIndex;
- continue;
- }
- if (lhs.charAt(lhsIndex) != rhs.charAt(rhsIndex)) {
- break;
- }
- --lhsIndex;
- --rhsIndex;
- ++matchedDigits;
- }
-
- return matchedDigits >= REQUIRED_MATCHED_DIGITS;
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/OutgoingCallComposerData.java b/java/com/android/dialer/enrichedcall/OutgoingCallComposerData.java
deleted file mode 100644
index 56145ddd41d94ebe33673b3c480f23e89a5799ca..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/OutgoingCallComposerData.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.enrichedcall;
-
-import android.net.Uri;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import com.android.dialer.common.Assert;
-import com.google.auto.value.AutoValue;
-
-/**
- * Value type holding references to all data that could be provided for the call composer.
- *
- * Note: Either the subject, the image data, or both must be specified, e.g.
- *
- * This activity will dynamically refresh as new sessions are added or updated, but there's no
- * update when sessions are deleted from memory. Use the refresh button to update the view.
- */
-public class EnrichedCallSimulatorActivity extends AppCompatActivity
- implements StateChangedListener, OnClickListener {
-
- public static Intent newIntent(@NonNull Context context) {
- return new Intent(Assert.isNotNull(context), EnrichedCallSimulatorActivity.class);
- }
-
- private Button refreshButton;
-
- private SessionsAdapter sessionsAdapter;
-
- @Override
- protected void onCreate(@Nullable Bundle bundle) {
- LogUtil.enterBlock("EnrichedCallSimulatorActivity.onCreate");
- super.onCreate(bundle);
- setContentView(R.layout.enriched_call_simulator_activity);
- Toolbar toolbar = findViewById(R.id.toolbar);
- toolbar.setTitle(R.string.enriched_call_simulator_activity);
-
- refreshButton = findViewById(R.id.refresh);
- refreshButton.setOnClickListener(this);
-
- RecyclerView recyclerView = findViewById(R.id.sessions_recycler_view);
- recyclerView.setLayoutManager(new LinearLayoutManager(this));
-
- sessionsAdapter = new SessionsAdapter();
- sessionsAdapter.setSessionStrings(getEnrichedCallManager().getAllSessionsForDisplay());
- recyclerView.setAdapter(sessionsAdapter);
- }
-
- @Override
- protected void onResume() {
- LogUtil.enterBlock("EnrichedCallSimulatorActivity.onResume");
- super.onResume();
- getEnrichedCallManager().registerStateChangedListener(this);
- }
-
- @Override
- protected void onPause() {
- LogUtil.enterBlock("EnrichedCallSimulatorActivity.onPause");
- super.onPause();
- getEnrichedCallManager().unregisterStateChangedListener(this);
- }
-
- @Override
- public void onEnrichedCallStateChanged() {
- LogUtil.enterBlock("EnrichedCallSimulatorActivity.onEnrichedCallStateChanged");
- refreshSessions();
- }
-
- @Override
- public void onClick(View v) {
- if (v == refreshButton) {
- LogUtil.i("EnrichedCallSimulatorActivity.onClick", "refreshing sessions");
- refreshSessions();
- }
- }
-
- private void refreshSessions() {
- sessionsAdapter.setSessionStrings(getEnrichedCallManager().getAllSessionsForDisplay());
- sessionsAdapter.notifyDataSetChanged();
- }
-
- private EnrichedCallManager getEnrichedCallManager() {
- return EnrichedCallComponent.get(this).getEnrichedCallManager();
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/simulator/SessionViewHolder.java b/java/com/android/dialer/enrichedcall/simulator/SessionViewHolder.java
deleted file mode 100644
index 44431253d88205958b94d83d3e925350e9e87ced..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/simulator/SessionViewHolder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.enrichedcall.simulator;
-
-import android.support.annotation.NonNull;
-import android.support.v7.widget.RecyclerView;
-import android.view.View;
-import android.widget.TextView;
-
-/** ViewHolder for an Enriched call session. */
-class SessionViewHolder extends RecyclerView.ViewHolder {
-
- private final TextView sessionStringView;
-
- SessionViewHolder(View view) {
- super(view);
- sessionStringView = view.findViewById(R.id.session_string);
- }
-
- void updateSession(@NonNull String sessionString) {
- sessionStringView.setText(sessionString);
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/simulator/SessionsAdapter.java b/java/com/android/dialer/enrichedcall/simulator/SessionsAdapter.java
deleted file mode 100644
index 25edfc7dd2a8ac1c175e3ab19f48a1b8a7655420..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/simulator/SessionsAdapter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.enrichedcall.simulator;
-
-import android.support.annotation.NonNull;
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.ViewGroup;
-import com.android.dialer.common.Assert;
-import java.util.List;
-
-/** Adapter for the RecyclerView in {@link EnrichedCallSimulatorActivity}. */
-class SessionsAdapter extends RecyclerView.Adapter Usually users put this annotation on application class that is root of dependencies (the last
- * thing to compile). The annotation processor will figure out what it needs to generate a variant
- * root through dependencies.
- *
- * Example:
- *
- * It has a parameter for users to enter on which variants annotated module will be installed and
- * also must be non-empty. Example:
- *
- * By default, this class scales the indicator in the x direction to reveal the default pill
+ * shape.
+ *
+ * Subclasses can override {@link #updateForProgress(float, float, View)} to manipulate the
+ * view in any way appropriate.
+ */
+ private static class ActiveIndicatorTransform {
+
+ private static final float SCALE_X_HIDDEN = .4F;
+ private static final float SCALE_X_SHOWN = 1F;
+
+ // The fraction of the animation's total duration over which the indicator will be faded in or
+ // out.
+ private static final float ALPHA_FRACTION = 1F / 5F;
+
+ /**
+ * Calculate the alpha value, based on a progress and target value, that has the indicator
+ * appear or disappear over the first 1/5th of the transform.
+ */
+ protected float calculateAlpha(
+ @FloatRange(from = 0F, to = 1F) float progress,
+ @FloatRange(from = 0F, to = 1F) float targetValue) {
+ // Animate the alpha of the indicator over the first ALPHA_FRACTION of the animation
+ float startAlphaFraction = targetValue == 0F ? 1F - ALPHA_FRACTION : 0F;
+ float endAlphaFraction = targetValue == 0F ? 1F : 0F + ALPHA_FRACTION;
+ return MathUtil.lerp(0F, 1F, progress);
+ }
+
+ protected float calculateScaleX(
+ @FloatRange(from = 0F, to = 1F) float progress,
+ @FloatRange(from = 0F, to = 1F) float targetValue) {
+ return MathUtil.lerp(SCALE_X_HIDDEN, SCALE_X_SHOWN, progress);
+ }
+
+ protected float calculateScaleY(
+ @FloatRange(from = 0F, to = 1F) float progress,
+ @FloatRange(from = 0F, to = 1F) float targetValue) {
+ return 1F;
+ }
+
+ /**
+ * Called whenever the {@code indicator} should update its parameters (scale, alpha, etc.) in
+ * response to a change in progress.
+ *
+ * @param progress A value between 0 and 1 where 0 represents a fully hidden indicator and 1
+ * indicates a fully shown indicator.
+ * @param targetValue The final value towards which the progress is moving. This will be either
+ * 0 and 1 and can be used to determine whether the indicator is showing or hiding if show
+ * and hide animations differ.
+ * @param indicator The active indicator {@link View}.
+ */
+ public void updateForProgress(
+ @FloatRange(from = 0F, to = 1F) float progress,
+ @FloatRange(from = 0F, to = 1F) float targetValue,
+ @NonNull View indicator) {
+ indicator.setScaleX(calculateScaleX(progress, targetValue));
+ indicator.setScaleY(calculateScaleY(progress, targetValue));
+ indicator.setAlpha(calculateAlpha(progress, targetValue));
+ }
+ }
}
diff --git a/java/com/android/dialer/main/impl/bottomnav/MissedCallCountObserver.java b/java/com/android/dialer/main/impl/bottomnav/MissedCallCountObserver.java
index a4995c1e693fcf1d71d015c06d188c0e33124b2a..9907d84346616e14c95bf2b291b6747df6345aae 100644
--- a/java/com/android/dialer/main/impl/bottomnav/MissedCallCountObserver.java
+++ b/java/com/android/dialer/main/impl/bottomnav/MissedCallCountObserver.java
@@ -21,7 +21,9 @@ import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.provider.CallLog.Calls;
-import android.support.annotation.RequiresPermission;
+
+import androidx.annotation.RequiresPermission;
+
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.common.concurrent.UiListener;
import com.android.dialer.main.impl.bottomnav.BottomNavBar.TabIndex;
diff --git a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml
index 1dd60d8dbf2f133416ba2af4c8873d8ad9954a2c..668a6557ecff0a061c3ed4476a42a7ba52c57143 100644
--- a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml
+++ b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml
@@ -19,7 +19,7 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="?android:attr/colorBackgroundFloating"
+ android:background="@color/rounded_dialpad_bg_color"
android:elevation="8dp">
For example:
- *
- * The thread policy is only mutated if this is called from the main thread.
- */
- @AnyThread
- public static For example:
- *
- * The thread policy is only mutated if this is called from the main thread.
- */
- @AnyThread
- public static void bypass(Runnable runnable) {
- if (isStrictModeAllowed() && onMainThread()) {
- ThreadPolicy originalPolicy = StrictMode.getThreadPolicy();
- StrictMode.setThreadPolicy(THREAD_NO_PENALTY);
- try {
- runnable.run();
- } finally {
- StrictMode.setThreadPolicy(originalPolicy);
- }
- } else {
- runnable.run();
- }
- }
-
- public static boolean isStrictModeAllowed() {
- return BuildType.get() == Type.BUGFOOD;
- }
-
- private static boolean onMainThread() {
- return Looper.getMainLooper().equals(Looper.myLooper());
- }
-
- /**
- * We frequently access shared preferences on the main thread, which causes strict mode
- * violations. When strict mode is allowed, warm up the shared preferences so that later uses of
- * shared preferences access the in-memory versions and we don't have to bypass strict mode at
- * every point in the application where shared preferences are accessed.
- */
- public static void warmupSharedPrefs(Application application) {
- // From credential-encrypted (CE) storage, i.e.:
- // /data/data/com.android.dialer/shared_prefs
-
- if (UserManagerCompat.isUserUnlocked(application)) {
- // adb shell settings put system dialer_emergency_call_threshold_ms 60000
+ */
+ private static final String RECENT_EMERGENCY_CALL_THRESHOLD_SETTINGS_KEY =
+ "dialer_emergency_call_threshold_ms";
+
+ public static long getLastEmergencyCallTimeMillis(Context context) {
+ return StorageComponent.get(context)
+ .unencryptedSharedPrefs()
+ .getLong(LAST_EMERGENCY_CALL_MS_PREF_KEY, 0);
+ }
+
+ public static boolean hasRecentEmergencyCall(Context context) {
+ if (context == null) {
+ return false;
+ }
+
+ Long lastEmergencyCallTime = getLastEmergencyCallTimeMillis(context);
+ if (lastEmergencyCallTime == 0) {
+ return false;
+ }
+
+ return (System.currentTimeMillis() - lastEmergencyCallTime)
+ < getRecentEmergencyCallThresholdMs(context);
+ }
+
+ public static void recordLastEmergencyCallTime(Context context) {
+ if (context == null) {
+ return;
+ }
+
+ StorageComponent.get(context)
+ .unencryptedSharedPrefs()
+ .edit()
+ .putLong(LAST_EMERGENCY_CALL_MS_PREF_KEY, System.currentTimeMillis())
+ .putBoolean(NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY, false)
+ .apply();
+ }
+
+ private static long getRecentEmergencyCallThresholdMs(Context context) {
+ if (LogUtil.isVerboseEnabled()) {
+ long thresholdMs =
+ Settings.System.getLong(
+ context.getContentResolver(), RECENT_EMERGENCY_CALL_THRESHOLD_SETTINGS_KEY, 0);
+ return thresholdMs > 0 ? thresholdMs : RECENT_EMERGENCY_CALL_THRESHOLD_MS;
+ } else {
+ return RECENT_EMERGENCY_CALL_THRESHOLD_MS;
+ }
+ }
+}
diff --git a/java/com/android/dialer/util/MoreStrings.java b/java/com/android/dialer/util/MoreStrings.java
index 5a43b1d1084032c790bb71359d0cdc7330bb3645..297389c308526e7a7b7d03f60423e35e9164ad82 100644
--- a/java/com/android/dialer/util/MoreStrings.java
+++ b/java/com/android/dialer/util/MoreStrings.java
@@ -16,9 +16,10 @@
package com.android.dialer.util;
-import android.support.annotation.Nullable;
import android.text.TextUtils;
+import androidx.annotation.Nullable;
+
/** Static utility methods for Strings. */
public class MoreStrings {
diff --git a/java/com/android/dialer/util/PermissionsUtil.java b/java/com/android/dialer/util/PermissionsUtil.java
index 7e8aae9436c91a5d6a352ca0cadad3d83c522426..76bc5b1758c6c1de7126f05854ece015e7beb5a5 100644
--- a/java/com/android/dialer/util/PermissionsUtil.java
+++ b/java/com/android/dialer/util/PermissionsUtil.java
@@ -36,11 +36,13 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
-import android.support.annotation.NonNull;
-import android.support.annotation.VisibleForTesting;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.LocalBroadcastManager;
import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+
+import com.android.dialer.R;
import com.android.dialer.common.LogUtil;
import com.android.dialer.storage.StorageComponent;
import java.util.ArrayList;
@@ -51,8 +53,7 @@ import java.util.List;
/** Utility class to help with runtime permissions. */
public class PermissionsUtil {
- @VisibleForTesting
- public static final String PREFERENCE_CAMERA_ALLOWED_BY_USER = "camera_allowed_by_user";
+ private static final String PREFERENCE_CAMERA_ALLOWED_BY_USER = "camera_allowed_by_user";
private static final String PERMISSION_PREFERENCE = "dialer_permissions";
private static final String CEQUINT_PERMISSION = "com.cequint.ecid.CALLER_ID_LOOKUP";
diff --git a/java/com/android/dialer/util/ViewUtil.java b/java/com/android/dialer/util/ViewUtil.java
index 81a32f98584189f226e9dcd830f386e0e725030e..d2e4e992706c2ff521604271572c81925e8d4dc1 100644
--- a/java/com/android/dialer/util/ViewUtil.java
+++ b/java/com/android/dialer/util/ViewUtil.java
@@ -22,7 +22,6 @@ import android.graphics.Paint;
import android.os.PowerManager;
import android.provider.Settings;
import android.provider.Settings.Global;
-import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.View;
@@ -30,6 +29,9 @@ import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.ViewTreeObserver.OnPreDrawListener;
import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+
import java.util.Locale;
/** Provides static functions to work with views */
@@ -101,7 +103,7 @@ public class ViewUtil {
}
public static void doOnPreDraw(
- @NonNull final View view, final boolean drawNextFrame, final ViewRunnable runnable) {
+ @NonNull final View view, final boolean drawNextFrame, final ViewRunnable runnable) {
view.getViewTreeObserver()
.addOnPreDrawListener(
new OnPreDrawListener() {
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java
deleted file mode 100644
index 5b2f0619f77ddbb68a54ba3a8f8c2fddeb047069..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java
+++ /dev/null
@@ -1,1115 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-package com.android.dialer.voicemail.listui;
-
-import android.app.FragmentManager;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.database.Cursor;
-import android.media.MediaPlayer;
-import android.media.MediaPlayer.OnCompletionListener;
-import android.media.MediaPlayer.OnErrorListener;
-import android.media.MediaPlayer.OnPreparedListener;
-import android.net.Uri;
-import android.provider.VoicemailContract.Voicemails;
-import android.support.annotation.IntDef;
-import android.support.annotation.Nullable;
-import android.support.annotation.WorkerThread;
-import android.support.design.widget.Snackbar;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.RecyclerView.ViewHolder;
-import android.util.ArrayMap;
-import android.util.ArraySet;
-import android.util.Pair;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import com.android.dialer.calllogutils.CallLogDates;
-import com.android.dialer.common.Assert;
-import com.android.dialer.common.LogUtil;
-import com.android.dialer.common.concurrent.DialerExecutorComponent;
-import com.android.dialer.common.concurrent.ThreadUtil;
-import com.android.dialer.time.Clock;
-import com.android.dialer.voicemail.listui.NewVoicemailViewHolder.NewVoicemailViewHolderListener;
-import com.android.dialer.voicemail.listui.error.VoicemailErrorMessage;
-import com.android.dialer.voicemail.listui.error.VoicemailErrorMessageCreator;
-import com.android.dialer.voicemail.listui.error.VoicemailStatus;
-import com.android.dialer.voicemail.model.VoicemailEntry;
-import com.android.voicemail.VoicemailClient;
-import com.google.common.collect.ImmutableList;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.Locale;
-import java.util.Objects;
-import java.util.Set;
-
-/** {@link RecyclerView.Adapter} for the new voicemail call log fragment. */
-final class NewVoicemailAdapter extends RecyclerView.Adapter The {@link NewVoicemailMediaPlayer} is also reset, if there is an existing playing
- * voicemail.
- *
- * This is the function that is responsible of keeping track of the expanded viewholder in the
- * {@link NewVoicemailAdapter}
- *
- * This is the first function called in the adapter when a viewholder has been expanded.
- *
- * This is the function that is responsible of keeping track of the expanded viewholder in the
- * {@link NewVoicemailAdapter}
- *
- * @param viewHolderRequestedToExpand is the view holder that is currently expanded.
- * @param voicemailEntryOfViewHolder
- */
- @Override
- public void expandViewHolderFirstTimeAndCollapseAllOtherVisibleViewHolders(
- NewVoicemailViewHolder viewHolderRequestedToExpand,
- VoicemailEntry voicemailEntryOfViewHolder,
- NewVoicemailViewHolderListener listener) {
-
- LogUtil.i(
- "NewVoicemailAdapter.expandViewHolderFirstTimeAndCollapseAllOtherVisibleViewHolders",
- "viewholder id:%d being request to expand, isExpanded:%b, size of our view holder "
- + "dataset:%d, hashmap size:%d",
- viewHolderRequestedToExpand.getViewHolderId(),
- viewHolderRequestedToExpand.isViewHolderExpanded(),
- newVoicemailViewHolderSet.size(),
- newVoicemailViewHolderArrayMap.size());
-
- currentlyExpandedViewHolderId = viewHolderRequestedToExpand.getViewHolderId();
-
- for (NewVoicemailViewHolder viewHolder : newVoicemailViewHolderSet) {
- if (viewHolder.getViewHolderId() != viewHolderRequestedToExpand.getViewHolderId()) {
- viewHolder.collapseViewHolder();
- }
- }
-
- // If the media player is playing and we expand something other than the currently playing one
- // we should stop playing the media player
- if (mediaPlayer.isPlaying()
- && !Objects.equals(
- mediaPlayer.getLastPlayedOrPlayingVoicemailUri(),
- viewHolderRequestedToExpand.getViewHolderVoicemailUri())) {
- LogUtil.i(
- "NewVoicemailAdapter.expandViewHolderFirstTimeAndCollapseAllOtherVisibleViewHolders",
- "Reset the media player since we expanded something other that the playing "
- + "voicemail, MP was playing:%s, viewholderExpanded:%d, MP.isPlaying():%b",
- String.valueOf(mediaPlayer.getLastPlayedOrPlayingVoicemailUri()),
- viewHolderRequestedToExpand.getViewHolderId(),
- mediaPlayer.isPlaying());
- mediaPlayer.reset();
- }
-
- // If the media player is paused and we expand something other than the currently paused one
- // we should stop playing the media player
- if (mediaPlayer.isPaused()
- && !Objects.equals(
- mediaPlayer.getLastPausedVoicemailUri(),
- viewHolderRequestedToExpand.getViewHolderVoicemailUri())) {
- LogUtil.i(
- "NewVoicemailAdapter.expandViewHolderFirstTimeAndCollapseAllOtherVisibleViewHolders",
- "There was an existing paused viewholder, the media player should reset since we "
- + "expanded something other that the paused voicemail, MP.paused:%s",
- String.valueOf(mediaPlayer.getLastPausedVoicemailUri()));
- mediaPlayer.reset();
- }
-
- Assert.checkArgument(
- !viewHolderRequestedToExpand.isViewHolderExpanded(),
- "cannot expand a voicemail that is not collapsed");
-
- viewHolderRequestedToExpand.expandAndBindViewHolderAndMediaPlayerViewWithAdapterValues(
- voicemailEntryOfViewHolder, fragmentManager, mediaPlayer, listener);
-
- // There should be nothing playing when we expand a viewholder for the first time
- Assert.checkArgument(!mediaPlayer.isPlaying());
- }
-
- /**
- * Ensures that when we collapse the expanded view, we don't expand it again when we are recycling
- * the viewholders. If we collapse an existing playing voicemail viewholder, we should stop
- * playing it.
- *
- * @param collapseViewHolder is the view holder that is currently collapsed.
- */
- @Override
- public void collapseExpandedViewHolder(NewVoicemailViewHolder collapseViewHolder) {
- Assert.checkArgument(collapseViewHolder.getViewHolderId() == currentlyExpandedViewHolderId);
- collapseViewHolder.collapseViewHolder();
- currentlyExpandedViewHolderId = -1;
-
- // If the view holder is currently playing, then we should stop playing it.
- if (mediaPlayer.isPlaying()) {
- Assert.checkArgument(
- Objects.equals(
- mediaPlayer.getLastPlayedOrPlayingVoicemailUri(),
- collapseViewHolder.getViewHolderVoicemailUri()),
- "the voicemail being played should have been of the recently collapsed view holder.");
- mediaPlayer.reset();
- }
- }
-
- @Override
- public void pauseViewHolder(NewVoicemailViewHolder expandedViewHolder) {
- Assert.isNotNull(
- getCurrentlyExpandedViewHolder(),
- "cannot have pressed pause if the viewholder wasn't expanded");
- Assert.checkArgument(
- getCurrentlyExpandedViewHolder()
- .getViewHolderVoicemailUri()
- .equals(expandedViewHolder.getViewHolderVoicemailUri()),
- "view holder whose pause button was pressed has to have been the expanded "
- + "viewholder being tracked by the adapter.");
- mediaPlayer.pauseMediaPlayer(expandedViewHolder.getViewHolderVoicemailUri());
- expandedViewHolder.setPausedStateOfMediaPlayerView(
- expandedViewHolder.getViewHolderVoicemailUri(), mediaPlayer);
- }
-
- @Override
- public void resumePausedViewHolder(NewVoicemailViewHolder expandedViewHolder) {
- Assert.isNotNull(
- getCurrentlyExpandedViewHolder(),
- "cannot have pressed pause if the viewholder wasn't expanded");
- Assert.checkArgument(
- getCurrentlyExpandedViewHolder()
- .getViewHolderVoicemailUri()
- .equals(expandedViewHolder.getViewHolderVoicemailUri()),
- "view holder whose play button was pressed has to have been the expanded "
- + "viewholder being tracked by the adapter.");
- Assert.isNotNull(
- mediaPlayer.getLastPausedVoicemailUri(), "there should be be an pausedUri to resume");
- Assert.checkArgument(
- mediaPlayer
- .getLastPlayedOrPlayingVoicemailUri()
- .equals(expandedViewHolder.getViewHolderVoicemailUri()),
- "only the last playing uri can be resumed");
- Assert.checkArgument(
- mediaPlayer
- .getLastPreparedOrPreparingToPlayVoicemailUri()
- .equals(expandedViewHolder.getViewHolderVoicemailUri()),
- "only the last prepared uri can be resumed");
- Assert.checkArgument(
- mediaPlayer
- .getLastPreparedOrPreparingToPlayVoicemailUri()
- .equals(mediaPlayer.getLastPlayedOrPlayingVoicemailUri()),
- "the last prepared and playing voicemails have to be the same when resuming");
-
- onPreparedListener.onPrepared(mediaPlayer.getMediaPlayer());
- }
-
- @Override
- public void deleteViewHolder(
- Context context,
- FragmentManager fragmentManager,
- NewVoicemailViewHolder expandedViewHolder,
- Uri voicemailUri) {
- LogUtil.i(
- "NewVoicemailAdapter.deleteViewHolder",
- "deleting adapter position %d, id:%d, uri:%s ",
- expandedViewHolder.getAdapterPosition(),
- expandedViewHolder.getViewHolderId(),
- String.valueOf(voicemailUri));
-
- deletedVoicemailPosition.add(expandedViewHolder.getAdapterPosition());
-
- Assert.checkArgument(expandedViewHolder.getViewHolderVoicemailUri().equals(voicemailUri));
-
- Assert.checkArgument(currentlyExpandedViewHolderId == expandedViewHolder.getViewHolderId());
-
- collapseExpandedViewHolder(expandedViewHolder);
-
- showUndoSnackbar(
- context,
- expandedViewHolder.getMediaPlayerView(),
- expandedViewHolder.getAdapterPosition(),
- voicemailUri);
- }
-
- private void showUndoSnackbar(
- Context context, View newVoicemailMediaPlayerView, int position, Uri voicemailUri) {
- LogUtil.i(
- "NewVoicemailAdapter.showUndoSnackbar",
- "position:%d and uri:%s",
- position,
- String.valueOf(voicemailUri));
- Snackbar undoSnackbar =
- Snackbar.make(
- newVoicemailMediaPlayerView,
- R.string.snackbar_voicemail_deleted,
- VOICEMAIL_DELETE_DELAY_MS);
- undoSnackbar.addCallback(
- new Snackbar.Callback() {
- @Override
- public void onShown(Snackbar sb) {
- notifyItemRemoved(position);
- LogUtil.i(
- "NewVoicemailAdapter.showUndoSnackbar",
- "onShown for position:%d and uri:%s",
- position,
- voicemailUri);
- super.onShown(sb);
- }
-
- @Override
- public void onDismissed(Snackbar transientBottomBar, int event) {
- LogUtil.i(
- "NewVoicemailAdapter.showUndoSnackbar",
- "onDismissed for event:%d, position:%d and uri:%s",
- event,
- position,
- String.valueOf(voicemailUri));
-
- switch (event) {
- case DISMISS_EVENT_SWIPE:
- case DISMISS_EVENT_ACTION:
- case DISMISS_EVENT_MANUAL:
- LogUtil.i(
- "NewVoicemailAdapter.showUndoSnackbar",
- "Not proceeding with deleting the voicemail");
- deletedVoicemailPosition.remove(position);
- notifyItemChanged(position);
- break;
- case DISMISS_EVENT_TIMEOUT:
- case DISMISS_EVENT_CONSECUTIVE:
- LogUtil.i(
- "NewVoicemailAdapter.showUndoSnackbar", "Proceeding with deleting voicemail");
-
- DialerExecutorComponent.get(context)
- .dialerExecutorFactory()
- .createNonUiTaskBuilder(this::deleteVoicemail)
- .build()
- .executeSerial(new Pair<>(context, voicemailUri));
- break;
- default:
- Assert.checkArgument(event <= 4 && event >= 0, "unknown event");
- }
- }
-
- @WorkerThread
- private Void deleteVoicemail(Pair Since this function is called at 30 frames/second, its possible (and eventually will happen)
- * that between each update the playing voicemail state could have changed, in which case this
- * method should stop calling itself. These conditions are:
- *
- * Note: Since the update happens at 30 frames/second, it's also possible that the viewholder
- * was recycled when scrolling the playing voicemail out of view.
- *
- * @param expandedViewHolderPossiblyPlaying the view holder that was expanded and could or could
- * not be playing. This viewholder can be recycled.
- */
- private void recursivelyUpdateMediaPlayerViewOfExpandedViewHolder(
- NewVoicemailViewHolder expandedViewHolderPossiblyPlaying) {
- // TODO(uabdullah): a bug Remove logging, temporarily here for debugging.
- LogUtil.i(
- "NewVoicemailAdapter.recursivelyUpdateMediaPlayerViewOfExpandedViewHolder",
- "currentlyExpanded:%d",
- currentlyExpandedViewHolderId);
-
- // It's possible that by the time this is run, the expanded view holder has been
- // scrolled out of view (and possibly recycled)
- if (getCurrentlyExpandedViewHolder() == null) {
- LogUtil.i(
- "NewVoicemailAdapter.recursivelyUpdateMediaPlayerViewOfExpandedViewHolder",
- "viewholder:%d media player view, no longer on screen, no need to update",
- expandedViewHolderPossiblyPlaying.getViewHolderId());
- return;
- }
-
- // Another viewholder was expanded, no need to update
- if (!getCurrentlyExpandedViewHolder().equals(expandedViewHolderPossiblyPlaying)) {
- LogUtil.i(
- "NewVoicemailAdapter.recursivelyUpdateMediaPlayerViewOfExpandedViewHolder",
- "currentlyExpandedViewHolderId:%d and the one we are attempting to update:%d "
- + "aren't the same.",
- currentlyExpandedViewHolderId,
- expandedViewHolderPossiblyPlaying.getViewHolderId());
- return;
- }
-
- Assert.checkArgument(expandedViewHolderPossiblyPlaying.isViewHolderExpanded());
- Assert.checkArgument(
- expandedViewHolderPossiblyPlaying.getViewHolderId()
- == getCurrentlyExpandedViewHolder().getViewHolderId());
-
- // If the viewholder was paused, there is no need to update the media player view
- if (mediaPlayer.isPaused()) {
- Assert.checkArgument(
- expandedViewHolderPossiblyPlaying
- .getViewHolderVoicemailUri()
- .equals(mediaPlayer.getLastPausedVoicemailUri()),
- "only the expanded viewholder can be paused.");
-
- LogUtil.i(
- "NewVoicemailAdapter.recursivelyUpdateMediaPlayerViewOfExpandedViewHolder",
- "set the media player to a paused state");
- expandedViewHolderPossiblyPlaying.setPausedStateOfMediaPlayerView(
- expandedViewHolderPossiblyPlaying.getViewHolderVoicemailUri(), mediaPlayer);
- return;
- }
-
- // In some weird corner cases a media player could return isPlaying() as true but would
- // have getCurrentPosition > getDuration(). We consider that as the voicemail has finished
- // playing.
- if (mediaPlayer.isPlaying() && mediaPlayer.getCurrentPosition() < mediaPlayer.getDuration()) {
-
- Assert.checkArgument(
- mediaPlayer
- .getLastPlayedOrPlayingVoicemailUri()
- .equals(getCurrentlyExpandedViewHolder().getViewHolderVoicemailUri()));
- // TODO(uabdullah): a bug Remove logging, temporarily here for debugging.
- LogUtil.i(
- "NewVoicemailAdapter.recursivelyUpdateMediaPlayerViewOfExpandedViewHolder",
- "recursely update the player, currentlyExpanded:%d",
- expandedViewHolderPossiblyPlaying.getViewHolderId());
-
- Assert.checkArgument(
- expandedViewHolderPossiblyPlaying
- .getViewHolderVoicemailUri()
- .equals(getCurrentlyExpandedViewHolder().getViewHolderVoicemailUri()));
-
- expandedViewHolderPossiblyPlaying.updateMediaPlayerViewWithPlayingState(
- expandedViewHolderPossiblyPlaying, mediaPlayer);
-
- ThreadUtil.postDelayedOnUiThread(
- new Runnable() {
- @Override
- public void run() {
- recursivelyUpdateMediaPlayerViewOfExpandedViewHolder(
- expandedViewHolderPossiblyPlaying);
- }
- },
- 1000 / 30 /*30 FPS*/);
- return;
- }
-
- if (!mediaPlayer.isPlaying()
- || (mediaPlayer.isPlaying()
- && mediaPlayer.getCurrentPosition() > mediaPlayer.getDuration())) {
- LogUtil.i(
- "NewVoicemailAdapter.recursivelyUpdateMediaPlayerViewOfExpandedViewHolder",
- "resetting the player, currentlyExpanded:%d, MPPlaying:%b",
- getCurrentlyExpandedViewHolder().getViewHolderId(),
- mediaPlayer.isPlaying());
- mediaPlayer.reset();
- Assert.checkArgument(
- expandedViewHolderPossiblyPlaying
- .getViewHolderVoicemailUri()
- .equals(getCurrentlyExpandedViewHolder().getViewHolderVoicemailUri()));
- expandedViewHolderPossiblyPlaying.setMediaPlayerViewToResetState(
- expandedViewHolderPossiblyPlaying, mediaPlayer);
- return;
- }
-
- String error =
- String.format(
- "expandedViewHolderPossiblyPlaying:%d, expanded:%b, CurrentExpanded:%d, uri:%s, "
- + "MPPlaying:%b, MPPaused:%b, MPPreparedUri:%s, MPPausedUri:%s",
- expandedViewHolderPossiblyPlaying.getViewHolderId(),
- expandedViewHolderPossiblyPlaying.isViewHolderExpanded(),
- currentlyExpandedViewHolderId,
- String.valueOf(expandedViewHolderPossiblyPlaying.getViewHolderVoicemailUri()),
- mediaPlayer.isPlaying(),
- mediaPlayer.isPaused(),
- String.valueOf(mediaPlayer.getLastPreparedOrPreparingToPlayVoicemailUri()),
- String.valueOf(mediaPlayer.getLastPreparedOrPreparingToPlayVoicemailUri()));
-
- throw Assert.createAssertionFailException(
- "All cases should have been handled before. Error " + error);
- }
-
- // When a voicemail has finished playing.
- OnCompletionListener onCompletionListener =
- new OnCompletionListener() {
-
- @Override
- public void onCompletion(MediaPlayer mp) {
- Assert.checkArgument(
- mediaPlayer
- .getLastPlayedOrPlayingVoicemailUri()
- .equals(mediaPlayer.getLastPreparedOrPreparingToPlayVoicemailUri()));
- Assert.checkArgument(!mediaPlayer.isPlaying());
-
- LogUtil.i(
- "NewVoicemailAdapter.onCompletionListener",
- "completed playing voicemailUri: %s, expanded viewholder is %d, visibility :%b",
- mediaPlayer.getLastPlayedOrPlayingVoicemailUri().toString(),
- currentlyExpandedViewHolderId,
- isCurrentlyExpandedViewHolderInViewHolderSet());
-
- Assert.checkArgument(
- currentlyExpandedViewHolderId != -1,
- "a voicemail that was never expanded, should never be playing.");
- mediaPlayer.reset();
- }
- };
-
- // When a voicemail has been prepared and can be played
- private final OnPreparedListener onPreparedListener =
- new OnPreparedListener() {
-
- /**
- * When a user pressed the play button, this listener should be called immediately. The
- * asserts ensures that is the case. This function starts playing the voicemail and updates
- * the UI.
- */
- @Override
- public void onPrepared(MediaPlayer mp) {
- LogUtil.i(
- "NewVoicemailAdapter.onPrepared",
- "MPPreparedUri: %s, currentlyExpandedViewHolderId:%d, and its visibility on "
- + "the screen is:%b",
- String.valueOf(mediaPlayer.getLastPreparedOrPreparingToPlayVoicemailUri()),
- currentlyExpandedViewHolderId,
- isCurrentlyExpandedViewHolderInViewHolderSet());
-
- NewVoicemailViewHolder currentlyExpandedViewHolder = getCurrentlyExpandedViewHolder();
- Assert.checkArgument(currentlyExpandedViewHolder != null);
- Assert.checkArgument(
- currentlyExpandedViewHolder
- .getViewHolderVoicemailUri()
- .equals(mediaPlayer.getLastPreparedOrPreparingToPlayVoicemailUri()),
- "should only have prepared the last expanded view holder.");
-
- mediaPlayer.start(mediaPlayer.getLastPreparedOrPreparingToPlayVoicemailUri());
-
- recursivelyUpdateMediaPlayerViewOfExpandedViewHolder(currentlyExpandedViewHolder);
-
- Assert.checkArgument(mediaPlayer.isPlaying());
- LogUtil.i("NewVoicemailAdapter.onPrepared", "voicemail should be playing");
- }
- };
-
- // TODO(uabdullah): when playing the voicemail results in an error
- // we must update the viewholder and mention there was an error playing the voicemail, and reset
- // the media player and the media player view
- private final OnErrorListener onErrorListener =
- new OnErrorListener() {
- @Override
- public boolean onError(MediaPlayer mp, int what, int extra) {
- LogUtil.e("NewVoicemailAdapter.onError", "onError, what:%d, extra:%d", what, extra);
- Assert.checkArgument(
- mediaPlayer.getMediaPlayer().equals(mp),
- "there should always only be one instance of the media player");
- Assert.checkArgument(
- mediaPlayer
- .getLastPlayedOrPlayingVoicemailUri()
- .equals(mediaPlayer.getLastPreparedOrPreparingToPlayVoicemailUri()));
- LogUtil.i(
- "NewVoicemailAdapter.onErrorListener",
- "error playing voicemailUri: %s",
- mediaPlayer.getLastPlayedOrPlayingVoicemailUri().toString());
- return false;
- }
- };
-
- private boolean isCurrentlyExpandedViewHolderInViewHolderSet() {
- for (NewVoicemailViewHolder viewHolder : newVoicemailViewHolderSet) {
- if (viewHolder.getViewHolderId() == currentlyExpandedViewHolderId) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * The expanded view holder may or may not be visible on the screen. Since the {@link
- * NewVoicemailViewHolder} may be recycled, it's possible that the expanded view holder is
- * recycled for a non-expanded view holder when the expanded view holder is scrolled out of view.
- *
- * @return the expanded view holder if it is amongst the recycled views on the screen, otherwise
- * null.
- */
- @Nullable
- private NewVoicemailViewHolder getCurrentlyExpandedViewHolder() {
- if (newVoicemailViewHolderArrayMap.containsKey(currentlyExpandedViewHolderId)) {
- Assert.checkArgument(
- newVoicemailViewHolderArrayMap.get(currentlyExpandedViewHolderId).getViewHolderId()
- == currentlyExpandedViewHolderId);
- return newVoicemailViewHolderArrayMap.get(currentlyExpandedViewHolderId);
- } else {
- // returned when currentlyExpandedViewHolderId = -1 (viewholder was collapsed)
- LogUtil.i(
- "NewVoicemailAdapter.getCurrentlyExpandedViewHolder",
- "no view holder found in hashmap size:%d for %d",
- newVoicemailViewHolderArrayMap.size(),
- currentlyExpandedViewHolderId);
- // TODO(uabdullah): a bug Remove logging, temporarily here for debugging.
- printHashSet();
- printArrayMap();
- return null;
- }
- }
-
- @Override
- public int getItemCount() {
- // TODO(uabdullah): a bug Remove logging, temporarily here for debugging.
- LogUtil.enterBlock("NewVoicemailAdapter.getItemCount");
- int numberOfHeaders = 0;
- if (voicemailAlertPosition != Integer.MAX_VALUE) {
- numberOfHeaders++;
- }
- if (todayHeaderPosition != Integer.MAX_VALUE) {
- numberOfHeaders++;
- }
- if (yesterdayHeaderPosition != Integer.MAX_VALUE) {
- numberOfHeaders++;
- }
- if (olderHeaderPosition != Integer.MAX_VALUE) {
- numberOfHeaders++;
- }
- // TODO(uabdullah): a bug Remove logging, temporarily here for debugging.
- LogUtil.i(
- "NewVoicemailAdapter.getItemCount",
- "cursor cnt:%d, num of headers:%d, delete size:%d",
- cursor.getCount(),
- numberOfHeaders,
- deletedVoicemailPosition.size());
- return cursor.getCount() + numberOfHeaders - deletedVoicemailPosition.size();
- }
-
- @RowType
- @Override
- public int getItemViewType(int position) {
- LogUtil.enterBlock("NewVoicemailAdapter.getItemViewType");
- if (voicemailAlertPosition != Integer.MAX_VALUE && position == voicemailAlertPosition) {
- return RowType.VOICEMAIL_ALERT;
- }
- if (todayHeaderPosition != Integer.MAX_VALUE && position == todayHeaderPosition) {
- return RowType.HEADER;
- }
- if (yesterdayHeaderPosition != Integer.MAX_VALUE && position == yesterdayHeaderPosition) {
- return RowType.HEADER;
- }
- if (olderHeaderPosition != Integer.MAX_VALUE && position == olderHeaderPosition) {
- return RowType.HEADER;
- }
- return RowType.VOICEMAIL_ENTRY;
- }
-
- /**
- * This will be called once the voicemail that was attempted to be played (and was not locally
- * available) was downloaded from the server. However it is possible that by the time the download
- * was completed, the view holder was collapsed. In that case we shouldn't play the voicemail.
- */
- public void checkAndPlayVoicemail() {
- LogUtil.i(
- "NewVoicemailAdapter.checkAndPlayVoicemail",
- "expandedViewHolder:%d, inViewHolderSet:%b, MPRequestToDownload:%s",
- currentlyExpandedViewHolderId,
- isCurrentlyExpandedViewHolderInViewHolderSet(),
- String.valueOf(mediaPlayer.getVoicemailRequestedToDownload()));
-
- NewVoicemailViewHolder currentlyExpandedViewHolder = getCurrentlyExpandedViewHolder();
- if (currentlyExpandedViewHolderId != -1
- && isCurrentlyExpandedViewHolderInViewHolderSet()
- && currentlyExpandedViewHolder != null
- // Used to differentiate underlying table changes from voicemail downloads and other changes
- // (e.g delete)
- && mediaPlayer.getVoicemailRequestedToDownload() != null
- && (mediaPlayer
- .getVoicemailRequestedToDownload()
- .equals(currentlyExpandedViewHolder.getViewHolderVoicemailUri()))) {
- currentlyExpandedViewHolder.clickPlayButtonOfViewHoldersMediaPlayerView(
- currentlyExpandedViewHolder);
- } else {
- LogUtil.i("NewVoicemailAdapter.checkAndPlayVoicemail", "not playing downloaded voicemail");
- }
- }
-
- /**
- * Updates the voicemail alert message to reflect the state of the {@link VoicemailStatus} table.
- * TODO(uabdullah): Handle ToS properly (a bug)
- */
- public void updateVoicemailAlertWithMostRecentStatus(
- Context context, ImmutableList Note that for a fragment, being resumed is not equivalent to becoming visible.
- *
- * For example, when an activity with a hidden fragment is resumed, the fragment's onResume()
- * will be called but it is not visible.
- */
- private void onFragmentShown() {
- registerRefreshAnnotatedCallLogReceiver();
-
- CallLogComponent.get(getContext())
- .getRefreshAnnotatedCallLogNotifier()
- .notify(/* checkDirty = */ true);
- }
-
- /**
- * To be called when the fragment becomes hidden.
- *
- * This can happen in the following two cases:
- *
- * Note: This must be called after the onClickListeners have been set, otherwise isClickable()
- * state is not maintained.
- */
- private void updatePhoneIcon(@Nullable String numberVoicemailFrom) {
- // TODO(uabdullah): Handle restricted/blocked numbers (a bug)
- if (TextUtils.isEmpty(numberVoicemailFrom)) {
- phoneButton.setEnabled(false);
- phoneButton.setClickable(false);
- } else {
- phoneButton.setEnabled(true);
- phoneButton.setClickable(true);
- }
- }
-
- private final OnSeekBarChangeListener seekbarChangeListener =
- new OnSeekBarChangeListener() {
- @Override
- public void onProgressChanged(SeekBar seekBarfromProgress, int progress, boolean fromUser) {
- // TODO(uabdullah): Only for debugging purposes, to be removed.
- if (progress < 100) {
- LogUtil.i(
- "NewVoicemailMediaPlayer.seekbarChangeListener",
- "onProgressChanged, progress:%d, seekbarMax: %d, fromUser:%b",
- progress,
- seekBarfromProgress.getMax(),
- fromUser);
- }
-
- if (fromUser) {
- mediaPlayer.seekTo(progress);
- currentSeekBarPosition.setText(formatAsMinutesAndSeconds(progress));
- }
- }
-
- @Override
- // TODO(uabdullah): Handle this case
- public void onStartTrackingTouch(SeekBar seekBar) {
- LogUtil.i("NewVoicemailMediaPlayer.onStartTrackingTouch", "does nothing for now");
- }
-
- @Override
- // TODO(uabdullah): Handle this case
- public void onStopTrackingTouch(SeekBar seekBar) {
- LogUtil.i("NewVoicemailMediaPlayer.onStopTrackingTouch", "does nothing for now");
- }
- };
-
- private final View.OnClickListener pauseButtonListener =
- new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- LogUtil.i(
- "NewVoicemailMediaPlayer.pauseButtonListener",
- "pauseMediaPlayerAndSetPausedStateOfViewHolder button for voicemailUri: %s",
- voicemailUri.toString());
-
- Assert.checkArgument(playButton.getVisibility() == GONE);
- Assert.checkArgument(mediaPlayer != null);
- Assert.checkArgument(
- mediaPlayer.getLastPlayedOrPlayingVoicemailUri().equals((voicemailUri)),
- "the voicemail being played is the only voicemail that should"
- + " be paused. last played voicemail:%s, uri:%s",
- mediaPlayer.getLastPlayedOrPlayingVoicemailUri().toString(),
- voicemailUri.toString());
- Assert.checkArgument(
- newVoicemailViewHolder.getViewHolderVoicemailUri().equals(voicemailUri),
- "viewholder uri and mediaplayer view should be the same.");
- newVoicemailViewHolderListener.pauseViewHolder(newVoicemailViewHolder);
- }
- };
-
- /**
- * Attempts to imitate clicking the play button. This is useful for when we the user attempted to
- * play a voicemail, but the media player didn't start playing till the voicemail was downloaded
- * from the server. However once we have the voicemail downloaded, we want to start playing, so as
- * to make it seem like that this is a continuation of the users initial play button click.
- */
- public final void clickPlayButton() {
- playButtonListener.onClick(null);
- }
-
- private final View.OnClickListener playButtonListener =
- new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- LogUtil.i(
- "NewVoicemailMediaPlayer.playButtonListener",
- "play button for voicemailUri: %s",
- String.valueOf(voicemailUri));
-
- if (mediaPlayer.getLastPausedVoicemailUri() != null
- && mediaPlayer
- .getLastPausedVoicemailUri()
- .toString()
- .contentEquals(voicemailUri.toString())) {
- LogUtil.i(
- "NewVoicemailMediaPlayer.playButtonListener",
- "resume playing voicemailUri: %s",
- voicemailUri.toString());
-
- newVoicemailViewHolderListener.resumePausedViewHolder(newVoicemailViewHolder);
-
- } else {
- playVoicemailWhenAvailableLocally();
- }
- }
- };
-
- /**
- * Plays the voicemail when we are able to play the voicemail locally from the device. This
- * involves checking if the voicemail is available to play locally, if it is, then we setup the
- * Media Player to play the voicemail. If the voicemail is not available, then we need download
- * the voicemail from the voicemail server to the device, and then have the Media player play it.
- */
- private void playVoicemailWhenAvailableLocally() {
- LogUtil.enterBlock("playVoicemailWhenAvailableLocally");
- Worker> {
-
- private List
> {
-
- static final String ARGS_LICENSE = "license";
-
- private static final int LOADER_ID = 54321;
-
- private ArrayAdapter
> onCreateLoader(int id, Bundle args) {
- return new LicenseLoader(this);
- }
-
- @Override
- public void onLoadFinished(Loader
> loader, List
> loader) {
- listAdapter.clear();
- listAdapter.notifyDataSetChanged();
- }
-}
diff --git a/java/com/android/dialer/about/Licenses.java b/java/com/android/dialer/about/Licenses.java
deleted file mode 100644
index bd3d0ce27f799692c81d7a6f3d915ced355e89dd..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/about/Licenses.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.about;
-
-import android.content.Context;
-import android.content.res.Resources;
-import com.android.dialer.common.Assert;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Collections;
-
-/** A helper for extracting licenses. */
-public final class Licenses {
- private static final String TAG = "Licenses";
- private static final String LICENSE_FILENAME = "third_party_licenses";
- private static final String LICENSE_METADATA_FILENAME = "third_party_license_metadata";
-
- /** Return the licenses bundled into this app. */
- public static ArrayList
- * dialer-cmd.py
- *
- *
- *
- * long initialDelayMillis = 1000;
- * double multiplier = 1.2;
- * int backoffs = 10;
- * ExponentialBackoff backoff = new ExponentialBackoff(initialDelayMillis, multiplier, backoffs);
- * while (backoff.isInRange()) {
- * ...
- * sleep(backoff.getNextBackoff());
- * }
- *
- *
- *
- * // Retry with exponential backoff for up to 2 minutes, with an initial delay of 100 millis
- * // and a maximum of 10 retries
- * long initialDelayMillis = 100;
- * int maxTries = 10;
- * double base = ExponentialBaseCalculator.findBase(
- * initialDelayMillis,
- * TimeUnit.MINUTES.toMillis(2),
- * maxTries);
- * ExponentialBackoff backoff = new ExponentialBackoff(initialDelayMillis, base, maxTries);
- * while (backoff.isInRange()) {
- * ...
- * long delay = backoff.getNextBackoff();
- * // Wait for the indicated time...
- * }
- *
- */
-public final class ExponentialBaseCalculator {
- private static final int MAX_STEPS = 1000;
- private static final double DEFAULT_TOLERANCE_MILLIS = 1;
-
- /**
- * Calculate an exponential backoff base multiplier such that the first backoff delay will be as
- * specified and the sum of the delays after doing the indicated maximum number of backoffs will
- * be as specified.
- *
- * @throws IllegalArgumentException if the initial delay is greater than the total backoff time
- * @throws IllegalArgumentException if the maximum number of backoffs is not greater than 1
- * @throws IllegalStateException if it fails to find an acceptable base multiplier
- */
- public static double findBase(
- long initialDelayMillis, long totalBackoffTimeMillis, int maximumBackoffs) {
- Assert.checkArgument(initialDelayMillis < totalBackoffTimeMillis);
- Assert.checkArgument(maximumBackoffs > 1);
- long scaledTotalTime = Math.round(((double) totalBackoffTimeMillis) / initialDelayMillis);
- double scaledTolerance = DEFAULT_TOLERANCE_MILLIS / initialDelayMillis;
- return getBaseImpl(scaledTotalTime, maximumBackoffs, scaledTolerance);
- }
-
- /**
- * T/D = (1 - b^N)/(1 - b) but this cannot be written as a simple equation for b in terms of T, D
- * and N so instead we use Newtons method to find an approximate value for b.
- *
- *
- *
- */
-public class SwitchPreferenceWithClickableSummary extends SwitchPreference {
- private final String urlToOpen;
-
- public SwitchPreferenceWithClickableSummary(
- Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- TypedArray typedArray =
- context.obtainStyledAttributes(attrs, R.styleable.SwitchPreferenceWithClickableSummary);
- urlToOpen =
- String.valueOf(
- typedArray.getText(R.styleable.SwitchPreferenceWithClickableSummary_urlToOpen));
- }
-
- public SwitchPreferenceWithClickableSummary(
- Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr, defStyleAttr);
- TypedArray typedArray =
- context.obtainStyledAttributes(attrs, R.styleable.SwitchPreferenceWithClickableSummary);
- urlToOpen =
- String.valueOf(
- typedArray.getText(R.styleable.SwitchPreferenceWithClickableSummary_urlToOpen));
- }
-
- public SwitchPreferenceWithClickableSummary(Context context, AttributeSet attrs) {
- super(context, attrs);
- TypedArray typedArray =
- context.obtainStyledAttributes(attrs, R.styleable.SwitchPreferenceWithClickableSummary);
- urlToOpen =
- String.valueOf(
- typedArray.getText(R.styleable.SwitchPreferenceWithClickableSummary_urlToOpen));
- }
-
- public SwitchPreferenceWithClickableSummary(Context context) {
- this(context, null);
- }
-
- @Override
- protected View onCreateView(ViewGroup parent) {
- return super.onCreateView(parent);
- }
-
- @Override
- protected void onBindView(View view) {
- super.onBindView(view);
- Assert.checkArgument(
- urlToOpen != null,
- "must have a urlToOpen attribute when using SwitchPreferenceWithClickableSummary");
- view.findViewById(android.R.id.summary)
- .setOnClickListener(
- new OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlToOpen));
- startActivity(view.getContext(), intent, null);
- }
- });
- }
-}
diff --git a/java/com/android/dialer/common/res/values-af/strings.xml b/java/com/android/dialer/common/res/values-af/strings.xml
index f960d616a22e3f2a1929a0a405488cf2d666acc0..0b5059de6eb3e17075b3de5d7e7e24977a1c386c 100644
--- a/java/com/android/dialer/common/res/values-af/strings.xml
+++ b/java/com/android/dialer/common/res/values-af/strings.xml
@@ -1,7 +1,5 @@
- * adb root
- * adb shell am startservice -n \
- * 'com.android.dialer/.configprovider.SharedPrefConfigProvider\$Service' \
- * --ez boolean_flag_name flag_value
- *
- *
- *
- * adb shell cat \
- * /data/user_de/0/com.android.dialer/shared_prefs/com.android.dialer_preferences.xml
- *
- */
-public class SharedPrefConfigProvider implements ConfigProvider {
- private static final String PREF_PREFIX = "config_provider_prefs_";
-
- private final SharedPreferences sharedPreferences;
-
- @Inject
- SharedPrefConfigProvider(@Unencrypted SharedPreferences sharedPreferences) {
- this.sharedPreferences = sharedPreferences;
- }
-
- /** Service to write values into {@link SharedPrefConfigProvider} using adb. */
- public static class Service extends IntentService {
-
- public Service() {
- super("SharedPrefConfigProvider.Service");
- }
-
- @Override
- protected void onHandleIntent(@Nullable Intent intent) {
- if (intent == null || intent.getExtras() == null || intent.getExtras().size() != 1) {
- LogUtil.w("SharedPrefConfigProvider.Service.onHandleIntent", "must set exactly one extra");
- return;
- }
- String key = intent.getExtras().keySet().iterator().next();
- Object value = intent.getExtras().get(key);
- put(key, value);
- }
-
- private void put(String key, Object value) {
- Editor editor = getSharedPrefs(getApplicationContext()).edit();
- String prefixedKey = PREF_PREFIX + key;
- if (value instanceof Boolean) {
- editor.putBoolean(prefixedKey, (Boolean) value);
- } else if (value instanceof Long) {
- editor.putLong(prefixedKey, (Long) value);
- } else if (value instanceof String) {
- editor.putString(prefixedKey, (String) value);
- } else {
- throw Assert.createAssertionFailException("unsupported extra type: " + value.getClass());
- }
- editor.apply();
- }
- }
-
- /** Set a boolean config value. */
- public void putBoolean(String key, boolean value) {
- sharedPreferences.edit().putBoolean(PREF_PREFIX + key, value).apply();
- }
-
- public void putLong(String key, long value) {
- sharedPreferences.edit().putLong(PREF_PREFIX + key, value).apply();
- }
-
- public void putString(String key, String value) {
- sharedPreferences.edit().putString(PREF_PREFIX + key, value).apply();
- }
-
- @Override
- public String getString(String key, String defaultValue) {
- // Reading shared prefs on the main thread is generally safe since a single instance is cached.
- return StrictModeUtils.bypass(
- () -> sharedPreferences.getString(PREF_PREFIX + key, defaultValue));
- }
-
- @Override
- public long getLong(String key, long defaultValue) {
- // Reading shared prefs on the main thread is generally safe since a single instance is cached.
- return StrictModeUtils.bypass(() -> sharedPreferences.getLong(PREF_PREFIX + key, defaultValue));
- }
-
- @Override
- public boolean getBoolean(String key, boolean defaultValue) {
- // Reading shared prefs on the main thread is generally safe since a single instance is cached.
- return StrictModeUtils.bypass(
- () -> sharedPreferences.getBoolean(PREF_PREFIX + key, defaultValue));
- }
-
- private static SharedPreferences getSharedPrefs(Context appContext) {
- return StorageComponent.get(appContext).unencryptedSharedPrefs();
- }
-}
diff --git a/java/com/android/dialer/configprovider/SharedPrefConfigProviderModule.java b/java/com/android/dialer/configprovider/SharedPrefConfigProviderModule.java
deleted file mode 100644
index 81bed19bdbc81aeebe7aedbe8940d79c8e23a251..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/configprovider/SharedPrefConfigProviderModule.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.configprovider;
-
-import com.android.dialer.inject.DialerVariant;
-import com.android.dialer.inject.InstallIn;
-import com.android.dialer.storage.StorageModule;
-import dagger.Binds;
-import dagger.Module;
-import javax.inject.Singleton;
-
-/** Dagger module providing {@link ConfigProvider} based on shared preferences. */
-@InstallIn(variants = {DialerVariant.DIALER_TEST})
-@Module(includes = StorageModule.class)
-public abstract class SharedPrefConfigProviderModule {
-
- private SharedPrefConfigProviderModule() {}
-
- @Binds
- @Singleton
- abstract ConfigProvider to(SharedPrefConfigProvider impl);
-}
diff --git a/java/com/android/dialer/constants/ActivityRequestCodes.java b/java/com/android/dialer/constants/ActivityRequestCodes.java
index 9945080196b2aa35ea17423c5b839787016a8e37..12b7263fc882f8c0642c1e339ed689f2b5d30968 100644
--- a/java/com/android/dialer/constants/ActivityRequestCodes.java
+++ b/java/com/android/dialer/constants/ActivityRequestCodes.java
@@ -27,12 +27,6 @@ public final class ActivityRequestCodes {
/** Request code for {@link android.speech.RecognizerIntent#ACTION_RECOGNIZE_SPEECH} intent. */
public static final int DIALTACTS_VOICE_SEARCH = 1;
- /** Request code for {@link com.android.dialer.callcomposer.CallComposerActivity} intent. */
- public static final int DIALTACTS_CALL_COMPOSER = 2;
-
- /** Request code for {@link com.android.dialer.duo.Duo#getCallIntent(String)}. */
- public static final int DIALTACTS_DUO = 3;
-
/** Request code for {@link com.android.dialer.calldetails.OldCallDetailsActivity} intent. */
public static final int DIALTACTS_CALL_DETAILS = 4;
diff --git a/java/com/android/dialer/constants/Constants.java b/java/com/android/dialer/constants/Constants.java
index fb1aa2ae05d5b31ecf04b0cf3ee8c8143655abf8..dedcf15f620dfd246aaa905c83753a2bcb5a036f 100644
--- a/java/com/android/dialer/constants/Constants.java
+++ b/java/com/android/dialer/constants/Constants.java
@@ -16,19 +16,12 @@
package com.android.dialer.constants;
-import android.content.Context;
-import android.support.annotation.NonNull;
-import com.android.dialer.common.Assert;
-import com.android.dialer.proguard.UsedByReflection;
+import androidx.annotation.NonNull;
/**
- * Utility to access constants that are different across build variants (Google Dialer, AOSP,
- * etc...). This functionality depends on a an implementation being present in the app that has the
- * same package and the class name ending in "Impl". For example,
- * com.android.dialer.constants.ConstantsImpl. This class is found by the module using reflection.
+ * Utility to access constants
*/
-@UsedByReflection(value = "Constants.java")
-public abstract class Constants {
+public class Constants {
private static Constants instance;
private static boolean didInitializeInstance;
@@ -36,37 +29,30 @@ public abstract class Constants {
public static synchronized Constants get() {
if (!didInitializeInstance) {
didInitializeInstance = true;
- try {
- Class> clazz = Class.forName(Constants.class.getName() + "Impl");
- instance = (Constants) clazz.getConstructor().newInstance();
- } catch (ReflectiveOperationException e) {
- Assert.fail(
- "Unable to create an instance of ConstantsImpl. To fix this error include one of the "
- + "constants modules (googledialer, aosp etc...) in your target.");
- }
+ instance = new Constants();
}
return instance;
}
@NonNull
- public abstract String getFilteredNumberProviderAuthority();
-
- @NonNull
- public abstract String getFileProviderAuthority();
-
- @NonNull
- public abstract String getAnnotatedCallLogProviderAuthority();
+ public String getFileProviderAuthority() {
+ return "com.android.dialer.files";
+ }
@NonNull
- public abstract String getPhoneLookupHistoryProviderAuthority();
+ public String getAnnotatedCallLogProviderAuthority() {
+ return "com.android.dialer.annotatedcalllog";
+ }
@NonNull
- public abstract String getPreferredSimFallbackProviderAuthority();
-
- public abstract String getUserAgent(Context context);
+ public String getPhoneLookupHistoryProviderAuthority() {
+ return "com.android.dialer.phonelookuphistory";
+ }
@NonNull
- public abstract String getSettingsActivity();
+ public String getPreferredSimFallbackProviderAuthority() {
+ return "com.android.dialer.preferredsimfallback";
+ }
protected Constants() {}
}
diff --git a/java/com/android/dialer/constants/ScheduledJobIds.java b/java/com/android/dialer/constants/ScheduledJobIds.java
index 7ffd2da824258f80572102dba2f40baed518eafc..e9815c7502db5f2e2e0450231061793efbf402b4 100644
--- a/java/com/android/dialer/constants/ScheduledJobIds.java
+++ b/java/com/android/dialer/constants/ScheduledJobIds.java
@@ -16,7 +16,8 @@
package com.android.dialer.constants;
-import android.support.annotation.IntDef;
+import androidx.annotation.IntDef;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -29,30 +30,11 @@ import java.lang.annotation.RetentionPolicy;
*
- * OutgoingCallComposerData.builder.build(); // throws exception, no data set
- * OutgoingCallComposerData.builder
- * .setText(subject)
- * .build(); // Success
- * OutgoingCallComposerData.builder
- * .setImageData(uri, contentType)
- * .build(); // Success
- * OutgoingCallComposerData.builder
- * .setText(subject)
- * .setImageData(uri, contentType)
- * .build(); // Success
- *
- */
-@AutoValue
-public abstract class OutgoingCallComposerData {
-
- public static Builder builder() {
- return new AutoValue_OutgoingCallComposerData.Builder();
- }
-
- public boolean hasImageData() {
- return getImageUri() != null && getImageContentType() != null;
- }
-
- @Nullable
- public abstract String getSubject();
-
- @Nullable
- public abstract Uri getImageUri();
-
- @Nullable
- public abstract String getImageContentType();
-
- /** Builds instances of {@link OutgoingCallComposerData}. */
- @AutoValue.Builder
- public abstract static class Builder {
- public abstract Builder setSubject(String subject);
-
- public Builder setImageData(@NonNull Uri imageUri, @NonNull String imageContentType) {
- setImageUri(Assert.isNotNull(imageUri));
- setImageContentType(Assert.isNotNull(imageContentType));
- return this;
- }
-
- abstract Builder setImageUri(Uri imageUri);
-
- abstract Builder setImageContentType(String imageContentType);
-
- abstract OutgoingCallComposerData autoBuild();
-
- /**
- * Returns the OutgoingCallComposerData from this builder.
- *
- * @return the OutgoingCallComposerData.
- * @throws IllegalStateException if neither {@link #setSubject(String)} nor {@link
- * #setImageData(Uri, String)} were called.
- */
- public OutgoingCallComposerData build() {
- OutgoingCallComposerData data = autoBuild();
- Assert.checkState(data.getSubject() != null || data.hasImageData());
- return data;
- }
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/RcsVideoShareFactory.java b/java/com/android/dialer/enrichedcall/RcsVideoShareFactory.java
deleted file mode 100644
index faea3bc5a255dcf4903018e652fcdcde1d19fd6d..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/RcsVideoShareFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.enrichedcall;
-
-import android.support.annotation.NonNull;
-import com.android.incallui.videotech.VideoTech;
-import com.android.incallui.videotech.VideoTech.VideoTechListener;
-
-/** Interface for creating new RCS video tech instances. */
-public interface RcsVideoShareFactory {
-
- @NonNull
- VideoTech newRcsVideoShare(
- @NonNull EnrichedCallManager enrichedCallManager,
- @NonNull VideoTechListener videoTechListener,
- @NonNull String number);
-}
diff --git a/java/com/android/dialer/enrichedcall/Session.java b/java/com/android/dialer/enrichedcall/Session.java
deleted file mode 100644
index 06837e399f6eed7b834f41b927c3ca1ea4bdcb96..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/Session.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.enrichedcall;
-
-import android.support.annotation.IntDef;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import com.android.dialer.multimedia.MultimediaData;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/** Holds state information and data about enriched calling sessions. */
-public interface Session {
-
- /** Possible states for call composer sessions. */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({
- STATE_NONE,
- STATE_STARTING,
- STATE_STARTED,
- STATE_START_FAILED,
- STATE_MESSAGE_SENT,
- STATE_MESSAGE_FAILED,
- STATE_CLOSED,
- })
- @interface State {}
-
- int STATE_NONE = 0;
- int STATE_STARTING = STATE_NONE + 1;
- int STATE_STARTED = STATE_STARTING + 1;
- int STATE_START_FAILED = STATE_STARTED + 1;
- int STATE_MESSAGE_SENT = STATE_START_FAILED + 1;
- int STATE_MESSAGE_FAILED = STATE_MESSAGE_SENT + 1;
- int STATE_CLOSED = STATE_MESSAGE_FAILED + 1;
-
- /** Id used for sessions that fail to start. */
- long NO_SESSION_ID = -1;
-
- /**
- * An id for the specific case when sending a message fails so early that a message id isn't
- * created.
- */
- String MESSAGE_ID_COULD_NOT_CREATE_ID = "messageIdCouldNotCreateId";
-
- /**
- * Returns the id associated with this session, or {@link #NO_SESSION_ID} if this represents a
- * session that failed to start.
- */
- long getSessionId();
-
- /** Returns the id of the dialer call associated with this session, or null if there isn't one. */
- @Nullable
- String getUniqueDialerCallId();
-
- void setUniqueDialerCallId(@NonNull String id);
-
- /** Returns the number associated with the remote end of this session. */
- @NonNull
- String getRemoteNumber();
-
- /** Returns the {@link State} for this session. */
- @State
- int getState();
-
- /** Returns the {@link MultimediaData} associated with this session. */
- @NonNull
- MultimediaData getMultimediaData();
-
- /** Returns type of this session, based on some arbitrarily defined type. */
- int getType();
-
- /**
- * Sets the {@link MultimediaData} for this session.
- *
- *
- * @throws IllegalArgumentException if the type is invalid
- */
- void setSessionData(@NonNull MultimediaData multimediaData, int type);
-}
diff --git a/java/com/android/dialer/enrichedcall/extensions/StateExtension.java b/java/com/android/dialer/enrichedcall/extensions/StateExtension.java
deleted file mode 100644
index 5d90829c3e9576aa5aa003bc25a1265f24bd824d..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/extensions/StateExtension.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.enrichedcall.extensions;
-
-import android.support.annotation.NonNull;
-import com.android.dialer.common.Assert;
-import com.android.dialer.enrichedcall.Session;
-import com.android.dialer.enrichedcall.Session.State;
-
-/** Extends the {@link State} to include a toString method. */
-public class StateExtension {
-
- /** Returns the string representation for the given {@link State}. */
- @NonNull
- public static String toString(@State int callComposerState) {
- if (callComposerState == Session.STATE_NONE) {
- return "STATE_NONE";
- }
- if (callComposerState == Session.STATE_STARTING) {
- return "STATE_STARTING";
- }
- if (callComposerState == Session.STATE_STARTED) {
- return "STATE_STARTED";
- }
- if (callComposerState == Session.STATE_START_FAILED) {
- return "STATE_START_FAILED";
- }
- if (callComposerState == Session.STATE_MESSAGE_SENT) {
- return "STATE_MESSAGE_SENT";
- }
- if (callComposerState == Session.STATE_MESSAGE_FAILED) {
- return "STATE_MESSAGE_FAILED";
- }
- if (callComposerState == Session.STATE_CLOSED) {
- return "STATE_CLOSED";
- }
- Assert.checkArgument(false, "Unexpected callComposerState: %d", callComposerState);
- return null;
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/historyquery/HistoryQuery.java b/java/com/android/dialer/enrichedcall/historyquery/HistoryQuery.java
deleted file mode 100644
index e61c79ec8eee6c37810bdf84558b74c204ef2931..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/historyquery/HistoryQuery.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.dialer.enrichedcall.historyquery;
-
-import android.support.annotation.NonNull;
-import com.android.dialer.common.LogUtil;
-import com.google.auto.value.AutoValue;
-
-/**
- * Data object representing the pieces of information required to query for historical enriched call
- * data.
- */
-@AutoValue
-public abstract class HistoryQuery {
-
- @NonNull
- public static HistoryQuery create(@NonNull String number, long callStartTime, long callEndTime) {
- return new AutoValue_HistoryQuery(number, callStartTime, callEndTime);
- }
-
- public abstract String getNumber();
-
- public abstract long getCallStartTimestamp();
-
- public abstract long getCallEndTimestamp();
-
- @Override
- public String toString() {
- return String.format(
- "HistoryQuery{number: %s, callStartTimestamp: %d, callEndTimestamp: %d}",
- LogUtil.sanitizePhoneNumber(getNumber()), getCallStartTimestamp(), getCallEndTimestamp());
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/historyquery/proto/history_result.proto b/java/com/android/dialer/enrichedcall/historyquery/proto/history_result.proto
deleted file mode 100644
index 6aed395c66856ae8da45da8c3b05ff71ae7f7c12..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/historyquery/proto/history_result.proto
+++ /dev/null
@@ -1,23 +0,0 @@
-syntax = "proto2";
-
-option java_package = "com.android.dialer.enrichedcall.historyquery.proto";
-option java_multiple_files = true;
-
-
-package com.android.dialer.enrichedcall.historyquery.proto;
-
-// Holds data that was used in an enrichedcall in the past
-message HistoryResult {
- optional Type type = 1;
- optional string text = 2;
- optional string image_uri = 4;
- optional string image_content_type = 5;
- optional int64 timestamp = 7;
-
- enum Type {
- INCOMING_CALL_COMPOSER = 1;
- OUTGOING_CALL_COMPOSER = 2;
- INCOMING_POST_CALL = 3;
- OUTGOING_POST_CALL = 4;
- }
-}
diff --git a/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml b/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml
deleted file mode 100644
index 35dc531d808170992bee02ecc9705398363b7602..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/enrichedcall/simulator/AndroidManifest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
- *
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.SOURCE)
-public @interface DialerRootComponent {
- DialerVariant variant();
-
- Class> injectClass() default Object.class;
-}
diff --git a/java/com/android/dialer/inject/DialerVariant.java b/java/com/android/dialer/inject/DialerVariant.java
deleted file mode 100644
index 2e5794ffbdefe49d0ba4ec6b19a54dc5857ff7e4..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/inject/DialerVariant.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.inject;
-
-/** Represents all dialer variants. */
-public enum DialerVariant {
- // AOSP Dialer variants
- DIALER_AOSP("DialerAosp"),
- DIALER_AOSP_ESPRESSO("DialerAospEspresso"),
- DIALER_ROBOLECTRIC("DialerRobolectric"),
-
-
-
- // TEST variant will be used in situations where we need create in-test application class which
- // doesn't belong to any variants listed above
- DIALER_TEST("DialerTest"),
- // Just for sample code in inject/demo.
- DIALER_DEMO("DialerDemo");
-
- private final String variant;
-
- DialerVariant(String variant) {
- this.variant = variant;
- }
-
- @Override
- public String toString() {
- return variant;
- }
-}
diff --git a/java/com/android/dialer/inject/InstallIn.java b/java/com/android/dialer/inject/InstallIn.java
deleted file mode 100644
index a6f973b7b7073aa76de1f6490ad8b8c2f9d87fb5..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/inject/InstallIn.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.inject;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for {@link dagger.Module dagger.Modules} which causes them to be installed in the
- * specified variants.
- *
- *
- * @DialerRootComponent(variant = DialerVariant.DIALER_AOSP)
- * public class RootDialerAosp {}
- *
- *
- *
- */
-@Target(ElementType.TYPE)
-public @interface InstallIn {
- DialerVariant[] variants();
-}
diff --git a/java/com/android/dialer/inject/RootComponentGeneratorMetadata.java b/java/com/android/dialer/inject/RootComponentGeneratorMetadata.java
index 924b41e8426af8cb802513eb151d239423ad2e13..5987a279e5142d95f7af10ee0cdd4bae82e8db4f 100644
--- a/java/com/android/dialer/inject/RootComponentGeneratorMetadata.java
+++ b/java/com/android/dialer/inject/RootComponentGeneratorMetadata.java
@@ -21,7 +21,7 @@ import java.lang.annotation.Target;
/**
* Only used by rootcomponent generator to store metadata for locating annotated class with {@link
- * IncludeInDialerRoot}, {@link InstallIn}.
+ * IncludeInDialerRoot}.
*/
@Target(ElementType.TYPE)
public @interface RootComponentGeneratorMetadata {
diff --git a/java/com/android/dialer/inject/demo/DemoDaggerApplication.java b/java/com/android/dialer/inject/demo/DemoDaggerApplication.java
deleted file mode 100644
index ab40eca1b2311436ddeea41c7129773d3c19ba8f..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/inject/demo/DemoDaggerApplication.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.inject.demo;
-
-import android.app.Application;
-import android.support.annotation.NonNull;
-import com.android.dialer.inject.ContextModule;
-import com.android.dialer.inject.DialerRootComponent;
-import com.android.dialer.inject.DialerVariant;
-import com.android.dialer.inject.HasRootComponent;
-
-/** Demo dialer dagger application. */
-@DialerRootComponent(variant = DialerVariant.DIALER_DEMO)
-public final class DemoDaggerApplication extends Application implements HasRootComponent {
-
- private volatile Object rootComponent;
-
- /** Returns a cached instance of application's root component. */
- @Override
- @NonNull
- public final Object component() {
- Object result = rootComponent;
- if (result == null) {
- synchronized (this) {
- result = rootComponent;
- if (result == null) {
- rootComponent =
- result = DaggerDialerDemo.builder().contextModule(new ContextModule(this)).build();
- }
- }
- }
- return result;
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
-
- DemoSubcomponent.get(this).demoObjects();
- }
-}
diff --git a/java/com/android/dialer/inject/demo/DemoModule.java b/java/com/android/dialer/inject/demo/DemoModule.java
deleted file mode 100644
index 9917c7dbd68af409aa20908c3c4c200b531b51d3..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/inject/demo/DemoModule.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.inject.demo;
-
-import com.android.dialer.inject.DialerVariant;
-import com.android.dialer.inject.InstallIn;
-import dagger.Module;
-import dagger.Provides;
-import dagger.multibindings.IntoSet;
-
-/** Module for demo dagger application. */
-@Module
-@InstallIn(variants = DialerVariant.DIALER_DEMO)
-public final class DemoModule {
-
- private DemoModule() {}
-
- @Provides
- @IntoSet
- static DemoObject provide() {
- return DemoObject.create("prod");
- }
-}
diff --git a/java/com/android/dialer/inject/demo/DemoObject.java b/java/com/android/dialer/inject/demo/DemoObject.java
deleted file mode 100644
index 3c3862124ffec2b59df8145499c0ab5474119697..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/inject/demo/DemoObject.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.inject.demo;
-
-import com.google.auto.value.AutoValue;
-
-/** Object used to demonstrate dagger bindings. */
-@AutoValue
-abstract class DemoObject {
-
- abstract String value();
-
- static DemoObject create(String value) {
- return new AutoValue_DemoObject(value);
- }
-}
diff --git a/java/com/android/dialer/inject/demo/DemoSubcomponent.java b/java/com/android/dialer/inject/demo/DemoSubcomponent.java
deleted file mode 100644
index 3e4dd66bb9580c911c7ec59e7c6fd28f886338e1..0000000000000000000000000000000000000000
--- a/java/com/android/dialer/inject/demo/DemoSubcomponent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.inject.demo;
-
-import android.content.Context;
-import com.android.dialer.inject.HasRootComponent;
-import com.android.dialer.inject.IncludeInDialerRoot;
-import dagger.Subcomponent;
-import java.util.Set;
-
-/** Subcomponent for the demo dagger application. */
-@Subcomponent
-public abstract class DemoSubcomponent {
-
- abstract Set
- * @InstallIn(variants = {DialerVariant.DIALER_AOSP, DialerVariant.DIALER_TEST})
- * public class Module1 {}
- *
- *
- *
";
+ private static String RELEVANT_CONTENT_REGEX =
+ "
- * Value foo = StrictModeUtils.bypass(() -> doDiskAccessOnMainThreadReturningValue());
- *
- *
- *
- * StrictModeUtils.bypass(() -> doDiskAccessOnMainThread());
- *
- *
- *
- *
- *
- *
- *
- */
- private void onFragmentHidden() {
- unregisterRefreshAnnotatedCallLogReceiver();
- }
-
- @Override
- public View onCreateView(
- LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- LogUtil.enterBlock("NewVoicemailFragment.onCreateView");
-
- fragmentRootFrameLayout =
- (FrameLayout) inflater.inflate(R.layout.new_voicemail_call_log_fragment, container, false);
- recyclerView = fragmentRootFrameLayout.findViewById(R.id.new_voicemail_call_log_recycler_view);
-
- emptyContentView = fragmentRootFrameLayout.findViewById(R.id.empty_content_view);
- getLoaderManager().restartLoader(0, null, this);
- return fragmentRootFrameLayout;
- }
-
- @Override
- public Loader