Dialer: Various other fixes
Change-Id: Ia664f17bc891d3cbe38020a3e7fb310c7789e03f
diff --git a/java/com/android/contacts/common/Collapser.java b/java/com/android/contacts/common/Collapser.java
index 0b5c48b..f3d6850 100644
--- a/java/com/android/contacts/common/Collapser.java
+++ b/java/com/android/contacts/common/Collapser.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +18,9 @@
package com.android.contacts.common;
import android.content.Context;
-import java.util.Iterator;
+
import java.util.List;
+import java.util.Objects;
/**
* Class used for collapsing data items into groups of similar items. The data items that should be
@@ -74,12 +76,7 @@
}
// Remove the null items
- Iterator<T> itr = list.iterator();
- while (itr.hasNext()) {
- if (itr.next() == null) {
- itr.remove();
- }
- }
+ list.removeIf(Objects::isNull);
}
/*
diff --git a/java/com/android/contacts/common/ContactsUtils.java b/java/com/android/contacts/common/ContactsUtils.java
index 5dac957..1a24361 100644
--- a/java/com/android/contacts/common/ContactsUtils.java
+++ b/java/com/android/contacts/common/ContactsUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +20,7 @@
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Directory;
-import androidx.annotation.IntDef;
+import androidx.annotation.LongDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -80,6 +81,6 @@
*/
@Retention(RetentionPolicy.SOURCE)
// TODO: Switch to @LongDef when @LongDef is available in the support library
- @IntDef({(int) USER_TYPE_CURRENT, (int) USER_TYPE_WORK})
+ @LongDef({USER_TYPE_CURRENT, USER_TYPE_WORK})
public @interface UserType {}
}
diff --git a/java/com/android/contacts/common/MoreContactUtils.java b/java/com/android/contacts/common/MoreContactUtils.java
index 9749cab..8fc2270 100644
--- a/java/com/android/contacts/common/MoreContactUtils.java
+++ b/java/com/android/contacts/common/MoreContactUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.view.View;
+
import com.android.contacts.common.model.account.AccountType;
import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
diff --git a/java/com/android/contacts/common/dialog/CallSubjectDialog.java b/java/com/android/contacts/common/dialog/CallSubjectDialog.java
index 3ddf4da..610316b 100644
--- a/java/com/android/contacts/common/dialog/CallSubjectDialog.java
+++ b/java/com/android/contacts/common/dialog/CallSubjectDialog.java
@@ -45,12 +45,12 @@
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;
+import com.android.dialer.R;
import com.android.dialer.animation.AnimUtils;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.common.LogUtil;
import com.android.dialer.contactphoto.ContactPhotoManager;
-import com.android.dialer.contacts.resources.R;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.precall.PreCall;
import com.android.dialer.util.ViewUtil;
@@ -88,8 +88,6 @@
private TextView mNumberView;
private EditText mCallSubjectView;
private TextView mCharacterLimitView;
- private View mHistoryButton;
- private View mSendAndCallButton;
private ListView mSubjectList;
private int mLimit = CALL_SUBJECT_LIMIT;
@@ -276,22 +274,22 @@
mBackgroundView = findViewById(R.id.call_subject_dialog);
mBackgroundView.setOnClickListener(mBackgroundListener);
mDialogView = findViewById(R.id.dialog_view);
- mContactPhoto = (QuickContactBadge) findViewById(R.id.contact_photo);
- mNameView = (TextView) findViewById(R.id.name);
- mNumberView = (TextView) findViewById(R.id.number);
- mCallSubjectView = (EditText) findViewById(R.id.call_subject);
+ mContactPhoto = findViewById(R.id.contact_photo);
+ mNameView = findViewById(R.id.name);
+ mNumberView = findViewById(R.id.number);
+ mCallSubjectView = findViewById(R.id.call_subject);
mCallSubjectView.addTextChangedListener(mTextWatcher);
mCallSubjectView.setOnClickListener(mCallSubjectClickListener);
InputFilter[] filters = new InputFilter[1];
filters[0] = new InputFilter.LengthFilter(mLimit);
mCallSubjectView.setFilters(filters);
- mCharacterLimitView = (TextView) findViewById(R.id.character_limit);
- mHistoryButton = findViewById(R.id.history_button);
- mHistoryButton.setOnClickListener(mHistoryOnClickListener);
- mHistoryButton.setVisibility(mSubjectHistory.isEmpty() ? View.GONE : View.VISIBLE);
- mSendAndCallButton = findViewById(R.id.send_and_call_button);
- mSendAndCallButton.setOnClickListener(mSendAndCallOnClickListener);
- mSubjectList = (ListView) findViewById(R.id.subject_list);
+ mCharacterLimitView = findViewById(R.id.character_limit);
+ View historyButton = findViewById(R.id.history_button);
+ historyButton.setOnClickListener(mHistoryOnClickListener);
+ historyButton.setVisibility(mSubjectHistory.isEmpty() ? View.GONE : View.VISIBLE);
+ View sendAndCallButton = findViewById(R.id.send_and_call_button);
+ sendAndCallButton.setOnClickListener(mSendAndCallOnClickListener);
+ mSubjectList = findViewById(R.id.subject_list);
mSubjectList.setOnItemClickListener(mItemClickListener);
mSubjectList.setVisibility(View.GONE);
@@ -356,13 +354,14 @@
length = subjectText.length();
}
- mCharacterLimitView.setText(getString(R.string.call_subject_limit, length, mLimit));
+ mCharacterLimitView.setText(getString(R.string.call_subject_limit,
+ String.valueOf(length), String.valueOf(mLimit)));
if (length >= mLimit) {
mCharacterLimitView.setTextColor(
- getResources().getColor(R.color.call_subject_limit_exceeded));
+ getResources().getColor(R.color.call_subject_limit_exceeded, getTheme()));
} else {
mCharacterLimitView.setTextColor(
- getResources().getColor(R.color.dialer_secondary_text_color));
+ getResources().getColor(R.color.dialer_secondary_text_color, getTheme()));
}
}
@@ -414,9 +413,8 @@
final int dialogStartingBottom = mDialogView.getBottom();
if (show) {
// Showing the subject list; bind the list of history items to the list and show it.
- ArrayAdapter<String> adapter =
- new ArrayAdapter<String>(
- CallSubjectDialog.this, R.layout.call_subject_history_list_item, mSubjectHistory);
+ ArrayAdapter<String> adapter = new ArrayAdapter<>(CallSubjectDialog.this,
+ R.layout.call_subject_history_list_item, mSubjectHistory);
mSubjectList.setAdapter(adapter);
mSubjectList.setVisibility(View.VISIBLE);
} else {
diff --git a/java/com/android/contacts/common/list/ContactEntry.java b/java/com/android/contacts/common/list/ContactEntry.java
index 75e6509..3194255 100644
--- a/java/com/android/contacts/common/list/ContactEntry.java
+++ b/java/com/android/contacts/common/list/ContactEntry.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Context;
import android.net.Uri;
import android.provider.ContactsContract.PinnedPositions;
+
import com.android.dialer.contacts.ContactsComponent;
/** Class to hold contact information */
diff --git a/java/com/android/contacts/common/list/ContactListFilterController.java b/java/com/android/contacts/common/list/ContactListFilterController.java
index a0093e3..f9b9710 100644
--- a/java/com/android/contacts/common/list/ContactListFilterController.java
+++ b/java/com/android/contacts/common/list/ContactListFilterController.java
@@ -70,8 +70,7 @@
class ContactListFilterControllerImpl extends ContactListFilterController {
private final Context mAppContext;
- private final List<ContactListFilterListener> mListeners =
- new ArrayList<ContactListFilterListener>();
+ private final List<ContactListFilterListener> mListeners = new ArrayList<>();
private ContactListFilter mFilter;
public ContactListFilterControllerImpl(Context context) {
diff --git a/java/com/android/contacts/common/list/ViewPagerTabStrip.java b/java/com/android/contacts/common/list/ViewPagerTabStrip.java
index 329b72d..80dec96 100644
--- a/java/com/android/contacts/common/list/ViewPagerTabStrip.java
+++ b/java/com/android/contacts/common/list/ViewPagerTabStrip.java
@@ -24,6 +24,7 @@
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
+
import com.android.dialer.contacts.resources.R;
import com.android.dialer.theme.base.ThemeComponent;
diff --git a/java/com/android/contacts/common/model/AccountTypeManager.java b/java/com/android/contacts/common/model/AccountTypeManager.java
index 283863e..70009a5 100644
--- a/java/com/android/contacts/common/model/AccountTypeManager.java
+++ b/java/com/android/contacts/common/model/AccountTypeManager.java
@@ -40,6 +40,7 @@
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
+
import com.android.contacts.common.MoreContactUtils;
import com.android.contacts.common.list.ContactListFilterController;
import com.android.contacts.common.model.account.AccountType;
@@ -52,6 +53,7 @@
import com.android.contacts.common.model.account.SamsungAccountType;
import com.android.contacts.common.model.dataitem.DataKind;
import com.android.contacts.common.util.Constants;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -162,8 +164,7 @@
implements OnAccountsUpdateListener, SyncStatusObserver {
private static final Map<AccountTypeWithDataSet, AccountType>
- EMPTY_UNMODIFIABLE_ACCOUNT_TYPE_MAP =
- Collections.unmodifiableMap(new HashMap<AccountTypeWithDataSet, AccountType>());
+ EMPTY_UNMODIFIABLE_ACCOUNT_TYPE_MAP = Collections.unmodifiableMap(new HashMap<>());
/**
* A sample contact URI used to test whether any activities will respond to an invitable intent
@@ -519,9 +520,9 @@
}
}
- Collections.sort(allAccounts, ACCOUNT_COMPARATOR);
- Collections.sort(contactWritableAccounts, ACCOUNT_COMPARATOR);
- Collections.sort(groupWritableAccounts, ACCOUNT_COMPARATOR);
+ allAccounts.sort(ACCOUNT_COMPARATOR);
+ contactWritableAccounts.sort(ACCOUNT_COMPARATOR);
+ groupWritableAccounts.sort(ACCOUNT_COMPARATOR);
synchronized (this) {
mAccountTypesWithDataSets = accountTypesByTypeAndDataSet;
diff --git a/java/com/android/contacts/common/model/Contact.java b/java/com/android/contacts/common/model/Contact.java
index 44b94f7..08c5ce8 100644
--- a/java/com/android/contacts/common/model/Contact.java
+++ b/java/com/android/contacts/common/model/Contact.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +23,11 @@
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.Directory;
import android.provider.ContactsContract.DisplayNameSources;
+
import com.android.contacts.common.GroupMetaData;
import com.android.contacts.common.model.account.AccountType;
import com.google.common.collect.ImmutableList;
+
import java.util.ArrayList;
/**
diff --git a/java/com/android/contacts/common/model/ContactLoader.java b/java/com/android/contacts/common/model/ContactLoader.java
index 3f8e8f9..8942bf4 100644
--- a/java/com/android/contacts/common/model/ContactLoader.java
+++ b/java/com/android/contacts/common/model/ContactLoader.java
@@ -57,6 +57,10 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -69,10 +73,6 @@
import java.util.Objects;
import java.util.Set;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
/** Loads a single Contact and all it constituent RawContacts. */
public class ContactLoader extends AsyncTaskLoader<Contact> {
@@ -297,8 +297,7 @@
// status data. Initially, result has empty entities and statuses.
long currentRawContactId = -1;
RawContact rawContact = null;
- ImmutableList.Builder<RawContact> rawContactsBuilder =
- new ImmutableList.Builder<RawContact>();
+ ImmutableList.Builder<RawContact> rawContactsBuilder = new ImmutableList.Builder<>();
do {
long rawContactId = cursor.getLong(ContactQuery.RAW_CONTACT_ID);
if (rawContactId != currentRawContactId) {
@@ -393,8 +392,7 @@
/** Sets the "invitable" account types to {@link Contact#mInvitableAccountTypes}. */
private void loadInvitableAccountTypes(Contact contactData) {
- final ImmutableList.Builder<AccountType> resultListBuilder =
- new ImmutableList.Builder<AccountType>();
+ final ImmutableList.Builder<AccountType> resultListBuilder = new ImmutableList.Builder<>();
if (!contactData.isUserProfile()) {
Map<AccountTypeWithDataSet, AccountType> invitables =
AccountTypeManager.getInstance(getContext()).getUsableInvitableAccountTypes();
@@ -599,7 +597,7 @@
*/
private void loadGroupMetaData(Contact result) {
StringBuilder selection = new StringBuilder();
- ArrayList<String> selectionArgs = new ArrayList<String>();
+ ArrayList<String> selectionArgs = new ArrayList<>();
final HashSet<AccountKey> accountsSeen = new HashSet<>();
for (RawContact rawContact : result.getRawContacts()) {
final String accountName = rawContact.getAccountName();
@@ -624,8 +622,7 @@
selection.append(")");
}
}
- final ImmutableList.Builder<GroupMetaData> groupListBuilder =
- new ImmutableList.Builder<GroupMetaData>();
+ final ImmutableList.Builder<GroupMetaData> groupListBuilder = new ImmutableList.Builder<>();
final Cursor cursor =
getContext()
.getContentResolver()
@@ -933,7 +930,7 @@
static {
List<String> projectionList = Lists.newArrayList(COLUMNS_INTERNAL);
projectionList.add(Data.CARRIER_PRESENCE);
- COLUMNS = projectionList.toArray(new String[projectionList.size()]);
+ COLUMNS = projectionList.toArray(new String[0]);
}
}
diff --git a/java/com/android/contacts/common/model/RawContact.java b/java/com/android/contacts/common/model/RawContact.java
index 37c5634..cdb2571 100644
--- a/java/com/android/contacts/common/model/RawContact.java
+++ b/java/com/android/contacts/common/model/RawContact.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,9 +26,11 @@
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
+
import com.android.contacts.common.model.account.AccountType;
import com.android.contacts.common.model.account.AccountWithDataSet;
import com.android.contacts.common.model.dataitem.DataItem;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -69,7 +72,7 @@
public RawContact(ContentValues values) {
mValues = values;
- mDataItems = new ArrayList<NamedDataItem>();
+ mDataItems = new ArrayList<>();
}
/**
diff --git a/java/com/android/contacts/common/model/account/AccountType.java b/java/com/android/contacts/common/model/account/AccountType.java
index 3e659e5..fd9eb0e 100644
--- a/java/com/android/contacts/common/model/account/AccountType.java
+++ b/java/com/android/contacts/common/model/account/AccountType.java
@@ -36,7 +36,6 @@
import java.text.Collator;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -207,7 +206,7 @@
* the account.
*/
public List<String> getExtensionPackageNames() {
- return new ArrayList<String>();
+ return new ArrayList<>();
}
/**
@@ -238,13 +237,6 @@
/** Whether or not groups created under this account type have editable membership lists. */
public abstract boolean isGroupMembershipEditable();
- /** Return list of {@link DataKind} supported, sorted by {@link DataKind#weight}. */
- public ArrayList<DataKind> getSortedDataKinds() {
- // TODO: optimize by marking if already sorted
- Collections.sort(mKinds, sWeightComparator);
- return mKinds;
- }
-
/** Find the {@link DataKind} for a specific MIME-type, if it's handled by this data source. */
public DataKind getKindForMimetype(String mimeType) {
return this.mMimeKinds.get(mimeType);
diff --git a/java/com/android/contacts/common/model/account/AccountTypeWithDataSet.java b/java/com/android/contacts/common/model/account/AccountTypeWithDataSet.java
index a32ebe1..24fcac3 100644
--- a/java/com/android/contacts/common/model/account/AccountTypeWithDataSet.java
+++ b/java/com/android/contacts/common/model/account/AccountTypeWithDataSet.java
@@ -23,6 +23,7 @@
import android.provider.ContactsContract;
import android.provider.ContactsContract.RawContacts;
import android.text.TextUtils;
+
import java.util.Objects;
/** Encapsulates an "account type" string and a "data set" string. */
diff --git a/java/com/android/contacts/common/model/account/AccountWithDataSet.java b/java/com/android/contacts/common/model/account/AccountWithDataSet.java
index 54e9a3c..63399d1 100644
--- a/java/com/android/contacts/common/model/account/AccountWithDataSet.java
+++ b/java/com/android/contacts/common/model/account/AccountWithDataSet.java
@@ -16,20 +16,11 @@
package com.android.contacts.common.model.account;
-import android.accounts.Account;
-import android.content.Context;
-import android.database.Cursor;
-import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
-import android.provider.BaseColumns;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.RawContacts;
import android.text.TextUtils;
-import java.util.ArrayList;
-import java.util.List;
+
import java.util.Objects;
-import java.util.regex.Pattern;
/** Wrapper for an account that includes a data set (which may be null). */
public class AccountWithDataSet implements Parcelable {
diff --git a/java/com/android/contacts/common/model/account/BaseAccountType.java b/java/com/android/contacts/common/model/account/BaseAccountType.java
index d96e28c..2fb17ce 100644
--- a/java/com/android/contacts/common/model/account/BaseAccountType.java
+++ b/java/com/android/contacts/common/model/account/BaseAccountType.java
@@ -38,18 +38,21 @@
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.view.inputmethod.EditorInfo;
+
import com.android.contacts.common.model.dataitem.DataKind;
import com.android.contacts.common.util.CommonDateUtils;
import com.android.contacts.common.util.ContactDisplayUtils;
import com.android.dialer.common.LogUtil;
import com.android.dialer.contacts.resources.R;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
public abstract class BaseAccountType extends AccountType {
diff --git a/java/com/android/contacts/common/model/account/ExchangeAccountType.java b/java/com/android/contacts/common/model/account/ExchangeAccountType.java
index 0a95e7e..20f3c09 100644
--- a/java/com/android/contacts/common/model/account/ExchangeAccountType.java
+++ b/java/com/android/contacts/common/model/account/ExchangeAccountType.java
@@ -29,10 +29,12 @@
import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.provider.ContactsContract.CommonDataKinds.Website;
+
import com.android.contacts.common.model.dataitem.DataKind;
import com.android.contacts.common.util.CommonDateUtils;
import com.android.dialer.common.LogUtil;
import com.android.dialer.contacts.resources.R;
+
import java.util.ArrayList;
import java.util.Locale;
diff --git a/java/com/android/contacts/common/model/account/ExternalAccountType.java b/java/com/android/contacts/common/model/account/ExternalAccountType.java
index 24cd6ed..d93195b 100644
--- a/java/com/android/contacts/common/model/account/ExternalAccountType.java
+++ b/java/com/android/contacts/common/model/account/ExternalAccountType.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,11 +36,12 @@
import com.android.dialer.R;
import com.android.dialer.common.LogUtil;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
/** A general contacts account type descriptor. */
public class ExternalAccountType extends BaseAccountType {
@@ -153,7 +155,7 @@
}
}
- mExtensionPackageNames = new ArrayList<String>();
+ mExtensionPackageNames = new ArrayList<>();
mInviteActionLabelResId =
resolveExternalResId(
context,
@@ -401,9 +403,7 @@
addKind(kind);
}
}
- } catch (XmlPullParserException e) {
- throw new DefinitionException("Problem reading XML", e);
- } catch (IOException e) {
+ } catch (XmlPullParserException | IOException e) {
throw new DefinitionException("Problem reading XML", e);
}
}
diff --git a/java/com/android/contacts/common/model/account/FallbackAccountType.java b/java/com/android/contacts/common/model/account/FallbackAccountType.java
index 9e8af62..6fc02f1 100644
--- a/java/com/android/contacts/common/model/account/FallbackAccountType.java
+++ b/java/com/android/contacts/common/model/account/FallbackAccountType.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,7 @@
package com.android.contacts.common.model.account;
import android.content.Context;
-import com.android.contacts.common.model.dataitem.DataKind;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.contacts.resources.R;
diff --git a/java/com/android/contacts/common/model/account/GoogleAccountType.java b/java/com/android/contacts/common/model/account/GoogleAccountType.java
index e10ade4..55ab945 100644
--- a/java/com/android/contacts/common/model/account/GoogleAccountType.java
+++ b/java/com/android/contacts/common/model/account/GoogleAccountType.java
@@ -24,10 +24,12 @@
import android.provider.ContactsContract.CommonDataKinds.Event;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.Relation;
+
import com.android.contacts.common.model.dataitem.DataKind;
import com.android.contacts.common.util.CommonDateUtils;
import com.android.dialer.common.LogUtil;
import com.android.dialer.contacts.resources.R;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
diff --git a/java/com/android/contacts/common/model/account/SamsungAccountType.java b/java/com/android/contacts/common/model/account/SamsungAccountType.java
index 77c0575..a550c3f 100644
--- a/java/com/android/contacts/common/model/account/SamsungAccountType.java
+++ b/java/com/android/contacts/common/model/account/SamsungAccountType.java
@@ -23,10 +23,12 @@
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.Relation;
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+
import com.android.contacts.common.model.dataitem.DataKind;
import com.android.contacts.common.util.CommonDateUtils;
import com.android.dialer.common.LogUtil;
import com.android.dialer.contacts.resources.R;
+
import java.util.ArrayList;
import java.util.Locale;
diff --git a/java/com/android/contacts/common/model/dataitem/DataItem.java b/java/com/android/contacts/common/model/dataitem/DataItem.java
index 43a472b..ebfe85e 100644
--- a/java/com/android/contacts/common/model/dataitem/DataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/DataItem.java
@@ -35,6 +35,7 @@
import android.provider.ContactsContract.CommonDataKinds.Website;
import android.provider.ContactsContract.Contacts.Data;
import android.provider.ContactsContract.Contacts.Entity;
+
import com.android.contacts.common.Collapser;
import com.android.contacts.common.MoreContactUtils;
import com.android.contacts.common.model.account.AccountType.EditType;
diff --git a/java/com/android/contacts/common/model/dataitem/DataKind.java b/java/com/android/contacts/common/model/dataitem/DataKind.java
index 3b470a2..194aa84 100644
--- a/java/com/android/contacts/common/model/dataitem/DataKind.java
+++ b/java/com/android/contacts/common/model/dataitem/DataKind.java
@@ -19,10 +19,12 @@
import android.content.ContentValues;
import android.content.Context;
import android.provider.ContactsContract.Data;
+
import com.android.contacts.common.model.account.AccountType.EditField;
import com.android.contacts.common.model.account.AccountType.EditType;
import com.android.contacts.common.model.account.AccountType.StringInflater;
import com.google.common.collect.Iterators;
+
import java.text.SimpleDateFormat;
import java.util.List;
diff --git a/java/com/android/contacts/common/model/dataitem/EmailDataItem.java b/java/com/android/contacts/common/model/dataitem/EmailDataItem.java
index 2fe2978..aed419d 100644
--- a/java/com/android/contacts/common/model/dataitem/EmailDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/EmailDataItem.java
@@ -17,6 +17,7 @@
package com.android.contacts.common.model.dataitem;
import android.content.ContentValues;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Email;
/**
diff --git a/java/com/android/contacts/common/model/dataitem/EventDataItem.java b/java/com/android/contacts/common/model/dataitem/EventDataItem.java
index 15d9880..4060e67 100644
--- a/java/com/android/contacts/common/model/dataitem/EventDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/EventDataItem.java
@@ -18,6 +18,7 @@
import android.content.ContentValues;
import android.content.Context;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Event;
import android.text.TextUtils;
diff --git a/java/com/android/contacts/common/model/dataitem/GroupMembershipDataItem.java b/java/com/android/contacts/common/model/dataitem/GroupMembershipDataItem.java
index 42a0dcd..7b5115d 100644
--- a/java/com/android/contacts/common/model/dataitem/GroupMembershipDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/GroupMembershipDataItem.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +19,6 @@
import android.content.ContentValues;
import android.provider.ContactsContract;
-import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
/**
* Represents a group memebership data item, wrapping the columns in {@link
diff --git a/java/com/android/contacts/common/model/dataitem/IdentityDataItem.java b/java/com/android/contacts/common/model/dataitem/IdentityDataItem.java
index 81e6934..09cca10 100644
--- a/java/com/android/contacts/common/model/dataitem/IdentityDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/IdentityDataItem.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,7 @@
package com.android.contacts.common.model.dataitem;
import android.content.ContentValues;
-import android.provider.ContactsContract.CommonDataKinds.Identity;
+import android.provider.ContactsContract;
/**
* Represents an identity data item, wrapping the columns in {@link
diff --git a/java/com/android/contacts/common/model/dataitem/ImDataItem.java b/java/com/android/contacts/common/model/dataitem/ImDataItem.java
index 8fbf059..efc6383 100644
--- a/java/com/android/contacts/common/model/dataitem/ImDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/ImDataItem.java
@@ -18,6 +18,7 @@
import android.content.ContentValues;
import android.content.Context;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Im;
import android.text.TextUtils;
diff --git a/java/com/android/contacts/common/model/dataitem/NicknameDataItem.java b/java/com/android/contacts/common/model/dataitem/NicknameDataItem.java
index a448be7..0eabb40 100644
--- a/java/com/android/contacts/common/model/dataitem/NicknameDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/NicknameDataItem.java
@@ -17,6 +17,7 @@
package com.android.contacts.common.model.dataitem;
import android.content.ContentValues;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Nickname;
/**
diff --git a/java/com/android/contacts/common/model/dataitem/NoteDataItem.java b/java/com/android/contacts/common/model/dataitem/NoteDataItem.java
index b55ecc3..ec9a862 100644
--- a/java/com/android/contacts/common/model/dataitem/NoteDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/NoteDataItem.java
@@ -17,6 +17,7 @@
package com.android.contacts.common.model.dataitem;
import android.content.ContentValues;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Note;
/**
diff --git a/java/com/android/contacts/common/model/dataitem/PhoneDataItem.java b/java/com/android/contacts/common/model/dataitem/PhoneDataItem.java
index a314f7a..e25328f 100644
--- a/java/com/android/contacts/common/model/dataitem/PhoneDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/PhoneDataItem.java
@@ -19,6 +19,7 @@
import android.content.ContentValues;
import android.content.Context;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
/**
diff --git a/java/com/android/contacts/common/model/dataitem/RelationDataItem.java b/java/com/android/contacts/common/model/dataitem/RelationDataItem.java
index fdbcbb3..517b7a2 100644
--- a/java/com/android/contacts/common/model/dataitem/RelationDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/RelationDataItem.java
@@ -18,6 +18,7 @@
import android.content.ContentValues;
import android.content.Context;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Relation;
import android.text.TextUtils;
diff --git a/java/com/android/contacts/common/model/dataitem/StructuredNameDataItem.java b/java/com/android/contacts/common/model/dataitem/StructuredNameDataItem.java
index a2ddf43..2b5b480 100644
--- a/java/com/android/contacts/common/model/dataitem/StructuredNameDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/StructuredNameDataItem.java
@@ -17,6 +17,7 @@
package com.android.contacts.common.model.dataitem;
import android.content.ContentValues;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.provider.ContactsContract.Contacts.Data;
diff --git a/java/com/android/contacts/common/model/dataitem/WebsiteDataItem.java b/java/com/android/contacts/common/model/dataitem/WebsiteDataItem.java
index b8400ec..53b1039 100644
--- a/java/com/android/contacts/common/model/dataitem/WebsiteDataItem.java
+++ b/java/com/android/contacts/common/model/dataitem/WebsiteDataItem.java
@@ -17,6 +17,7 @@
package com.android.contacts.common.model.dataitem;
import android.content.ContentValues;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Website;
/**
diff --git a/java/com/android/contacts/common/util/ContactDisplayUtils.java b/java/com/android/contacts/common/util/ContactDisplayUtils.java
index 22da719..74123f7 100644
--- a/java/com/android/contacts/common/util/ContactDisplayUtils.java
+++ b/java/com/android/contacts/common/util/ContactDisplayUtils.java
@@ -31,6 +31,7 @@
import com.android.dialer.common.LogUtil;
import com.android.dialer.contacts.resources.R;
+
import java.util.Objects;
/** Methods for handling various contact data labels. */
diff --git a/java/com/android/contacts/common/util/ContactListViewUtils.java b/java/com/android/contacts/common/util/ContactListViewUtils.java
index ba24079..5bdb96d 100644
--- a/java/com/android/contacts/common/util/ContactListViewUtils.java
+++ b/java/com/android/contacts/common/util/ContactListViewUtils.java
@@ -16,11 +16,8 @@
package com.android.contacts.common.util;
-import android.content.res.Resources;
import android.view.View;
import android.widget.ListView;
-import com.android.dialer.contacts.resources.R;
-import com.android.dialer.util.ViewUtil;
/** Utilities for configuring ListViews with a card background. */
public class ContactListViewUtils {
diff --git a/java/com/android/contacts/common/util/ContactLoaderUtils.java b/java/com/android/contacts/common/util/ContactLoaderUtils.java
index 371bb4e..df081b1 100644
--- a/java/com/android/contacts/common/util/ContactLoaderUtils.java
+++ b/java/com/android/contacts/common/util/ContactLoaderUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,10 +20,11 @@
import android.content.ContentResolver;
import android.content.ContentUris;
import android.net.Uri;
-import android.provider.Contacts;
import android.provider.ContactsContract;
import android.provider.ContactsContract.RawContacts;
+import com.android.contacts.common.model.ContactLoader;
+
/** Utility methods for the {@link ContactLoader}. */
public final class ContactLoaderUtils {
@@ -36,7 +38,6 @@
*
* <p>Do not call from the UI thread.
*/
- @SuppressWarnings("deprecation")
public static Uri ensureIsContactUri(final ContentResolver resolver, final Uri uri)
throws IllegalArgumentException {
if (uri == null) {
diff --git a/java/com/android/contacts/common/util/TelephonyManagerUtils.java b/java/com/android/contacts/common/util/TelephonyManagerUtils.java
index e4c2c63..10af0f5 100644
--- a/java/com/android/contacts/common/util/TelephonyManagerUtils.java
+++ b/java/com/android/contacts/common/util/TelephonyManagerUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +16,7 @@
*/
package com.android.contacts.common.util;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.telephony.TelephonyManager;
@@ -27,6 +29,7 @@
* @param context Current application context
* @return Voicemail tag, the alphabetic identifier associated with the voice mail number.
*/
+ @SuppressLint("MissingPermission")
public static String getVoiceMailAlphaTag(Context context) {
final TelephonyManager telephonyManager =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
diff --git a/java/com/android/contacts/common/widget/ActivityTouchLinearLayout.java b/java/com/android/contacts/common/widget/ActivityTouchLinearLayout.java
index 2988a5a..7df82c0 100644
--- a/java/com/android/contacts/common/widget/ActivityTouchLinearLayout.java
+++ b/java/com/android/contacts/common/widget/ActivityTouchLinearLayout.java
@@ -20,6 +20,7 @@
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;
+
import com.android.dialer.util.TouchPointManager;
/**
diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java
index 6106bc3..18b0055 100644
--- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java
+++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogOptionsUtil.java
@@ -19,11 +19,10 @@
import android.os.Parcel;
import android.os.UserHandle;
-import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
+
import com.android.dialer.common.Assert;
import com.android.dialer.telecom.TelecomUtil;
-
import com.google.protobuf.ByteString;
import java.util.Collection;
diff --git a/java/com/android/dialer/activecalls/ActiveCallsComponent.java b/java/com/android/dialer/activecalls/ActiveCallsComponent.java
index 99e0e94..f583b83 100644
--- a/java/com/android/dialer/activecalls/ActiveCallsComponent.java
+++ b/java/com/android/dialer/activecalls/ActiveCallsComponent.java
@@ -17,8 +17,10 @@
package com.android.dialer.activecalls;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
+
import dagger.Subcomponent;
/** Component for {@link ActiveCalls} */
diff --git a/java/com/android/dialer/activecalls/ActiveCallsModule.java b/java/com/android/dialer/activecalls/ActiveCallsModule.java
index 9c02ba6..8ebb6ff 100644
--- a/java/com/android/dialer/activecalls/ActiveCallsModule.java
+++ b/java/com/android/dialer/activecalls/ActiveCallsModule.java
@@ -17,9 +17,11 @@
package com.android.dialer.activecalls;
import com.android.dialer.activecalls.impl.ActiveCallsImpl;
+
+import javax.inject.Singleton;
+
import dagger.Binds;
import dagger.Module;
-import javax.inject.Singleton;
/** Module for {@link ActiveCallsComponent} */
@Module
diff --git a/java/com/android/dialer/activecalls/impl/ActiveCallsImpl.java b/java/com/android/dialer/activecalls/impl/ActiveCallsImpl.java
index 10e6ffa..8995962 100644
--- a/java/com/android/dialer/activecalls/impl/ActiveCallsImpl.java
+++ b/java/com/android/dialer/activecalls/impl/ActiveCallsImpl.java
@@ -22,6 +22,7 @@
import com.android.dialer.activecalls.ActiveCalls;
import com.android.dialer.common.Assert;
import com.google.common.collect.ImmutableList;
+
import javax.inject.Inject;
/** Implementation of {@link ActiveCalls} */
diff --git a/java/com/android/dialer/app/AndroidManifest.xml b/java/com/android/dialer/app/AndroidManifest.xml
index 400551b..c645f15 100644
--- a/java/com/android/dialer/app/AndroidManifest.xml
+++ b/java/com/android/dialer/app/AndroidManifest.xml
@@ -152,7 +152,8 @@
<provider xmlns:tools="http://schemas.android.com/tools"
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
- tools:replace="android:authorities" />
+ android:exported="false"
+ tools:replace="android:authorities"/>
<meta-data android:name="supports_per_number_preferred_account" android:value="true" />
</application>
</manifest>
diff --git a/java/com/android/dialer/app/calllog/CallLogActivity.java b/java/com/android/dialer/app/calllog/CallLogActivity.java
index 9416124..5df7fdd 100644
--- a/java/com/android/dialer/app/calllog/CallLogActivity.java
+++ b/java/com/android/dialer/app/calllog/CallLogActivity.java
@@ -86,14 +86,14 @@
tabTitles[1] = getString(R.string.call_log_missed_title);
tabTitles[2] = getString(R.string.call_log_stats_title);
- viewPager = (ViewPager) findViewById(R.id.call_log_pager);
+ viewPager = findViewById(R.id.call_log_pager);
viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(viewPagerAdapter);
viewPager.setOffscreenPageLimit(1);
viewPager.setOnPageChangeListener(this);
- viewPagerTabs = (ViewPagerTabs) findViewById(R.id.viewpager_header);
+ viewPagerTabs = findViewById(R.id.viewpager_header);
viewPagerTabs.setViewPager(viewPager);
viewPager.setCurrentItem(startingTab);
@@ -212,11 +212,6 @@
}
}
- @Override
- public void onBackPressed() {
- super.onBackPressed();
- }
-
/** Adapter for the view pager. */
public class ViewPagerAdapter extends FragmentPagerAdapter {
diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java
index 6057649..869f90b 100644
--- a/java/com/android/dialer/app/calllog/CallLogAdapter.java
+++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java
@@ -19,8 +19,6 @@
import android.app.Activity;
import android.content.ContentUris;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnCancelListener;
import android.content.res.Resources;
import android.database.Cursor;
import android.net.Uri;
@@ -70,8 +68,6 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.FragmentUtils.FragmentUtilListener;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.common.concurrent.AsyncTaskExecutor;
-import com.android.dialer.common.concurrent.AsyncTaskExecutors;
import com.android.dialer.contacts.ContactsComponent;
import com.android.dialer.logging.ContactSource;
import com.android.dialer.logging.ContactSource.Type;
@@ -630,7 +626,7 @@
* @param position The position of the entry.
*/
@Override
- public void onBindViewHolder(ViewHolder viewHolder, int position) {
+ public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) {
Trace.beginSection("onBindViewHolder: " + position);
switch (getItemViewType(position)) {
case VIEW_TYPE_ALERT:
@@ -713,10 +709,7 @@
}
private boolean isHiddenRow(@Nullable String number, long rowId) {
- if (hiddenRowIds.contains(rowId)) {
- return true;
- }
- return false;
+ return hiddenRowIds.contains(rowId);
}
private void loadAndRender(
diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java
index 9aa1af6..82f56d6 100644
--- a/java/com/android/dialer/app/calllog/CallLogFragment.java
+++ b/java/com/android/dialer/app/calllog/CallLogFragment.java
@@ -44,6 +44,7 @@
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -669,8 +670,8 @@
@Override
public void setSelectAllModeToFalse() {
selectAllMode = false;
- selectUnselectAllIcon.setImageDrawable(
- getContext().getDrawable(R.drawable.ic_empty_check_mark_white_24dp));
+ selectUnselectAllIcon.setImageDrawable(AppCompatResources.getDrawable(requireContext(),
+ R.drawable.ic_empty_check_mark_white_24dp));
}
@Override
@@ -688,12 +689,12 @@
private void updateSelectAllIcon() {
if (selectAllMode) {
- selectUnselectAllIcon.setImageDrawable(
- getContext().getDrawable(R.drawable.ic_check_mark_blue_24dp));
+ selectUnselectAllIcon.setImageDrawable(AppCompatResources.getDrawable(requireContext(),
+ R.drawable.ic_check_mark_blue_24dp));
getAdapter().onAllSelected();
} else {
- selectUnselectAllIcon.setImageDrawable(
- getContext().getDrawable(R.drawable.ic_empty_check_mark_white_24dp));
+ selectUnselectAllIcon.setImageDrawable(AppCompatResources.getDrawable(requireContext(),
+ R.drawable.ic_empty_check_mark_white_24dp));
getAdapter().onAllDeselected();
}
}
diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
index b12fcbb..e4d27a4 100644
--- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
+++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
@@ -31,7 +31,6 @@
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import java.time.ZoneId;
-import java.util.Objects;
/**
* Groups together calls in the call log. The primary grouping attempts to group together calls to
@@ -190,7 +189,7 @@
*/
private boolean equalNumbers(@Nullable String number1, @Nullable String number2) {
if (PhoneNumberHelper.isUriNumber(number1) || PhoneNumberHelper.isUriNumber(number2)) {
- return compareSipAddresses(number1, number2);
+ return PhoneNumberHelper.compareSipAddresses(number1, number2);
}
// PhoneNumberUtils.compare(String, String) ignores special characters such as '#'. For example,
@@ -209,36 +208,6 @@
return TextUtils.equals(name1, name2) && TextUtils.equals(id1, id2);
}
- private boolean compareSipAddresses(@Nullable String number1, @Nullable String number2) {
- if (number1 == null || number2 == null) {
- return Objects.equals(number1, number2);
- }
-
- int index1 = number1.indexOf('@');
- final String userinfo1;
- final String rest1;
- if (index1 != -1) {
- userinfo1 = number1.substring(0, index1);
- rest1 = number1.substring(index1);
- } else {
- userinfo1 = number1;
- rest1 = "";
- }
-
- int index2 = number2.indexOf('@');
- final String userinfo2;
- final String rest2;
- if (index2 != -1) {
- userinfo2 = number2.substring(0, index2);
- rest2 = number2.substring(index2);
- } else {
- userinfo2 = number2;
- rest2 = "";
- }
-
- return userinfo1.equals(userinfo2) && rest1.equalsIgnoreCase(rest2);
- }
-
/**
* Given a call date and the current date, determine which date group the call belongs in.
*
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index 76622ca..1dd4e53 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -54,7 +54,6 @@
import android.widget.ImageView;
import android.widget.TextView;
-import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresPermission;
import androidx.cardview.widget.CardView;
@@ -88,8 +87,6 @@
import com.android.dialer.util.DialerUtils;
import com.android.dialer.util.UriUtils;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
/**
@@ -130,7 +127,6 @@
private final CachedNumberLookupService cachedNumberLookupService;
private final VoicemailPlaybackPresenter voicemailPlaybackPresenter;
private final OnClickListener blockReportListener;
- @HostUi private final int hostUi;
/** Whether the data fields are populated by the worker thread, ready to be shown. */
public boolean isLoaded;
/** The view containing call log item actions. Null until the ViewStub is inflated. */
@@ -269,21 +265,13 @@
this.callLogEntryView = callLogEntryView;
this.dayGroupHeader = dayGroupHeader;
this.primaryActionButtonView = primaryActionButtonView;
- this.workIconView = (ImageView) rootView.findViewById(R.id.work_profile_icon);
- this.checkBoxView = (ImageView) rootView.findViewById(R.id.quick_contact_checkbox);
+ this.workIconView = rootView.findViewById(R.id.work_profile_icon);
+ this.checkBoxView = rootView.findViewById(R.id.quick_contact_checkbox);
// Set text height to false on the TextViews so they don't have extra padding.
phoneCallDetailsViews.nameView.setElegantTextHeight(false);
phoneCallDetailsViews.callLocationAndDate.setElegantTextHeight(false);
- if (this.context instanceof CallLogActivity) {
- hostUi = HostUi.CALL_HISTORY;
- } else if (this.voicemailPlaybackPresenter == null) {
- hostUi = HostUi.CALL_LOG;
- } else {
- hostUi = HostUi.VOICEMAIL;
- }
-
quickContactView.setOverlay(null);
quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
primaryActionButtonView.setOnClickListener(this);
@@ -493,7 +481,7 @@
videoCallButtonView.setVisibility(View.GONE);
// For an emergency number, show "Call details" only.
- if (PhoneNumberHelper.isLocalEmergencyNumber(context, number)) {
+ if (PhoneNumberHelper.isEmergencyNumber(context, number)) {
createNewContactButtonView.setVisibility(View.GONE);
addToExistingContactButtonView.setVisibility(View.GONE);
sendMessageView.setVisibility(View.GONE);
@@ -899,11 +887,6 @@
if (OldCallDetailsActivity.isLaunchIntent(intent)) {
((Activity) context).startActivity(intent);
} else {
- if (Intent.ACTION_CALL.equals(intent.getAction())
- && intent.getIntExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, -1)
- == VideoProfile.STATE_BIDIRECTIONAL) {
- }
-
DialerUtils.startActivityWithErrorToast(context, intent);
}
}
@@ -964,11 +947,11 @@
blockView.setVisibility(View.GONE);
unblockView.setVisibility(View.GONE);
reportNotSpamView.setVisibility(View.GONE);
- String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso);
+
if (!canPlaceCallToNumber
|| isVoicemailNumber
|| !BlockedNumberContract.canCurrentUserBlockNumbers(context)
- || PhoneNumberUtils.isEmergencyNumber(e164Number)) {
+ || PhoneNumberHelper.isEmergencyNumber(context, number, countryIso)) {
return;
}
@@ -1021,13 +1004,12 @@
.setOnMenuItemClickListener(this);
}
- String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso);
boolean isVoicemailNumber = callLogCache.isVoicemailNumber(accountHandle, number);
boolean canPlaceCallToNumber = PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation);
if (canPlaceCallToNumber
&& !isVoicemailNumber
&& BlockedNumberContract.canCurrentUserBlockNumbers(context)
- && !PhoneNumberUtils.isEmergencyNumber(e164Number)) {
+ && !PhoneNumberHelper.isEmergencyNumber(context, number, countryIso)) {
if (isBlocked) {
menu.add(
ContextMenu.NONE,
@@ -1051,15 +1033,6 @@
}
}
- /** Specifies where the view holder belongs. */
- @IntDef({HostUi.CALL_LOG, HostUi.CALL_HISTORY, HostUi.VOICEMAIL})
- @Retention(RetentionPolicy.SOURCE)
- private @interface HostUi {
- int CALL_LOG = 0;
- int CALL_HISTORY = 1;
- int VOICEMAIL = 2;
- }
-
public interface OnClickListener {
void onBlockReportSpam(
diff --git a/java/com/android/dialer/app/calllog/CallLogReceiver.java b/java/com/android/dialer/app/calllog/CallLogReceiver.java
index 5d8d130..e28a081 100644
--- a/java/com/android/dialer/app/calllog/CallLogReceiver.java
+++ b/java/com/android/dialer/app/calllog/CallLogReceiver.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
import android.content.Intent;
import android.database.Cursor;
import android.provider.VoicemailContract;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.database.CallLogQueryHandler;
diff --git a/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java b/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java
index ef61aac..5a4dd0a 100644
--- a/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java
+++ b/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.util.AttributeSet;
import android.view.View;
import android.widget.QuickContactBadge;
+
import com.android.dialer.app.calllog.CallLogAdapter.OnActionModeStateChangedListener;
/** Allows us to click the contact badge for non multi select mode. */
diff --git a/java/com/android/dialer/app/calllog/IntentProvider.java b/java/com/android/dialer/app/calllog/IntentProvider.java
index f80e0d8..10d6a89 100644
--- a/java/com/android/dialer/app/calllog/IntentProvider.java
+++ b/java/com/android/dialer/app/calllog/IntentProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import android.provider.ContactsContract;
import android.telecom.PhoneAccountHandle;
import android.telephony.TelephonyManager;
+
import com.android.contacts.common.model.Contact;
import com.android.contacts.common.model.ContactLoader;
import com.android.dialer.app.AccountSelectionActivity;
@@ -33,6 +35,7 @@
import com.android.dialer.dialercontact.DialerContact;
import com.android.dialer.precall.PreCall;
import com.android.dialer.util.IntentUtil;
+
import java.util.ArrayList;
/**
diff --git a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
index 47d97aa..3eb4616 100644
--- a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
+++ b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
@@ -16,6 +16,7 @@
package com.android.dialer.app.calllog;
+import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
@@ -96,6 +97,7 @@
context
.getResources()
.getQuantityString(R.plurals.notification_voicemail_title, count, count);
+ @SuppressLint("MissingPermission")
PersistableBundle config = pinnedTelephonyManager.getCarrierConfig();
boolean isOngoing;
if (config == null) {
diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java
index 7f2f663..85ca135 100644
--- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java
+++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java
@@ -18,9 +18,9 @@
import static com.android.dialer.app.DevicePolicyResources.NOTIFICATION_MISSED_WORK_CALL_TITLE;
+import android.annotation.SuppressLint;
import android.app.BroadcastOptions;
import android.app.Notification;
-import android.app.Notification.Builder;
import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
@@ -48,8 +48,8 @@
import androidx.core.util.Pair;
import com.android.contacts.common.ContactsUtils;
+import com.android.dialer.R;
import com.android.dialer.app.MainComponent;
-import com.android.dialer.app.R;
import com.android.dialer.app.calllog.CallLogNotificationsQueryHelper.NewCall;
import com.android.dialer.app.contactinfo.ContactPhotoLoader;
import com.android.dialer.callintent.CallInitiationType;
@@ -368,7 +368,7 @@
}
private Notification.Builder createNotificationBuilder() {
- return new Notification.Builder(context)
+ return new Notification.Builder(context, NotificationChannelId.MISSED_CALL)
.setGroup(MissedCallConstants.GROUP_KEY)
.setSmallIcon(android.R.drawable.stat_notify_missed_call)
.setColor(ThemeComponent.get(context).theme().getColorPrimary())
@@ -379,7 +379,7 @@
}
private Notification.Builder createNotificationBuilder(@NonNull NewCall call) {
- Builder builder =
+ Notification.Builder builder =
createNotificationBuilder()
.setWhen(call.dateMs)
.setDeleteIntent(
@@ -468,6 +468,7 @@
}
/** Closes open system dialogs and the notification shade. */
+ @SuppressLint("MissingPermission")
private void closeSystemDialogs(Context context) {
final Intent intent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
index fee98a2..e118543 100644
--- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
+++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
@@ -23,7 +23,7 @@
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.telecom.PhoneAccount;
-import android.telephony.PhoneNumberUtils;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.view.View;
@@ -151,7 +151,8 @@
int color = callLogCache.getAccountColor(details.accountHandle);
if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) {
int defaultColor = R.color.dialer_secondary_text_color;
- views.callAccountLabel.setTextColor(context.getResources().getColor(defaultColor));
+ views.callAccountLabel.setTextColor(context.getResources().getColor(defaultColor,
+ context.getTheme()));
} else {
views.callAccountLabel.setTextColor(color);
}
@@ -180,7 +181,8 @@
return;
}
- if (PhoneNumberUtils.isEmergencyNumber(details.displayNumber)) {
+ TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class);
+ if (telephonyManager.isEmergencyNumber(details.displayNumber)) {
views.nameView.setText(R.string.emergency_number);
views.nameView.setTextDirection(View.TEXT_DIRECTION_INHERIT);
return;
diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java
index 8ba3493..88d05fb 100644
--- a/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java
+++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsViews.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.view.View;
import android.widget.TextView;
+
import com.android.dialer.app.R;
import com.android.dialer.calllogutils.CallTypeIconsView;
import com.android.dialer.widget.BidiTextView;
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java
index edb5115..4fe6019 100644
--- a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java
+++ b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java
@@ -91,11 +91,11 @@
if (shouldAlert) {
groupSummary.setOnlyAlertOnce(false);
// Group summary will alert when posted/updated
- groupSummary.setGroupAlertBehavior(Notification.GROUP_ALERT_ALL);
+ groupSummary.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL);
} else {
// Only children will alert. but since all children are set to "only alert summary" it is
// effectively silenced.
- groupSummary.setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN);
+ groupSummary.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN);
}
PhoneAccountHandle handle = getAccountForCall(context, newCalls.get(0));
groupSummary.setChannelId(NotificationChannelManager.getVoicemailChannelId(context, handle));
@@ -171,7 +171,7 @@
}
builder.setChannelId(NotificationChannelManager.getVoicemailChannelId(context, handle));
- builder.setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY);
+ builder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY);
ContactPhotoLoader loader = new ContactPhotoLoader(context, contactInfo);
Bitmap photoIcon = loader.loadPhotoIcon();
diff --git a/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java b/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java
index c6ea069..4801f96 100644
--- a/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java
+++ b/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java
@@ -24,6 +24,7 @@
import android.content.ComponentName;
import android.content.Context;
import android.provider.VoicemailContract;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.constants.ScheduledJobIds;
diff --git a/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java b/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
index ca759af..8e2b4c6 100644
--- a/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
+++ b/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +28,9 @@
import com.android.dialer.calllogutils.PhoneAccountUtils;
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.CallUtil;
+
import java.util.Map;
+
import javax.annotation.concurrent.ThreadSafe;
/**
@@ -104,7 +107,7 @@
if (phoneAccountColorCache.containsKey(accountHandle)) {
return phoneAccountColorCache.get(accountHandle);
} else {
- Integer color = PhoneAccountUtils.getAccountColor(context, accountHandle);
+ int color = PhoneAccountUtils.getAccountColor(context, accountHandle);
phoneAccountColorCache.put(accountHandle, color);
return color;
}
@@ -121,7 +124,7 @@
if (phoneAccountCallWithNoteCache.containsKey(accountHandle)) {
return phoneAccountCallWithNoteCache.get(accountHandle);
} else {
- Boolean supportsCallWithNote =
+ boolean supportsCallWithNote =
PhoneAccountUtils.getAccountSupportsCallSubject(context, accountHandle);
phoneAccountCallWithNoteCache.put(accountHandle, supportsCallWithNote);
return supportsCallWithNote;
diff --git a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
index 0121eeb..f53bd5e 100644
--- a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
+++ b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
@@ -31,6 +31,7 @@
import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.phonenumbercache.ContactInfoHelper;
import com.android.dialer.util.ExpirableCache;
+
import java.lang.ref.WeakReference;
import java.util.Objects;
import java.util.concurrent.BlockingQueue;
diff --git a/java/com/android/dialer/app/contactinfo/ContactInfoRequest.java b/java/com/android/dialer/app/contactinfo/ContactInfoRequest.java
index 256c9c0..f575e87 100644
--- a/java/com/android/dialer/app/contactinfo/ContactInfoRequest.java
+++ b/java/com/android/dialer/app/contactinfo/ContactInfoRequest.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
import androidx.annotation.IntDef;
import com.android.dialer.phonenumbercache.ContactInfo;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
diff --git a/java/com/android/dialer/app/list/RemoveView.java b/java/com/android/dialer/app/list/RemoveView.java
index ba6fbe1..1420ead 100644
--- a/java/com/android/dialer/app/list/RemoveView.java
+++ b/java/com/android/dialer/app/list/RemoveView.java
@@ -27,6 +27,8 @@
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.core.content.res.ResourcesCompat;
+
import com.android.dialer.R;
public class RemoveView extends FrameLayout {
@@ -52,12 +54,12 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- removeText = (TextView) findViewById(R.id.remove_view_text);
- removeIcon = (ImageView) findViewById(R.id.remove_view_icon);
+ removeText = findViewById(R.id.remove_view_text);
+ removeIcon = findViewById(R.id.remove_view_icon);
final Resources r = getResources();
- unhighlightedColor = r.getColor(android.R.color.white);
- highlightedColor = r.getColor(R.color.remove_highlighted_text_color);
- removeDrawable = r.getDrawable(R.drawable.quantum_ic_clear_vd_theme_24,
+ unhighlightedColor = r.getColor(android.R.color.white, getContext().getTheme());
+ highlightedColor = r.getColor(R.color.remove_highlighted_text_color, getContext().getTheme());
+ removeDrawable = ResourcesCompat.getDrawable(r, R.drawable.quantum_ic_clear_vd_theme_24,
getContext().getTheme());
}
diff --git a/java/com/android/dialer/app/settings/DefaultRingtonePreference.java b/java/com/android/dialer/app/settings/DefaultRingtonePreference.java
index cbabb74..409eea3 100644
--- a/java/com/android/dialer/app/settings/DefaultRingtonePreference.java
+++ b/java/com/android/dialer/app/settings/DefaultRingtonePreference.java
@@ -23,16 +23,9 @@
import android.net.Uri;
import android.provider.Settings;
import android.util.AttributeSet;
-import android.util.Log;
import android.widget.Toast;
-import androidx.activity.result.ActivityResult;
-import androidx.activity.result.ActivityResultCallback;
-import androidx.activity.result.contract.ActivityResultContracts;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import androidx.preference.Preference;
-import androidx.preference.PreferenceFragmentCompat;
import com.android.dialer.R;
diff --git a/java/com/android/dialer/app/settings/DialerSettingsActivity.java b/java/com/android/dialer/app/settings/DialerSettingsActivity.java
index ec7d85e..b8d087e 100644
--- a/java/com/android/dialer/app/settings/DialerSettingsActivity.java
+++ b/java/com/android/dialer/app/settings/DialerSettingsActivity.java
@@ -241,8 +241,8 @@
bundle.putInt(PhoneAccountSelectionFragment.PARAM_TARGET_TITLE_RES,
R.string.voicemail_settings_label);
} else {
- LogUtil.i(
- "DialerSettingsActivity.addVoicemailSettings", "showing single-SIM voicemail settings");
+ LogUtil.i("DialerSettingsActivity.addVoicemailSettings",
+ "showing single-SIM voicemail settings");
voicemailSettings.setFragment(VoicemailSettingsFragment.class.getName());
bundle.putParcelable(VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE, soleAccount);
}
@@ -266,8 +266,8 @@
continue;
}
if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) {
- LogUtil.i(
- "DialerSettingsActivity.getSoleSimAccount", phoneAccountHandle + " is a SIM account");
+ LogUtil.i("DialerSettingsActivity.getSoleSimAccount",
+ phoneAccountHandle + " is a SIM account");
if (result != null) {
return null;
}
@@ -279,8 +279,8 @@
/**
* Returns {@code true} or {@code false} based on whether the display options setting should be
- * shown. For languages such as Chinese, Japanese, or Korean, display options aren't useful since
- * contacts are sorted and displayed family name first by default.
+ * shown. For languages such as Chinese, Japanese, or Korean, display options aren't useful
+ * since contacts are sorted and displayed family name first by default.
*
* @return {@code true} if the display options should be shown, {@code false} otherwise.
*/
diff --git a/java/com/android/dialer/app/settings/PhoneAccountSelectionFragment.java b/java/com/android/dialer/app/settings/PhoneAccountSelectionFragment.java
index 01073b3..fb15a6d 100644
--- a/java/com/android/dialer/app/settings/PhoneAccountSelectionFragment.java
+++ b/java/com/android/dialer/app/settings/PhoneAccountSelectionFragment.java
@@ -112,13 +112,14 @@
}
}
+ @SuppressLint("MissingPermission")
@Override
public void onResume() {
super.onResume();
- setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext()));
+ setPreferenceScreen(getPreferenceManager().createPreferenceScreen(requireContext()));
PreferenceScreen screen = getPreferenceScreen();
- TelecomManager telecomManager = getContext().getSystemService(TelecomManager.class);
+ TelecomManager telecomManager = requireContext().getSystemService(TelecomManager.class);
List<PhoneAccountHandle> accountHandles = telecomManager.getCallCapablePhoneAccounts();
diff --git a/java/com/android/dialer/app/voicemail/VoicemailAudioManager.java b/java/com/android/dialer/app/voicemail/VoicemailAudioManager.java
index 80117c8..7d6b551 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailAudioManager.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailAudioManager.java
@@ -18,11 +18,15 @@
package com.android.dialer.app.voicemail;
import android.content.Context;
+import android.media.AudioAttributes;
import android.media.AudioDeviceInfo;
+import android.media.AudioFocusRequest;
import android.media.AudioManager;
import android.media.AudioManager.OnAudioFocusChangeListener;
import android.telecom.CallAudioState;
+
import com.android.dialer.common.LogUtil;
+
import java.util.concurrent.RejectedExecutionException;
/** This class manages all audio changes for voicemail playback. */
@@ -40,6 +44,8 @@
private CallAudioState callAudioState;
private boolean bluetoothScoEnabled;
+ private AudioFocusRequest audioFocusRequest;
+
public VoicemailAudioManager(
Context context, VoicemailPlaybackPresenter voicemailPlaybackPresenter) {
audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
@@ -53,10 +59,15 @@
}
public void requestAudioFocus() {
- int result =
- audioManager.requestAudioFocus(
- this, PLAYBACK_STREAM, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
+ audioFocusRequest = new AudioFocusRequest.Builder(
+ AudioManager.AUDIOFOCUS_GAIN_TRANSIENT)
+ .setAudioAttributes(
+ new AudioAttributes.Builder().setLegacyStreamType(PLAYBACK_STREAM).build())
+ .setOnAudioFocusChangeListener(this)
+ .build();
+ int result = audioManager.requestAudioFocus(audioFocusRequest);
if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
+ audioFocusRequest = null;
throw new RejectedExecutionException("Could not capture audio focus.");
}
updateBluetoothScoState(true);
@@ -64,7 +75,10 @@
public void abandonAudioFocus() {
updateBluetoothScoState(false);
- audioManager.abandonAudioFocus(this);
+ if (audioFocusRequest != null) {
+ audioManager.abandonAudioFocusRequest(audioFocusRequest);
+ audioFocusRequest = null;
+ }
}
@Override
diff --git a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java
index 40d9e7b..a390ff6 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java
@@ -40,6 +40,7 @@
import com.android.dialer.voicemail.listui.error.VoicemailStatus;
import com.android.dialer.voicemail.listui.error.VoicemailStatusReader;
import com.android.voicemail.VoicemailComponent;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
index 506f547..a5f8efa 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
@@ -162,7 +162,7 @@
if (powerManager.isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) {
proximityWakeLock =
powerManager.newWakeLock(
- PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "VoicemailPlaybackPresenter");
+ PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "Voicemail:PlaybackPresenter");
}
}
@@ -862,6 +862,7 @@
// dialer/app/res/xml/file_paths.xml for correct cache directory name.
File parentDir = new File(context.getCacheDir(), "my_cache");
if (!parentDir.exists()) {
+ //noinspection ResultOfMethodCallIgnored
parentDir.mkdirs();
}
File temporaryVoicemailFile =
@@ -874,7 +875,7 @@
ByteStreams.copy(inputStream, outputStream);
return new Pair<>(
FileProvider.getUriForFile(
- context, Constants.get().getFileProviderAuthority(), temporaryVoicemailFile),
+ context, Constants.FILE_PROVIDER_AUTHORITY, temporaryVoicemailFile),
transcription);
}
} catch (IOException e) {
diff --git a/java/com/android/dialer/app/voicemail/WiredHeadsetManager.java b/java/com/android/dialer/app/voicemail/WiredHeadsetManager.java
index 3734d05..46a6ba1 100644
--- a/java/com/android/dialer/app/voicemail/WiredHeadsetManager.java
+++ b/java/com/android/dialer/app/voicemail/WiredHeadsetManager.java
@@ -21,6 +21,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
+
import com.android.dialer.common.LogUtil;
/** Listens for and caches headset state. */
diff --git a/java/com/android/dialer/app/widget/DialpadSearchEmptyContentView.java b/java/com/android/dialer/app/widget/DialpadSearchEmptyContentView.java
index 5846b1f..e348102 100644
--- a/java/com/android/dialer/app/widget/DialpadSearchEmptyContentView.java
+++ b/java/com/android/dialer/app/widget/DialpadSearchEmptyContentView.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Context;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
+
import com.android.dialer.app.R;
import com.android.dialer.util.OrientationUtil;
import com.android.dialer.widget.EmptyContentView;
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
index 8665b7d..5442e66 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import androidx.annotation.NonNull;
import com.android.dialer.common.LogUtil;
+
import java.util.Optional;
/**
@@ -33,8 +35,8 @@
private final LocationDetector locationDetector;
private final NumberTransformer numberTransformer;
- AssistedDialingMediatorImpl(
- @NonNull LocationDetector locationDetector, @NonNull NumberTransformer numberTransformer) {
+ AssistedDialingMediatorImpl(@NonNull LocationDetector locationDetector,
+ @NonNull NumberTransformer numberTransformer) {
if (locationDetector == null) {
throw new NullPointerException("locationDetector was null");
}
diff --git a/java/com/android/dialer/assisteddialing/Constraints.java b/java/com/android/dialer/assisteddialing/Constraints.java
index 6a24016..5b95517 100644
--- a/java/com/android/dialer/assisteddialing/Constraints.java
+++ b/java/com/android/dialer/assisteddialing/Constraints.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,6 @@
package com.android.dialer.assisteddialing;
import android.content.Context;
-import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import androidx.annotation.NonNull;
@@ -28,6 +28,7 @@
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
+
import java.util.Locale;
import java.util.Optional;
@@ -193,9 +194,7 @@
private boolean isNotEmergencyNumber(@NonNull String numberToCheck, @NonNull Context context) {
// isEmergencyNumber may depend on network state, so also use isLocalEmergencyNumber when
// roaming and out of service.
- boolean result =
- !PhoneNumberUtils.isEmergencyNumber(numberToCheck)
- && !PhoneNumberHelper.isLocalEmergencyNumber(context, numberToCheck);
+ boolean result = !PhoneNumberHelper.isEmergencyNumber(context, numberToCheck);
LogUtil.i("Constraints.isNotEmergencyNumber", String.valueOf(result));
return result;
}
diff --git a/java/com/android/dialer/assisteddialing/CountryCodeProvider.java b/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
index ffdbdd9..7099cd6 100644
--- a/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
+++ b/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,9 @@
package com.android.dialer.assisteddialing;
import android.util.ArraySet;
+
import com.android.dialer.common.LogUtil;
+
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
diff --git a/java/com/android/dialer/assisteddialing/LocationDetector.java b/java/com/android/dialer/assisteddialing/LocationDetector.java
index 11f5ae9..51dd182 100644
--- a/java/com/android/dialer/assisteddialing/LocationDetector.java
+++ b/java/com/android/dialer/assisteddialing/LocationDetector.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import androidx.annotation.Nullable;
import com.android.dialer.common.LogUtil;
+
import java.util.Locale;
import java.util.Optional;
diff --git a/java/com/android/dialer/assisteddialing/NumberTransformer.java b/java/com/android/dialer/assisteddialing/NumberTransformer.java
index f5b1bbd..26b25a5 100644
--- a/java/com/android/dialer/assisteddialing/NumberTransformer.java
+++ b/java/com/android/dialer/assisteddialing/NumberTransformer.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +18,12 @@
package com.android.dialer.assisteddialing;
import android.text.TextUtils;
+
import com.android.dialer.common.LogUtil;
import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+
import java.util.Optional;
/** Responsible for transforming numbers to make them dialable and valid when roaming. */
diff --git a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
index 9da71be..082936e 100644
--- a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
+++ b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
@@ -129,8 +129,8 @@
}
}
- countryChooserPref.setEntries(newKeys.toArray(new CharSequence[newKeys.size()]));
- countryChooserPref.setEntryValues(newValues.toArray(new CharSequence[newValues.size()]));
+ countryChooserPref.setEntries(newKeys.toArray(new CharSequence[0]));
+ countryChooserPref.setEntryValues(newValues.toArray(new CharSequence[0]));
if (!newValues.contains(countryChooserPref.getValue())) {
ameliorateInvalidSelectedValue(countryChooserPref);
diff --git a/java/com/android/dialer/binary/aosp/AospDialerApplication.java b/java/com/android/dialer/binary/aosp/AospDialerApplication.java
index 52366ce..8b2774e 100644
--- a/java/com/android/dialer/binary/aosp/AospDialerApplication.java
+++ b/java/com/android/dialer/binary/aosp/AospDialerApplication.java
@@ -31,7 +31,6 @@
import com.android.dialer.lookup.LookupProvider;
import com.android.dialer.lookup.LookupSettings;
import com.android.dialer.lookup.ReverseLookupService;
-import com.android.dialer.phonenumbercache.CachedNumberLookupService;
import com.android.dialer.phonenumbercache.PhoneNumberCacheBindings;
import com.android.dialer.phonenumbercache.PhoneNumberCacheBindingsFactory;
import com.android.incallui.bindings.InCallUiBindings;
diff --git a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java
index bc4fbd3..407afa2 100644
--- a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java
+++ b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,9 +34,11 @@
import com.android.dialer.storage.StorageModule;
import com.android.dialer.theme.base.impl.AospThemeModule;
import com.android.voicemail.impl.VoicemailModule;
-import dagger.Component;
+
import javax.inject.Singleton;
+import dagger.Component;
+
/** Root component for the AOSP Dialer application. */
@Singleton
@Component(
diff --git a/java/com/android/dialer/blocking/Blocking.java b/java/com/android/dialer/blocking/Blocking.java
index 212e395..34cd97d 100644
--- a/java/com/android/dialer/blocking/Blocking.java
+++ b/java/com/android/dialer/blocking/Blocking.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +37,7 @@
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.ListenableFuture;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
diff --git a/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java b/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java
index 8b1a62b..9c5dd36 100644
--- a/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java
+++ b/java/com/android/dialer/blockreportspam/ShowBlockReportSpamDialogReceiver.java
@@ -55,7 +55,7 @@
static final String ACTION_SHOW_DIALOG_TO_UNBLOCK_NUMBER = "show_dialog_to_unblock_number";
static final String EXTRA_DIALOG_INFO = "dialog_info";
- /** {@link FragmentManager} needed to show a {@link android.app.DialogFragment}. */
+ /** {@link FragmentManager} needed to show a {@link androidx.fragment.app.DialogFragment}. */
private final FragmentManager fragmentManager;
/** Returns an {@link IntentFilter} containing all actions accepted by this broadcast receiver. */
@@ -155,9 +155,7 @@
// Set up the positive listener for the dialog.
OnConfirmListener onConfirmListener =
- () -> {
- LogUtil.i("ShowBlockReportSpamDialogReceiver.showDialogToReportNotSpam", "confirmed");
- };
+ () -> LogUtil.i("ShowBlockReportSpamDialogReceiver.showDialogToReportNotSpam", "confirmed");
// Create & show the dialog.
DialogFragmentForReportingNotSpam.newInstance(
diff --git a/java/com/android/dialer/calldetails/CallDetailsActivityCommon.java b/java/com/android/dialer/calldetails/CallDetailsActivityCommon.java
index e8cd928..da5f9ff 100644
--- a/java/com/android/dialer/calldetails/CallDetailsActivityCommon.java
+++ b/java/com/android/dialer/calldetails/CallDetailsActivityCommon.java
@@ -195,12 +195,6 @@
return adapter;
}
- @Override
- @CallSuper
- public void onBackPressed() {
- super.onBackPressed();
- }
-
@MainThread
protected final void setCallDetailsEntries(CallDetailsEntries entries) {
Assert.isMainThread();
diff --git a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
index c7d58d1..d150be4 100644
--- a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
+++ b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
@@ -167,7 +167,7 @@
numberView.setVisibility(View.GONE);
numberView.setText(null);
- if (PhoneNumberHelper.isLocalEmergencyNumber(context, contact.getNumber())) {
+ if (PhoneNumberHelper.isEmergencyNumber(context, contact.getNumber())) {
nameView.setText(context.getResources().getString(R.string.emergency_number));
} else {
nameView.setText(contact.getNameOrNumber());
diff --git a/java/com/android/dialer/calldetails/OldCallDetailsActivity.java b/java/com/android/dialer/calldetails/OldCallDetailsActivity.java
index 0f53d69..8f5ade1 100644
--- a/java/com/android/dialer/calldetails/OldCallDetailsActivity.java
+++ b/java/com/android/dialer/calldetails/OldCallDetailsActivity.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.content.Intent;
+
import com.android.dialer.calldetails.CallDetailsEntryViewHolder.CallDetailsEntryListener;
import com.android.dialer.calldetails.CallDetailsFooterViewHolder.DeleteCallDetailsListener;
import com.android.dialer.calldetails.CallDetailsFooterViewHolder.ReportCallIdListener;
diff --git a/java/com/android/dialer/calllog/AnnotatedCallLogMigrator.java b/java/com/android/dialer/calllog/AnnotatedCallLogMigrator.java
index 71bfb75..5edf217 100644
--- a/java/com/android/dialer/calllog/AnnotatedCallLogMigrator.java
+++ b/java/com/android/dialer/calllog/AnnotatedCallLogMigrator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.dialer.calllog;
import android.content.SharedPreferences;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
import com.android.dialer.storage.Unencrypted;
@@ -24,6 +26,7 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/calllog/CallLogCacheUpdater.java b/java/com/android/dialer/calllog/CallLogCacheUpdater.java
index 42326e9..cdf52a9 100644
--- a/java/com/android/dialer/calllog/CallLogCacheUpdater.java
+++ b/java/com/android/dialer/calllog/CallLogCacheUpdater.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,7 @@
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+
import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.NumberAttributes;
import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog;
@@ -36,9 +38,11 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Stream;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/calllog/CallLogComponent.java b/java/com/android/dialer/calllog/CallLogComponent.java
index 4f147f1..824b4d6 100644
--- a/java/com/android/dialer/calllog/CallLogComponent.java
+++ b/java/com/android/dialer/calllog/CallLogComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +17,10 @@
package com.android.dialer.calllog;
import android.content.Context;
+
import com.android.dialer.calllog.notifier.RefreshAnnotatedCallLogNotifier;
import com.android.dialer.inject.HasRootComponent;
+
import dagger.Subcomponent;
/** Dagger component for the call log package. */
diff --git a/java/com/android/dialer/calllog/CallLogFramework.java b/java/com/android/dialer/calllog/CallLogFramework.java
index 7c7a015..d447eb1 100644
--- a/java/com/android/dialer/calllog/CallLogFramework.java
+++ b/java/com/android/dialer/calllog/CallLogFramework.java
@@ -17,13 +17,10 @@
package com.android.dialer.calllog;
-import android.content.Context;
-
import com.android.dialer.calllog.datasources.CallLogDataSource;
import com.android.dialer.calllog.datasources.DataSources;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.Ui;
-import com.android.dialer.inject.ApplicationContext;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
@@ -43,7 +40,6 @@
@Singleton
public final class CallLogFramework {
- private final Context appContext;
private final DataSources dataSources;
private final AnnotatedCallLogMigrator annotatedCallLogMigrator;
private final ListeningExecutorService uiExecutor;
@@ -51,12 +47,10 @@
@Inject
CallLogFramework(
- @ApplicationContext Context appContext,
DataSources dataSources,
AnnotatedCallLogMigrator annotatedCallLogMigrator,
@Ui ListeningExecutorService uiExecutor,
CallLogState callLogState) {
- this.appContext = appContext;
this.dataSources = dataSources;
this.annotatedCallLogMigrator = annotatedCallLogMigrator;
this.uiExecutor = uiExecutor;
diff --git a/java/com/android/dialer/calllog/CallLogModule.java b/java/com/android/dialer/calllog/CallLogModule.java
index 5657270..48a4c90 100644
--- a/java/com/android/dialer/calllog/CallLogModule.java
+++ b/java/com/android/dialer/calllog/CallLogModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import com.android.dialer.calllog.datasources.systemcalllog.SystemCallLogDataSource;
import com.android.dialer.calllog.datasources.voicemail.VoicemailDataSource;
import com.google.common.collect.ImmutableList;
+
import dagger.Module;
import dagger.Provides;
diff --git a/java/com/android/dialer/calllog/CallLogState.java b/java/com/android/dialer/calllog/CallLogState.java
index 7c3dff5..e1a1d36 100644
--- a/java/com/android/dialer/calllog/CallLogState.java
+++ b/java/com/android/dialer/calllog/CallLogState.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@
import com.android.dialer.storage.Unencrypted;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import javax.annotation.concurrent.ThreadSafe;
import javax.inject.Inject;
diff --git a/java/com/android/dialer/calllog/RefreshAnnotatedCallLogWorker.java b/java/com/android/dialer/calllog/RefreshAnnotatedCallLogWorker.java
index 7d6a000..8031bc7 100644
--- a/java/com/android/dialer/calllog/RefreshAnnotatedCallLogWorker.java
+++ b/java/com/android/dialer/calllog/RefreshAnnotatedCallLogWorker.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.content.SharedPreferences;
+
import com.android.dialer.calllog.constants.SharedPrefKeys;
import com.android.dialer.calllog.database.MutationApplier;
import com.android.dialer.calllog.datasources.CallLogDataSource;
@@ -39,8 +41,10 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+
import java.util.ArrayList;
import java.util.List;
+
import javax.inject.Inject;
import javax.inject.Singleton;
diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogConstraints.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogConstraints.java
index cb34bb3..1e2a5e4 100644
--- a/java/com/android/dialer/calllog/database/AnnotatedCallLogConstraints.java
+++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogConstraints.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog;
import com.android.dialer.common.Assert;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.function.Predicate;
diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java
index 8af7876..1b2836b 100644
--- a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java
+++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +37,7 @@
import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java
index 27b58e7..4ae1dd9 100644
--- a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java
+++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,13 +21,16 @@
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.CallLog.Calls;
+
import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
import com.android.dialer.inject.ApplicationContext;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.util.Locale;
+
import javax.inject.Inject;
import javax.inject.Singleton;
diff --git a/java/com/android/dialer/calllog/database/CallLogDatabaseComponent.java b/java/com/android/dialer/calllog/database/CallLogDatabaseComponent.java
index dc16ba4..b971e80 100644
--- a/java/com/android/dialer/calllog/database/CallLogDatabaseComponent.java
+++ b/java/com/android/dialer/calllog/database/CallLogDatabaseComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +17,9 @@
package com.android.dialer.calllog.database;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
+
import dagger.Subcomponent;
/** Dagger component for database package. */
diff --git a/java/com/android/dialer/calllog/database/MutationApplier.java b/java/com/android/dialer/calllog/database/MutationApplier.java
index b5e3c4e..c6f7aaa 100644
--- a/java/com/android/dialer/calllog/database/MutationApplier.java
+++ b/java/com/android/dialer/calllog/database/MutationApplier.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,10 +36,12 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
+
import javax.inject.Inject;
/** Applies {@link CallLogMutations} to the annotated call log. */
diff --git a/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java b/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java
index b6e4bba..2639ac5 100644
--- a/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java
+++ b/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,13 +18,13 @@
package com.android.dialer.calllog.database.contract;
import android.net.Uri;
-import android.os.Build;
import android.provider.BaseColumns;
+
import com.android.dialer.constants.Constants;
/** Contract for the AnnotatedCallLog content provider. */
public class AnnotatedCallLogContract {
- public static final String AUTHORITY = Constants.get().getAnnotatedCallLogProviderAuthority();
+ public static final String AUTHORITY = Constants.ANNOTATED_CALL_LOG_PROVIDER_AUTHORITY;
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
diff --git a/java/com/android/dialer/calllog/datasources/CallLogMutations.java b/java/com/android/dialer/calllog/datasources/CallLogMutations.java
index 148601d..62e4f18 100644
--- a/java/com/android/dialer/calllog/datasources/CallLogMutations.java
+++ b/java/com/android/dialer/calllog/datasources/CallLogMutations.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.ContentValues;
import android.util.ArrayMap;
import android.util.ArraySet;
+
import com.android.dialer.common.Assert;
/** A collection of mutations to the annotated call log. */
diff --git a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java
index ec1b981..cdf14fd 100644
--- a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java
+++ b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,12 +54,14 @@
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.InvalidProtocolBufferException;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.Callable;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
index 7994ddf..fa2f9df 100644
--- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
+++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,10 +51,11 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
-import java.util.ArrayList;
+
import java.util.Arrays;
import java.util.List;
import java.util.Set;
+
import javax.inject.Inject;
import javax.inject.Singleton;
diff --git a/java/com/android/dialer/calllog/datasources/voicemail/VoicemailDataSource.java b/java/com/android/dialer/calllog/datasources/voicemail/VoicemailDataSource.java
index 8d9cae2..0831550 100644
--- a/java/com/android/dialer/calllog/datasources/voicemail/VoicemailDataSource.java
+++ b/java/com/android/dialer/calllog/datasources/voicemail/VoicemailDataSource.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.TelephonyManager;
+
import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog;
import com.android.dialer.calllog.datasources.CallLogDataSource;
@@ -34,7 +36,9 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.protobuf.InvalidProtocolBufferException;
+
import java.util.Map.Entry;
+
import javax.inject.Inject;
/** Provide information for whether the call is a call to the voicemail inbox. */
diff --git a/java/com/android/dialer/calllog/observer/MarkDirtyObserver.java b/java/com/android/dialer/calllog/observer/MarkDirtyObserver.java
index 93ae96e..209e3ce 100644
--- a/java/com/android/dialer/calllog/observer/MarkDirtyObserver.java
+++ b/java/com/android/dialer/calllog/observer/MarkDirtyObserver.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.ThreadUtil;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/calllog/ui/CallLogUiComponent.java b/java/com/android/dialer/calllog/ui/CallLogUiComponent.java
index a8e3b22..a9dbb9a 100644
--- a/java/com/android/dialer/calllog/ui/CallLogUiComponent.java
+++ b/java/com/android/dialer/calllog/ui/CallLogUiComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +17,9 @@
package com.android.dialer.calllog.ui;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
+
import dagger.Subcomponent;
/** Dagger component for the call log UI package. */
diff --git a/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java b/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java
index a28f525..4093f5b 100644
--- a/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java
+++ b/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,11 +42,13 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java
index 6d0b795..5eb3dac 100644
--- a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java
+++ b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.dialer.calllog.ui.menu;
import android.content.Context;
+
import com.android.dialer.calllog.model.CoalescedRow;
import com.android.dialer.calllogutils.CallLogEntryText;
import com.android.dialer.calllogutils.PhotoInfoBuilder;
diff --git a/java/com/android/dialer/calllog/ui/menu/DeleteCallLogItemModule.java b/java/com/android/dialer/calllog/ui/menu/DeleteCallLogItemModule.java
index e90a2dc..986a751 100644
--- a/java/com/android/dialer/calllog/ui/menu/DeleteCallLogItemModule.java
+++ b/java/com/android/dialer/calllog/ui/menu/DeleteCallLogItemModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +33,7 @@
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.common.database.Selection;
import com.android.dialer.historyitemactions.HistoryItemActionModule;
+
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/dialer/calllog/ui/menu/Modules.java b/java/com/android/dialer/calllog/ui/menu/Modules.java
index 6e47841..37c8aaf 100644
--- a/java/com/android/dialer/calllog/ui/menu/Modules.java
+++ b/java/com/android/dialer/calllog/ui/menu/Modules.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +31,7 @@
import com.android.dialer.historyitemactions.HistoryItemActionModulesBuilder;
import com.android.dialer.historyitemactions.IntentModule;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
+
import java.util.List;
/**
diff --git a/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java b/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java
index 3869e78..dc35508 100644
--- a/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java
+++ b/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Context;
import android.provider.CallLog.Calls;
import android.view.View;
+
import com.android.dialer.calllog.CallLogComponent;
import com.android.dialer.calllog.model.CoalescedRow;
import com.android.dialer.common.concurrent.DefaultFutureCallback;
diff --git a/java/com/android/dialer/calllogutils/CallLogDates.java b/java/com/android/dialer/calllogutils/CallLogDates.java
index 9c04c05..8e33c4b 100644
--- a/java/com/android/dialer/calllogutils/CallLogDates.java
+++ b/java/com/android/dialer/calllogutils/CallLogDates.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.icu.lang.UCharacter;
import android.icu.text.BreakIterator;
import android.text.format.DateUtils;
+
import java.util.Calendar;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
diff --git a/java/com/android/dialer/calllogutils/CallLogDurations.java b/java/com/android/dialer/calllogutils/CallLogDurations.java
index 9ed8a93..d3e4646 100644
--- a/java/com/android/dialer/calllogutils/CallLogDurations.java
+++ b/java/com/android/dialer/calllogutils/CallLogDurations.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +20,9 @@
import android.content.Context;
import android.content.res.Resources;
import android.text.format.Formatter;
+
import com.android.dialer.util.DialerUtils;
+
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
diff --git a/java/com/android/dialer/calllogutils/CallLogEntryText.java b/java/com/android/dialer/calllogutils/CallLogEntryText.java
index c21237f..15d6538 100644
--- a/java/com/android/dialer/calllogutils/CallLogEntryText.java
+++ b/java/com/android/dialer/calllogutils/CallLogEntryText.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,8 +27,8 @@
import com.android.dialer.spam.Spam;
import com.google.common.base.Optional;
import com.google.common.collect.Collections2;
+
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
/**
diff --git a/java/com/android/dialer/calllogutils/CallLogRowActions.java b/java/com/android/dialer/calllogutils/CallLogRowActions.java
index d23a15f..10b6164 100644
--- a/java/com/android/dialer/calllogutils/CallLogRowActions.java
+++ b/java/com/android/dialer/calllogutils/CallLogRowActions.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
import android.app.Activity;
import android.provider.CallLog.Calls;
+
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.calllog.model.CoalescedRow;
diff --git a/java/com/android/dialer/calllogutils/CallTypeIconsView.java b/java/com/android/dialer/calllogutils/CallTypeIconsView.java
index c4a73c4..51bbcf8 100644
--- a/java/com/android/dialer/calllogutils/CallTypeIconsView.java
+++ b/java/com/android/dialer/calllogutils/CallTypeIconsView.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,13 +22,22 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.provider.CallLog.Calls;
import android.util.AttributeSet;
import android.view.View;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.content.res.ResourcesCompat;
+
+import com.android.dialer.R;
import com.android.dialer.theme.base.Theme;
import com.android.dialer.theme.base.ThemeComponent;
+
import java.util.ArrayList;
import java.util.List;
@@ -44,7 +54,7 @@
private final boolean useLargeIcons;
private static Resources resources;
- private static Resources largeResouces;
+ private static Resources largeResources;
private final List<Integer> callTypes = new ArrayList<>(3);
private boolean showVideo;
private boolean showHd;
@@ -67,8 +77,8 @@
if (resources == null) {
resources = new Resources(context, false);
}
- if (largeResouces == null && useLargeIcons) {
- largeResouces = new Resources(context, true);
+ if (largeResources == null && useLargeIcons) {
+ largeResources = new Resources(context, true);
}
}
@@ -152,19 +162,18 @@
}
private Drawable getCallTypeDrawable(int callType) {
- Resources resources = useLargeIcons ? largeResouces : CallTypeIconsView.resources;
+ Resources resources = useLargeIcons ? largeResources : CallTypeIconsView.resources;
switch (callType) {
case Calls.INCOMING_TYPE:
case Calls.ANSWERED_EXTERNALLY_TYPE:
return resources.incoming;
case Calls.OUTGOING_TYPE:
return resources.outgoing;
- case Calls.MISSED_TYPE:
- return resources.missed;
case Calls.VOICEMAIL_TYPE:
return resources.voicemail;
case Calls.BLOCKED_TYPE:
return resources.blocked;
+ case Calls.MISSED_TYPE:
default:
// It is possible for users to end up with calls with unknown call types in their
// call history, possibly due to 3rd party call log implementations (e.g. to
@@ -181,7 +190,7 @@
@Override
protected void onDraw(Canvas canvas) {
- Resources resources = useLargeIcons ? largeResouces : CallTypeIconsView.resources;
+ Resources resources = useLargeIcons ? largeResources : CallTypeIconsView.resources;
int left = 0;
// If we are using large icons, we should only show one icon (video, hd or call type) with
// priority give to HD or Video. So we skip the call type icon if we plan to show them.
@@ -230,7 +239,7 @@
// Drawable representing an incoming answered call.
public final Drawable incoming;
- // Drawable respresenting an outgoing call.
+ // Drawable representing an outgoing call.
public final Drawable outgoing;
// Drawable representing an incoming missed call.
@@ -242,10 +251,10 @@
// Drawable representing a blocked call.
public final Drawable blocked;
- // Drawable repesenting a video call.
+ // Drawable representing a video call.
final Drawable videoCall;
- // Drawable represeting a hd call.
+ // Drawable representing a hd call.
final Drawable hdCall;
// Drawable representing a WiFi call.
@@ -272,76 +281,59 @@
*/
public Resources(Context context, boolean largeIcons) {
final android.content.res.Resources r = context.getResources();
+ android.content.res.Resources.Theme contextTheme = context.getTheme();
- int iconId = R.drawable.quantum_ic_call_received_vd_theme_24;
- Drawable drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- incoming = drawable.mutate();
- incoming.setColorFilter(r.getColor(R.color.answered_incoming_call),
- PorterDuff.Mode.MULTIPLY);
+ incoming = getBitmap(context, R.drawable.quantum_ic_call_received_vd_theme_24,
+ r.getColor(R.color.answered_incoming_call, contextTheme), largeIcons);
// Create a rotated instance of the call arrow for outgoing calls.
- iconId = R.drawable.quantum_ic_call_made_vd_theme_24;
- drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- outgoing = drawable.mutate();
- outgoing.setColorFilter(r.getColor(R.color.answered_outgoing_call),
- PorterDuff.Mode.MULTIPLY);
+ outgoing = getBitmap(context, R.drawable.quantum_ic_call_made_vd_theme_24,
+ r.getColor(R.color.answered_outgoing_call, contextTheme), largeIcons);
// Need to make a copy of the arrow drawable, otherwise the same instance colored
// above will be recolored here.
- iconId = R.drawable.quantum_ic_call_missed_vd_theme_24;
- drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- missed = drawable.mutate();
- missed.setColorFilter(r.getColor(R.color.dialer_red), PorterDuff.Mode.MULTIPLY);
+ missed = getBitmap(context, R.drawable.quantum_ic_call_missed_vd_theme_24,
+ r.getColor(R.color.dialer_red, contextTheme), largeIcons);
Theme theme = ThemeComponent.get(context).theme();
- iconId = R.drawable.quantum_ic_voicemail_vd_theme_24;
- drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- voicemail = drawable.mutate();
- voicemail.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY);
+ int iconColor = theme.getColorIcon();
- iconId = R.drawable.quantum_ic_block_vd_theme_24;
- drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- blocked = drawable.mutate();
- blocked.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY);
-
- iconId = R.drawable.quantum_ic_videocam_vd_white_24;
- drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- videoCall = drawable.mutate();
- videoCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY);
-
- iconId = R.drawable.quantum_ic_hd_vd_theme_24;
- drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- hdCall = drawable.mutate();
- hdCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY);
-
- iconId = R.drawable.quantum_ic_signal_wifi_4_bar_vd_theme_24;
- drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- wifiCall = drawable.mutate();
- wifiCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY);
-
- iconId = R.drawable.quantum_ic_language_vd_theme_24;
- drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId);
- assistedDialedCall = drawable.mutate();
- assistedDialedCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY);
-
- iconId = R.drawable.quantum_ic_rtt_vd_theme_24;
- drawable = largeIcons ? r.getDrawable(iconId, null) : getScaledBitmap(context, iconId);
- rttCall = drawable.mutate();
- rttCall.setColorFilter(theme.getColorIcon(), PorterDuff.Mode.MULTIPLY);
+ voicemail = getBitmap(context, R.drawable.quantum_ic_voicemail_vd_theme_24, iconColor,
+ largeIcons);
+ blocked = getBitmap(context, R.drawable.quantum_ic_block_vd_theme_24, iconColor,
+ largeIcons);
+ videoCall = getBitmap(context, R.drawable.quantum_ic_videocam_vd_white_24, iconColor,
+ largeIcons);
+ hdCall = getBitmap(context, R.drawable.quantum_ic_hd_vd_theme_24, iconColor,
+ largeIcons);
+ wifiCall = getBitmap(context, R.drawable.quantum_ic_signal_wifi_4_bar_vd_theme_24,
+ iconColor, largeIcons);
+ assistedDialedCall = getBitmap(context, R.drawable.quantum_ic_language_vd_theme_24,
+ iconColor, largeIcons);
+ rttCall = getBitmap(context, R.drawable.quantum_ic_rtt_vd_theme_24, iconColor,
+ largeIcons);
iconMargin = largeIcons ? 0 : r.getDimensionPixelSize(R.dimen.call_log_icon_margin);
}
+ private Drawable getBitmap(Context context, @DrawableRes int iconId, @ColorInt int color,
+ boolean largeIcons) {
+ final android.content.res.Resources r = context.getResources();
+ Drawable drawable = largeIcons
+ ? ResourcesCompat.getDrawable(r, iconId, context.getTheme())
+ : getScaledBitmap(context, iconId);
+ drawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
+ return drawable;
+ }
+
// Gets the icon, scaled to the height of the call type icons. This helps display all the
// icons to be the same height, while preserving their width aspect ratio.
private Drawable getScaledBitmap(Context context, int resourceId) {
- Drawable drawable = context.getDrawable(resourceId);
+ Drawable drawable = AppCompatResources.getDrawable(context, resourceId);
int scaledHeight = context.getResources().getDimensionPixelSize(R.dimen.call_type_icon_size);
- int scaledWidth =
- (int)
- ((float) drawable.getIntrinsicWidth()
- * ((float) scaledHeight / (float) drawable.getIntrinsicHeight()));
+ int scaledWidth = (int) ((float) drawable.getIntrinsicWidth()
+ * ((float) scaledHeight / (float) drawable.getIntrinsicHeight()));
Bitmap icon = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(icon);
diff --git a/java/com/android/dialer/calllogutils/FilterSpinnerHelper.java b/java/com/android/dialer/calllogutils/FilterSpinnerHelper.java
index 32bd184..831b64b 100644
--- a/java/com/android/dialer/calllogutils/FilterSpinnerHelper.java
+++ b/java/com/android/dialer/calllogutils/FilterSpinnerHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 The CyanogenMod Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,12 +16,12 @@
*/
package com.android.dialer.calllogutils;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.provider.CallLog;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.text.TextUtils;
-import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@@ -28,8 +29,8 @@
import com.android.dialer.R;
import com.android.dialer.util.PermissionsUtil;
+
import java.util.ArrayList;
-import java.util.List;
public class FilterSpinnerHelper implements AdapterView.OnItemSelectedListener {
private static final String TAG = FilterSpinnerHelper.class.getSimpleName();
@@ -82,6 +83,7 @@
return spinner;
}
+ @SuppressLint("MissingPermission")
private ArrayAdapter<AccountItem> createAccountAdapter(Context context) {
ArrayList<AccountItem> items = new ArrayList<>();
items.add(new AccountItem(null, context.getString(R.string.call_log_show_all_accounts)));
@@ -95,7 +97,7 @@
}
}
- return new ArrayAdapter<AccountItem>(context, R.layout.call_log_filter_spinner_item, items);
+ return new ArrayAdapter<>(context, R.layout.call_log_filter_spinner_item, items);
}
private ArrayAdapter<TypeItem> createTypeAdapter(Context context, boolean includeVoicemail) {
@@ -114,10 +116,10 @@
context.getString(R.string.call_log_voicemail_header)));
}
- return new ArrayAdapter<TypeItem>(context, R.layout.call_log_filter_spinner_item, items);
+ return new ArrayAdapter<>(context, R.layout.call_log_filter_spinner_item, items);
}
- private final class AccountItem {
+ private static final class AccountItem {
public final PhoneAccountHandle account;
public final String label;
@@ -132,7 +134,7 @@
}
}
- private final class TypeItem {
+ private static final class TypeItem {
public final int value;
public final String label;
diff --git a/java/com/android/dialer/calllogutils/NumberAttributesBuilder.java b/java/com/android/dialer/calllogutils/NumberAttributesBuilder.java
index 015d59f..66c424c 100644
--- a/java/com/android/dialer/calllogutils/NumberAttributesBuilder.java
+++ b/java/com/android/dialer/calllogutils/NumberAttributesBuilder.java
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2018 The Android Open Source Project
- *
+ * Copyright (C) 2023 The LineageOS 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
@@ -17,6 +18,7 @@
package com.android.dialer.calllogutils;
import android.text.TextUtils;
+
import com.android.dialer.NumberAttributes;
import com.android.dialer.phonelookup.PhoneLookupInfo;
import com.android.dialer.phonelookup.consolidator.PhoneLookupInfoConsolidator;
diff --git a/java/com/android/dialer/calllogutils/PhoneNumberDisplayUtil.java b/java/com/android/dialer/calllogutils/PhoneNumberDisplayUtil.java
index 6509af3..c76aac1 100644
--- a/java/com/android/dialer/calllogutils/PhoneNumberDisplayUtil.java
+++ b/java/com/android/dialer/calllogutils/PhoneNumberDisplayUtil.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
+
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.google.common.base.Optional;
diff --git a/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java b/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java
index 16fb9ac..119e681 100644
--- a/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java
+++ b/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.provider.CallLog.Calls;
+
import com.android.dialer.NumberAttributes;
import com.android.dialer.calllog.model.CoalescedRow;
import com.android.dialer.glidephotomanager.PhotoInfo;
diff --git a/java/com/android/dialer/callrecord/CallRecording.java b/java/com/android/dialer/callrecord/CallRecording.java
index 8d9ec0f..76b66e8 100644
--- a/java/com/android/dialer/callrecord/CallRecording.java
+++ b/java/com/android/dialer/callrecord/CallRecording.java
@@ -18,15 +18,12 @@
package com.android.dialer.callrecord;
import android.content.ContentValues;
-import android.os.Environment;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.webkit.MimeTypeMap;
-import java.io.File;
-
public final class CallRecording implements Parcelable {
public final String phoneNumber;
public final long creationTime;
diff --git a/java/com/android/dialer/callrecord/CallRecordingDataStore.java b/java/com/android/dialer/callrecord/CallRecordingDataStore.java
index 0a24c34..1babb85 100644
--- a/java/com/android/dialer/callrecord/CallRecordingDataStore.java
+++ b/java/com/android/dialer/callrecord/CallRecordingDataStore.java
@@ -103,7 +103,7 @@
* @return list of recordings
*/
public List<CallRecording> getRecordings(String phoneNumber, long callCreationDate) {
- List<CallRecording> resultList = new ArrayList<CallRecording>();
+ List<CallRecording> resultList = new ArrayList<>();
final String query = "SELECT " +
CallRecordingsContract.CallRecording.COLUMN_NAME_RECORDING_FILENAME + "," +
@@ -115,7 +115,7 @@
" AND " + CallRecordingsContract.CallRecording.COLUMN_NAME_MEDIA_ID + " != 0" +
" ORDER BY " + CallRecordingsContract.CallRecording.COLUMN_NAME_CREATION_DATE;
- String args[] = {
+ String[] args = {
phoneNumber, String.valueOf(callCreationDate)
};
diff --git a/java/com/android/dialer/callrecord/impl/CallRecorderService.java b/java/com/android/dialer/callrecord/impl/CallRecorderService.java
index 9940956..ac90d02 100644
--- a/java/com/android/dialer/callrecord/impl/CallRecorderService.java
+++ b/java/com/android/dialer/callrecord/impl/CallRecorderService.java
@@ -30,19 +30,16 @@
import android.os.RemoteException;
import android.provider.MediaStore;
import android.text.TextUtils;
-import android.provider.Settings;
import android.util.Log;
+import com.android.dialer.R;
import com.android.dialer.callrecord.CallRecording;
import com.android.dialer.callrecord.ICallRecorderService;
-import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
-import com.android.dialer.R;
-
public class CallRecorderService extends Service {
private static final String TAG = "CallRecorderService";
private static final boolean DBG = false;
diff --git a/java/com/android/dialer/callstats/CallStatsAdapter.java b/java/com/android/dialer/callstats/CallStatsAdapter.java
index 2f18a8c..7030860 100644
--- a/java/com/android/dialer/callstats/CallStatsAdapter.java
+++ b/java/com/android/dialer/callstats/CallStatsAdapter.java
@@ -44,7 +44,6 @@
import com.android.dialer.util.PermissionsUtil;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -130,8 +129,8 @@
final String currentCountryIso = GeoUtil.getCurrentCountryIso(mContext);
mContactInfoHelper = new ContactInfoHelper(mContext, currentCountryIso);
- mAllItems = new ArrayList<CallStatsDetails>();
- mShownItems = new ArrayList<CallStatsDetails>();
+ mAllItems = new ArrayList<>();
+ mShownItems = new ArrayList<>();
mTotalItem = new CallStatsDetails(null, 0, null, null, null, null, null, 0);
mInfoLookup = new ConcurrentHashMap<>();
@@ -171,7 +170,7 @@
}
}
- Collections.sort(mShownItems, sortByDuration ? mDurationComparator : mCountComparator);
+ mShownItems.sort(sortByDuration ? mDurationComparator : mCountComparator);
notifyDataSetChanged();
}
diff --git a/java/com/android/dialer/callstats/CallStatsDetailActivity.java b/java/com/android/dialer/callstats/CallStatsDetailActivity.java
index 5d18de8..db32c70 100644
--- a/java/com/android/dialer/callstats/CallStatsDetailActivity.java
+++ b/java/com/android/dialer/callstats/CallStatsDetailActivity.java
@@ -171,7 +171,7 @@
mTotalData = launchIntent.getParcelableExtra(EXTRA_TOTAL, CallStatsDetails.class);
updateData();
- TextView dateFilterView = (TextView) findViewById(R.id.date_filter);
+ TextView dateFilterView = findViewById(R.id.date_filter);
long filterFrom = launchIntent.getLongExtra(EXTRA_FROM, -1);
if (filterFrom == -1) {
dateFilterView.setVisibility(View.GONE);
@@ -184,11 +184,11 @@
@Override
public void onResume() {
super.onResume();
- new UpdateContactTask().execute(mData.number.toString(), mData.countryIso);
+ new UpdateContactTask().execute(mData.number, mData.countryIso);
}
private void updateData() {
- mNumber = mData.number.toString();
+ mNumber = mData.number;
// Cache the details about the phone number.
boolean canPlaceCallsTo = PhoneNumberHelper.canPlaceCallsTo(mNumber, mData.numberPresentation);
diff --git a/java/com/android/dialer/callstats/CallStatsDetails.java b/java/com/android/dialer/callstats/CallStatsDetails.java
index cfa6dfa..740284e 100644
--- a/java/com/android/dialer/callstats/CallStatsDetails.java
+++ b/java/com/android/dialer/callstats/CallStatsDetails.java
@@ -247,8 +247,8 @@
name = in.readString();
numberType = in.readInt();
numberLabel = in.readString();
- contactUri = in.readParcelable(null);
- photoUri = in.readParcelable(null);
+ contactUri = in.readParcelable(null, Uri.class);
+ photoUri = in.readParcelable(null, Uri.class);
photoId = in.readLong();
inDuration = in.readLong();
outDuration = in.readLong();
diff --git a/java/com/android/dialer/callstats/CallStatsFragment.java b/java/com/android/dialer/callstats/CallStatsFragment.java
index 2941b0f..b84cd3d 100644
--- a/java/com/android/dialer/callstats/CallStatsFragment.java
+++ b/java/com/android/dialer/callstats/CallStatsFragment.java
@@ -70,10 +70,8 @@
private RecyclerView mRecyclerView;
private EmptyContentView mEmptyListView;
- private LinearLayoutManager mLayoutManager;
private CallStatsAdapter mAdapter;
private CallStatsQueryHandler mCallStatsQueryHandler;
- private FilterSpinnerHelper mFilterHelper;
private TextView mSumHeaderView;
private TextView mDateFilterView;
@@ -103,7 +101,7 @@
public void onCreate(Bundle state) {
super.onCreate(state);
- final ContentResolver cr = getActivity().getContentResolver();
+ final ContentResolver cr = requireActivity().getContentResolver();
mCallStatsQueryHandler = new CallStatsQueryHandler(cr, this);
cr.registerContentObserver(CallLog.CONTENT_URI, true, mObserver);
cr.registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, mObserver);
@@ -113,7 +111,7 @@
ExpirableCacheHeadlessFragment cacheFragment =
ExpirableCacheHeadlessFragment.attach((AppCompatActivity) getActivity());
mAdapter = new CallStatsAdapter(getActivity(),
- ContactsComponent.get(getActivity()).contactDisplayPreferences(),
+ ContactsComponent.get(requireActivity()).contactDisplayPreferences(),
cacheFragment.getRetainedCache());
}
@@ -121,16 +119,16 @@
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
View view = inflater.inflate(R.layout.call_stats_fragment, container, false);
- mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
+ mRecyclerView = view.findViewById(R.id.recycler_view);
mRecyclerView.setHasFixedSize(true);
- mLayoutManager = new LinearLayoutManager(getActivity());
- mRecyclerView.setLayoutManager(mLayoutManager);
- mEmptyListView = (EmptyContentView) view.findViewById(R.id.empty_list_view);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
+ mRecyclerView.setLayoutManager(layoutManager);
+ mEmptyListView = view.findViewById(R.id.empty_list_view);
mEmptyListView.setImage(R.drawable.empty_call_log);
mEmptyListView.setActionClickedListener(this);
- mSumHeaderView = (TextView) view.findViewById(R.id.sum_header);
- mDateFilterView = (TextView) view.findViewById(R.id.date_filter);
+ mSumHeaderView = view.findViewById(R.id.sum_header);
+ mDateFilterView = view.findViewById(R.id.date_filter);
return view;
}
@@ -139,7 +137,6 @@
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView.setAdapter(mAdapter);
- mFilterHelper = new FilterSpinnerHelper(view, false, this);
updateEmptyVisibilityAndMessage();
}
@@ -163,30 +160,22 @@
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final int itemId = item.getItemId();
- switch (itemId) {
- case R.id.date_filter: {
- final DoubleDatePickerDialog.Fragment fragment =
- new DoubleDatePickerDialog.Fragment();
- fragment.setArguments(
- DoubleDatePickerDialog.Fragment.createArguments(mFilterFrom, mFilterTo));
- fragment.show(getParentFragmentManager(), "filter");
- break;
- }
- case R.id.reset_date_filter: {
- mFilterFrom = -1;
- mFilterTo = -1;
- fetchCalls();
- updateEmptyVisibilityAndMessage();
- getActivity().invalidateOptionsMenu();
- break;
- }
- case R.id.sort_by_duration:
- case R.id.sort_by_count: {
- mSortByDuration = itemId == R.id.sort_by_duration;
- mAdapter.updateDisplayedData(mCallTypeFilter, mSortByDuration);
- getActivity().invalidateOptionsMenu();
- break;
- }
+ if (itemId == R.id.date_filter) {
+ final DoubleDatePickerDialog.Fragment fragment =
+ new DoubleDatePickerDialog.Fragment();
+ fragment.setArguments(
+ DoubleDatePickerDialog.Fragment.createArguments(mFilterFrom, mFilterTo));
+ fragment.show(getParentFragmentManager(), "filter");
+ } else if (itemId == R.id.reset_date_filter) {
+ mFilterFrom = -1;
+ mFilterTo = -1;
+ fetchCalls();
+ updateEmptyVisibilityAndMessage();
+ requireActivity().invalidateOptionsMenu();
+ } else if (itemId == R.id.sort_by_duration || itemId == R.id.sort_by_count) {
+ mSortByDuration = itemId == R.id.sort_by_duration;
+ mAdapter.updateDisplayedData(mCallTypeFilter, mSortByDuration);
+ requireActivity().invalidateOptionsMenu();
}
return true;
}
@@ -218,7 +207,7 @@
public void onDateSet(long from, long to) {
mFilterFrom = from;
mFilterTo = to;
- getActivity().invalidateOptionsMenu();
+ requireActivity().invalidateOptionsMenu();
fetchCalls();
updateEmptyVisibilityAndMessage();
}
diff --git a/java/com/android/dialer/callstats/CallStatsListItemViewHolder.java b/java/com/android/dialer/callstats/CallStatsListItemViewHolder.java
index c861523..01d214a 100644
--- a/java/com/android/dialer/callstats/CallStatsListItemViewHolder.java
+++ b/java/com/android/dialer/callstats/CallStatsListItemViewHolder.java
@@ -18,8 +18,8 @@
package com.android.dialer.callstats;
import android.content.Context;
-import android.content.res.Resources;
import android.content.Intent;
+import android.content.res.Resources;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.text.TextUtils;
@@ -87,20 +87,18 @@
quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
mContext = rootView.getContext();
- mPhotoSize = mContext.getResources().getDimensionPixelSize(R.dimen.contact_photo_size);
mContactInfoHelper = contactInfoHelper;
}
- public static CallStatsListItemViewHolder create(View view,
- ContactInfoHelper contactInfoHelper) {
+ public static CallStatsListItemViewHolder create(View view, ContactInfoHelper contactInfoHelper) {
return new CallStatsListItemViewHolder(view,
- (QuickContactBadge) view.findViewById(R.id.quick_contact_photo),
+ view.findViewById(R.id.quick_contact_photo),
view.findViewById(R.id.primary_action_view),
- (TextView) view.findViewById(R.id.name),
- (TextView) view.findViewById(R.id.number),
- (TextView) view.findViewById(R.id.label),
- (TextView) view.findViewById(R.id.percent),
- (LinearColorBar) view.findViewById(R.id.percent_bar),
+ view.findViewById(R.id.name),
+ view.findViewById(R.id.number),
+ view.findViewById(R.id.label),
+ view.findViewById(R.id.percent),
+ view.findViewById(R.id.percent_bar),
contactInfoHelper);
}
diff --git a/java/com/android/dialer/callstats/CallStatsQueryHandler.java b/java/com/android/dialer/callstats/CallStatsQueryHandler.java
index 3c93be0..32f7397 100644
--- a/java/com/android/dialer/callstats/CallStatsQueryHandler.java
+++ b/java/com/android/dialer/callstats/CallStatsQueryHandler.java
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2011 The Android Open Source Project
* Copyright (C) 2013 Android Open Kang Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,8 +23,8 @@
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabaseCorruptException;
import android.database.sqlite.SQLiteDiskIOException;
+import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteFullException;
-import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -33,9 +34,9 @@
import android.util.Log;
import com.android.dialer.phonenumbercache.ContactInfo;
+import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.UriUtils;
-
import com.google.common.collect.Lists;
import java.lang.ref.WeakReference;
@@ -82,11 +83,7 @@
try {
// Perform same query while catching any exceptions
super.handleMessage(msg);
- } catch (SQLiteDiskIOException e) {
- Log.w(TAG, "Exception on background worker thread", e);
- } catch (SQLiteFullException e) {
- Log.w(TAG, "Exception on background worker thread", e);
- } catch (SQLiteDatabaseCorruptException e) {
+ } catch (SQLiteDiskIOException | SQLiteFullException | SQLiteDatabaseCorruptException e) {
Log.w(TAG, "Exception on background worker thread", e);
}
}
@@ -101,7 +98,7 @@
public CallStatsQueryHandler(ContentResolver contentResolver, Listener listener) {
super(contentResolver);
- mListener = new WeakReference<Listener>(listener);
+ mListener = new WeakReference<>(listener);
}
public void fetchCalls(long from, long to, PhoneAccountHandle account) {
@@ -160,9 +157,9 @@
}
private Map<ContactInfo, CallStatsDetails> processData(Cursor cursor) {
- final Map<ContactInfo, CallStatsDetails> result = new HashMap<ContactInfo, CallStatsDetails>();
- final ArrayList<ContactInfo> infos = new ArrayList<ContactInfo>();
- final ArrayList<CallStatsDetails> calls = new ArrayList<CallStatsDetails>();
+ final Map<ContactInfo, CallStatsDetails> result = new HashMap<>();
+ final ArrayList<ContactInfo> infos = new ArrayList<>();
+ final ArrayList<CallStatsDetails> calls = new ArrayList<>();
CallStatsDetails pending = null;
cursor.moveToFirst();
@@ -205,8 +202,8 @@
private void mergeItemsByNumber(List<CallStatsDetails> calls, List<ContactInfo> infos) {
// temporarily store items marked for removal
- final ArrayList<CallStatsDetails> callsToRemove = new ArrayList<CallStatsDetails>();
- final ArrayList<ContactInfo> infosToRemove = new ArrayList<ContactInfo>();
+ final ArrayList<CallStatsDetails> callsToRemove = new ArrayList<>();
+ final ArrayList<ContactInfo> infosToRemove = new ArrayList<>();
for (int i = 0; i < calls.size(); i++) {
final CallStatsDetails outerItem = calls.get(i);
@@ -254,43 +251,13 @@
}
private static boolean phoneNumbersEqual(String number1, String number2) {
- if (PhoneNumberUtils.isUriNumber(number1) || PhoneNumberUtils.isUriNumber(number2)) {
- return sipAddressesEqual(number1, number2);
+ if (PhoneNumberHelper.isUriNumber(number1) || PhoneNumberHelper.isUriNumber(number2)) {
+ return PhoneNumberHelper.compareSipAddresses(number1, number2);
} else {
return PhoneNumberUtils.compare(number1, number2);
}
}
- private static boolean sipAddressesEqual(String number1, String number2) {
- if (number1 == null || number2 == null) {
- return number1 == number2;
- }
-
- int index1 = number1.indexOf('@');
- final String userinfo1;
- final String rest1;
- if (index1 != -1) {
- userinfo1 = number1.substring(0, index1);
- rest1 = number1.substring(index1);
- } else {
- userinfo1 = number1;
- rest1 = "";
- }
-
- int index2 = number2.indexOf('@');
- final String userinfo2;
- final String rest2;
- if (index2 != -1) {
- userinfo2 = number2.substring(0, index2);
- rest2 = number2.substring(index2);
- } else {
- userinfo2 = number2;
- rest2 = "";
- }
-
- return userinfo1.equals(userinfo2) && rest1.equalsIgnoreCase(rest2);
- }
-
public interface Listener {
void onCallsFetched(Map<ContactInfo, CallStatsDetails> calls);
}
diff --git a/java/com/android/dialer/callstats/DoubleDatePickerDialog.java b/java/com/android/dialer/callstats/DoubleDatePickerDialog.java
index e0c40bf..1e9e072 100644
--- a/java/com/android/dialer/callstats/DoubleDatePickerDialog.java
+++ b/java/com/android/dialer/callstats/DoubleDatePickerDialog.java
@@ -148,10 +148,10 @@
View view = inflater.inflate(R.layout.double_date_picker_dialog, null);
setView(view);
- mDatePickerFrom = (DatePicker) view.findViewById(R.id.date_picker_from);
- mDatePickerTo = (DatePicker) view.findViewById(R.id.date_picker_to);
+ mDatePickerFrom = view.findViewById(R.id.date_picker_from);
+ mDatePickerTo = view.findViewById(R.id.date_picker_to);
- ArrayList<CharSequence> quickSelEntries = new ArrayList<CharSequence>();
+ ArrayList<CharSequence> quickSelEntries = new ArrayList<>();
for (int entryId : QUICKSELECTION_ENTRIES) {
quickSelEntries.add(context.getString(entryId));
}
@@ -166,7 +166,7 @@
};
quickSelAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- mQuickSelSpinner = (Spinner) view.findViewById(R.id.date_quick_selection);
+ mQuickSelSpinner = view.findViewById(R.id.date_quick_selection);
mQuickSelSpinner.setOnItemSelectedListener(this);
mQuickSelSpinner.setAdapter(quickSelAdapter);
diff --git a/java/com/android/dialer/common/FragmentUtils.java b/java/com/android/dialer/common/FragmentUtils.java
index f31d2b7..df1e475 100644
--- a/java/com/android/dialer/common/FragmentUtils.java
+++ b/java/com/android/dialer/common/FragmentUtils.java
@@ -56,36 +56,6 @@
return null;
}
- /**
- * Returns an instance of the {@code callbackInterface} that is defined in the parent of the
- * {@code fragment}, or null if no such call back can be found.
- */
- @CheckResult(suggest = "#checkParent(Fragment, Class)}")
- @Nullable
- public static <T> T getParent(
- @NonNull android.app.Fragment fragment, @NonNull Class<T> callbackInterface) {
- android.app.Fragment parentFragment = fragment.getParentFragment();
- if (callbackInterface.isInstance(parentFragment)) {
- @SuppressWarnings("unchecked") // Casts are checked using runtime methods
- T parent = (T) parentFragment;
- return parent;
- } else if (callbackInterface.isInstance(fragment.getActivity())) {
- @SuppressWarnings("unchecked") // Casts are checked using runtime methods
- T parent = (T) fragment.getActivity();
- return parent;
- } else if (fragment.getActivity() instanceof FragmentUtilListener) {
- @SuppressWarnings("unchecked") // Casts are checked using runtime methods
- T parent = ((FragmentUtilListener) fragment.getActivity()).getImpl(callbackInterface);
- return parent;
- } else if (fragment.getActivity() instanceof MainActivityPeer.PeerSupplier) {
- MainActivityPeer peer = ((MainActivityPeer.PeerSupplier) fragment.getActivity()).getPeer();
- if (peer instanceof FragmentUtilListener) {
- return ((FragmentUtilListener) peer).getImpl(callbackInterface);
- }
- }
- return null;
- }
-
/** Returns the parent or throws. Should perform check elsewhere(e.g. onAttach, newInstance). */
@NonNull
public static <T> T getParentUnsafe(
@@ -94,16 +64,6 @@
}
/**
- * Version of {@link #getParentUnsafe(Fragment, Class)} which supports {@link
- * android.app.Fragment}.
- */
- @NonNull
- public static <T> T getParentUnsafe(
- @NonNull android.app.Fragment fragment, @NonNull Class<T> callbackInterface) {
- return Assert.isNotNull(getParent(fragment, callbackInterface));
- }
-
- /**
* Ensures fragment has a parent that implements the corresponding interface
*
* @param frag The Fragment whose parents are to be checked
diff --git a/java/com/android/dialer/common/concurrent/AsyncTaskExecutors.java b/java/com/android/dialer/common/concurrent/AsyncTaskExecutors.java
index d925b34..ed4faa0 100644
--- a/java/com/android/dialer/common/concurrent/AsyncTaskExecutors.java
+++ b/java/com/android/dialer/common/concurrent/AsyncTaskExecutors.java
@@ -23,6 +23,7 @@
import androidx.annotation.MainThread;
import com.android.dialer.common.Assert;
+
import java.util.concurrent.Executor;
/**
diff --git a/java/com/android/dialer/common/concurrent/DialerExecutorModule.java b/java/com/android/dialer/common/concurrent/DialerExecutorModule.java
index b8659b1..7503407 100644
--- a/java/com/android/dialer/common/concurrent/DialerExecutorModule.java
+++ b/java/com/android/dialer/common/concurrent/DialerExecutorModule.java
@@ -17,6 +17,7 @@
package com.android.dialer.common.concurrent;
import android.os.AsyncTask;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
import com.android.dialer.common.concurrent.Annotations.LightweightExecutor;
@@ -27,15 +28,17 @@
import com.android.dialer.common.concurrent.Annotations.UiSerial;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
-import dagger.Binds;
-import dagger.Module;
-import dagger.Provides;
+
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
+
import javax.inject.Singleton;
+import dagger.Binds;
+import dagger.Module;
+import dagger.Provides;
+
/** Module which provides concurrency bindings. */
@Module
public abstract class DialerExecutorModule {
diff --git a/java/com/android/dialer/common/concurrent/DialerExecutors.java b/java/com/android/dialer/common/concurrent/DialerExecutors.java
index 91c77ae..b9ed480 100644
--- a/java/com/android/dialer/common/concurrent/DialerExecutors.java
+++ b/java/com/android/dialer/common/concurrent/DialerExecutors.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
import androidx.annotation.NonNull;
import com.android.dialer.common.Assert;
+
import java.util.concurrent.ExecutorService;
/** Shared application executors. */
diff --git a/java/com/android/dialer/common/concurrent/DialerFutureSerializer.java b/java/com/android/dialer/common/concurrent/DialerFutureSerializer.java
index 2629abb..ef36ae6 100644
--- a/java/com/android/dialer/common/concurrent/DialerFutureSerializer.java
+++ b/java/com/android/dialer/common/concurrent/DialerFutureSerializer.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
+
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/java/com/android/dialer/common/concurrent/DialerFutures.java b/java/com/android/dialer/common/concurrent/DialerFutures.java
index 0c9f455..45d2106 100644
--- a/java/com/android/dialer/common/concurrent/DialerFutures.java
+++ b/java/com/android/dialer/common/concurrent/DialerFutures.java
@@ -24,6 +24,7 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
+
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
diff --git a/java/com/android/dialer/common/concurrent/UiThreadExecutor.java b/java/com/android/dialer/common/concurrent/UiThreadExecutor.java
index 8378d69..b112dbc 100644
--- a/java/com/android/dialer/common/concurrent/UiThreadExecutor.java
+++ b/java/com/android/dialer/common/concurrent/UiThreadExecutor.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +19,11 @@
import com.google.common.util.concurrent.AbstractListeningExecutorService;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
+
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/common/database/Selection.java b/java/com/android/dialer/common/database/Selection.java
index f1b6191..a4af033 100644
--- a/java/com/android/dialer/common/database/Selection.java
+++ b/java/com/android/dialer/common/database/Selection.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import androidx.annotation.Nullable;
import com.android.dialer.common.Assert;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -111,7 +113,6 @@
* enclosed in a parenthesis.
*/
@NonNull
- @SuppressWarnings("rawtypes")
public static Selection fromString(@Nullable String selection, @Nullable String... args) {
return new Builder(selection, args == null ? Collections.emptyList() : Arrays.asList(args))
.build();
@@ -204,7 +205,7 @@
}
return new Selection(
parenthesized(selection.toString()),
- selectionArgs.toArray(new String[selectionArgs.size()]));
+ selectionArgs.toArray(new String[0]));
}
@NonNull
diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
index d50febf..f160fd2 100644
--- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
+++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,15 +17,17 @@
package com.android.dialer.compat.telephony;
+import android.annotation.SuppressLint;
import android.content.Context;
-import android.net.Uri;
import android.telecom.PhoneAccountHandle;
+import android.telecom.TelecomManager;
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;
/** Hidden APIs in {@link android.telephony.TelephonyManager}. */
@@ -47,10 +50,6 @@
"android.telephony.event.EVENT_NOTIFY_INTERNATIONAL_CALL_ON_WFC";
public static final String EVENT_CALL_FORWARDED = "android.telephony.event.EVENT_CALL_FORWARDED";
- public static final String TELEPHONY_MANAGER_CLASS = "android.telephony.TelephonyManager";
-
- private static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE";
-
// TODO(erfanian): a bug Replace with the platform/telecom constant when available.
/**
* Indicates that the call being placed originated from a known contact.
@@ -64,9 +63,6 @@
public static final String ASSISTED_DIALING_EXTRAS =
"android.telecom.extra.ASSISTED_DIALING_EXTRAS";
- /** Indicates the Connection/Call used assisted dialing. */
- public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9;
-
public static final String EXTRA_IS_REFRESH = "android.telephony.extra.IS_REFRESH";
/**
@@ -100,11 +96,12 @@
/**
* Whether the phone supports TTY mode.
*
- * @param telephonyManager The telephony manager instance to use for method calls.
+ * @param telecomManager The TelecomManager manager instance to use for method calls.
* @return {@code true} if the device supports TTY mode, and {@code false} otherwise.
*/
- public static boolean isTtyModeSupported(@Nullable TelephonyManager telephonyManager) {
- return telephonyManager != null && telephonyManager.isTtyModeSupported();
+ @SuppressLint("MissingPermission")
+ public static boolean isTtyModeSupported(@Nullable TelecomManager telecomManager) {
+ return telecomManager != null && telecomManager.isTtySupported();
}
/**
@@ -120,34 +117,6 @@
}
/**
- * Returns the URI for the per-account voicemail ringtone set in Phone settings.
- *
- * @param telephonyManager The telephony manager instance to use for method calls.
- * @param accountHandle The handle for the {@link android.telecom.PhoneAccount} for which to
- * retrieve the voicemail ringtone.
- * @return The URI for the ringtone to play when receiving a voicemail from a specific
- * PhoneAccount.
- */
- @Nullable
- public static Uri getVoicemailRingtoneUri(
- TelephonyManager telephonyManager, PhoneAccountHandle accountHandle) {
- return telephonyManager.getVoicemailRingtoneUri(accountHandle);
- }
-
- /**
- * Returns whether vibration is set for voicemail notification in Phone settings.
- *
- * @param telephonyManager The telephony manager instance to use for method calls.
- * @param accountHandle The handle for the {@link android.telecom.PhoneAccount} for which to
- * retrieve the voicemail vibration setting.
- * @return {@code true} if the vibration is set for this PhoneAccount, {@code false} otherwise.
- */
- public static boolean isVoicemailVibrationEnabled(
- TelephonyManager telephonyManager, PhoneAccountHandle accountHandle) {
- return telephonyManager.isVoicemailVibrationEnabled(accountHandle);
- }
-
- /**
* This method uses a new system API to enable or disable visual voicemail. TODO(twyen): restrict
* to N MR1, not needed in future SDK.
*/
@@ -163,23 +132,6 @@
}
/**
- * This method uses a new system API to check if visual voicemail is enabled TODO(twyen): restrict
- * to N MR1, not needed in future SDK.
- */
- public static boolean isVisualVoicemailEnabled(
- TelephonyManager telephonyManager, PhoneAccountHandle handle) {
- try {
- return (boolean)
- TelephonyManager.class
- .getMethod("isVisualVoicemailEnabled", PhoneAccountHandle.class)
- .invoke(telephonyManager, handle);
- } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
- LogUtil.e("TelephonyManagerCompat.setVisualVoicemailEnabled", "failed", e);
- }
- return false;
- }
-
- /**
* Handles secret codes to launch arbitrary activities.
*
* @param context the context to use
diff --git a/java/com/android/dialer/constants/Constants.java b/java/com/android/dialer/constants/Constants.java
index dedcf15..a157c77 100644
--- a/java/com/android/dialer/constants/Constants.java
+++ b/java/com/android/dialer/constants/Constants.java
@@ -16,43 +16,18 @@
package com.android.dialer.constants;
-import androidx.annotation.NonNull;
-
/**
* Utility to access constants
*/
public class Constants {
- private static Constants instance;
- private static boolean didInitializeInstance;
+ public static final String FILE_PROVIDER_AUTHORITY = "com.android.dialer.files";
- @NonNull
- public static synchronized Constants get() {
- if (!didInitializeInstance) {
- didInitializeInstance = true;
- instance = new Constants();
- }
- return instance;
- }
+ public static final String ANNOTATED_CALL_LOG_PROVIDER_AUTHORITY =
+ "com.android.dialer.annotatedcalllog";
- @NonNull
- public String getFileProviderAuthority() {
- return "com.android.dialer.files";
- }
+ public static final String PHONE_LOOKUP_HISTORY_PROVIDER_AUTHORITY =
+ "com.android.dialer.phonelookuphistory";
- @NonNull
- public String getAnnotatedCallLogProviderAuthority() {
- return "com.android.dialer.annotatedcalllog";
- }
-
- @NonNull
- public String getPhoneLookupHistoryProviderAuthority() {
- return "com.android.dialer.phonelookuphistory";
- }
-
- @NonNull
- public String getPreferredSimFallbackProviderAuthority() {
- return "com.android.dialer.preferredsimfallback";
- }
-
- protected Constants() {}
+ public static final String PREFERRED_SIM_FALLBACK_PROVIDER_AUTHORITY =
+ "com.android.dialer.preferredsimfallback";
}
diff --git a/java/com/android/dialer/constants/ScheduledJobIds.java b/java/com/android/dialer/constants/ScheduledJobIds.java
index e9815c7..34a27bd 100644
--- a/java/com/android/dialer/constants/ScheduledJobIds.java
+++ b/java/com/android/dialer/constants/ScheduledJobIds.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +17,6 @@
package com.android.dialer.constants;
-import androidx.annotation.IntDef;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
/**
* Registry of scheduled job ids used by the dialer UID.
*
diff --git a/java/com/android/dialer/contactphoto/ContactPhotoManager.java b/java/com/android/dialer/contactphoto/ContactPhotoManager.java
index 4bac886..fd98d2b 100644
--- a/java/com/android/dialer/contactphoto/ContactPhotoManager.java
+++ b/java/com/android/dialer/contactphoto/ContactPhotoManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import android.view.View;
import android.widget.ImageView;
import android.widget.QuickContactBadge;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.util.PermissionsUtil;
@@ -97,22 +99,22 @@
try {
String contactType = uri.getQueryParameter(CONTACT_TYPE_PARAM_KEY);
if (!TextUtils.isEmpty(contactType)) {
- request.contactType = Integer.valueOf(contactType);
+ request.contactType = Integer.parseInt(contactType);
}
String scale = uri.getQueryParameter(SCALE_PARAM_KEY);
if (!TextUtils.isEmpty(scale)) {
- request.scale = Float.valueOf(scale);
+ request.scale = Float.parseFloat(scale);
}
String offset = uri.getQueryParameter(OFFSET_PARAM_KEY);
if (!TextUtils.isEmpty(offset)) {
- request.offset = Float.valueOf(offset);
+ request.offset = Float.parseFloat(offset);
}
String isCircular = uri.getQueryParameter(IS_CIRCULAR_PARAM_KEY);
if (!TextUtils.isEmpty(isCircular)) {
- request.isCircular = Boolean.valueOf(isCircular);
+ request.isCircular = Boolean.parseBoolean(isCircular);
}
} catch (NumberFormatException e) {
LogUtil.w(
diff --git a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
index 7f2905e..576b040 100644
--- a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
+++ b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
@@ -110,7 +110,7 @@
static {
BITMAP_UNAVAILABLE = new BitmapHolder(new byte[0], 0);
- BITMAP_UNAVAILABLE.bitmapRef = new SoftReference<Bitmap>(null);
+ BITMAP_UNAVAILABLE.bitmapRef = new SoftReference<>(null);
}
private final Context context;
@@ -131,8 +131,7 @@
* A map from ImageView to the corresponding photo ID or uri, encapsulated in a request. The
* request may swapped out before the photo loading request is started.
*/
- private final ConcurrentHashMap<ImageView, Request> pendingRequests =
- new ConcurrentHashMap<ImageView, Request>();
+ private final ConcurrentHashMap<ImageView, Request> pendingRequests = new ConcurrentHashMap<>();
/** Handler for messages sent to the UI thread. */
private final Handler mainThreadHandler = new Handler(Looper.getMainLooper(), this);
/** For debug: How many times we had to reload cached photo for a stale entry */
@@ -281,7 +280,7 @@
holder.decodedSampleSize = sampleSize;
holder.bitmap = bitmap;
- holder.bitmapRef = new SoftReference<Bitmap>(bitmap);
+ holder.bitmapRef = new SoftReference<>(bitmap);
if (DEBUG) {
LogUtil.d(
"ContactPhotoManagerImpl.inflateBitmap",
@@ -339,7 +338,7 @@
LogUtil.d(
"ContactPhotoManagerImpl.dumpStats",
"L1 Stats: "
- + bitmapHolderCache.toString()
+ + bitmapHolderCache
+ ", overwrite: fresh="
+ freshCacheOverwrite.get()
+ " stale="
diff --git a/java/com/android/dialer/contacts/ContactsComponent.java b/java/com/android/dialer/contacts/ContactsComponent.java
index 9c67737..9e374a0 100644
--- a/java/com/android/dialer/contacts/ContactsComponent.java
+++ b/java/com/android/dialer/contacts/ContactsComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +18,12 @@
package com.android.dialer.contacts;
import android.content.Context;
+
import com.android.dialer.contacts.displaypreference.ContactDisplayPreferences;
import com.android.dialer.contacts.hiresphoto.HighResolutionPhotoRequester;
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
+
import dagger.Subcomponent;
/** Component for contacts related utilities */
diff --git a/java/com/android/dialer/contacts/ContactsModule.java b/java/com/android/dialer/contacts/ContactsModule.java
index 9cbb6ae..a41dec2 100644
--- a/java/com/android/dialer/contacts/ContactsModule.java
+++ b/java/com/android/dialer/contacts/ContactsModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +19,14 @@
import android.content.Context;
import android.os.UserManager;
+
import com.android.dialer.contacts.displaypreference.ContactDisplayPreferences;
import com.android.dialer.contacts.displaypreference.ContactDisplayPreferencesImpl;
import com.android.dialer.contacts.displaypreference.ContactDisplayPreferencesStub;
import com.android.dialer.contacts.hiresphoto.HighResolutionPhotoRequester;
import com.android.dialer.contacts.hiresphoto.HighResolutionPhotoRequesterImpl;
import com.android.dialer.inject.ApplicationContext;
+
import dagger.Binds;
import dagger.Lazy;
import dagger.Module;
diff --git a/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequester.java b/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequester.java
index 1075ec1..13d6104 100644
--- a/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequester.java
+++ b/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequester.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.dialer.contacts.hiresphoto;
import android.net.Uri;
+
import com.google.common.util.concurrent.ListenableFuture;
/**
diff --git a/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java b/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
index 64eab60..c9dbb47 100644
--- a/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
+++ b/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,14 +25,17 @@
import android.net.Uri;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.RawContacts;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
import com.android.dialer.common.database.Selection;
import com.android.dialer.inject.ApplicationContext;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.util.ArrayList;
import java.util.List;
+
import javax.inject.Inject;
/** Use the contacts sync adapter to load high resolution photos for a Google account. */
diff --git a/java/com/android/dialer/contactsfragment/ContactViewHolder.java b/java/com/android/dialer/contactsfragment/ContactViewHolder.java
index bf8b3d4..25eab26 100644
--- a/java/com/android/dialer/contactsfragment/ContactViewHolder.java
+++ b/java/com/android/dialer/contactsfragment/ContactViewHolder.java
@@ -17,7 +17,6 @@
package com.android.dialer.contactsfragment;
-import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
@@ -38,7 +37,6 @@
private final TextView header;
private final BidiTextView name;
private final QuickContactBadge photo;
- private final Context context;
private final OnContactSelectedListener onContactSelectedListener;
private String headerText;
@@ -48,7 +46,6 @@
ContactViewHolder(View itemView, OnContactSelectedListener onContactSelectedListener) {
super(itemView);
this.onContactSelectedListener = Assert.isNotNull(onContactSelectedListener);
- context = itemView.getContext();
itemView.findViewById(R.id.click_target).setOnClickListener(this);
header = itemView.findViewById(R.id.header);
name = itemView.findViewById(R.id.contact_name);
diff --git a/java/com/android/dialer/database/CallLogQueryHandler.java b/java/com/android/dialer/database/CallLogQueryHandler.java
index de4329d..4c19e2d 100644
--- a/java/com/android/dialer/database/CallLogQueryHandler.java
+++ b/java/com/android/dialer/database/CallLogQueryHandler.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +33,7 @@
import android.provider.CallLog.Calls;
import android.provider.VoicemailContract.Status;
import android.provider.VoicemailContract.Voicemails;
+
import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
import com.android.dialer.common.LogUtil;
import com.android.dialer.phonenumbercache.CallLogQuery;
@@ -39,6 +41,7 @@
import com.android.dialer.util.PermissionsUtil;
import com.android.dialer.voicemailstatus.VoicemailStatusQuery;
import com.android.voicemail.VoicemailComponent;
+
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
@@ -118,7 +121,7 @@
Status.CONTENT_URI,
VoicemailStatusQuery.getProjection(),
where.toString(),
- selectionArgs.toArray(new String[selectionArgs.size()]),
+ selectionArgs.toArray(new String[0]),
null);
} else {
LogUtil.i(
@@ -144,7 +147,7 @@
Voicemails.CONTENT_URI,
new String[] {Voicemails._ID},
where.toString(),
- selectionArgs.toArray(new String[selectionArgs.size()]),
+ selectionArgs.toArray(new String[0]),
null);
}
}
@@ -211,7 +214,7 @@
uri,
CallLogQuery.getProjection(),
selection,
- selectionArgs.toArray(new String[selectionArgs.size()]),
+ selectionArgs.toArray(new String[0]),
Calls.DEFAULT_SORT_ORDER);
}
diff --git a/java/com/android/dialer/database/Database.java b/java/com/android/dialer/database/Database.java
index 9868e26..0c3a094 100644
--- a/java/com/android/dialer/database/Database.java
+++ b/java/com/android/dialer/database/Database.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.dialer.database;
import android.content.Context;
+
import java.util.Objects;
/** Accessor for the database bindings. */
diff --git a/java/com/android/dialer/database/DialerDatabaseHelper.java b/java/com/android/dialer/database/DialerDatabaseHelper.java
index 4da1522..e0d92c8 100644
--- a/java/com/android/dialer/database/DialerDatabaseHelper.java
+++ b/java/com/android/dialer/database/DialerDatabaseHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +48,7 @@
import com.android.dialer.util.PermissionsUtil;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Objects;
@@ -444,7 +446,7 @@
continue;
}
- final Long contactId = updatedContactCursor.getLong(UpdatedContactQuery.UPDATED_CONTACT_ID);
+ final long contactId = updatedContactCursor.getLong(UpdatedContactQuery.UPDATED_CONTACT_ID);
db.delete(Tables.SMARTDIAL_TABLE, SmartDialDbColumns.CONTACT_ID + "=" + contactId, null);
db.delete(Tables.PREFIX_TABLE, PrefixColumns.CONTACT_ID + "=" + contactId, null);
@@ -655,7 +657,7 @@
"DialerDatabaseHelper.updateSmartDialDatabase", "last updated at %s", lastUpdateMillis);
/** Sets the time after querying the database as the current update time. */
- final Long currentMillis = System.currentTimeMillis();
+ final long currentMillis = System.currentTimeMillis();
/** Removes contacts that have been deleted. */
removeDeletedContacts(db, lastUpdateMillis);
diff --git a/java/com/android/dialer/databasepopulator/BlockedBumberPopulator.java b/java/com/android/dialer/databasepopulator/BlockedBumberPopulator.java
index 7d7cd56..a354199 100644
--- a/java/com/android/dialer/databasepopulator/BlockedBumberPopulator.java
+++ b/java/com/android/dialer/databasepopulator/BlockedBumberPopulator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import androidx.annotation.NonNull;
import com.android.dialer.common.Assert;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -50,7 +52,7 @@
try {
context.getContentResolver().applyBatch(BlockedNumberContract.AUTHORITY, operations);
} catch (RemoteException | OperationApplicationException e) {
- Assert.fail("error adding block number entries: " + e);
+ Assert.createAssertionFailException("error adding block number entries: " + e);
}
}
diff --git a/java/com/android/dialer/databasepopulator/CallLogPopulator.java b/java/com/android/dialer/databasepopulator/CallLogPopulator.java
index 1bc4a88..093b5fb 100644
--- a/java/com/android/dialer/databasepopulator/CallLogPopulator.java
+++ b/java/com/android/dialer/databasepopulator/CallLogPopulator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
package com.android.dialer.databasepopulator;
+import android.annotation.SuppressLint;
import android.content.ContentProviderOperation;
import android.content.ContentValues;
import android.content.Context;
@@ -29,8 +31,10 @@
import com.android.dialer.common.Assert;
import com.google.auto.value.AutoValue;
+
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -86,6 +90,7 @@
populateCallLog(context, false);
}
+ @SuppressLint("CheckResult")
@WorkerThread
public static void populateCallLog(
@NonNull Context context, boolean isWithoutMissedCalls, boolean fastMode) {
@@ -116,7 +121,7 @@
try {
context.getContentResolver().applyBatch(CallLog.AUTHORITY, operations);
} catch (RemoteException | OperationApplicationException e) {
- Assert.fail("error adding call entries: " + e);
+ Assert.createAssertionFailException("error adding call entries: " + e);
}
}
@@ -125,6 +130,7 @@
populateCallLog(context, true);
}
+ @SuppressLint("CheckResult")
@WorkerThread
public static void deleteAllCallLog(@NonNull Context context) {
Assert.isWorkerThread();
@@ -133,10 +139,10 @@
.getContentResolver()
.applyBatch(
CallLog.AUTHORITY,
- new ArrayList<>(
- Arrays.asList(ContentProviderOperation.newDelete(Calls.CONTENT_URI).build())));
+ new ArrayList<>(Collections.singletonList(
+ ContentProviderOperation.newDelete(Calls.CONTENT_URI).build())));
} catch (RemoteException | OperationApplicationException e) {
- Assert.fail("failed to delete call log: " + e);
+ Assert.createAssertionFailException("failed to delete call log: " + e);
}
}
diff --git a/java/com/android/dialer/databasepopulator/ContactsPopulator.java b/java/com/android/dialer/databasepopulator/ContactsPopulator.java
index c72b764..c87c946 100644
--- a/java/com/android/dialer/databasepopulator/ContactsPopulator.java
+++ b/java/com/android/dialer/databasepopulator/ContactsPopulator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
package com.android.dialer.databasepopulator;
+import android.annotation.SuppressLint;
import android.content.ContentProviderOperation;
import android.content.Context;
import android.content.OperationApplicationException;
@@ -35,9 +37,11 @@
import com.android.dialer.common.Assert;
import com.google.auto.value.AutoValue;
+
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
/** Populates the device database with contacts. */
@@ -128,6 +132,7 @@
.build(),
};
+ @SuppressLint("CheckResult")
@WorkerThread
public static void populateContacts(@NonNull Context context, boolean fastMode) {
Assert.isWorkerThread();
@@ -145,29 +150,11 @@
try {
context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);
} catch (RemoteException | OperationApplicationException e) {
- Assert.fail("error adding contacts: " + e);
+ Assert.createAssertionFailException("error adding contacts: " + e);
}
}
- @WorkerThread
- public static void populateSpeedDialTestContacts(@NonNull Context context) {
- Assert.isWorkerThread();
- ArrayList<ContentProviderOperation> operations = new ArrayList<>();
- addContact(SIMPLE_CONTACTS[0], operations);
- addContact(SIMPLE_CONTACTS[3], operations);
- addContact(SIMPLE_CONTACTS[5], operations);
- try {
- context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);
- } catch (RemoteException | OperationApplicationException e) {
- Assert.fail("error adding contacts: " + e);
- }
- }
-
- @WorkerThread
- public static void populateContacts(@NonNull Context context) {
- populateContacts(context, false);
- }
-
+ @SuppressLint("CheckResult")
@WorkerThread
public static void deleteAllContacts(@NonNull Context context) {
Assert.isWorkerThread();
@@ -176,11 +163,10 @@
.getContentResolver()
.applyBatch(
ContactsContract.AUTHORITY,
- new ArrayList<>(
- Arrays.asList(
+ new ArrayList<>(Collections.singletonList(
ContentProviderOperation.newDelete(RawContacts.CONTENT_URI).build())));
} catch (RemoteException | OperationApplicationException e) {
- Assert.fail("failed to delete contacts: " + e);
+ Assert.createAssertionFailException("failed to delete contacts: " + e);
}
}
diff --git a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
index 854dc56..aec765e 100644
--- a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
+++ b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,8 +28,8 @@
import androidx.annotation.WorkerThread;
import com.android.dialer.common.Assert;
-import com.android.voicemail.impl.Voicemail;
import com.google.auto.value.AutoValue;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
diff --git a/java/com/android/dialer/dialpadview/DialpadView.java b/java/com/android/dialer/dialpadview/DialpadView.java
index 6d538f3..a5811f3 100644
--- a/java/com/android/dialer/dialpadview/DialpadView.java
+++ b/java/com/android/dialer/dialpadview/DialpadView.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,10 +39,12 @@
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
+
import com.android.dialer.animation.AnimUtils;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.i18n.LocaleUtils;
+
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
diff --git a/java/com/android/dialer/dialpadview/DigitsEditText.java b/java/com/android/dialer/dialpadview/DigitsEditText.java
index 4a4b9b4..3d30d7f 100644
--- a/java/com/android/dialer/dialpadview/DigitsEditText.java
+++ b/java/com/android/dialer/dialpadview/DigitsEditText.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.inputmethod.InputMethodManager;
+
import com.android.dialer.widget.ResizingTextEditText;
/** EditText which suppresses IME show up. */
diff --git a/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java b/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java
index aaa65d0..bc45cb8 100644
--- a/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java
+++ b/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java
@@ -26,6 +26,7 @@
import android.graphics.LightingColorFilter;
import android.os.Handler;
import android.os.Looper;
+import android.os.VibrationEffect;
import android.os.Vibrator;
import android.view.View;
@@ -127,9 +128,10 @@
private void vibrate(long milliseconds) {
Context context = viewProvider.getContext();
if (context != null) {
- Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
- if (vibrator != null) {
- vibrator.vibrate(milliseconds);
+ Vibrator vibrator = context.getSystemService(Vibrator.class);
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(VibrationEffect.createOneShot(milliseconds,
+ VibrationEffect.DEFAULT_AMPLITUDE));
}
}
}
diff --git a/java/com/android/dialer/glidephotomanager/GlidePhotoManagerComponent.java b/java/com/android/dialer/glidephotomanager/GlidePhotoManagerComponent.java
index b4699be..b4f4e07 100644
--- a/java/com/android/dialer/glidephotomanager/GlidePhotoManagerComponent.java
+++ b/java/com/android/dialer/glidephotomanager/GlidePhotoManagerComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,9 @@
package com.android.dialer.glidephotomanager;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
+
import dagger.Subcomponent;
/** Entry point for {@link GlidePhotoManager} */
diff --git a/java/com/android/dialer/glidephotomanager/GlidePhotoManagerModule.java b/java/com/android/dialer/glidephotomanager/GlidePhotoManagerModule.java
index 79629d6..f38ce3c 100644
--- a/java/com/android/dialer/glidephotomanager/GlidePhotoManagerModule.java
+++ b/java/com/android/dialer/glidephotomanager/GlidePhotoManagerModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +18,11 @@
package com.android.dialer.glidephotomanager;
import com.android.dialer.glidephotomanager.impl.GlidePhotoManagerImpl;
+
+import javax.inject.Singleton;
+
import dagger.Binds;
import dagger.Module;
-import javax.inject.Singleton;
/** Module for {@link GlidePhotoManagerComponent} */
@Module
diff --git a/java/com/android/dialer/glidephotomanager/impl/DefaultLookupUriGenerator.java b/java/com/android/dialer/glidephotomanager/impl/DefaultLookupUriGenerator.java
index 2c4acd4..fdd7391 100644
--- a/java/com/android/dialer/glidephotomanager/impl/DefaultLookupUriGenerator.java
+++ b/java/com/android/dialer/glidephotomanager/impl/DefaultLookupUriGenerator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +22,9 @@
import android.provider.ContactsContract.CommonDataKinds;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.DisplayNameSources;
+
import com.android.dialer.glidephotomanager.PhotoInfo;
+
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
diff --git a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java
index 243e3f9..e030524 100644
--- a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java
+++ b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +41,9 @@
import com.android.dialer.i18n.DialerBidiFormatter;
import com.android.dialer.inject.ApplicationContext;
import com.android.dialer.lettertile.LetterTileDrawable;
+
import java.util.List;
+
import javax.inject.Inject;
/** Implementation of {@link GlidePhotoManager} */
diff --git a/java/com/android/dialer/helplines/AndroidManifest.xml b/java/com/android/dialer/helplines/AndroidManifest.xml
index a16c36c..9117e3b 100644
--- a/java/com/android/dialer/helplines/AndroidManifest.xml
+++ b/java/com/android/dialer/helplines/AndroidManifest.xml
@@ -25,7 +25,7 @@
android:name=".HelplineActivity"
android:autoRemoveFromRecents="true"
android:label="@string/helplines_name"
- android:theme="@android:style/Theme.DeviceDefault.Settings"
+ android:theme="@style/Dialer.ThemeBase.ActionBar"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
diff --git a/java/com/android/dialer/helplines/HelplineActivity.java b/java/com/android/dialer/helplines/HelplineActivity.java
old mode 100755
new mode 100644
index 5a62489..c79f6cd
--- a/java/com/android/dialer/helplines/HelplineActivity.java
+++ b/java/com/android/dialer/helplines/HelplineActivity.java
@@ -19,7 +19,6 @@
import static android.graphics.Paint.UNDERLINE_TEXT_FLAG;
import android.app.ActionBar;
-import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
diff --git a/java/com/android/dialer/helplines/LoadHelplinesTask.java b/java/com/android/dialer/helplines/LoadHelplinesTask.java
index 291dd36..7876fb1 100644
--- a/java/com/android/dialer/helplines/LoadHelplinesTask.java
+++ b/java/com/android/dialer/helplines/LoadHelplinesTask.java
@@ -15,6 +15,7 @@
*/
package com.android.dialer.helplines;
+import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Looper;
@@ -101,6 +102,7 @@
});
}
+ @SuppressLint("MissingPermission")
private List<SubscriptionInfo> getSubscriptionInfos() {
List<SubscriptionInfo> subList = mSubManager.getActiveSubscriptionInfoList();
if (subList == null) {
diff --git a/java/com/android/dialer/helplines/utils/HelplineUtils.java b/java/com/android/dialer/helplines/utils/HelplineUtils.java
index a31a9ec..6dafd2f 100644
--- a/java/com/android/dialer/helplines/utils/HelplineUtils.java
+++ b/java/com/android/dialer/helplines/utils/HelplineUtils.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (C) 2019-2021 The LineageOS Project
+/*
+ * Copyright (C) 2019-2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
import com.android.dialer.R;
import com.android.dialer.helplines.HelplineItem;
+
import org.lineageos.lib.phone.spn.Item;
import java.util.ArrayList;
diff --git a/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java b/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java
index 9fa46c8..9b1e014 100644
--- a/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java
+++ b/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java
@@ -170,7 +170,7 @@
private void setupBottomSheetBehavior() {
BottomSheetBehavior<View> behavior = BottomSheetBehavior.from(
findViewById(com.google.android.material.R.id.design_bottom_sheet));
- behavior.setBottomSheetCallback(
+ behavior.addBottomSheetCallback(
new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
diff --git a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java
index 7fff434..ba2389e 100644
--- a/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java
+++ b/java/com/android/dialer/historyitemactions/HistoryItemActionModulesBuilder.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +34,7 @@
import com.android.dialer.util.CallUtil;
import com.android.dialer.util.PermissionsUtil;
import com.android.dialer.util.UriUtils;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/dialer/i18n/LocaleUtils.java b/java/com/android/dialer/i18n/LocaleUtils.java
index 0532cc3..f866b73 100644
--- a/java/com/android/dialer/i18n/LocaleUtils.java
+++ b/java/com/android/dialer/i18n/LocaleUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
import android.content.Context;
import android.os.LocaleList;
+
import java.util.Locale;
/** Utilities for locale. */
diff --git a/java/com/android/dialer/interactions/ContactUpdateService.java b/java/com/android/dialer/interactions/ContactUpdateService.java
index 9b2d701..334abe7 100644
--- a/java/com/android/dialer/interactions/ContactUpdateService.java
+++ b/java/com/android/dialer/interactions/ContactUpdateService.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
+
import com.android.contacts.common.database.ContactUpdateUtils;
/** Service for updating primary number on a contact. */
diff --git a/java/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java b/java/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java
index 76f7ade..39e3b4f 100644
--- a/java/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java
+++ b/java/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java
@@ -28,6 +28,7 @@
import android.provider.ContactsContract.PhoneLookup;
import android.provider.ContactsContract.PinnedPositions;
import android.text.TextUtils;
+
import com.android.dialer.util.PermissionsUtil;
/**
@@ -93,8 +94,7 @@
}
try {
if (cursor.moveToFirst()) {
- final long id = cursor.getLong(0);
- return id;
+ return cursor.getLong(0);
} else {
return NO_CONTACT_FOUND;
}
diff --git a/java/com/android/dialer/lettertile/LetterTileDrawable.java b/java/com/android/dialer/lettertile/LetterTileDrawable.java
index efe595e..f4c3ec8 100644
--- a/java/com/android/dialer/lettertile/LetterTileDrawable.java
+++ b/java/com/android/dialer/lettertile/LetterTileDrawable.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +38,7 @@
import com.android.dialer.R;
import com.android.dialer.common.Assert;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -52,7 +54,8 @@
* #TYPE_BUSINESS}, and voicemail contacts should use {@link #TYPE_VOICEMAIL}.
*/
@Retention(RetentionPolicy.SOURCE)
- @IntDef({TYPE_PERSON, TYPE_BUSINESS, TYPE_VOICEMAIL, TYPE_GENERIC_AVATAR, TYPE_SPAM})
+ @IntDef({TYPE_PERSON, TYPE_BUSINESS, TYPE_VOICEMAIL, TYPE_GENERIC_AVATAR, TYPE_SPAM,
+ TYPE_CONFERENCE})
public @interface ContactType {}
/** Contact type constants */
@@ -118,9 +121,9 @@
public LetterTileDrawable(final Resources res) {
colors = res.obtainTypedArray(R.array.letter_tile_colors);
- spamColor = res.getColor(R.color.spam_contact_background);
- defaultColor = res.getColor(R.color.letter_tile_default_color);
- tileFontColor = res.getColor(R.color.letter_tile_font_color);
+ spamColor = res.getColor(R.color.spam_contact_background, null);
+ defaultColor = res.getColor(R.color.letter_tile_default_color, null);
+ tileFontColor = res.getColor(R.color.letter_tile_font_color, null);
letterToTileRatio = res.getFraction(R.dimen.letter_to_tile_ratio, 1, 1);
defaultPersonAvatar = res.getDrawable(R.drawable.quantum_ic_person_vd_theme_24, null);
defaultBusinessAvatar = res.getDrawable(R.drawable.quantum_ic_business_vd_theme_24, null);
diff --git a/java/com/android/dialer/location/CountryDetector.java b/java/com/android/dialer/location/CountryDetector.java
index 093ddd9..f4e5c5d 100644
--- a/java/com/android/dialer/location/CountryDetector.java
+++ b/java/com/android/dialer/location/CountryDetector.java
@@ -211,7 +211,7 @@
final Location location =
intent.getParcelableExtra(LocationManager.KEY_LOCATION_CHANGED, Location.class);
- // TODO: rething how we access the gecoder here, right now we have to set the static instance
+ // TODO: rethink how we access the gecoder here, right now we have to set the static instance
// of CountryDetector to make this work for tests which is weird
// (see CountryDetectorTest.locationChangedBroadcast_GeocodesLocation)
processLocationUpdate(context, CountryDetector.getInstance(context).geocoder, location);
diff --git a/java/com/android/dialer/lookup/ContactBuilder.java b/java/com/android/dialer/lookup/ContactBuilder.java
index e88f956..39afe3a 100644
--- a/java/com/android/dialer/lookup/ContactBuilder.java
+++ b/java/com/android/dialer/lookup/ContactBuilder.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Xiao-Long Chen <chillermillerlong@hotmail.com>
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,20 +27,16 @@
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Directory;
import android.provider.ContactsContract.DisplayNameSources;
-import android.text.TextUtils;
import android.util.Log;
import com.android.contacts.common.util.Constants;
-import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.R;
+import com.android.dialer.phonenumbercache.ContactInfo;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.w3c.dom.Text;
-import java.sql.Struct;
import java.util.ArrayList;
public class ContactBuilder {
@@ -69,10 +66,6 @@
return new ContactBuilder(DirectoryId.NEARBY, null, number);
}
- public static ContactBuilder forPeopleLookup(String number) {
- return new ContactBuilder(DirectoryId.PEOPLE, null, number);
- }
-
public static ContactBuilder forReverseLookup(String normalizedNumber, String formattedNumber) {
return new ContactBuilder(DirectoryId.NULL, normalizedNumber, formattedNumber);
}
@@ -83,75 +76,6 @@
this.formattedNumber = formattedNumber;
}
- public ContactBuilder(Uri encodedContactUri) throws JSONException {
- String jsonData = encodedContactUri.getEncodedFragment();
- String directoryIdStr = encodedContactUri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY);
- long directoryId = DirectoryId.DEFAULT;
-
- if (!TextUtils.isEmpty(directoryIdStr)) {
- try {
- directoryId = Long.parseLong(directoryIdStr);
- } catch (NumberFormatException e) {
- Log.e(TAG, "Error parsing directory id of uri " + encodedContactUri, e);
- }
- }
-
- this.directoryId = directoryId;
- this.formattedNumber = null;
- this.normalizedNumber = null;
-
- try {
- // name
- JSONObject json = new JSONObject(jsonData);
- JSONObject contact = json.optJSONObject(Contacts.CONTENT_ITEM_TYPE);
- JSONObject nameObj = contact.optJSONObject(StructuredName.CONTENT_ITEM_TYPE);
- name = new Name(nameObj);
-
- if (contact != null) {
- // numbers
- if (contact.has(Phone.CONTENT_ITEM_TYPE)) {
- String phoneData = contact.getString(Phone.CONTENT_ITEM_TYPE);
- Object phoneObject = new JSONTokener(phoneData).nextValue();
- JSONArray phoneNumbersJson;
- if (phoneObject instanceof JSONObject) {
- phoneNumbersJson = new JSONArray();
- phoneNumbersJson.put(phoneObject);
- } else {
- phoneNumbersJson = contact.getJSONArray(Phone.CONTENT_ITEM_TYPE);
- }
- for (int i = 0; i < phoneNumbersJson.length(); ++i) {
- JSONObject phoneObj = phoneNumbersJson.getJSONObject(i);
- phoneNumbers.add(new PhoneNumber(phoneObj));
- }
- }
-
- // address
- if (contact.has(StructuredPostal.CONTENT_ITEM_TYPE)) {
- JSONArray addressesJson = contact.getJSONArray(StructuredPostal.CONTENT_ITEM_TYPE);
- for (int i = 0; i < addressesJson.length(); ++i) {
- JSONObject addrObj = addressesJson.getJSONObject(i);
- addresses.add(new Address(addrObj));
- }
- }
-
- // websites
- if (contact.has(Website.CONTENT_ITEM_TYPE)) {
- JSONArray websitesJson = contact.getJSONArray(Website.CONTENT_ITEM_TYPE);
- for (int i = 0; i < websitesJson.length(); ++i) {
- JSONObject websiteObj = websitesJson.getJSONObject(i);
- final WebsiteUrl websiteUrl = new WebsiteUrl(websiteObj);
- if (!TextUtils.isEmpty(websiteUrl.url)) {
- websites.add(new WebsiteUrl(websiteObj));
- }
- }
- }
- }
- } catch(JSONException e) {
- Log.e(TAG, "Error parsing encoded fragment of uri " + encodedContactUri, e);
- throw e;
- }
- }
-
public ContactBuilder addAddress(Address address) {
if (DEBUG) Log.d(TAG, "Adding address");
if (address != null) {
diff --git a/java/com/android/dialer/lookup/DirectoryId.java b/java/com/android/dialer/lookup/DirectoryId.java
index 023585c..1d39d74 100644
--- a/java/com/android/dialer/lookup/DirectoryId.java
+++ b/java/com/android/dialer/lookup/DirectoryId.java
@@ -25,7 +25,7 @@
if (lookupUri != null) {
String dqp = lookupUri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY);
if (dqp != null) {
- directory = Long.valueOf(dqp);
+ directory = Long.parseLong(dqp);
}
}
return directory;
diff --git a/java/com/android/dialer/lookup/ForwardLookup.java b/java/com/android/dialer/lookup/ForwardLookup.java
index 6a690bf..6d8be80 100644
--- a/java/com/android/dialer/lookup/ForwardLookup.java
+++ b/java/com/android/dialer/lookup/ForwardLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Xiao-Long Chen <chillermillerlong@hotmail.com>
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +21,8 @@
import android.location.Location;
import android.util.Log;
-import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.lookup.openstreetmap.OpenStreetMapForwardLookup;
+import com.android.dialer.phonenumbercache.ContactInfo;
import java.util.List;
diff --git a/java/com/android/dialer/lookup/LookupCache.java b/java/com/android/dialer/lookup/LookupCache.java
index 6fe3a9f..10305e5 100644
--- a/java/com/android/dialer/lookup/LookupCache.java
+++ b/java/com/android/dialer/lookup/LookupCache.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Xiao-Long Chen <chenxiaolong@cxl.epac.to>
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,9 +37,10 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.InputStreamReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -76,7 +78,7 @@
try {
out = new FileOutputStream(file);
- writer = new JsonWriter(new OutputStreamWriter(out, "UTF-8"));
+ writer = new JsonWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8));
writer.setIndent(" ");
List messages = new ArrayList();
@@ -135,7 +137,7 @@
try {
in = new FileInputStream(file);
- reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
+ reader = new JsonReader(new InputStreamReader(in, StandardCharsets.UTF_8));
reader.beginObject();
while (reader.hasNext()) {
@@ -249,7 +251,7 @@
try {
out = new FileOutputStream(image);
- bmp.compress(Bitmap.CompressFormat.WEBP, 100, out);
+ bmp.compress(Bitmap.CompressFormat.WEBP_LOSSLESS, 100, out);
return Uri.fromFile(image);
} catch (Exception e) {
e.printStackTrace();
diff --git a/java/com/android/dialer/lookup/LookupProvider.java b/java/com/android/dialer/lookup/LookupProvider.java
index ba8c2b6..725587c 100644
--- a/java/com/android/dialer/lookup/LookupProvider.java
+++ b/java/com/android/dialer/lookup/LookupProvider.java
@@ -17,6 +17,7 @@
package com.android.dialer.lookup;
+import android.annotation.SuppressLint;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
@@ -32,10 +33,9 @@
import android.provider.ContactsContract.Contacts;
import android.util.Log;
-import com.android.dialer.searchfragment.common.Projections;
import com.android.dialer.phonenumbercache.ContactInfo;
+import com.android.dialer.searchfragment.common.Projections;
import com.android.dialer.util.PermissionsUtil;
-import com.android.dialer.R;
import org.json.JSONArray;
import org.json.JSONException;
@@ -43,18 +43,18 @@
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeoutException;
import java.util.concurrent.TimeUnit;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.concurrent.TimeoutException;
public class LookupProvider extends ContentProvider {
private static final String TAG = LookupProvider.class.getSimpleName();
@@ -236,6 +236,7 @@
*
* @return The last location
*/
+ @SuppressLint("MissingPermission")
private Location getLastLocation() {
LocationManager locationManager = requireContext().getSystemService(LocationManager.class);
@@ -266,10 +267,7 @@
return null;
}
- try {
- filter = URLDecoder.decode(filter, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- }
+ filter = URLDecoder.decode(filter, StandardCharsets.UTF_8);
ArrayList<ContactInfo> results = new ArrayList<>();
if ((type == NEARBY || type == NEARBY_AND_PEOPLE) && lastLocation != null) {
@@ -385,8 +383,8 @@
* @return Instance of the thread
*/
private <T> T execute(Callable<T> callable, String name) {
- FutureCallable<T> futureCallable = new FutureCallable<T>(callable);
- FutureTask<T> future = new FutureTask<T>(futureCallable);
+ FutureCallable<T> futureCallable = new FutureCallable<>(callable);
+ FutureTask<T> future = new FutureTask<>(futureCallable);
futureCallable.setFuture(future);
synchronized (activeTasks) {
diff --git a/java/com/android/dialer/lookup/LookupSettings.java b/java/com/android/dialer/lookup/LookupSettings.java
index d7ad1d9..3c89f17 100644
--- a/java/com/android/dialer/lookup/LookupSettings.java
+++ b/java/com/android/dialer/lookup/LookupSettings.java
@@ -54,7 +54,7 @@
}
public static void setForwardLookupEnabled(Context context, boolean value) {
- getSharedPreferences(context).edit().putBoolean(ENABLE_FORWARD_LOOKUP, value).commit();
+ getSharedPreferences(context).edit().putBoolean(ENABLE_FORWARD_LOOKUP, value).apply();
}
public static boolean isReverseLookupEnabled(Context context) {
@@ -62,7 +62,7 @@
}
public static void setReverseLookupEnabled(Context context, boolean value) {
- getSharedPreferences(context).edit().putBoolean(ENABLE_REVERSE_LOOKUP, value).commit();
+ getSharedPreferences(context).edit().putBoolean(ENABLE_REVERSE_LOOKUP, value).apply();
}
public static String getForwardLookupProvider(Context context) {
@@ -70,7 +70,7 @@
}
public static void setForwardLookupProvider(Context context, String value) {
- getSharedPreferences(context).edit().putString(FORWARD_LOOKUP_PROVIDER, value).commit();
+ getSharedPreferences(context).edit().putString(FORWARD_LOOKUP_PROVIDER, value).apply();
}
public static String getReverseLookupProvider(Context context) {
@@ -78,6 +78,6 @@
}
public static void setReverseLookupProvider(Context context, String value) {
- getSharedPreferences(context).edit().putString(REVERSE_LOOKUP_PROVIDER, value).commit();
+ getSharedPreferences(context).edit().putString(REVERSE_LOOKUP_PROVIDER, value).apply();
}
}
diff --git a/java/com/android/dialer/lookup/LookupUtils.java b/java/com/android/dialer/lookup/LookupUtils.java
index 47271c6..f8174f6 100644
--- a/java/com/android/dialer/lookup/LookupUtils.java
+++ b/java/com/android/dialer/lookup/LookupUtils.java
@@ -144,7 +144,7 @@
Pattern pattern = Pattern.compile(regex, dotall ? Pattern.DOTALL : 0);
Matcher matcher = pattern.matcher(input);
- List<String> regexResults = new ArrayList<String>();
+ List<String> regexResults = new ArrayList<>();
while (matcher.find()) {
regexResults.add(matcher.group(1).trim());
}
diff --git a/java/com/android/dialer/lookup/ReverseLookup.java b/java/com/android/dialer/lookup/ReverseLookup.java
index ff19002..2df6459 100644
--- a/java/com/android/dialer/lookup/ReverseLookup.java
+++ b/java/com/android/dialer/lookup/ReverseLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Xiao-Long Chen <chillermillerlong@hotmail.com>
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +22,10 @@
import android.net.Uri;
import android.util.Log;
-import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.lookup.dastelefonbuch.TelefonbuchReverseLookup;
import com.android.dialer.lookup.yellowpages.YellowPagesReverseLookup;
import com.android.dialer.lookup.zabasearch.ZabaSearchReverseLookup;
+import com.android.dialer.phonenumbercache.ContactInfo;
import java.io.IOException;
diff --git a/java/com/android/dialer/lookup/ReverseLookupService.java b/java/com/android/dialer/lookup/ReverseLookupService.java
index 647ca5b..3391ae5 100644
--- a/java/com/android/dialer/lookup/ReverseLookupService.java
+++ b/java/com/android/dialer/lookup/ReverseLookupService.java
@@ -35,7 +35,6 @@
import java.io.IOException;
public class ReverseLookupService implements PhoneNumberService, Handler.Callback {
- private final HandlerThread backgroundThread;
private final Handler backgroundHandler;
private final Handler handler;
private final Context context;
@@ -49,7 +48,7 @@
telephonyManager = context.getSystemService(TelephonyManager.class);
// TODO: stop after a while?
- backgroundThread = new HandlerThread("ReverseLookup");
+ HandlerThread backgroundThread = new HandlerThread("ReverseLookup");
backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper(), this);
diff --git a/java/com/android/dialer/lookup/dastelefonbuch/TelefonbuchReverseLookup.java b/java/com/android/dialer/lookup/dastelefonbuch/TelefonbuchReverseLookup.java
index cd89499..dc6305e 100644
--- a/java/com/android/dialer/lookup/dastelefonbuch/TelefonbuchReverseLookup.java
+++ b/java/com/android/dialer/lookup/dastelefonbuch/TelefonbuchReverseLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Danny Baumann <dannybaumann@web.de>
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,14 +18,10 @@
package com.android.dialer.lookup.dastelefonbuch;
import android.content.Context;
-import android.net.Uri;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import android.provider.ContactsContract.CommonDataKinds.Website;
-import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.lookup.ContactBuilder;
import com.android.dialer.lookup.ReverseLookup;
+import com.android.dialer.phonenumbercache.ContactInfo;
import java.io.IOException;
diff --git a/java/com/android/dialer/lookup/openstreetmap/OpenStreetMapForwardLookup.java b/java/com/android/dialer/lookup/openstreetmap/OpenStreetMapForwardLookup.java
index 6d3a92d..e5ec00e 100644
--- a/java/com/android/dialer/lookup/openstreetmap/OpenStreetMapForwardLookup.java
+++ b/java/com/android/dialer/lookup/openstreetmap/OpenStreetMapForwardLookup.java
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2014 The OmniROM Project
* Copyright (C) 2014 Xiao-Long Chen <chillermillerlong@hotmail.com>
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,10 +26,10 @@
import android.provider.ContactsContract.CommonDataKinds.Website;
import android.util.Log;
-import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.lookup.ContactBuilder;
import com.android.dialer.lookup.ForwardLookup;
import com.android.dialer.lookup.LookupUtils;
+import com.android.dialer.phonenumbercache.ContactInfo;
import org.json.JSONArray;
import org.json.JSONException;
diff --git a/java/com/android/dialer/lookup/yellowpages/YellowPagesApi.java b/java/com/android/dialer/lookup/yellowpages/YellowPagesApi.java
index 30d5aaf..e5d90e7 100644
--- a/java/com/android/dialer/lookup/yellowpages/YellowPagesApi.java
+++ b/java/com/android/dialer/lookup/yellowpages/YellowPagesApi.java
@@ -16,7 +16,6 @@
package com.android.dialer.lookup.yellowpages;
-import android.content.Context;
import android.text.TextUtils;
import com.android.dialer.lookup.LookupUtils;
diff --git a/java/com/android/dialer/lookup/yellowpages/YellowPagesReverseLookup.java b/java/com/android/dialer/lookup/yellowpages/YellowPagesReverseLookup.java
index 5638df6..42e332e 100644
--- a/java/com/android/dialer/lookup/yellowpages/YellowPagesReverseLookup.java
+++ b/java/com/android/dialer/lookup/yellowpages/YellowPagesReverseLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Xiao-Long Chen <chillermillerlong@hotmail.com>
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,11 +25,11 @@
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.util.Log;
-import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.lookup.ContactBuilder;
import com.android.dialer.lookup.LookupSettings;
import com.android.dialer.lookup.LookupUtils;
import com.android.dialer.lookup.ReverseLookup;
+import com.android.dialer.phonenumbercache.ContactInfo;
import java.io.FileNotFoundException;
import java.io.IOException;
diff --git a/java/com/android/dialer/lookup/zabasearch/ZabaSearchReverseLookup.java b/java/com/android/dialer/lookup/zabasearch/ZabaSearchReverseLookup.java
index 5c6608b..16afd09 100644
--- a/java/com/android/dialer/lookup/zabasearch/ZabaSearchReverseLookup.java
+++ b/java/com/android/dialer/lookup/zabasearch/ZabaSearchReverseLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Xiao-Long Chen <chillermillerlong@hotmail.com>
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +19,9 @@
import android.content.Context;
-import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.lookup.ContactBuilder;
import com.android.dialer.lookup.ReverseLookup;
+import com.android.dialer.phonenumbercache.ContactInfo;
import java.io.IOException;
diff --git a/java/com/android/dialer/main/MainActivityPeer.java b/java/com/android/dialer/main/MainActivityPeer.java
index fe8d922..494bfc4 100644
--- a/java/com/android/dialer/main/MainActivityPeer.java
+++ b/java/com/android/dialer/main/MainActivityPeer.java
@@ -32,8 +32,6 @@
void onActivityStop();
- void onActivityDestroyed();
-
void onNewIntent(Intent intent);
void onSaveInstanceState(Bundle bundle);
diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java
index 380995b..966c323 100644
--- a/java/com/android/dialer/main/impl/MainActivity.java
+++ b/java/com/android/dialer/main/impl/MainActivity.java
@@ -27,6 +27,8 @@
import com.android.dialer.blockreportspam.ShowBlockReportSpamDialogReceiver;
import com.android.dialer.common.LogUtil;
import com.android.dialer.main.MainActivityPeer;
+
+import com.android.dialer.R;
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.TransactionSafeActivity;
diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java
index c2c1b4a..1309d1e 100644
--- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java
+++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java
@@ -260,7 +260,7 @@
new MainSpeedDialFragmentHost(
toolbar,
activity.findViewById(R.id.root_layout),
- activity.findViewById(R.id.coordinator_layout),
+ (ViewGroup) snackbarContainer,
activity.findViewById(R.id.fragment_container));
lastTabController = new LastTabController(activity, bottomNav, showVoicemailTab);
@@ -443,9 +443,6 @@
activity.getSystemService(KeyguardManager.class).isKeyguardLocked());
}
- @Override
- public void onActivityDestroyed() {}
-
private void showPostCallPrompt() {
if (TelecomUtil.isInManagedCall(activity)) {
// No prompt to show if the user is in a call
diff --git a/java/com/android/dialer/metrics/FutureTimer.java b/java/com/android/dialer/metrics/FutureTimer.java
index 3c3072f..b0c7694 100644
--- a/java/com/android/dialer/metrics/FutureTimer.java
+++ b/java/com/android/dialer/metrics/FutureTimer.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,8 +28,10 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+
import javax.inject.Inject;
/** Applies logcat and metric logging to a supplied future. */
diff --git a/java/com/android/dialer/notification/DialerNotificationManager.java b/java/com/android/dialer/notification/DialerNotificationManager.java
index 767ef41..385f50b 100644
--- a/java/com/android/dialer/notification/DialerNotificationManager.java
+++ b/java/com/android/dialer/notification/DialerNotificationManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +29,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+
import java.util.HashSet;
import java.util.Set;
diff --git a/java/com/android/dialer/notification/NotificationChannelManager.java b/java/com/android/dialer/notification/NotificationChannelManager.java
index 9c71fb4..ba51125 100644
--- a/java/com/android/dialer/notification/NotificationChannelManager.java
+++ b/java/com/android/dialer/notification/NotificationChannelManager.java
@@ -29,6 +29,7 @@
import com.android.dialer.R;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+
import java.util.Set;
/** Creates all notification channels for Dialer. */
@@ -116,7 +117,7 @@
new NotificationChannel(
NotificationChannelId.INCOMING_CALL,
context.getText(R.string.notification_channel_incoming_call),
- NotificationManager.IMPORTANCE_MAX);
+ NotificationManager.IMPORTANCE_HIGH);
channel.setShowBadge(false);
channel.enableLights(true);
channel.enableVibration(false);
diff --git a/java/com/android/dialer/notification/NotificationThrottler.java b/java/com/android/dialer/notification/NotificationThrottler.java
index c34a883..aadc602 100644
--- a/java/com/android/dialer/notification/NotificationThrottler.java
+++ b/java/com/android/dialer/notification/NotificationThrottler.java
@@ -27,8 +27,8 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
diff --git a/java/com/android/dialer/notification/VoicemailChannelUtils.java b/java/com/android/dialer/notification/VoicemailChannelUtils.java
index ac41cf6..1b77a49 100644
--- a/java/com/android/dialer/notification/VoicemailChannelUtils.java
+++ b/java/com/android/dialer/notification/VoicemailChannelUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +38,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.util.PermissionsUtil;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
diff --git a/java/com/android/dialer/oem/CequintCallerIdManager.java b/java/com/android/dialer/oem/CequintCallerIdManager.java
index 6620074..69cc84a 100644
--- a/java/com/android/dialer/oem/CequintCallerIdManager.java
+++ b/java/com/android/dialer/oem/CequintCallerIdManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +32,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.google.auto.value.AutoValue;
+
import java.util.concurrent.ConcurrentHashMap;
/**
diff --git a/java/com/android/dialer/oem/CequintPackageUtils.java b/java/com/android/dialer/oem/CequintPackageUtils.java
index 010d54d..70e16aa 100644
--- a/java/com/android/dialer/oem/CequintPackageUtils.java
+++ b/java/com/android/dialer/oem/CequintPackageUtils.java
@@ -25,6 +25,7 @@
import androidx.annotation.Nullable;
import com.android.dialer.common.LogUtil;
+
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
diff --git a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java
index 2453a76..595b3fd 100644
--- a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java
+++ b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* This file is derived in part from code issued under the following license.
*
@@ -23,7 +24,9 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+
import com.android.dialer.common.LogUtil;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
diff --git a/java/com/android/dialer/oem/MotorolaUtils.java b/java/com/android/dialer/oem/MotorolaUtils.java
index 4a74034..e40792f 100644
--- a/java/com/android/dialer/oem/MotorolaUtils.java
+++ b/java/com/android/dialer/oem/MotorolaUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,8 +20,10 @@
import android.content.res.Resources;
import android.provider.CallLog.Calls;
import android.telephony.TelephonyManager;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.PackageUtils;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -29,7 +32,7 @@
// This is used to check if a Motorola device supports HD voice call feature, which comes from
// system feature setting.
- private static final String HD_CALL_FEATRURE = "com.motorola.software.sprint.hd_call";
+ private static final String HD_CALL_FEATURE = "com.motorola.software.sprint.hd_call";
// This is used to check if a Motorola device supports WiFi call feature, by checking if a certain
// package is enabled.
private static final String WIFI_CALL_PACKAGE_NAME = "com.motorola.sprintwfc";
@@ -112,7 +115,7 @@
private static boolean isSupportingSprintHdCodec(Context context) {
return isSpnMatched(context)
&& context.getResources().getBoolean(R.bool.motorola_sprint_hd_codec)
- && context.getPackageManager().hasSystemFeature(HD_CALL_FEATRURE);
+ && context.getPackageManager().hasSystemFeature(HD_CALL_FEATURE);
}
private static boolean isSupportingSprintWifiCall(Context context) {
diff --git a/java/com/android/dialer/oem/PhoneNumberUtilsAccessor.java b/java/com/android/dialer/oem/PhoneNumberUtilsAccessor.java
index 178a7b2..abbc764 100644
--- a/java/com/android/dialer/oem/PhoneNumberUtilsAccessor.java
+++ b/java/com/android/dialer/oem/PhoneNumberUtilsAccessor.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.telephony.PhoneNumberUtils;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
diff --git a/java/com/android/dialer/oem/SystemPropertiesAccessor.java b/java/com/android/dialer/oem/SystemPropertiesAccessor.java
index e069a8e..4605bf2 100644
--- a/java/com/android/dialer/oem/SystemPropertiesAccessor.java
+++ b/java/com/android/dialer/oem/SystemPropertiesAccessor.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import androidx.annotation.Nullable;
import com.android.dialer.common.LogUtil;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
diff --git a/java/com/android/dialer/oem/TranssionUtils.java b/java/com/android/dialer/oem/TranssionUtils.java
index 43ca43e..de8df20 100644
--- a/java/com/android/dialer/oem/TranssionUtils.java
+++ b/java/com/android/dialer/oem/TranssionUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.os.Build;
+
import com.android.dialer.common.Assert;
import com.android.dialer.compat.telephony.TelephonyManagerCompat;
import com.google.common.collect.ImmutableSet;
diff --git a/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java b/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java
index e3dbbcf..be9bd71 100644
--- a/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java
+++ b/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java
@@ -41,6 +41,7 @@
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.List;
/**
@@ -201,10 +202,7 @@
if (files == null) {
files = new File[0];
}
- Arrays.sort(
- files,
- (File lhs, File rhs) ->
- Long.compare(Long.valueOf(lhs.getName()), Long.valueOf(rhs.getName())));
+ Arrays.sort(files, Comparator.comparingLong((File lhs) -> Long.valueOf(lhs.getName())));
return files;
}
diff --git a/java/com/android/dialer/phonelookup/PhoneLookupComponent.java b/java/com/android/dialer/phonelookup/PhoneLookupComponent.java
index 70743c8..3a13ae2 100644
--- a/java/com/android/dialer/phonelookup/PhoneLookupComponent.java
+++ b/java/com/android/dialer/phonelookup/PhoneLookupComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +17,11 @@
package com.android.dialer.phonelookup;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
import com.android.dialer.phonelookup.composite.CompositePhoneLookup;
+
import dagger.Subcomponent;
/** Dagger component for the PhoneLookup package. */
diff --git a/java/com/android/dialer/phonelookup/PhoneLookupModule.java b/java/com/android/dialer/phonelookup/PhoneLookupModule.java
index dd52470..813e2e1 100644
--- a/java/com/android/dialer/phonelookup/PhoneLookupModule.java
+++ b/java/com/android/dialer/phonelookup/PhoneLookupModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import com.android.dialer.phonelookup.cp2.Cp2ExtendedDirectoryPhoneLookup;
import com.android.dialer.phonelookup.emergency.EmergencyPhoneLookup;
import com.google.common.collect.ImmutableList;
+
import dagger.Module;
import dagger.Provides;
@@ -31,7 +33,7 @@
public abstract class PhoneLookupModule {
@Provides
- @SuppressWarnings({"unchecked", "rawtype"})
+ @SuppressWarnings("rawtypes")
static ImmutableList<PhoneLookup> providePhoneLookupList(
CequintPhoneLookup cequintPhoneLookup,
CnapPhoneLookup cnapPhoneLookup,
diff --git a/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java b/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java
index 8c3e50e..c9232aa 100644
--- a/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +43,9 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.util.Set;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java b/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java
index 4426eb8..875b9bc 100644
--- a/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Context;
import android.telecom.Call;
import android.text.TextUtils;
+
import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.common.Assert;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
@@ -37,6 +39,7 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import javax.inject.Inject;
/** PhoneLookup implementation for Cequint. */
diff --git a/java/com/android/dialer/phonelookup/cnap/CnapPhoneLookup.java b/java/com/android/dialer/phonelookup/cnap/CnapPhoneLookup.java
index 1b78a8e..657e480 100644
--- a/java/com/android/dialer/phonelookup/cnap/CnapPhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/cnap/CnapPhoneLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.database.Cursor;
import android.telecom.Call;
import android.text.TextUtils;
+
import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
@@ -36,6 +38,7 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.protobuf.InvalidProtocolBufferException;
+
import javax.inject.Inject;
/** PhoneLookup implementation for CNAP info. */
diff --git a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java
index 30b107a..734f6d0 100644
--- a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,9 +43,11 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java b/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java
index 5ef6c1f..9ab3e86 100644
--- a/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java
+++ b/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import com.android.dialer.phonelookup.PhoneLookupInfo.PeopleApiInfo;
import com.android.dialer.phonelookup.PhoneLookupInfo.PeopleApiInfo.InfoType;
import com.google.common.collect.ImmutableList;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java
index e748cbc..bab7ca3 100644
--- a/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java
@@ -352,8 +352,8 @@
try (Cursor cursor =
queryPhoneLookup(new String[] {ContactsContract.PhoneLookup.CONTACT_ID}, rawNumber)) {
if (cursor == null) {
- LogUtil.w(
- "Cp2DefaultDirectoryPhoneLookup.queryPhoneLookupTableForContactIdsBasedOnRawNumber",
+ LogUtil.w("Cp2DefaultDirectoryPhoneLookup." +
+ "queryPhoneLookupTableForContactIdsBasedOnRawNumber",
"null cursor");
return contactIds;
}
@@ -854,7 +854,7 @@
Phone.CONTENT_URI,
projection,
Phone.NORMALIZED_NUMBER + " IN (" + questionMarks(validE164Numbers.size()) + ")",
- validE164Numbers.toArray(new String[validE164Numbers.size()]),
+ validE164Numbers.toArray(new String[0]),
null);
}
diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java
index d86b2a4..548c92b 100644
--- a/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Directory;
+
import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
@@ -36,9 +38,11 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2Projections.java b/java/com/android/dialer/phonelookup/cp2/Cp2Projections.java
index 38390e5..dd0f7f8 100644
--- a/java/com/android/dialer/phonelookup/cp2/Cp2Projections.java
+++ b/java/com/android/dialer/phonelookup/cp2/Cp2Projections.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.PhoneLookup;
import android.text.TextUtils;
+
import com.android.dialer.phonelookup.PhoneLookupInfo.Cp2Info.Cp2ContactInfo;
/**
diff --git a/java/com/android/dialer/phonelookup/cp2/MissingPermissionsOperations.java b/java/com/android/dialer/phonelookup/cp2/MissingPermissionsOperations.java
index a241368..c7e3554 100644
--- a/java/com/android/dialer/phonelookup/cp2/MissingPermissionsOperations.java
+++ b/java/com/android/dialer/phonelookup/cp2/MissingPermissionsOperations.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.database.Cursor;
+
import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
@@ -32,7 +34,9 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.protobuf.InvalidProtocolBufferException;
+
import java.util.function.Predicate;
+
import javax.inject.Inject;
/** Shared logic for handling missing permissions in CP2 lookups. */
diff --git a/java/com/android/dialer/phonelookup/database/PhoneLookupDatabaseComponent.java b/java/com/android/dialer/phonelookup/database/PhoneLookupDatabaseComponent.java
index 92659c1..e8fca24 100644
--- a/java/com/android/dialer/phonelookup/database/PhoneLookupDatabaseComponent.java
+++ b/java/com/android/dialer/phonelookup/database/PhoneLookupDatabaseComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +17,10 @@
package com.android.dialer.phonelookup.database;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
+
import dagger.Subcomponent;
/** Dagger component for database package. */
diff --git a/java/com/android/dialer/phonelookup/database/PhoneLookupHistoryContentProvider.java b/java/com/android/dialer/phonelookup/database/PhoneLookupHistoryContentProvider.java
index c837fe3..3a2762f 100644
--- a/java/com/android/dialer/phonelookup/database/PhoneLookupHistoryContentProvider.java
+++ b/java/com/android/dialer/phonelookup/database/PhoneLookupHistoryContentProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +37,7 @@
import com.android.dialer.common.LogUtil;
import com.android.dialer.phonelookup.database.contract.PhoneLookupHistoryContract;
import com.android.dialer.phonelookup.database.contract.PhoneLookupHistoryContract.PhoneLookupHistory;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
diff --git a/java/com/android/dialer/phonelookup/database/PhoneLookupHistoryDatabaseHelper.java b/java/com/android/dialer/phonelookup/database/PhoneLookupHistoryDatabaseHelper.java
index 337e467..27dfe87 100644
--- a/java/com/android/dialer/phonelookup/database/PhoneLookupHistoryDatabaseHelper.java
+++ b/java/com/android/dialer/phonelookup/database/PhoneLookupHistoryDatabaseHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +21,14 @@
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.SystemClock;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
import com.android.dialer.inject.ApplicationContext;
import com.android.dialer.phonelookup.database.contract.PhoneLookupHistoryContract.PhoneLookupHistory;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import javax.inject.Inject;
import javax.inject.Singleton;
diff --git a/java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java b/java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java
index a195926..6703989 100644
--- a/java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java
+++ b/java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +18,12 @@
package com.android.dialer.phonelookup.database.contract;
import android.net.Uri;
+
import com.android.dialer.constants.Constants;
/** Contract for the PhoneLookupHistory content provider. */
public class PhoneLookupHistoryContract {
- public static final String AUTHORITY = Constants.get().getPhoneLookupHistoryProviderAuthority();
+ public static final String AUTHORITY = Constants.PHONE_LOOKUP_HISTORY_PROVIDER_AUTHORITY;
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
diff --git a/java/com/android/dialer/phonelookup/emergency/EmergencyPhoneLookup.java b/java/com/android/dialer/phonelookup/emergency/EmergencyPhoneLookup.java
index d31614a..e1be247 100644
--- a/java/com/android/dialer/phonelookup/emergency/EmergencyPhoneLookup.java
+++ b/java/com/android/dialer/phonelookup/emergency/EmergencyPhoneLookup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.dialer.phonelookup.emergency;
import android.content.Context;
+
import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
import com.android.dialer.inject.ApplicationContext;
@@ -29,6 +31,7 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import javax.inject.Inject;
/**
@@ -57,7 +60,7 @@
() ->
EmergencyInfo.newBuilder()
.setIsEmergencyNumber(
- PhoneNumberHelper.isLocalEmergencyNumber(
+ PhoneNumberHelper.isEmergencyNumber(
appContext, dialerPhoneNumber.getNormalizedNumber()))
.build());
}
diff --git a/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java b/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java
index 74f701c..d1b2cda 100644
--- a/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java
+++ b/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@
import androidx.annotation.WorkerThread;
import com.android.dialer.logging.ContactSource;
+
import java.io.InputStream;
public interface CachedNumberLookupService {
diff --git a/java/com/android/dialer/phonenumbercache/CallLogQuery.java b/java/com/android/dialer/phonenumbercache/CallLogQuery.java
index 78a0049..a183870 100644
--- a/java/com/android/dialer/phonenumbercache/CallLogQuery.java
+++ b/java/com/android/dialer/phonenumbercache/CallLogQuery.java
@@ -21,10 +21,6 @@
import androidx.annotation.NonNull;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
/** The query for the call log table. */
public final class CallLogQuery {
diff --git a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
index 122d6d2..f6e3b7a 100644
--- a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
+++ b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
@@ -1,15 +1,18 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS 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
+ * 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
+ * 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.
+ * 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.phonenumbercache;
@@ -45,11 +48,13 @@
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.PermissionsUtil;
import com.android.dialer.util.UriUtils;
-import java.util.ArrayList;
-import java.util.List;
+
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.ArrayList;
+import java.util.List;
+
/** Utility class to look up the contact information for a given number. */
public class ContactInfoHelper {
diff --git a/java/com/android/dialer/phonenumbercache/PhoneNumberCache.java b/java/com/android/dialer/phonenumbercache/PhoneNumberCache.java
index c29eb77..6071ce4 100644
--- a/java/com/android/dialer/phonenumbercache/PhoneNumberCache.java
+++ b/java/com/android/dialer/phonenumbercache/PhoneNumberCache.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.dialer.phonenumbercache;
import android.content.Context;
+
import java.util.Objects;
/** Accessor for the phone number cache bindings. */
diff --git a/java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtilComponent.java b/java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtilComponent.java
index a49005e..fd3c9f9 100644
--- a/java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtilComponent.java
+++ b/java/com/android/dialer/phonenumbergeoutil/PhoneNumberGeoUtilComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,9 @@
package com.android.dialer.phonenumbergeoutil;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
+
import dagger.Subcomponent;
/** Dagger component for phone number geo util. */
diff --git a/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java b/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java
index 89fe04a..ebda26d 100644
--- a/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java
+++ b/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.text.TextUtils;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.i18n.LocaleUtils;
import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtil;
@@ -25,7 +27,9 @@
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.Phonenumber;
import com.google.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder;
+
import java.util.Locale;
+
import javax.inject.Inject;
/** Implementation of {@link PhoneNumberGeoUtil}. */
diff --git a/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilModule.java b/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilModule.java
index 3878ac5..ab8bfb2 100644
--- a/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilModule.java
+++ b/java/com/android/dialer/phonenumbergeoutil/impl/PhoneNumberGeoUtilModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +18,11 @@
package com.android.dialer.phonenumbergeoutil.impl;
import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtil;
+
+import javax.inject.Singleton;
+
import dagger.Binds;
import dagger.Module;
-import javax.inject.Singleton;
/** Module which binds {@link PhoneNumberGeoUtilImpl}. */
@Module
diff --git a/java/com/android/dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java b/java/com/android/dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java
index 06cd137..6b6da4e 100644
--- a/java/com/android/dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java
+++ b/java/com/android/dialer/phonenumbergeoutil/stub/PhoneNumberGeoUtilStub.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,9 @@
package com.android.dialer.phonenumbergeoutil.stub;
import android.content.Context;
+
import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtil;
+
import javax.inject.Inject;
/** Stub implementation of {@link PhoneNumberGeoUtil}. */
diff --git a/java/com/android/dialer/phonenumbergeoutil/stub/StubPhoneNumberGeoUtilModule.java b/java/com/android/dialer/phonenumbergeoutil/stub/StubPhoneNumberGeoUtilModule.java
index 82252cc..0b702bc 100644
--- a/java/com/android/dialer/phonenumbergeoutil/stub/StubPhoneNumberGeoUtilModule.java
+++ b/java/com/android/dialer/phonenumbergeoutil/stub/StubPhoneNumberGeoUtilModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +18,11 @@
package com.android.dialer.phonenumbergeoutil.stub;
import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtil;
+
+import javax.inject.Singleton;
+
import dagger.Binds;
import dagger.Module;
-import javax.inject.Singleton;
/** Module which binds {@link PhoneNumberGeoUtilStub}. */
@Module
diff --git a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
index f080521..22c847e 100644
--- a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
+++ b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +24,6 @@
import android.provider.CallLog;
import android.telecom.PhoneAccountHandle;
import android.telephony.PhoneNumberUtils;
-import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;
@@ -38,13 +38,12 @@
import com.android.dialer.compat.telephony.TelephonyManagerCompat;
import com.android.dialer.i18n.LocaleUtils;
import com.android.dialer.oem.MotorolaUtils;
-import com.android.dialer.oem.PhoneNumberUtilsAccessor;
import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtilComponent;
import com.android.dialer.telecom.TelecomUtil;
-import com.google.common.base.Optional;
+
import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
+import java.util.Objects;
import java.util.Set;
public class PhoneNumberHelper {
@@ -144,37 +143,13 @@
return rawNumber1.equals(rawNumber2);
}
- /**
- * An enhanced version of {@link PhoneNumberUtils#isLocalEmergencyNumber(Context, String)}.
- *
- * <p>This methods supports checking the number for all SIMs.
- *
- * @param context the context which the number should be checked against
- * @param number the number to tbe checked
- * @return true if the specified number is an emergency number for any SIM in the device.
- */
- @SuppressWarnings("Guava")
- public static boolean isLocalEmergencyNumber(Context context, String number) {
- List<PhoneAccountHandle> phoneAccountHandles =
- TelecomUtil.getSubscriptionPhoneAccounts(context);
+ public static boolean isEmergencyNumber(Context context, String number) {
+ TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class);
+ return telephonyManager.isEmergencyNumber(number);
+ }
- // If the number of phone accounts with a subscription is no greater than 1, only one SIM is
- // installed in the device. We hand over the job to PhoneNumberUtils#isLocalEmergencyNumber.
- if (phoneAccountHandles.size() <= 1) {
- return PhoneNumberUtils.isLocalEmergencyNumber(context, number);
- }
-
- for (PhoneAccountHandle phoneAccountHandle : phoneAccountHandles) {
- Optional<SubscriptionInfo> subscriptionInfo =
- TelecomUtil.getSubscriptionInfo(context, phoneAccountHandle);
- if (subscriptionInfo.isPresent()
- && PhoneNumberUtilsAccessor.isLocalEmergencyNumber(
- context, subscriptionInfo.get().getSubscriptionId(), number)) {
- return true;
- }
- }
-
- return false;
+ public static boolean isEmergencyNumber(Context context, String number, String countryIso) {
+ return isEmergencyNumber(context, PhoneNumberUtils.formatNumberToE164(number, countryIso));
}
/**
@@ -197,32 +172,6 @@
return number != null && isUriNumber(number.toString());
}
- public static boolean isUnknownNumberThatCanBeLookedUp(
- Context context, PhoneAccountHandle accountHandle, CharSequence number, int presentation) {
- if (presentation == CallLog.Calls.PRESENTATION_UNKNOWN) {
- return false;
- }
- if (presentation == CallLog.Calls.PRESENTATION_RESTRICTED) {
- return false;
- }
- if (presentation == CallLog.Calls.PRESENTATION_UNAVAILABLE) {
- return false;
- }
- if (presentation == CallLog.Calls.PRESENTATION_PAYPHONE) {
- return false;
- }
- if (TextUtils.isEmpty(number)) {
- return false;
- }
- if (isVoicemailNumber(context, accountHandle, number)) {
- return false;
- }
- if (isLegacyUnknownNumbers(number)) {
- return false;
- }
- return true;
- }
-
public static boolean isLegacyUnknownNumbers(CharSequence number) {
return number != null && LEGACY_UNKNOWN_NUMBERS.contains(number.toString());
}
@@ -406,4 +355,34 @@
return context.getString(R.string.private_num_non_verizon);
}
}
+
+ public static boolean compareSipAddresses(@Nullable String number1, @Nullable String number2) {
+ if (number1 == null || number2 == null) {
+ return Objects.equals(number1, number2);
+ }
+
+ int index1 = number1.indexOf('@');
+ final String userinfo1;
+ final String rest1;
+ if (index1 != -1) {
+ userinfo1 = number1.substring(0, index1);
+ rest1 = number1.substring(index1);
+ } else {
+ userinfo1 = number1;
+ rest1 = "";
+ }
+
+ int index2 = number2.indexOf('@');
+ final String userinfo2;
+ final String rest2;
+ if (index2 != -1) {
+ userinfo2 = number2.substring(0, index2);
+ rest2 = number2.substring(index2);
+ } else {
+ userinfo2 = number2;
+ rest2 = "";
+ }
+
+ return userinfo1.equals(userinfo2) && rest1.equalsIgnoreCase(rest2);
+ }
}
diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java
index 26de1d6..3fc42b5 100644
--- a/java/com/android/dialer/postcall/PostCall.java
+++ b/java/com/android/dialer/postcall/PostCall.java
@@ -89,7 +89,8 @@
Snackbar.make(rootView, message, durationMs)
.setAction(actionText, onClickListener)
.setActionTextColor(
- activity.getResources().getColor(R.color.dialer_snackbar_action_text_color));
+ activity.getResources().getColor(R.color.dialer_snackbar_action_text_color,
+ activity.getTheme()));
activeSnackbar.show();
StorageComponent.get(activity)
.unencryptedSharedPrefs()
@@ -115,7 +116,8 @@
Snackbar.make(rootView, message, Snackbar.LENGTH_LONG)
.setAction(addMessage, onClickListener)
.setActionTextColor(
- activity.getResources().getColor(R.color.dialer_snackbar_action_text_color))
+ activity.getResources().getColor(R.color.dialer_snackbar_action_text_color,
+ activity.getTheme()))
.addCallback(
new BaseTransientBottomBar.BaseCallback<Snackbar>() {
@Override
diff --git a/java/com/android/dialer/postcall/PostCallActivity.java b/java/com/android/dialer/postcall/PostCallActivity.java
index 6988ad0..44e2014 100644
--- a/java/com/android/dialer/postcall/PostCallActivity.java
+++ b/java/com/android/dialer/postcall/PostCallActivity.java
@@ -123,7 +123,4 @@
startActivity(intent);
}
}
-
- @Override
- public void onMessageFragmentAfterTextChange(String message) {}
}
diff --git a/java/com/android/dialer/precall/PreCallComponent.java b/java/com/android/dialer/precall/PreCallComponent.java
index 2f5bf78..b98de35 100644
--- a/java/com/android/dialer/precall/PreCallComponent.java
+++ b/java/com/android/dialer/precall/PreCallComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import com.android.dialer.inject.HasRootComponent;
import com.google.common.collect.ImmutableList;
+
import dagger.Subcomponent;
/** Daggaer component for {@link PreCall} */
diff --git a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java
index 4aed1a5..a02e694 100644
--- a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java
+++ b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java
@@ -17,7 +17,6 @@
package com.android.dialer.precall.externalreceiver;
-import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
diff --git a/java/com/android/dialer/precall/impl/AssistedDialAction.java b/java/com/android/dialer/precall/impl/AssistedDialAction.java
index 44b7255..3f48817 100644
--- a/java/com/android/dialer/precall/impl/AssistedDialAction.java
+++ b/java/com/android/dialer/precall/impl/AssistedDialAction.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Context;
import android.os.Bundle;
import android.telecom.PhoneAccount;
+
import com.android.dialer.assisteddialing.AssistedDialingMediator;
import com.android.dialer.assisteddialing.ConcreteCreator;
import com.android.dialer.assisteddialing.TransformationInfo;
@@ -29,6 +31,7 @@
import com.android.dialer.precall.PreCallAction;
import com.android.dialer.precall.PreCallCoordinator;
import com.android.dialer.util.CallUtil;
+
import java.util.Optional;
/** Rewrites the call URI with country code. */
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index 46cac7f..671c6c6 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -30,7 +30,6 @@
import androidx.fragment.app.FragmentActivity;
import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment;
-import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener;
import com.android.contacts.common.widget.SelectPhoneAccountDialogOptions;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.common.Assert;
@@ -182,7 +181,8 @@
pendingAction,
new PreferredAccountRecorder(number, suggestion, dataId)));
selectPhoneAccountDialogFragment.show(
- ((FragmentActivity) coordinator.getActivity()).getSupportFragmentManager(), TAG_CALLING_ACCOUNT_SELECTOR);
+ ((FragmentActivity) coordinator.getActivity()).getSupportFragmentManager(),
+ TAG_CALLING_ACCOUNT_SELECTOR);
}
@MainThread
@@ -194,7 +194,8 @@
}
}
- private class SelectedListener extends SelectPhoneAccountListener {
+ private class SelectedListener extends
+ SelectPhoneAccountDialogFragment.SelectPhoneAccountListener {
private final PreCallCoordinator coordinator;
private final PreCallCoordinator.PendingAction listener;
diff --git a/java/com/android/dialer/precall/impl/PermissionCheckAction.java b/java/com/android/dialer/precall/impl/PermissionCheckAction.java
index 9377c25..83c872e 100644
--- a/java/com/android/dialer/precall/impl/PermissionCheckAction.java
+++ b/java/com/android/dialer/precall/impl/PermissionCheckAction.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.widget.Toast;
+
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.precall.PreCallAction;
import com.android.dialer.precall.PreCallCoordinator;
diff --git a/java/com/android/dialer/precall/impl/PreCallActivity.java b/java/com/android/dialer/precall/impl/PreCallActivity.java
index 4ff071c..e2e5e1c 100644
--- a/java/com/android/dialer/precall/impl/PreCallActivity.java
+++ b/java/com/android/dialer/precall/impl/PreCallActivity.java
@@ -17,7 +17,6 @@
package com.android.dialer.precall.impl;
-import android.app.Activity;
import android.app.KeyguardManager;
import android.os.Bundle;
import android.view.WindowManager.LayoutParams;
diff --git a/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java b/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
index 476202b..d320f72 100644
--- a/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
+++ b/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
@@ -35,7 +35,6 @@
import com.android.dialer.precall.PreCallComponent;
import com.android.dialer.precall.PreCallCoordinator;
import com.android.dialer.telecom.TelecomUtil;
-import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
diff --git a/java/com/android/dialer/precall/impl/PreCallImpl.java b/java/com/android/dialer/precall/impl/PreCallImpl.java
index 34d0745..e7c28a4 100644
--- a/java/com/android/dialer/precall/impl/PreCallImpl.java
+++ b/java/com/android/dialer/precall/impl/PreCallImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import com.android.dialer.precall.PreCallAction;
import com.android.dialer.precall.PreCallCoordinator;
import com.google.common.collect.ImmutableList;
+
import javax.inject.Inject;
/** Implementation of {@link PreCall} */
diff --git a/java/com/android/dialer/precall/impl/PreCallModule.java b/java/com/android/dialer/precall/impl/PreCallModule.java
index 7d5ee79..d5ee63e 100644
--- a/java/com/android/dialer/precall/impl/PreCallModule.java
+++ b/java/com/android/dialer/precall/impl/PreCallModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,10 +20,12 @@
import com.android.dialer.precall.PreCall;
import com.android.dialer.precall.PreCallAction;
import com.google.common.collect.ImmutableList;
+
+import javax.inject.Singleton;
+
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
-import javax.inject.Singleton;
/** Dagger module for {@link PreCall}. */
@Module
diff --git a/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java b/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java
index b3fb4d5..0412b1f 100644
--- a/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java
+++ b/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.telephony.PhoneNumberUtils;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.precall.impl.MalformedNumberRectifier.MalformedNumberHandler;
import com.google.common.base.Optional;
diff --git a/java/com/android/dialer/preferredsim/PreferredAccountRecorder.java b/java/com/android/dialer/preferredsim/PreferredAccountRecorder.java
index 142fefe..ab5f31b 100644
--- a/java/com/android/dialer/preferredsim/PreferredAccountRecorder.java
+++ b/java/com/android/dialer/preferredsim/PreferredAccountRecorder.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +49,8 @@
/**
* Record the result from {@link
- * com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener#onPhoneAccountSelected}
+ * com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener
+ * #onPhoneAccountSelected}
*/
public void record(
Context context, PhoneAccountHandle selectedAccountHandle, boolean setDefault) {
@@ -76,8 +78,8 @@
private final PhoneAccountHandle phoneAccountHandle;
private final boolean remember;
- public UserSelectionReporter(
- @NonNull PhoneAccountHandle phoneAccountHandle, @Nullable String number, boolean remember) {
+ public UserSelectionReporter(@NonNull PhoneAccountHandle phoneAccountHandle,
+ @Nullable String number, boolean remember) {
this.phoneAccountHandle = Assert.isNotNull(phoneAccountHandle);
this.number = Assert.isNotNull(number);
this.remember = remember;
@@ -127,7 +129,7 @@
PreferredSimFallbackContract.CONTENT_URI,
values,
PreferredSim.DATA_ID + " = ?",
- new String[] {String.valueOf(input.dataId)});
+ new String[] {input.dataId});
return null;
}
}
diff --git a/java/com/android/dialer/preferredsim/PreferredAccountUtil.java b/java/com/android/dialer/preferredsim/PreferredAccountUtil.java
index 9ebc0eb..7fc1547 100644
--- a/java/com/android/dialer/preferredsim/PreferredAccountUtil.java
+++ b/java/com/android/dialer/preferredsim/PreferredAccountUtil.java
@@ -40,8 +40,10 @@
* device.
*/
@NonNull
- public static Optional<PhoneAccountHandle> getValidPhoneAccount(
- @NonNull Context context, @Nullable String componentNameString, @Nullable String idString) {
+ public static Optional<PhoneAccountHandle> getValidPhoneAccount(@NonNull Context context,
+ @Nullable String
+ componentNameString,
+ @Nullable String idString) {
if (TextUtils.isEmpty(componentNameString) || TextUtils.isEmpty(idString)) {
LogUtil.i("PreferredAccountUtil.getValidPhoneAccount", "empty componentName or id");
return Optional.absent();
diff --git a/java/com/android/dialer/preferredsim/PreferredAccountWorker.java b/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
index 965d088..e7bed83 100644
--- a/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
+++ b/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +18,13 @@
package com.android.dialer.preferredsim;
import android.telecom.PhoneAccountHandle;
+
import com.android.contacts.common.widget.SelectPhoneAccountDialogOptions;
import com.android.dialer.preferredsim.suggestion.SuggestionProvider.Suggestion;
import com.google.auto.value.AutoValue;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.ListenableFuture;
+
import java.util.List;
/** Query a preferred SIM to make a call with. */
diff --git a/java/com/android/dialer/preferredsim/PreferredSimComponent.java b/java/com/android/dialer/preferredsim/PreferredSimComponent.java
index b8d7fa1..9f2eb14 100644
--- a/java/com/android/dialer/preferredsim/PreferredSimComponent.java
+++ b/java/com/android/dialer/preferredsim/PreferredSimComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,9 @@
package com.android.dialer.preferredsim;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
+
import dagger.Subcomponent;
/** Component for preferred SIM */
diff --git a/java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java b/java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java
index 6c2f860..594ff7b 100644
--- a/java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java
+++ b/java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds;
import android.telecom.PhoneAccountHandle;
+
import com.android.dialer.constants.Constants;
/**
@@ -37,7 +39,7 @@
* Check the meta-data "com.android.dialer.PREFERRED_SIM_FALLBACK_AUTHORITY" to get the authority
* of the default dialer if it support it.
*/
- public static final String AUTHORITY = Constants.get().getPreferredSimFallbackProviderAuthority();
+ public static final String AUTHORITY = Constants.PREFERRED_SIM_FALLBACK_PROVIDER_AUTHORITY;
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
diff --git a/java/com/android/dialer/preferredsim/PreferredSimModule.java b/java/com/android/dialer/preferredsim/PreferredSimModule.java
index bdc6a5a..717863e 100644
--- a/java/com/android/dialer/preferredsim/PreferredSimModule.java
+++ b/java/com/android/dialer/preferredsim/PreferredSimModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.dialer.preferredsim;
import com.android.dialer.preferredsim.impl.PreferredAccountWorkerImpl;
+
import dagger.Binds;
import dagger.Module;
diff --git a/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java b/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java
index 0302232..cc649b3 100644
--- a/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java
+++ b/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java
@@ -62,8 +62,10 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+
import java.util.List;
import java.util.Objects;
+
import javax.inject.Inject;
/** Implements {@link PreferredAccountWorker}. */
diff --git a/java/com/android/dialer/preferredsim/impl/PreferredSimDatabaseHelper.java b/java/com/android/dialer/preferredsim/impl/PreferredSimDatabaseHelper.java
index 4795ea4..b47ef4a 100644
--- a/java/com/android/dialer/preferredsim/impl/PreferredSimDatabaseHelper.java
+++ b/java/com/android/dialer/preferredsim/impl/PreferredSimDatabaseHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.preferredsim.PreferredSimFallbackContract.PreferredSim;
diff --git a/java/com/android/dialer/preferredsim/suggestion/SimSuggestionComponent.java b/java/com/android/dialer/preferredsim/suggestion/SimSuggestionComponent.java
index 5e3791b..255c67f 100644
--- a/java/com/android/dialer/preferredsim/suggestion/SimSuggestionComponent.java
+++ b/java/com/android/dialer/preferredsim/suggestion/SimSuggestionComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.inject.HasRootComponent;
+
import dagger.Subcomponent;
/** Dagger component for {@link SuggestionProvider} */
diff --git a/java/com/android/dialer/preferredsim/suggestion/stub/StubSimSuggestionModule.java b/java/com/android/dialer/preferredsim/suggestion/stub/StubSimSuggestionModule.java
index 2f0e9b2..a1e1823 100644
--- a/java/com/android/dialer/preferredsim/suggestion/stub/StubSimSuggestionModule.java
+++ b/java/com/android/dialer/preferredsim/suggestion/stub/StubSimSuggestionModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +18,11 @@
package com.android.dialer.preferredsim.suggestion.stub;
import com.android.dialer.preferredsim.suggestion.SuggestionProvider;
+
+import javax.inject.Singleton;
+
import dagger.Binds;
import dagger.Module;
-import javax.inject.Singleton;
/** Stub module for {@link com.android.dialer.preferredsim.suggestion.SimSuggestionComponent} */
@Module
diff --git a/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java b/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
index 824a47e..efb75cd 100644
--- a/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
+++ b/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@
import com.android.dialer.preferredsim.suggestion.SuggestionProvider;
import com.google.common.base.Optional;
+
import javax.inject.Inject;
/** {@link SuggestionProvider} that does nothing. */
diff --git a/java/com/android/dialer/promotion/PromotionComponent.java b/java/com/android/dialer/promotion/PromotionComponent.java
index caf10db..dfb55d5 100644
--- a/java/com/android/dialer/promotion/PromotionComponent.java
+++ b/java/com/android/dialer/promotion/PromotionComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +18,11 @@
package com.android.dialer.promotion;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
import com.google.common.collect.ImmutableList;
+
import dagger.Subcomponent;
/** Component for promotion. */
diff --git a/java/com/android/dialer/promotion/PromotionManager.java b/java/com/android/dialer/promotion/PromotionManager.java
index 0918bcc..127149e 100644
--- a/java/com/android/dialer/promotion/PromotionManager.java
+++ b/java/com/android/dialer/promotion/PromotionManager.java
@@ -19,7 +19,9 @@
import com.android.dialer.promotion.Promotion.PromotionType;
import com.google.common.collect.ImmutableList;
+
import java.util.Optional;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/dialer/promotion/impl/PromotionModule.java b/java/com/android/dialer/promotion/impl/PromotionModule.java
index 0606338..b5438ec 100644
--- a/java/com/android/dialer/promotion/impl/PromotionModule.java
+++ b/java/com/android/dialer/promotion/impl/PromotionModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import com.android.dialer.promotion.Promotion;
import com.google.common.collect.ImmutableList;
+
import dagger.Module;
import dagger.Provides;
diff --git a/java/com/android/dialer/promotion/impl/RttPromotion.java b/java/com/android/dialer/promotion/impl/RttPromotion.java
index bff9fb6..4a9c78c 100644
--- a/java/com/android/dialer/promotion/impl/RttPromotion.java
+++ b/java/com/android/dialer/promotion/impl/RttPromotion.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +29,7 @@
import com.android.dialer.spannable.ContentWithLearnMoreSpanner;
import com.android.dialer.storage.StorageComponent;
import com.android.dialer.storage.Unencrypted;
+
import javax.inject.Inject;
/** RTT promotion. */
diff --git a/java/com/android/dialer/rootcomponentgenerator/ComponentGeneratingStep.java b/java/com/android/dialer/rootcomponentgenerator/ComponentGeneratingStep.java
index 1a40611..3553564 100644
--- a/java/com/android/dialer/rootcomponentgenerator/ComponentGeneratingStep.java
+++ b/java/com/android/dialer/rootcomponentgenerator/ComponentGeneratingStep.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,12 +37,13 @@
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
-import dagger.Subcomponent;
+
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
+
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
@@ -51,6 +53,8 @@
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeMirror;
+import dagger.Subcomponent;
+
/**
* Generates component for a type annotated with {@link IncludeInDialerRoot}.
*
diff --git a/java/com/android/dialer/rootcomponentgenerator/MetadataGeneratingStep.java b/java/com/android/dialer/rootcomponentgenerator/MetadataGeneratingStep.java
index 0a8b831..cc0c1d0 100644
--- a/java/com/android/dialer/rootcomponentgenerator/MetadataGeneratingStep.java
+++ b/java/com/android/dialer/rootcomponentgenerator/MetadataGeneratingStep.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +17,6 @@
package com.android.dialer.rootcomponentgenerator;
-import static javax.tools.Diagnostic.Kind.ERROR;
-
import com.android.dialer.inject.IncludeInDialerRoot;
import com.android.dialer.inject.RootComponentGeneratorMetadata;
import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep;
@@ -26,9 +25,11 @@
import com.google.common.collect.SetMultimap;
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.TypeSpec;
+
import java.lang.annotation.Annotation;
import java.util.Collections;
import java.util.Set;
+
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
diff --git a/java/com/android/dialer/rootcomponentgenerator/RootComponentProcessor.java b/java/com/android/dialer/rootcomponentgenerator/RootComponentProcessor.java
index 84d1961..9362bbc 100644
--- a/java/com/android/dialer/rootcomponentgenerator/RootComponentProcessor.java
+++ b/java/com/android/dialer/rootcomponentgenerator/RootComponentProcessor.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import com.google.auto.common.BasicAnnotationProcessor;
import com.google.auto.service.AutoService;
import com.google.common.collect.ImmutableList;
+
import javax.annotation.processing.Processor;
import javax.lang.model.SourceVersion;
diff --git a/java/com/android/dialer/rootcomponentgenerator/RootComponentUtils.java b/java/com/android/dialer/rootcomponentgenerator/RootComponentUtils.java
index cdcae92..ef73699 100644
--- a/java/com/android/dialer/rootcomponentgenerator/RootComponentUtils.java
+++ b/java/com/android/dialer/rootcomponentgenerator/RootComponentUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +19,9 @@
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;
+
import java.io.IOException;
+
import javax.annotation.processing.ProcessingEnvironment;
/**
diff --git a/java/com/android/dialer/rtt/RttTranscriptDatabaseHelper.java b/java/com/android/dialer/rtt/RttTranscriptDatabaseHelper.java
index 934eedb..26498f3 100644
--- a/java/com/android/dialer/rtt/RttTranscriptDatabaseHelper.java
+++ b/java/com/android/dialer/rtt/RttTranscriptDatabaseHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.SystemClock;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.rtt.RttTranscriptContract.RttTranscriptColumn;
diff --git a/java/com/android/dialer/searchfragment/common/QueryBoldingUtil.java b/java/com/android/dialer/searchfragment/common/QueryBoldingUtil.java
index ad74b7d..aa65a16 100644
--- a/java/com/android/dialer/searchfragment/common/QueryBoldingUtil.java
+++ b/java/com/android/dialer/searchfragment/common/QueryBoldingUtil.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import androidx.annotation.Nullable;
import com.android.dialer.common.LogUtil;
+
import java.util.regex.Matcher;
import java.util.regex.Pattern;
diff --git a/java/com/android/dialer/searchfragment/common/RowClickListener.java b/java/com/android/dialer/searchfragment/common/RowClickListener.java
index 9b0e595..2224ebc 100644
--- a/java/com/android/dialer/searchfragment/common/RowClickListener.java
+++ b/java/com/android/dialer/searchfragment/common/RowClickListener.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +17,6 @@
package com.android.dialer.searchfragment.common;
-import com.android.dialer.dialercontact.DialerContact;
-
/** Interface of possible actions that can be performed by search elements. */
public interface RowClickListener {
diff --git a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java
index 3a6c702..b350580 100644
--- a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java
+++ b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java
@@ -131,7 +131,7 @@
}
// Sort the contacts back into the exact same order they were inside of {@code cursor}
- Collections.sort(coalescedContacts, (o1, o2) -> compare(contactIdsToPosition, o1, o2));
+ coalescedContacts.sort((o1, o2) -> compare(contactIdsToPosition, o1, o2));
MatrixCursor newCursor = new MatrixCursor(Projections.CP2_PROJECTION, coalescedContacts.size());
for (Cp2Contact contact : coalescedContacts) {
newCursor.addRow(contact.toCursorRow());
diff --git a/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java b/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java
index 49d0b2e..a0f2972 100644
--- a/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java
+++ b/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java
@@ -32,13 +32,12 @@
import androidx.annotation.IntDef;
import androidx.recyclerview.widget.RecyclerView;
+import com.android.dialer.R;
import com.android.dialer.common.Assert;
import com.android.dialer.contactphoto.ContactPhotoManager;
-import com.android.dialer.dialercontact.DialerContact;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.searchfragment.common.Projections;
import com.android.dialer.searchfragment.common.QueryBoldingUtil;
-import com.android.dialer.searchfragment.common.R;
import com.android.dialer.searchfragment.common.RowClickListener;
import com.android.dialer.searchfragment.common.SearchCursor;
import com.android.dialer.widget.BidiTextView;
@@ -70,7 +69,6 @@
private int position;
private String number;
- private DialerContact dialerContact;
private @CallToAction int currentAction;
public SearchContactViewHolder(View view, RowClickListener listener) {
@@ -89,7 +87,6 @@
* at the cursors set position.
*/
public void bind(SearchCursor cursor, String query) {
- dialerContact = getDialerContact(context, cursor);
position = cursor.getPosition();
number = cursor.getString(Projections.PHONE_NUMBER);
String name = cursor.getString(Projections.DISPLAY_NAME);
@@ -98,7 +95,7 @@
TextUtils.isEmpty(label)
? number
: context.getString(
- com.android.dialer.contacts.resources.R.string.call_subject_type_and_number,
+ R.string.call_subject_type_and_number,
label,
number);
@@ -206,40 +203,4 @@
listener.placeVoiceCall(number, position);
}
}
-
- private static DialerContact getDialerContact(Context context, Cursor cursor) {
- DialerContact.Builder contact = DialerContact.newBuilder();
- String displayName = cursor.getString(Projections.DISPLAY_NAME);
- String number = cursor.getString(Projections.PHONE_NUMBER);
- Uri contactUri =
- Contacts.getLookupUri(
- cursor.getLong(Projections.CONTACT_ID), cursor.getString(Projections.LOOKUP_KEY));
-
- contact
- .setNumber(number)
- .setPhotoId(cursor.getLong(Projections.PHOTO_ID))
- .setContactType(LetterTileDrawable.TYPE_DEFAULT)
- .setNameOrNumber(displayName)
- .setNumberLabel(
- Phone.getTypeLabel(
- context.getResources(),
- cursor.getInt(Projections.PHONE_TYPE),
- cursor.getString(Projections.PHONE_LABEL))
- .toString());
-
- String photoUri = cursor.getString(Projections.PHOTO_URI);
- if (photoUri != null) {
- contact.setPhotoUri(photoUri);
- }
-
- if (contactUri != null) {
- contact.setContactUri(contactUri.toString());
- }
-
- if (!TextUtils.isEmpty(displayName)) {
- contact.setDisplayNumber(number);
- }
-
- return contact.build();
- }
}
diff --git a/java/com/android/dialer/searchfragment/directories/DirectoryContactsCursor.java b/java/com/android/dialer/searchfragment/directories/DirectoryContactsCursor.java
index 35a5b1b..5706bc3 100644
--- a/java/com/android/dialer/searchfragment/directories/DirectoryContactsCursor.java
+++ b/java/com/android/dialer/searchfragment/directories/DirectoryContactsCursor.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +29,7 @@
import com.android.dialer.common.cp2.DirectoryUtils;
import com.android.dialer.searchfragment.common.SearchCursor;
import com.android.dialer.searchfragment.directories.DirectoriesCursorLoader.Directory;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -96,7 +98,7 @@
cursorList.add(createHeaderCursor(context, directory.getDisplayName(), directory.getId()));
cursorList.add(cursor);
}
- return cursorList.toArray(new Cursor[cursorList.size()]);
+ return cursorList.toArray(new Cursor[0]);
}
private static MatrixCursor createHeaderCursor(Context context, String name, long id) {
diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
index 8edf4e3..8998d2b 100644
--- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
+++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java
@@ -441,11 +441,6 @@
LoaderManager.getInstance(this).restartLoader(CONTACTS_LOADER_ID, null, this);
}
- @Override
- public void onPause() {
- super.onPause();
- }
-
/**
* Returns a list of search actions to be shown in the search results.
*
diff --git a/java/com/android/dialer/searchfragment/list/SearchCursorManager.java b/java/com/android/dialer/searchfragment/list/SearchCursorManager.java
index eabf8d3..9b4e865 100644
--- a/java/com/android/dialer/searchfragment/list/SearchCursorManager.java
+++ b/java/com/android/dialer/searchfragment/list/SearchCursorManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.searchfragment.common.SearchCursor;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
@@ -101,11 +103,7 @@
return false;
}
- if (cursor != null) {
- contactsCursor = cursor;
- } else {
- contactsCursor = null;
- }
+ contactsCursor = cursor;
return true;
}
@@ -115,11 +113,7 @@
return false;
}
- if (cursor != null) {
- nearbyPlacesCursor = cursor;
- } else {
- nearbyPlacesCursor = null;
- }
+ nearbyPlacesCursor = cursor;
return true;
}
@@ -138,11 +132,7 @@
return false;
}
- if (cursor != null) {
- corpDirectoryCursor = cursor;
- } else {
- corpDirectoryCursor = null;
- }
+ corpDirectoryCursor = cursor;
return true;
}
diff --git a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlacesCursorLoader.java b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlacesCursorLoader.java
index e5bccc8..1ff5443 100644
--- a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlacesCursorLoader.java
+++ b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlacesCursorLoader.java
@@ -28,6 +28,7 @@
import com.android.contacts.common.extensions.PhoneDirectoryExtenderAccessor;
import com.android.dialer.common.LogUtil;
import com.android.dialer.searchfragment.common.Projections;
+
import java.util.List;
/** Cursor loader for nearby places search results. */
diff --git a/java/com/android/dialer/shortcuts/CallContactActivity.java b/java/com/android/dialer/shortcuts/CallContactActivity.java
index 585ab0c..d50d497 100644
--- a/java/com/android/dialer/shortcuts/CallContactActivity.java
+++ b/java/com/android/dialer/shortcuts/CallContactActivity.java
@@ -25,7 +25,7 @@
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
-import android.widget.Toast;
+import com.android.dialer.R;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallSpecificAppData;
import com.android.dialer.common.LogUtil;
@@ -47,7 +47,8 @@
if (grantResults.values().iterator().next()) {
makeCall();
} else {
- Toast.makeText(this, R.string.dialer_shortcut_no_permissions, Toast.LENGTH_SHORT).show();
+ Toast.makeText(this, R.string.dialer_shortcut_no_permissions, Toast.LENGTH_SHORT)
+ .show();
finish();
}
});
diff --git a/java/com/android/dialer/shortcuts/IconFactory.java b/java/com/android/dialer/shortcuts/IconFactory.java
index 75b99ac..67d9178 100644
--- a/java/com/android/dialer/shortcuts/IconFactory.java
+++ b/java/com/android/dialer/shortcuts/IconFactory.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +34,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.util.DrawableConverter;
+
import java.io.InputStream;
/** Constructs the icons for dialer shortcuts. */
diff --git a/java/com/android/dialer/shortcuts/ShortcutInfoFactory.java b/java/com/android/dialer/shortcuts/ShortcutInfoFactory.java
index 3e71b5d..6cc2ce3 100644
--- a/java/com/android/dialer/shortcuts/ShortcutInfoFactory.java
+++ b/java/com/android/dialer/shortcuts/ShortcutInfoFactory.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@
import androidx.annotation.WorkerThread;
import com.android.dialer.common.Assert;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
diff --git a/java/com/android/dialer/shortcuts/ShortcutRefresher.java b/java/com/android/dialer/shortcuts/ShortcutRefresher.java
index e48b2dd..a87dda4 100644
--- a/java/com/android/dialer/shortcuts/ShortcutRefresher.java
+++ b/java/com/android/dialer/shortcuts/ShortcutRefresher.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import com.android.dialer.common.concurrent.DialerExecutor.Worker;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.speeddial.loader.SpeedDialUiItem;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/dialer/simulator/Simulator.java b/java/com/android/dialer/simulator/Simulator.java
index 00a6152..985b3d1 100644
--- a/java/com/android/dialer/simulator/Simulator.java
+++ b/java/com/android/dialer/simulator/Simulator.java
@@ -156,7 +156,7 @@
@Override
public int hashCode() {
- return Objects.hash(Integer.valueOf(type), data1, data2);
+ return Objects.hash(type, data1, data2);
}
}
}
diff --git a/java/com/android/dialer/simulator/SimulatorComponent.java b/java/com/android/dialer/simulator/SimulatorComponent.java
index 952c97f..ca7d9ec 100644
--- a/java/com/android/dialer/simulator/SimulatorComponent.java
+++ b/java/com/android/dialer/simulator/SimulatorComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +18,10 @@
package com.android.dialer.simulator;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
+
import dagger.Subcomponent;
/** Subcomponent that can be used to access the simulator implementation. */
diff --git a/java/com/android/dialer/simulator/SimulatorConnectionsBank.java b/java/com/android/dialer/simulator/SimulatorConnectionsBank.java
index 56ac328..a91a8bf 100644
--- a/java/com/android/dialer/simulator/SimulatorConnectionsBank.java
+++ b/java/com/android/dialer/simulator/SimulatorConnectionsBank.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import androidx.annotation.NonNull;
import com.android.dialer.simulator.Simulator.ConferenceType;
+
import java.util.List;
/**
diff --git a/java/com/android/dialer/simulator/impl/RttChatBot.java b/java/com/android/dialer/simulator/impl/RttChatBot.java
index 14390b1..ff633be 100644
--- a/java/com/android/dialer/simulator/impl/RttChatBot.java
+++ b/java/com/android/dialer/simulator/impl/RttChatBot.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.incallui.rtt.protocol.Constants;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/dialer/simulator/impl/SimulatorConference.java b/java/com/android/dialer/simulator/impl/SimulatorConference.java
index 38688e6..de78812 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorConference.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorConference.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import com.android.dialer.common.LogUtil;
import com.android.dialer.simulator.Simulator;
import com.android.dialer.simulator.Simulator.Event;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/dialer/simulator/impl/SimulatorConferenceCreator.java b/java/com/android/dialer/simulator/impl/SimulatorConferenceCreator.java
index cca4547..4bb10da 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorConferenceCreator.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorConferenceCreator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +31,7 @@
import com.android.dialer.simulator.Simulator.Event;
import com.android.dialer.simulator.SimulatorComponent;
import com.android.dialer.simulator.SimulatorConnectionsBank;
+
import java.util.ArrayList;
import java.util.Locale;
diff --git a/java/com/android/dialer/simulator/impl/SimulatorConnection.java b/java/com/android/dialer/simulator/impl/SimulatorConnection.java
index d813373..d8bd89f 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorConnection.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorConnection.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +19,6 @@
import android.content.Context;
import android.telecom.Connection;
-import android.telecom.Connection.RttTextStream;
import android.telecom.ConnectionRequest;
import android.telecom.VideoProfile;
@@ -30,6 +30,7 @@
import com.android.dialer.simulator.Simulator.Event;
import com.android.dialer.simulator.SimulatorComponent;
import com.android.dialer.simulator.SimulatorConnectionsBank;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/dialer/simulator/impl/SimulatorConnectionService.java b/java/com/android/dialer/simulator/impl/SimulatorConnectionService.java
index 174237c..fa3ab06 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorConnectionService.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorConnectionService.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +36,7 @@
import com.android.dialer.simulator.Simulator;
import com.android.dialer.simulator.SimulatorComponent;
import com.android.dialer.simulator.SimulatorConnectionsBank;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/dialer/simulator/impl/SimulatorConnectionsBankImpl.java b/java/com/android/dialer/simulator/impl/SimulatorConnectionsBankImpl.java
index c080c95..04c3174 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorConnectionsBankImpl.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorConnectionsBankImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,9 +29,11 @@
import com.android.dialer.simulator.Simulator.ConferenceType;
import com.android.dialer.simulator.Simulator.Event;
import com.android.dialer.simulator.SimulatorConnectionsBank;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+
import javax.inject.Inject;
/** Wraps a list of connection tags and common methods around the connection tags list. */
diff --git a/java/com/android/dialer/simulator/impl/SimulatorMenu.java b/java/com/android/dialer/simulator/impl/SimulatorMenu.java
index 0d4deb0..caf754f 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorMenu.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorMenu.java
@@ -26,6 +26,7 @@
import androidx.annotation.NonNull;
import com.android.dialer.common.Assert;
+
import java.util.Map.Entry;
/** Makes option menu for simulator. */
diff --git a/java/com/android/dialer/simulator/impl/SimulatorModule.java b/java/com/android/dialer/simulator/impl/SimulatorModule.java
index 2bc72c9..3a8ae3c 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorModule.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +19,11 @@
import com.android.dialer.simulator.Simulator;
import com.android.dialer.simulator.SimulatorConnectionsBank;
+
+import javax.inject.Singleton;
+
import dagger.Binds;
import dagger.Module;
-import javax.inject.Singleton;
/** This module provides an instance of the simulator. */
@Module
diff --git a/java/com/android/dialer/simulator/impl/SimulatorPortalEntryGroup.java b/java/com/android/dialer/simulator/impl/SimulatorPortalEntryGroup.java
index 200b10f..e6db99d 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorPortalEntryGroup.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorPortalEntryGroup.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableMap;
+
import java.util.Collections;
import java.util.Map;
diff --git a/java/com/android/dialer/simulator/impl/SimulatorPreviewCamera.java b/java/com/android/dialer/simulator/impl/SimulatorPreviewCamera.java
index d068dc7..d402e5f 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorPreviewCamera.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorPreviewCamera.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,8 @@
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.CaptureRequest;
+import android.hardware.camera2.params.OutputConfiguration;
+import android.hardware.camera2.params.SessionConfiguration;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.telecom.VideoProfile.CameraCapabilities;
import android.util.Size;
@@ -35,7 +38,9 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
-import java.util.Arrays;
+
+import java.util.Collections;
+import java.util.concurrent.Executors;
/**
* Used by the video provider to draw the local camera. The in-call UI is responsible for setting
@@ -114,10 +119,11 @@
}
try {
- camera.createCaptureSession(
- Arrays.asList(Assert.isNotNull(surface)),
- new CaptureSessionCallback(),
- null /* handler */);
+ OutputConfiguration out = new OutputConfiguration(surface);
+ SessionConfiguration cfg = new SessionConfiguration(SessionConfiguration.SESSION_REGULAR,
+ Collections.singletonList(Assert.isNotNull(out)),
+ Executors.newSingleThreadExecutor(), new CaptureSessionCallback());
+ camera.createCaptureSession(cfg);
} catch (CameraAccessException e) {
throw Assert.createIllegalStateFailException("camera error: " + e);
}
diff --git a/java/com/android/dialer/simulator/impl/SimulatorSimCallManager.java b/java/com/android/dialer/simulator/impl/SimulatorSimCallManager.java
index 9135070..9a07947 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorSimCallManager.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorSimCallManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,9 +33,10 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Random;
@@ -164,7 +166,7 @@
return new PhoneAccount.Builder(getSimCallManagerHandle(context), "Simulator SIM call manager")
.setCapabilities(PhoneAccount.CAPABILITY_CONNECTION_MANAGER | PhoneAccount.CAPABILITY_RTT)
.setShortDescription("Simulator SIM call manager")
- .setSupportedUriSchemes(Arrays.asList(PhoneAccount.SCHEME_TEL))
+ .setSupportedUriSchemes(Collections.singletonList(PhoneAccount.SCHEME_TEL))
.build();
}
@@ -176,7 +178,7 @@
| PhoneAccount.CAPABILITY_SUPPORTS_VIDEO_CALLING
| PhoneAccount.CAPABILITY_VIDEO_CALLING)
.setShortDescription("Simulator video provider")
- .setSupportedUriSchemes(Arrays.asList(PhoneAccount.SCHEME_TEL))
+ .setSupportedUriSchemes(Collections.singletonList(PhoneAccount.SCHEME_TEL))
.build();
}
diff --git a/java/com/android/dialer/simulator/impl/SimulatorUtils.java b/java/com/android/dialer/simulator/impl/SimulatorUtils.java
index debcd75..9bd4578 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorUtils.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorUtils.java
@@ -35,6 +35,7 @@
import com.android.dialer.databasepopulator.VoicemailPopulator;
import com.android.dialer.persistentlog.PersistentLogger;
import com.android.dialer.preferredsim.PreferredSimFallbackContract;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -142,7 +143,7 @@
.getContentResolver()
.bulkInsert(
Voicemails.buildSourceUri(context.getPackageName()),
- voicemails.toArray(new ContentValues[voicemails.size()]));
+ voicemails.toArray(new ContentValues[0]));
}
private static class PopulateVoicemailWorker
diff --git a/java/com/android/dialer/simulator/impl/SimulatorVideoProvider.java b/java/com/android/dialer/simulator/impl/SimulatorVideoProvider.java
index 43f5368..2eb9a31 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorVideoProvider.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorVideoProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +39,7 @@
@NonNull
private final Context context;
@NonNull private final SimulatorConnection connection;
- @Nullable private String previewCameraId;;
+ @Nullable private String previewCameraId;
@Nullable
private SimulatorPreviewCamera simulatorPreviewCamera;
@Nullable private SimulatorRemoteVideo simulatorRemoteVideo;
diff --git a/java/com/android/dialer/simulator/service/SimulatorService.java b/java/com/android/dialer/simulator/service/SimulatorService.java
index 1b679b5..51936fb 100644
--- a/java/com/android/dialer/simulator/service/SimulatorService.java
+++ b/java/com/android/dialer/simulator/service/SimulatorService.java
@@ -36,6 +36,7 @@
import com.android.dialer.simulator.impl.SimulatorMainPortal;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
+
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
diff --git a/java/com/android/dialer/simulator/service/SimulatorServiceClient.java b/java/com/android/dialer/simulator/service/SimulatorServiceClient.java
index 7917dfb..e48dfab 100644
--- a/java/com/android/dialer/simulator/service/SimulatorServiceClient.java
+++ b/java/com/android/dialer/simulator/service/SimulatorServiceClient.java
@@ -45,8 +45,6 @@
}
}
- private void onServiceDisconnected() {}
-
static class SimulatorServiceConnection implements ServiceConnection {
private SimulatorServiceClient client;
@@ -60,7 +58,6 @@
@Override
public void onServiceDisconnected(ComponentName name) {
- client.onServiceDisconnected();
}
void bindToClient(SimulatorServiceClient client) {
diff --git a/java/com/android/dialer/smartdial/SmartDialCursorLoader.java b/java/com/android/dialer/smartdial/SmartDialCursorLoader.java
index 314bbd6..72aa8da 100644
--- a/java/com/android/dialer/smartdial/SmartDialCursorLoader.java
+++ b/java/com/android/dialer/smartdial/SmartDialCursorLoader.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +30,7 @@
import com.android.dialer.database.DialerDatabaseHelper.ContactNumber;
import com.android.dialer.smartdial.util.SmartDialNameMatcher;
import com.android.dialer.util.PermissionsUtil;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -229,14 +231,14 @@
final List<String> projectionList =
new ArrayList<>(Arrays.asList(PROJECTION_PRIMARY_INTERNAL));
projectionList.add(Phone.CARRIER_PRESENCE); // 9
- PROJECTION_PRIMARY = projectionList.toArray(new String[projectionList.size()]);
+ PROJECTION_PRIMARY = projectionList.toArray(new String[0]);
}
static {
final List<String> projectionList =
new ArrayList<>(Arrays.asList(PROJECTION_ALTERNATIVE_INTERNAL));
projectionList.add(Phone.CARRIER_PRESENCE); // 9
- PROJECTION_ALTERNATIVE = projectionList.toArray(new String[projectionList.size()]);
+ PROJECTION_ALTERNATIVE = projectionList.toArray(new String[0]);
}
}
}
diff --git a/java/com/android/dialer/smartdial/util/SmartDialMatchPosition.java b/java/com/android/dialer/smartdial/util/SmartDialMatchPosition.java
index db317ae..3f2f2e5 100644
--- a/java/com/android/dialer/smartdial/util/SmartDialMatchPosition.java
+++ b/java/com/android/dialer/smartdial/util/SmartDialMatchPosition.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.dialer.smartdial.util;
import com.android.dialer.common.LogUtil;
+
import java.util.ArrayList;
/**
diff --git a/java/com/android/dialer/smartdial/util/SmartDialNameMatcher.java b/java/com/android/dialer/smartdial/util/SmartDialNameMatcher.java
index ae0a7c4..d876856 100644
--- a/java/com/android/dialer/smartdial/util/SmartDialNameMatcher.java
+++ b/java/com/android/dialer/smartdial/util/SmartDialNameMatcher.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import com.android.dialer.smartdial.map.CompositeSmartDialMap;
import com.android.dialer.smartdial.util.SmartDialPrefix.PhoneNumberTokens;
+
import java.util.ArrayList;
/**
@@ -262,7 +264,7 @@
// positions
int seperatorCount = 0;
- ArrayList<SmartDialMatchPosition> partial = new ArrayList<SmartDialMatchPosition>();
+ ArrayList<SmartDialMatchPosition> partial = new ArrayList<>();
// Keep going until we reach the end of displayName
while (nameStart < nameLength && queryStart < queryLength) {
char ch = displayName.charAt(nameStart);
diff --git a/java/com/android/dialer/smartdial/util/SmartDialPrefix.java b/java/com/android/dialer/smartdial/util/SmartDialPrefix.java
index 0089fd4..74d7479 100644
--- a/java/com/android/dialer/smartdial/util/SmartDialPrefix.java
+++ b/java/com/android/dialer/smartdial/util/SmartDialPrefix.java
@@ -65,8 +65,6 @@
/** Set of supported country codes in front of the phone number. */
private static Set<String> countryCodes = null;
- private static boolean nanpInitialized = false;
-
/** Initializes the Nanp settings, and finds out whether user is in a NANP region. */
public static void initializeNanpSettings(Context context) {
final TelephonyManager manager =
@@ -88,7 +86,6 @@
}
/** Queries the NANP country list to find out whether user is in a NANP region. */
userInNanpRegion = isCountryNanp(userSimCountryCode);
- nanpInitialized = true;
}
/**
@@ -302,7 +299,7 @@
}
private static Set<String> initCountryCodes() {
- final HashSet<String> result = new HashSet<String>();
+ final HashSet<String> result = new HashSet<>();
result.add("1");
result.add("7");
result.add("20");
@@ -540,7 +537,7 @@
}
private static Set<String> initNanpCountries() {
- final HashSet<String> result = new HashSet<String>();
+ final HashSet<String> result = new HashSet<>();
result.add("US"); // United States
result.add("CA"); // Canada
result.add("AS"); // American Samoa
diff --git a/java/com/android/dialer/speeddial/DisambigDialog.java b/java/com/android/dialer/speeddial/DisambigDialog.java
index e4fe34b..dbfce63 100644
--- a/java/com/android/dialer/speeddial/DisambigDialog.java
+++ b/java/com/android/dialer/speeddial/DisambigDialog.java
@@ -30,6 +30,7 @@
import androidx.annotation.WorkerThread;
import androidx.appcompat.app.AlertDialog;
+import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
@@ -87,8 +88,8 @@
public void onResume() {
super.onResume();
getDialog().getWindow().setBackgroundDrawable(
- getActivity().getResources().getDrawable(R.drawable.dialog_background,
- getActivity().getTheme()));
+ ResourcesCompat.getDrawable(requireActivity().getResources(),
+ R.drawable.dialog_background, requireActivity().getTheme()));
}
@Override
diff --git a/java/com/android/dialer/speeddial/FavoritesViewHolder.java b/java/com/android/dialer/speeddial/FavoritesViewHolder.java
index 2f43d81..74cc4e4 100644
--- a/java/com/android/dialer/speeddial/FavoritesViewHolder.java
+++ b/java/com/android/dialer/speeddial/FavoritesViewHolder.java
@@ -36,12 +36,12 @@
import com.android.dialer.glidephotomanager.PhotoInfo;
import com.android.dialer.speeddial.database.SpeedDialEntry.Channel;
import com.android.dialer.speeddial.draghelper.SpeedDialFavoritesViewHolderOnTouchListener;
-import com.android.dialer.speeddial.draghelper.SpeedDialFavoritesViewHolderOnTouchListener.OnTouchFinishCallback;
import com.android.dialer.speeddial.loader.SpeedDialUiItem;
/** ViewHolder for starred/favorite contacts in {@link SpeedDialFragment}. */
-public class FavoritesViewHolder extends RecyclerView.ViewHolder
- implements OnClickListener, OnLongClickListener, OnTouchFinishCallback {
+public class FavoritesViewHolder extends RecyclerView.ViewHolder implements
+ OnClickListener, OnLongClickListener,
+ SpeedDialFavoritesViewHolderOnTouchListener.OnTouchFinishCallback {
private final FavoriteContactsListener listener;
diff --git a/java/com/android/dialer/speeddial/SpeedDialAdapter.java b/java/com/android/dialer/speeddial/SpeedDialAdapter.java
index de0172f..2404c7f 100644
--- a/java/com/android/dialer/speeddial/SpeedDialAdapter.java
+++ b/java/com/android/dialer/speeddial/SpeedDialAdapter.java
@@ -70,7 +70,8 @@
private static final float IN_REMOVE_VIEW_ALPHA = 0.5f;
@Retention(RetentionPolicy.SOURCE)
- @IntDef({RowType.STARRED_HEADER, RowType.SUGGESTION_HEADER, RowType.STARRED, RowType.SUGGESTION})
+ @IntDef({RowType.REMOVE_VIEW, RowType.STARRED_HEADER, RowType.SUGGESTION_HEADER, RowType.STARRED,
+ RowType.SUGGESTION})
@interface RowType {
int REMOVE_VIEW = 0;
int STARRED_HEADER = 1;
diff --git a/java/com/android/dialer/speeddial/SpeedDialFragment.java b/java/com/android/dialer/speeddial/SpeedDialFragment.java
index 462f817..0951d7e 100644
--- a/java/com/android/dialer/speeddial/SpeedDialFragment.java
+++ b/java/com/android/dialer/speeddial/SpeedDialFragment.java
@@ -195,7 +195,7 @@
recyclerView.setAdapter(adapter);
// Setup drag and drop touch helper
- ItemTouchHelper.Callback callback = new SpeedDialItemTouchHelperCallback(getContext(), adapter);
+ ItemTouchHelper.Callback callback = new SpeedDialItemTouchHelperCallback(adapter);
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
touchHelper.attachToRecyclerView(recyclerView);
adapter.setItemTouchHelper(touchHelper);
diff --git a/java/com/android/dialer/speeddial/database/SpeedDialEntry.java b/java/com/android/dialer/speeddial/database/SpeedDialEntry.java
index a2dceb5..132a283 100644
--- a/java/com/android/dialer/speeddial/database/SpeedDialEntry.java
+++ b/java/com/android/dialer/speeddial/database/SpeedDialEntry.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import com.google.auto.value.AutoValue;
import com.google.common.base.Optional;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/java/com/android/dialer/speeddial/database/SpeedDialEntryDatabaseHelper.java b/java/com/android/dialer/speeddial/database/SpeedDialEntryDatabaseHelper.java
index caba77f..f84cbab 100644
--- a/java/com/android/dialer/speeddial/database/SpeedDialEntryDatabaseHelper.java
+++ b/java/com/android/dialer/speeddial/database/SpeedDialEntryDatabaseHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,12 +23,14 @@
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
+
import com.android.dialer.common.Assert;
import com.android.dialer.common.database.Selection;
import com.android.dialer.speeddial.database.SpeedDialEntry.Channel;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java b/java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java
index 194fa7b..07ade72 100644
--- a/java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java
+++ b/java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java
@@ -17,7 +17,6 @@
package com.android.dialer.speeddial.draghelper;
-import android.content.Context;
import android.graphics.Canvas;
import androidx.annotation.NonNull;
@@ -30,7 +29,6 @@
public class SpeedDialItemTouchHelperCallback extends ItemTouchHelper.Callback {
private final ItemTouchHelperAdapter adapter;
- private final Context context;
// When dragged item is in removeView, onMove() and onChildDraw() are called in turn. This
// behavior changes when dragged item entering/leaving removeView. The boolean field
@@ -38,8 +36,7 @@
private boolean movedOverRemoveView;
private boolean inRemoveView;
- public SpeedDialItemTouchHelperCallback(Context context, ItemTouchHelperAdapter adapter) {
- this.context = context;
+ public SpeedDialItemTouchHelperCallback(ItemTouchHelperAdapter adapter) {
this.adapter = adapter;
}
@@ -56,8 +53,8 @@
}
@Override
- public boolean canDropOver(
- @NonNull RecyclerView recyclerView, @NonNull ViewHolder current, @NonNull ViewHolder target) {
+ public boolean canDropOver(@NonNull RecyclerView recyclerView, @NonNull ViewHolder current,
+ @NonNull ViewHolder target) {
return adapter.canDropOver(target);
}
diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
index 448d73a..59f9d53 100644
--- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
+++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +36,7 @@
import com.google.auto.value.AutoValue;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java
index 3e1e444..47d102a 100644
--- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java
+++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +31,6 @@
import android.util.ArrayMap;
import android.util.ArraySet;
-import androidx.annotation.MainThread;
import androidx.annotation.WorkerThread;
import com.android.dialer.common.Assert;
@@ -57,11 +57,13 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+
import javax.inject.Inject;
import javax.inject.Singleton;
diff --git a/java/com/android/dialer/speeddial/loader/UiItemLoaderComponent.java b/java/com/android/dialer/speeddial/loader/UiItemLoaderComponent.java
index 8529084..c655611 100644
--- a/java/com/android/dialer/speeddial/loader/UiItemLoaderComponent.java
+++ b/java/com/android/dialer/speeddial/loader/UiItemLoaderComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,9 @@
package com.android.dialer.speeddial.loader;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
+
import dagger.Subcomponent;
/** Dagger component for the speeddial/loader package. */
diff --git a/java/com/android/dialer/storage/StorageComponent.java b/java/com/android/dialer/storage/StorageComponent.java
index 4754cc6..109ea09 100644
--- a/java/com/android/dialer/storage/StorageComponent.java
+++ b/java/com/android/dialer/storage/StorageComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +19,10 @@
import android.content.Context;
import android.content.SharedPreferences;
+
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
+
import dagger.Subcomponent;
/** Dagger component for storage. */
diff --git a/java/com/android/dialer/telecom/TelecomCallUtil.java b/java/com/android/dialer/telecom/TelecomCallUtil.java
index 482c868..600ed6f 100644
--- a/java/com/android/dialer/telecom/TelecomCallUtil.java
+++ b/java/com/android/dialer/telecom/TelecomCallUtil.java
@@ -20,6 +20,7 @@
import android.net.Uri;
import android.telecom.Call;
import android.telephony.PhoneNumberUtils;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import androidx.annotation.NonNull;
@@ -39,10 +40,10 @@
public class TelecomCallUtil {
/** Returns Whether the call handle is an emergency number. */
- public static boolean isEmergencyCall(@NonNull Call call) {
+ public static boolean isEmergencyCall(TelephonyManager telephonyManager, @NonNull Call call) {
Assert.isNotNull(call);
Uri handle = call.getDetails().getHandle();
- return PhoneNumberUtils.isEmergencyNumber(handle == null ? "" : handle.getSchemeSpecificPart());
+ return telephonyManager.isEmergencyNumber(handle == null ? "" : handle.getSchemeSpecificPart());
}
/**
diff --git a/java/com/android/dialer/telecom/TelecomUtil.java b/java/com/android/dialer/telecom/TelecomUtil.java
index 6e21860..b71a007 100644
--- a/java/com/android/dialer/telecom/TelecomUtil.java
+++ b/java/com/android/dialer/telecom/TelecomUtil.java
@@ -17,8 +17,8 @@
package com.android.dialer.telecom;
-import android.app.role.RoleManager;
import android.Manifest.permission;
+import android.app.role.RoleManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
diff --git a/java/com/android/dialer/theme/base/ThemeComponent.java b/java/com/android/dialer/theme/base/ThemeComponent.java
index d906761..5025660 100644
--- a/java/com/android/dialer/theme/base/ThemeComponent.java
+++ b/java/com/android/dialer/theme/base/ThemeComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +18,10 @@
package com.android.dialer.theme.base;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
+
import dagger.Subcomponent;
/** Component for Theme. */
diff --git a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java
index 0d9d199..9df5666 100644
--- a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java
+++ b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.theme.base.R;
import com.android.dialer.theme.base.Theme;
+
import javax.inject.Singleton;
/** Utility for fetching */
diff --git a/java/com/android/dialer/theme/base/impl/AospThemeModule.java b/java/com/android/dialer/theme/base/impl/AospThemeModule.java
index 7070932..5b67185 100644
--- a/java/com/android/dialer/theme/base/impl/AospThemeModule.java
+++ b/java/com/android/dialer/theme/base/impl/AospThemeModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +18,10 @@
package com.android.dialer.theme.base.impl;
import android.content.Context;
+
import com.android.dialer.inject.ApplicationContext;
import com.android.dialer.theme.base.Theme;
+
import dagger.Module;
import dagger.Provides;
diff --git a/java/com/android/dialer/util/CallUtil.java b/java/com/android/dialer/util/CallUtil.java
index 160a40f..c27612a 100644
--- a/java/com/android/dialer/util/CallUtil.java
+++ b/java/com/android/dialer/util/CallUtil.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
@@ -93,6 +95,7 @@
/**
* Returns a list of phone accounts that are able to call to numbers with the supplied scheme
*/
+ @SuppressLint("MissingPermission")
public static List<PhoneAccount> getCallCapablePhoneAccounts(Context context, String scheme) {
if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE)) {
return null;
diff --git a/java/com/android/dialer/util/DialerUtils.java b/java/com/android/dialer/util/DialerUtils.java
index b877619..0b9b8e5 100644
--- a/java/com/android/dialer/util/DialerUtils.java
+++ b/java/com/android/dialer/util/DialerUtils.java
@@ -20,8 +20,6 @@
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Point;
@@ -40,6 +38,7 @@
import com.android.dialer.R;
import com.android.dialer.common.LogUtil;
import com.android.dialer.telecom.TelecomUtil;
+
import java.util.Iterator;
/** General purpose utility methods for the Dialer. */
diff --git a/java/com/android/dialer/util/EmergencyCallUtil.java b/java/com/android/dialer/util/EmergencyCallUtil.java
index cbcddee..ed0b18a 100644
--- a/java/com/android/dialer/util/EmergencyCallUtil.java
+++ b/java/com/android/dialer/util/EmergencyCallUtil.java
@@ -56,7 +56,7 @@
return false;
}
- Long lastEmergencyCallTime = getLastEmergencyCallTimeMillis(context);
+ long lastEmergencyCallTime = getLastEmergencyCallTimeMillis(context);
if (lastEmergencyCallTime == 0) {
return false;
}
diff --git a/java/com/android/dialer/util/ExpirableCache.java b/java/com/android/dialer/util/ExpirableCache.java
index ba3951e..2e6de2d 100644
--- a/java/com/android/dialer/util/ExpirableCache.java
+++ b/java/com/android/dialer/util/ExpirableCache.java
@@ -18,7 +18,9 @@
package com.android.dialer.util;
import android.util.LruCache;
+
import java.util.concurrent.atomic.AtomicInteger;
+
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.ThreadSafe;
@@ -120,7 +122,7 @@
* @throws IllegalArgumentException if the cache is not empty
*/
public static <K, V> ExpirableCache<K, V> create(LruCache<K, CachedValue<V>> cache) {
- return new ExpirableCache<K, V>(cache);
+ return new ExpirableCache<>(cache);
}
/**
@@ -131,7 +133,7 @@
* @return the newly created expirable cache
*/
public static <K, V> ExpirableCache<K, V> create(int maxSize) {
- return create(new LruCache<K, CachedValue<V>>(maxSize));
+ return create(new LruCache<>(maxSize));
}
/**
@@ -211,7 +213,7 @@
* <p>Implementation of {@link LruCache#create(K)} can use this method to create a new entry.
*/
public CachedValue<V> newCachedValue(V value) {
- return new GenerationalCachedValue<V>(value, generation);
+ return new GenerationalCachedValue<>(value, generation);
}
/**
diff --git a/java/com/android/dialer/util/PermissionsUtil.java b/java/com/android/dialer/util/PermissionsUtil.java
index 13fdbdd..3844380 100644
--- a/java/com/android/dialer/util/PermissionsUtil.java
+++ b/java/com/android/dialer/util/PermissionsUtil.java
@@ -232,7 +232,7 @@
permissionsCurrentlyDenied.add(permission);
}
}
- return permissionsCurrentlyDenied.toArray(new String[permissionsCurrentlyDenied.size()]);
+ return permissionsCurrentlyDenied.toArray(new String[0]);
}
/**
diff --git a/java/com/android/dialer/util/UriUtils.java b/java/com/android/dialer/util/UriUtils.java
index c4308a8..b1a02f7 100644
--- a/java/com/android/dialer/util/UriUtils.java
+++ b/java/com/android/dialer/util/UriUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.net.Uri;
import android.provider.ContactsContract;
+
import java.util.List;
/** Utility methods for dealing with URIs. */
diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailErrorAlert.java b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorAlert.java
index 7e0ad37..98b5690 100644
--- a/java/com/android/dialer/voicemail/listui/error/VoicemailErrorAlert.java
+++ b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorAlert.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +22,12 @@
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
+
import com.android.dialer.app.alert.AlertManager;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.voicemail.listui.error.VoicemailErrorMessage.Action;
+
import java.util.List;
/**
diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java
index c73a563..469a9de 100644
--- a/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java
+++ b/java/com/android/dialer/voicemail/listui/error/VoicemailErrorMessage.java
@@ -36,6 +36,7 @@
import com.android.dialer.voicemail.settings.VoicemailChangePinActivity;
import com.android.voicemail.VoicemailClient;
import com.android.voicemail.VoicemailComponent;
+
import java.util.Arrays;
import java.util.List;
diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java b/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java
index 148d350..ccf631a 100644
--- a/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java
+++ b/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
package com.android.dialer.voicemail.listui.error;
+import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.database.Cursor;
@@ -122,6 +124,7 @@
isAirplaneMode = builder.isAirplaneMode;
}
+ @SuppressLint("MissingPermission")
private static int getNotificationChannelStateFormTelephony(
Context context, PhoneAccountHandle phoneAccountHandle) {
TelephonyManager telephonyManager =
diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java
index 5096da2..4466409 100644
--- a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java
+++ b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.voicemailstatus.VoicemailStatusQuery;
import com.android.voicemail.VoicemailComponent;
+
import java.util.ArrayList;
import java.util.List;
@@ -55,7 +57,7 @@
Status.CONTENT_URI,
VoicemailStatusQuery.getProjection(),
where.toString(),
- selectionArgs.toArray(new String[selectionArgs.size()]),
+ selectionArgs.toArray(new String[0]),
null)) {
if (cursor == null) {
return statuses;
diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java
index 1ce09dd..7826e9d 100644
--- a/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java
+++ b/java/com/android/dialer/voicemail/listui/error/VoicemailTosMessageCreator.java
@@ -20,7 +20,6 @@
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.telecom.PhoneAccountHandle;
@@ -32,8 +31,6 @@
import android.text.style.AlignmentSpan;
import android.text.style.TextAppearanceSpan;
import android.text.style.URLSpan;
-import android.view.View;
-import android.view.View.OnClickListener;
import androidx.annotation.Nullable;
import androidx.preference.PreferenceManager;
diff --git a/java/com/android/dialer/voicemail/listui/error/Vvm3VoicemailMessageCreator.java b/java/com/android/dialer/voicemail/listui/error/Vvm3VoicemailMessageCreator.java
index 9da10e9..c4910ae 100644
--- a/java/com/android/dialer/voicemail/listui/error/Vvm3VoicemailMessageCreator.java
+++ b/java/com/android/dialer/voicemail/listui/error/Vvm3VoicemailMessageCreator.java
@@ -21,8 +21,6 @@
import android.content.Intent;
import android.net.Uri;
import android.provider.VoicemailContract.Status;
-import android.view.View;
-import android.view.View.OnClickListener;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
diff --git a/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java
index d112f63..5a73c03 100644
--- a/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java
+++ b/java/com/android/dialer/voicemail/settings/CurrentVoicemailGreetingActivity.java
@@ -18,18 +18,14 @@
package com.android.dialer.voicemail.settings;
import android.Manifest;
-import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ImageButton;
-import android.widget.TextView;
-
import androidx.appcompat.app.AppCompatActivity;
import com.android.dialer.R;
@@ -52,11 +48,6 @@
}
});
- private ImageButton changeGreetingButton;
- private ImageButton playButton;
-
- private DialerToolbar currentVoicemailGreetingDialerToolbar;
-
private int greetingDuration = -1;
private MediaPlayer mediaPlayer;
@@ -72,30 +63,12 @@
setContentView(R.layout.activity_current_voicemail_greeting);
playbackDisplay = findViewById(R.id.current_voicemail_greeting_recording_display);
- playbackProgressLabel = (TextView) findViewById(R.id.playback_progress_text_view);
- currentVoicemailGreetingDialerToolbar = (DialerToolbar) findViewById(R.id.toolbar);
+ playbackProgressLabel = findViewById(R.id.playback_progress_text_view);
+ DialerToolbar currentVoicemailGreetingDialerToolbar = findViewById(R.id.toolbar);
currentVoicemailGreetingDialerToolbar.setTitle(
R.string.voicemail_change_greeting_preference_title);
- changeGreetingButton = (ImageButton) findViewById(R.id.change_greeting_button);
- changeGreetingButton.setOnClickListener(
- new OnClickListener() {
- @Override
- public void onClick(View v) {
- // TODO(sabowitz): Implement this in CL child beta01.
- }
- });
-
- playButton = (ImageButton) findViewById(R.id.play_button);
- playButton.setOnClickListener(
- new OnClickListener() {
- @Override
- public void onClick(View v) {
- // TODO(sabowitz): Finish implementing this in CL child beta02.
- }
- });
-
displayCurrentVoicemailGreetingStatus();
}
diff --git a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java
index e67d763..f2a7ce7 100644
--- a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java
+++ b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java
@@ -17,7 +17,6 @@
package com.android.dialer.voicemail.settings;
-import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
diff --git a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java
index 0fe5c42..67caa41 100644
--- a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java
+++ b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java
@@ -20,7 +20,6 @@
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.os.Bundle;
import android.os.Handler;
diff --git a/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java b/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
index 3e651c2..ca6c748 100644
--- a/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
+++ b/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
@@ -47,11 +47,9 @@
"has_active_voicemail_provider";
private final SharedPreferences prefs;
private boolean hasActiveVoicemailProvider;
- private Context context;
private final Callback callback;
public VisualVoicemailEnabledChecker(Context context, @Nullable Callback callback) {
- this.context = context;
this.callback = callback;
prefs = PreferenceManager.getDefaultSharedPreferences(context);
hasActiveVoicemailProvider = prefs.getBoolean(PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER, false);
diff --git a/java/com/android/dialer/widget/FloatingActionButtonController.java b/java/com/android/dialer/widget/FloatingActionButtonController.java
index 136437c..2ab4f82 100644
--- a/java/com/android/dialer/widget/FloatingActionButtonController.java
+++ b/java/com/android/dialer/widget/FloatingActionButtonController.java
@@ -91,8 +91,8 @@
public void changeIcon(Context context, @DrawableRes int iconId, String description) {
if (this.fabIconId != iconId) {
fab.setImageResource(iconId);
- fab.setImageTintList(
- ColorStateList.valueOf(context.getResources().getColor(android.R.color.white)));
+ fab.setImageTintList(ColorStateList.valueOf(context.getResources().getColor(
+ android.R.color.white, context.getTheme())));
this.fabIconId = iconId;
}
if (!fab.getContentDescription().equals(description)) {
@@ -101,7 +101,8 @@
}
public void changeIconColor(Context context, @ColorRes int color) {
- fab.setImageTintList(ColorStateList.valueOf(context.getResources().getColor(color)));
+ fab.setImageTintList(ColorStateList.valueOf(context.getResources().getColor(color,
+ context.getTheme())));
}
/**
diff --git a/java/com/android/dialer/widget/LinearColorBar.java b/java/com/android/dialer/widget/LinearColorBar.java
index 344cb5d..6aa996e 100644
--- a/java/com/android/dialer/widget/LinearColorBar.java
+++ b/java/com/android/dialer/widget/LinearColorBar.java
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2011 The Android Open Source Project
* Copyright (C) 2013 Android Open Kang Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,13 +21,10 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
-import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
-import android.graphics.Shader;
import android.util.AttributeSet;
-import android.util.DisplayMetrics;
import android.widget.LinearLayout;
import com.android.dialer.R;
@@ -60,22 +58,16 @@
for (int i = 0; i < n; i++) {
int attr = a.getIndex(i);
- switch (attr) {
- case R.styleable.LinearColorBar_backgroundColor:
- mBackgroundColor = a.getColor(attr, 0);
- break;
- case R.styleable.LinearColorBar_redColor:
- mRedColor = a.getColor(attr, 0);
- break;
- case R.styleable.LinearColorBar_greenColor:
- mGreenColor = a.getColor(attr, 0);
- break;
- case R.styleable.LinearColorBar_blueColor:
- mBlueColor = a.getColor(attr, 0);
- break;
- case R.styleable.LinearColorBar_orangeColor:
- mOrangeColor = a.getColor(attr, 0);
- break;
+ if (attr == R.styleable.LinearColorBar_backgroundColor) {
+ mBackgroundColor = a.getColor(attr, 0);
+ } else if (attr == R.styleable.LinearColorBar_redColor) {
+ mRedColor = a.getColor(attr, 0);
+ } else if (attr == R.styleable.LinearColorBar_greenColor) {
+ mGreenColor = a.getColor(attr, 0);
+ } else if (attr == R.styleable.LinearColorBar_blueColor) {
+ mBlueColor = a.getColor(attr, 0);
+ } else if (attr == R.styleable.LinearColorBar_orangeColor) {
+ mOrangeColor = a.getColor(attr, 0);
}
}
diff --git a/java/com/android/dialer/widget/MessageFragment.java b/java/com/android/dialer/widget/MessageFragment.java
index 3d2eb3e..f8d1306 100644
--- a/java/com/android/dialer/widget/MessageFragment.java
+++ b/java/com/android/dialer/widget/MessageFragment.java
@@ -17,6 +17,7 @@
package com.android.dialer.widget;
+import android.annotation.SuppressLint;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
@@ -106,6 +107,7 @@
return view;
}
+ @SuppressLint("CheckResult")
@Override
public void onClick(View view) {
if (view == sendMessageContainer) {
@@ -116,7 +118,7 @@
customMessage.setText(((TextView) view).getText());
customMessage.setSelection(customMessage.getText().length());
} else {
- Assert.fail("Unknown view clicked");
+ Assert.createUnsupportedOperationFailException("Unknown view clicked");
}
}
@@ -133,7 +135,6 @@
if (charLimit != NO_CHAR_LIMIT) {
remainingChar.setText(Integer.toString(charLimit - s.length()));
}
- getListener().onMessageFragmentAfterTextChange(s.toString());
}
@Override
@@ -187,7 +188,5 @@
/** Interface for parent activity to implement to listen for important events. */
public interface Listener {
void onMessageFragmentSendMessage(String message);
-
- void onMessageFragmentAfterTextChange(String message);
}
}
diff --git a/java/com/android/incallui/AccelerometerListener.java b/java/com/android/incallui/AccelerometerListener.java
index 8bd1515..3caa24b 100644
--- a/java/com/android/incallui/AccelerometerListener.java
+++ b/java/com/android/incallui/AccelerometerListener.java
@@ -25,6 +25,7 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+
import com.android.dialer.common.LogUtil;
/**
diff --git a/java/com/android/incallui/AudioRouteSelectorActivity.java b/java/com/android/incallui/AudioRouteSelectorActivity.java
index d55a6f0..2c84840 100644
--- a/java/com/android/incallui/AudioRouteSelectorActivity.java
+++ b/java/com/android/incallui/AudioRouteSelectorActivity.java
@@ -18,7 +18,6 @@
package com.android.incallui;
import android.os.Bundle;
-import android.telecom.CallAudioState;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
diff --git a/java/com/android/incallui/Bindings.java b/java/com/android/incallui/Bindings.java
index 9f42585..8cabda5 100644
--- a/java/com/android/incallui/Bindings.java
+++ b/java/com/android/incallui/Bindings.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +18,11 @@
package com.android.incallui;
import android.content.Context;
+
import com.android.incallui.bindings.InCallUiBindings;
import com.android.incallui.bindings.InCallUiBindingsFactory;
import com.android.incallui.bindings.InCallUiBindingsStub;
+
import java.util.Objects;
/** Accessor for the in call UI bindings. */
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index 5ac76aa..13b4977 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -21,7 +21,6 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
-import android.os.Bundle;
import android.os.Trace;
import android.telecom.CallAudioState;
import android.telecom.PhoneAccountHandle;
@@ -292,7 +291,7 @@
@Override
public void showDialpadClicked(boolean checked) {
- LogUtil.v("CallButtonPresenter", "show dialpad " + String.valueOf(checked));
+ LogUtil.v("CallButtonPresenter", "show dialpad " + checked);
getActivity().showDialpadFragment(checked /* show */, true /* animate */);
}
@@ -556,12 +555,6 @@
}
@Override
- public void onSaveInstanceState(Bundle outState) {}
-
- @Override
- public void onRestoreInstanceState(Bundle savedInstanceState) {}
-
- @Override
public void onCameraPermissionGranted() {
if (call != null) {
updateButtonsState(call);
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index efcca39..44f4d37 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -21,7 +21,6 @@
import android.Manifest;
import android.content.Context;
-import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
@@ -96,13 +95,6 @@
*/
private static final long ACCESSIBILITY_ANNOUNCEMENT_DELAY_MILLIS = 500;
- /**
- * Make it possible to not get location during an emergency call if the battery is too low, since
- * doing so could trigger gps and thus potentially cause the phone to die in the middle of the
- * call.
- */
- private static final long CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT = 10;
-
private final Context context;
private final Handler handler = new Handler(Looper.getMainLooper());
@@ -505,28 +497,12 @@
}
@Override
- public void onCallStateButtonClicked() {
- Intent broadcastIntent = Bindings.get(context).getCallStateButtonBroadcastIntent(context);
- if (broadcastIntent != null) {
- LogUtil.v(
- "CallCardPresenter.onCallStateButtonClicked",
- "sending call state button broadcast: " + broadcastIntent);
- context.sendBroadcast(broadcastIntent, Manifest.permission.READ_PHONE_STATE);
- }
- }
-
- @Override
public void onManageConferenceClicked() {
InCallActivity activity =
(InCallActivity) (inCallScreen.getInCallScreenFragment().getActivity());
activity.showConferenceFragment(true);
}
- @Override
- public void onShrinkAnimationComplete() {
- InCallPresenter.getInstance().onShrinkAnimationComplete();
- }
-
private void maybeStartSearch(DialerCall call, boolean isPrimary) {
// no need to start search for conference calls which show generic info.
if (call != null && !call.isConferenceCall()) {
@@ -949,7 +925,7 @@
return false;
}
- AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_ANNOUNCEMENT);
+ AccessibilityEvent event = new AccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT);
inCallScreen.dispatchPopulateAccessibilityEvent(event);
View view = inCallScreen.getInCallScreenFragment().getView();
view.getParent().requestSendAccessibilityEvent(view, event);
@@ -1025,7 +1001,7 @@
private final boolean isPrimary;
public ContactLookupCallback(CallCardPresenter callCardPresenter, boolean isPrimary) {
- this.callCardPresenter = new WeakReference<CallCardPresenter>(callCardPresenter);
+ this.callCardPresenter = new WeakReference<>(callCardPresenter);
this.isPrimary = isPrimary;
}
diff --git a/java/com/android/incallui/CallerInfo.java b/java/com/android/incallui/CallerInfo.java
index 3ab3a77..678bbfa 100644
--- a/java/com/android/incallui/CallerInfo.java
+++ b/java/com/android/incallui/CallerInfo.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +30,7 @@
import android.provider.ContactsContract.RawContacts;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
+
import com.android.contacts.common.ContactsUtils;
import com.android.contacts.common.ContactsUtils.UserType;
import com.android.contacts.common.util.TelephonyManagerUtils;
diff --git a/java/com/android/incallui/CallerInfoAsyncQuery.java b/java/com/android/incallui/CallerInfoAsyncQuery.java
index 2ebcc95..506aaf0 100644
--- a/java/com/android/incallui/CallerInfoAsyncQuery.java
+++ b/java/com/android/incallui/CallerInfoAsyncQuery.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,6 +42,7 @@
import com.android.dialer.phonenumbercache.ContactInfoHelper;
import com.android.dialer.phonenumbercache.PhoneNumberCache;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -163,7 +165,7 @@
cw.countryIso = info.countryIso;
// check to see if these are recognized numbers, and use shortcuts if we can.
- if (PhoneNumberHelper.isLocalEmergencyNumber(context, info.phoneNumber)) {
+ if (PhoneNumberHelper.isEmergencyNumber(context, info.phoneNumber)) {
cw.event = EVENT_EMERGENCY_NUMBER;
} else if (info.isVoiceMailNumber()) {
cw.event = EVENT_VOICEMAIL_NUMBER;
@@ -439,7 +441,7 @@
Log.d(
this,
"notifying listener: "
- + cw.listener.getClass().toString()
+ + cw.listener.getClass()
+ " for token: "
+ token
+ callerInfo);
diff --git a/java/com/android/incallui/CallerInfoUtils.java b/java/com/android/incallui/CallerInfoUtils.java
index 27cb6a8..9db57ca 100644
--- a/java/com/android/incallui/CallerInfoUtils.java
+++ b/java/com/android/incallui/CallerInfoUtils.java
@@ -32,10 +32,11 @@
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.util.PermissionsUtil;
import com.android.incallui.call.DialerCall;
-import java.util.Arrays;
import org.lineageos.lib.phone.SensitivePhoneNumbers;
+import java.util.Arrays;
+
/** Utility methods for contact and caller info related functionality */
public class CallerInfoUtils {
diff --git a/java/com/android/incallui/ConferenceManagerFragment.java b/java/com/android/incallui/ConferenceManagerFragment.java
index 7978d57..ea52c9c 100644
--- a/java/com/android/incallui/ConferenceManagerFragment.java
+++ b/java/com/android/incallui/ConferenceManagerFragment.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +29,7 @@
import com.android.incallui.baseui.BaseFragment;
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
+
import java.util.List;
/** Fragment that allows the user to manage a conference call. */
@@ -59,7 +61,7 @@
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View parent = inflater.inflate(R.layout.conference_manager_fragment, container, false);
- conferenceParticipantList = (ListView) parent.findViewById(R.id.participantList);
+ conferenceParticipantList = parent.findViewById(R.id.participantList);
contactPhotoManager = ContactPhotoManager.getInstance(getActivity().getApplicationContext());
return parent;
diff --git a/java/com/android/incallui/ConferenceManagerPresenter.java b/java/com/android/incallui/ConferenceManagerPresenter.java
index 226741d..97a43cb 100644
--- a/java/com/android/incallui/ConferenceManagerPresenter.java
+++ b/java/com/android/incallui/ConferenceManagerPresenter.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,7 @@
import com.android.incallui.baseui.Ui;
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
+
import java.util.ArrayList;
import java.util.List;
@@ -57,7 +59,7 @@
final DialerCall call = callList.getActiveOrBackgroundCall();
if (call != null && call.isConferenceCall()) {
Log.v(
- this, "Number of existing calls is " + String.valueOf(call.getChildCallIds().size()));
+ this, "Number of existing calls is " + call.getChildCallIds().size());
update(callList);
} else {
InCallPresenter.getInstance().showConferenceCallManager(false);
@@ -117,7 +119,7 @@
calls.add(callList.getCallById(callerId));
}
- Log.d(this, "Number of calls is " + String.valueOf(calls.size()));
+ Log.d(this, "Number of calls is " + calls.size());
// Users can split out a call from the conference call if either the active call or the
// holding call is empty. If both are filled, users can not split out another call.
diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java
index 38e8e86..f6f68a9 100644
--- a/java/com/android/incallui/ConferenceParticipantListAdapter.java
+++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java
@@ -47,8 +47,6 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
diff --git a/java/com/android/incallui/ContactsAsyncHelper.java b/java/com/android/incallui/ContactsAsyncHelper.java
index fe30151..84a5563 100644
--- a/java/com/android/incallui/ContactsAsyncHelper.java
+++ b/java/com/android/incallui/ContactsAsyncHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +32,7 @@
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutor;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
+
import java.io.IOException;
import java.io.InputStream;
diff --git a/java/com/android/incallui/DialpadFragment.java b/java/com/android/incallui/DialpadFragment.java
index d47b9bc..147f5c0 100644
--- a/java/com/android/incallui/DialpadFragment.java
+++ b/java/com/android/incallui/DialpadFragment.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +31,6 @@
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
-import android.widget.TextView;
import com.android.dialer.R;
import com.android.dialer.common.LogUtil;
@@ -39,6 +39,7 @@
import com.android.dialer.dialpadview.DialpadView;
import com.android.incallui.DialpadPresenter.DialpadUi;
import com.android.incallui.baseui.BaseFragment;
+
import java.util.Map;
/** Fragment for call control buttons */
@@ -48,7 +49,7 @@
/** Hash Map to map a view id to a character */
private static final Map<Integer, Character> displayMap = new ArrayMap<>();
- /** Set up the static maps */
+ /* Set up the static maps */
static {
// Map the buttons to the display characters
displayMap.put(R.id.one, '1');
@@ -137,9 +138,9 @@
Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.Dialer_ThemeBase);
LayoutInflater layoutInflater = inflater.cloneInContext(contextThemeWrapper);
final View parent = layoutInflater.inflate(R.layout.incall_dialpad_fragment, container, false);
- dialpadView = (DialpadView) parent.findViewById(R.id.dialpad_view);
+ dialpadView = parent.findViewById(R.id.dialpad_view);
dialpadView.setCanDigitsBeEdited(false);
- dtmfDialerField = (EditText) parent.findViewById(R.id.digits);
+ dtmfDialerField = parent.findViewById(R.id.digits);
if (dtmfDialerField != null) {
LogUtil.i("DialpadFragment.onCreateView", "creating dtmfKeyListener");
dtmfKeyListener = new DtmfKeyListener(getPresenter());
@@ -190,7 +191,7 @@
/** Starts the slide up animation for the Dialpad keys when the Dialpad is revealed. */
public void animateShowDialpad() {
- final DialpadView dialpadView = (DialpadView) getView().findViewById(R.id.dialpad_view);
+ final DialpadView dialpadView = getView().findViewById(R.id.dialpad_view);
dialpadView.animateShow();
}
@@ -233,7 +234,7 @@
private void configureKeypadListeners() {
DialpadKeyButton dialpadKey;
for (int i = 0; i < buttonIds.length; i++) {
- dialpadKey = (DialpadKeyButton) dialpadView.findViewById(buttonIds[i]);
+ dialpadKey = dialpadView.findViewById(buttonIds[i]);
dialpadKey.setOnKeyListener(this);
dialpadKey.setOnClickListener(this);
dialpadKey.setOnPressedListener(this);
diff --git a/java/com/android/incallui/DialpadPresenter.java b/java/com/android/incallui/DialpadPresenter.java
index e6fbdc2..c4a7106 100644
--- a/java/com/android/incallui/DialpadPresenter.java
+++ b/java/com/android/incallui/DialpadPresenter.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.incallui;
import android.telephony.PhoneNumberUtils;
+
import com.android.incallui.DialpadPresenter.DialpadUi;
import com.android.incallui.baseui.Presenter;
import com.android.incallui.baseui.Ui;
diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java
index d1334f3..cdacd60 100644
--- a/java/com/android/incallui/ExternalCallNotifier.java
+++ b/java/com/android/incallui/ExternalCallNotifier.java
@@ -51,6 +51,7 @@
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCallDelegate;
import com.android.incallui.call.ExternalCallList;
+
import java.util.Map;
/**
@@ -264,14 +265,15 @@
.build());
}
- /**
+ /*
* This builder is used for the notification shown when the device is locked and the user has
* set their notification settings to 'hide sensitive content' {@see
* Notification.Builder#setPublicVersion}.
*/
Notification.Builder publicBuilder = new Notification.Builder(context);
publicBuilder.setSmallIcon(R.drawable.quantum_ic_call_vd_theme_24);
- publicBuilder.setColor(ThemeComponent.get(context).theme().getColorCallNotificationBackground());
+ publicBuilder.setColor(
+ ThemeComponent.get(context).theme().getColorCallNotificationBackground());
publicBuilder.setChannelId(NotificationChannelId.DEFAULT);
builder.setPublicVersion(publicBuilder.build());
diff --git a/java/com/android/incallui/InCallCameraManager.java b/java/com/android/incallui/InCallCameraManager.java
index 2296afb..8bb7060 100644
--- a/java/com/android/incallui/InCallCameraManager.java
+++ b/java/com/android/incallui/InCallCameraManager.java
@@ -21,6 +21,7 @@
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
+
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -29,7 +30,7 @@
public class InCallCameraManager {
private final Set<Listener> cameraSelectionListeners =
- Collections.newSetFromMap(new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
/** The camera ID for the front facing camera. */
private String frontFacingCameraId;
/** The camera ID for the rear facing camera. */
diff --git a/java/com/android/incallui/InCallDndHandler.java b/java/com/android/incallui/InCallDndHandler.java
index 062ab34..5ea6eed 100644
--- a/java/com/android/incallui/InCallDndHandler.java
+++ b/java/com/android/incallui/InCallDndHandler.java
@@ -22,10 +22,10 @@
import androidx.preference.PreferenceManager;
+import com.android.incallui.InCallPresenter.InCallState;
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.state.DialerCallState;
-import com.android.incallui.InCallPresenter.InCallState;
public class InCallDndHandler implements InCallPresenter.InCallStateListener {
diff --git a/java/com/android/incallui/InCallOrientationEventListener.java b/java/com/android/incallui/InCallOrientationEventListener.java
index 1858f8e..8d5d072 100644
--- a/java/com/android/incallui/InCallOrientationEventListener.java
+++ b/java/com/android/incallui/InCallOrientationEventListener.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import androidx.annotation.IntDef;
import com.android.dialer.common.LogUtil;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index 77bf562..66ca448 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -17,6 +17,7 @@
package com.android.incallui;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
@@ -44,8 +45,6 @@
import androidx.annotation.Nullable;
import com.android.contacts.common.compat.CallCompat;
-import com.android.dialer.CallConfiguration;
-import com.android.dialer.Mode;
import com.android.dialer.R;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
@@ -96,20 +95,19 @@
* resizing, 1 means we only expect a single thread to access the map so make only a single shard
*/
private final Set<InCallStateListener> listeners =
- Collections.newSetFromMap(new ConcurrentHashMap<InCallStateListener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
private final List<IncomingCallListener> incomingCallListeners = new CopyOnWriteArrayList<>();
private final Set<InCallDetailsListener> detailsListeners =
- Collections.newSetFromMap(new ConcurrentHashMap<InCallDetailsListener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
private final Set<CanAddCallListener> canAddCallListeners =
- Collections.newSetFromMap(new ConcurrentHashMap<CanAddCallListener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
private final Set<InCallUiListener> inCallUiListeners =
- Collections.newSetFromMap(new ConcurrentHashMap<InCallUiListener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
private final Set<InCallOrientationListener> orientationListeners =
- Collections.newSetFromMap(
- new ConcurrentHashMap<InCallOrientationListener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
private final Set<InCallEventListener> inCallEventListeners =
- Collections.newSetFromMap(new ConcurrentHashMap<InCallEventListener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
private StatusBarNotifier statusBarNotifier;
private ExternalCallNotifier externalCallNotifier;
@@ -1659,6 +1657,7 @@
}
}
+ @SuppressLint("MissingPermission")
@Override
public void onAudioStateChanged(CallAudioState audioState) {
if (statusBarNotifier != null) {
diff --git a/java/com/android/incallui/InCallServiceImpl.java b/java/com/android/incallui/InCallServiceImpl.java
index 6ff1610..5d0df24 100644
--- a/java/com/android/incallui/InCallServiceImpl.java
+++ b/java/com/android/incallui/InCallServiceImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import android.telecom.Call;
import android.telecom.CallAudioState;
import android.telecom.InCallService;
+
import com.android.incallui.audiomode.AudioModeProvider;
import com.android.incallui.call.CallList;
import com.android.incallui.call.CallRecorder;
@@ -74,11 +76,6 @@
}
@Override
- public void onCreate() {
- super.onCreate();
- }
-
- @Override
public IBinder onBind(Intent intent) {
Trace.beginSection("InCallServiceImpl.onBind");
final Context context = getApplicationContext();
diff --git a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
index 7c47e54..9e524a4 100644
--- a/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
+++ b/java/com/android/incallui/InCallUIMaterialColorMapUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +20,7 @@
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.telecom.PhoneAccount;
+
import com.android.contacts.common.util.MaterialColorMapUtils;
import com.android.dialer.R;
import com.android.dialer.theme.base.ThemeComponent;
@@ -42,7 +43,6 @@
/**
* {@link Resources#getColor(int) used for compatibility
*/
- @SuppressWarnings("deprecation")
public static MaterialPalette getDefaultPrimaryAndSecondaryColors(Context context) {
final int primaryColor = ThemeComponent.get(context).theme().getColorPrimary();
final int secondaryColor = ThemeComponent.get(context).theme().getColorPrimaryDark();
diff --git a/java/com/android/incallui/InCallVibrationHandler.java b/java/com/android/incallui/InCallVibrationHandler.java
index cde882a..ffd8f69 100644
--- a/java/com/android/incallui/InCallVibrationHandler.java
+++ b/java/com/android/incallui/InCallVibrationHandler.java
@@ -27,12 +27,10 @@
import android.os.VibratorManager;
import android.telecom.DisconnectCause;
-import androidx.preference.PreferenceManager;
-
+import com.android.incallui.InCallPresenter.InCallState;
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.state.DialerCallState;
-import com.android.incallui.InCallPresenter.InCallState;
public class InCallVibrationHandler extends Handler implements
InCallPresenter.InCallStateListener {
diff --git a/java/com/android/incallui/Log.java b/java/com/android/incallui/Log.java
index c63eccb..33be91b 100644
--- a/java/com/android/incallui/Log.java
+++ b/java/com/android/incallui/Log.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +20,9 @@
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telephony.PhoneNumberUtils;
+
import com.android.dialer.common.LogUtil;
+
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
diff --git a/java/com/android/incallui/MotorolaInCallUiNotifier.java b/java/com/android/incallui/MotorolaInCallUiNotifier.java
index 2377a55..4291df9 100644
--- a/java/com/android/incallui/MotorolaInCallUiNotifier.java
+++ b/java/com/android/incallui/MotorolaInCallUiNotifier.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* This file is derived in part from code issued under the following license.
*
@@ -20,6 +21,7 @@
import android.content.Context;
import android.content.Intent;
+
import com.android.dialer.common.LogUtil;
import com.android.incallui.InCallPresenter.InCallState;
import com.android.incallui.InCallPresenter.InCallStateListener;
diff --git a/java/com/android/incallui/NotificationBroadcastReceiver.java b/java/com/android/incallui/NotificationBroadcastReceiver.java
index 1d9c614..4c2977d 100644
--- a/java/com/android/incallui/NotificationBroadcastReceiver.java
+++ b/java/com/android/incallui/NotificationBroadcastReceiver.java
@@ -16,6 +16,7 @@
package com.android.incallui;
+import android.annotation.SuppressLint;
import android.app.BroadcastOptions;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -69,6 +70,7 @@
public static final String EXTRA_NOTIFICATION_ID =
"com.android.incallui.extra.EXTRA_NOTIFICATION_ID";
+ @SuppressLint("MissingPermission")
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
diff --git a/java/com/android/incallui/ProximitySensor.java b/java/com/android/incallui/ProximitySensor.java
index ad5b77c..c02ebf7 100644
--- a/java/com/android/incallui/ProximitySensor.java
+++ b/java/com/android/incallui/ProximitySensor.java
@@ -168,16 +168,6 @@
accelerometerListener.enable(isDisplayOn);
}
- /**
- * TODO: There is no way to determine if a screen is off due to proximity or if it is legitimately
- * off, but if ever we can do that in the future, it would be useful here. Until then, this
- * function will simply return true of the screen is off. TODO: Investigate whether this can be
- * replaced with the ProximityDisplayListener.
- */
- public boolean isScreenReallyOff() {
- return !powerManager.isScreenOn();
- }
-
private void turnOnProximitySensor() {
if (proximityWakeLock != null) {
if (!proximityWakeLock.isHeld()) {
diff --git a/java/com/android/incallui/RttCallPresenter.java b/java/com/android/incallui/RttCallPresenter.java
index 4726cd3..6066bba 100644
--- a/java/com/android/incallui/RttCallPresenter.java
+++ b/java/com/android/incallui/RttCallPresenter.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.os.HandlerThread;
import android.os.Looper;
import android.telecom.Call.RttCall;
+
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.ThreadUtil;
import com.android.dialer.rtt.RttTranscript;
@@ -29,6 +31,7 @@
import com.android.incallui.call.DialerCall;
import com.android.incallui.rtt.protocol.RttCallScreen;
import com.android.incallui.rtt.protocol.RttCallScreenDelegate;
+
import java.io.IOException;
/**
diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java
index 177a1a5..40449a7 100644
--- a/java/com/android/incallui/StatusBarNotifier.java
+++ b/java/com/android/incallui/StatusBarNotifier.java
@@ -82,7 +82,7 @@
import com.android.incallui.ContactInfoCache.ContactCacheEntry;
import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback;
import com.android.incallui.InCallPresenter.InCallState;
-import com.android.incallui.async.PausableExecutorImpl;
+import com.android.incallui.async.PausableExecutor;
import com.android.incallui.audiomode.AudioModeProvider;
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
@@ -93,6 +93,7 @@
import com.android.incallui.ringtone.InCallTonePlayer;
import com.android.incallui.ringtone.ToneGeneratorFactory;
import com.android.incallui.videotech.utils.SessionModificationState;
+
import java.util.Objects;
/** This class adds Notifications to the status bar for the in-call experience. */
@@ -135,7 +136,7 @@
this.contactInfoCache = contactInfoCache;
dialerRingtoneManager =
new DialerRingtoneManager(
- new InCallTonePlayer(new ToneGeneratorFactory(), new PausableExecutorImpl()),
+ new InCallTonePlayer(new ToneGeneratorFactory(), new PausableExecutor()),
CallList.getInstance());
currentNotification = NOTIFICATION_NONE;
Trace.endSection();
@@ -592,7 +593,8 @@
}
if (call.isSpam()) {
- Drawable drawable = resources.getDrawable(R.drawable.blocked_contact, context.getTheme());
+ Drawable drawable = ResourcesCompat.getDrawable(resources, R.drawable.blocked_contact,
+ context.getTheme());
largeIcon = DrawableConverter.drawableToBitmap(drawable);
}
Trace.endSection();
@@ -1027,6 +1029,7 @@
* Responds to changes in the session modification state for the call by dismissing the status
* bar notification as required.
*/
+ @SuppressLint("MissingPermission")
@Override
public void onDialerCallSessionModificationStateChange() {
if (dialerCall.getVideoTech().getSessionModificationState()
diff --git a/java/com/android/incallui/ThemeColorManager.java b/java/com/android/incallui/ThemeColorManager.java
index e6f0f0b..1b73354 100644
--- a/java/com/android/incallui/ThemeColorManager.java
+++ b/java/com/android/incallui/ThemeColorManager.java
@@ -16,6 +16,8 @@
package com.android.incallui;
+import static android.telecom.PhoneAccount.NO_HIGHLIGHT_COLOR;
+
import android.content.Context;
import androidx.annotation.ColorInt;
@@ -26,8 +28,6 @@
import com.android.dialer.R;
import com.android.incallui.call.DialerCall;
-import static android.telecom.PhoneAccount.NO_HIGHLIGHT_COLOR;
-
/**
* Calculates the background color for the in call window. The background color is based on the SIM
* and spam status.
diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java
index 2402394..31f620d 100644
--- a/java/com/android/incallui/VideoCallPresenter.java
+++ b/java/com/android/incallui/VideoCallPresenter.java
@@ -52,6 +52,7 @@
import com.android.incallui.videosurface.protocol.VideoSurfaceTexture;
import com.android.incallui.videotech.utils.SessionModificationState;
import com.android.incallui.videotech.utils.VideoUtils;
+
import java.util.Objects;
/**
diff --git a/java/com/android/incallui/VideoPauseController.java b/java/com/android/incallui/VideoPauseController.java
index fed7401..3a444c0 100644
--- a/java/com/android/incallui/VideoPauseController.java
+++ b/java/com/android/incallui/VideoPauseController.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.state.DialerCallState;
+
import java.util.Objects;
/**
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index 5f13ba7..d3ce392 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -38,9 +38,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.AccessibilityDelegate;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
@@ -639,11 +637,6 @@
}
@Override
- public void onDestroy() {
- super.onDestroy();
- }
-
- @Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Trace.beginSection("AnswerFragment.onCreateView");
diff --git a/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java b/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java
index d14d59f..a6f09f0 100644
--- a/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java
+++ b/java/com/android/incallui/answer/impl/CreateCustomSmsDialogFragment.java
@@ -20,7 +20,6 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
-import android.content.DialogInterface.OnShowListener;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@@ -56,7 +55,7 @@
super.onCreateDialog(savedInstanceState);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View view = View.inflate(builder.getContext(), R.layout.fragment_custom_sms_dialog, null);
- editText = (EditText) view.findViewById(R.id.custom_sms_input);
+ editText = view.findViewById(R.id.custom_sms_input);
if (savedInstanceState != null) {
editText.setText(savedInstanceState.getCharSequence(ARG_ENTERED_TEXT));
}
diff --git a/java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java b/java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java
index 1f7e6fe..ed63a41 100644
--- a/java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java
+++ b/java/com/android/incallui/answer/impl/FixedAspectSurfaceView.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
import android.util.AttributeSet;
import android.view.SurfaceView;
import android.view.View;
+
import com.android.dialer.common.Assert;
/**
diff --git a/java/com/android/incallui/answer/impl/SelfManagedAnswerVideoCallScreen.java b/java/com/android/incallui/answer/impl/SelfManagedAnswerVideoCallScreen.java
index 7f33ff9..f6df9c9 100644
--- a/java/com/android/incallui/answer/impl/SelfManagedAnswerVideoCallScreen.java
+++ b/java/com/android/incallui/answer/impl/SelfManagedAnswerVideoCallScreen.java
@@ -42,7 +42,7 @@
import com.android.dialer.common.LogUtil;
import com.android.incallui.video.protocol.VideoCallScreen;
-import java.util.Arrays;
+import java.util.Collections;
/**
* Shows the local preview for the incoming video call or video upgrade request. This class is used
@@ -139,7 +139,7 @@
try {
manager.openCamera(cameraId, this, null);
- } catch (CameraAccessException e) {
+ } catch (CameraAccessException | SecurityException e) {
LogUtil.e("SelfManagedAnswerVideoCallScreen.openCamera", "failed to open camera", e);
}
}
@@ -225,7 +225,8 @@
try {
captureRequestBuilder = camera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
captureRequestBuilder.addTarget(surface);
- camera.createCaptureSession(Arrays.asList(surface), new CaptureSessionCallback(), null);
+ camera.createCaptureSession(Collections.singletonList(surface), new CaptureSessionCallback(),
+ null);
} catch (CameraAccessException e) {
LogUtil.e(
"SelfManagedAnswerVideoCallScreen.createCameraPreview", "failed to create preview", e);
diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java
index 5895f9c..7352d68 100644
--- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java
+++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonHelper.java
@@ -85,7 +85,7 @@
public void run() {
callback.onAnimationToSideEnded(rightPage);
}
- };
+ }
public SwipeButtonHelper(Callback callback, Context context) {
this.context = context;
@@ -596,8 +596,7 @@
updateIcon(otherView, 0.0f, 0, true, false, true, false);
} else {
callback.onAnimationToSideStarted(!left, translation, 0);
- translation =
- left ? callback.getMaxTranslationDistance() : callback.getMaxTranslationDistance();
+ translation = callback.getMaxTranslationDistance();
updateIcon(otherView, 0.0f, 0.0f, false, false, true, false);
targetView.instantFinishAnimation();
flingEndListener.onAnimationEnd(null);
diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
index c6a5b71..931edc3 100644
--- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
+++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
@@ -27,6 +27,7 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
@@ -158,7 +159,7 @@
float alpha = circleRadius / minBackgroundRadius;
alpha = Math.min(1.0f, alpha);
int color = (int) colorInterpolator.evaluate(alpha, normalColor, inverseColor);
- drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
+ drawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP));
}
private void drawBackgroundCircle(Canvas canvas) {
diff --git a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java
index afaf799..41e0328 100644
--- a/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java
+++ b/java/com/android/incallui/answer/impl/answermethod/FlingUpDownTouchHandler.java
@@ -20,7 +20,6 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
-import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.MotionEvent;
@@ -36,10 +35,10 @@
import com.android.dialer.R;
import com.android.dialer.common.DpUtil;
-import com.android.dialer.common.LogUtil;
import com.android.dialer.common.MathUtil;
import com.android.incallui.answer.impl.classifier.FalsingManager;
import com.android.incallui.answer.impl.utils.FlingAnimationUtils;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -165,7 +164,6 @@
private boolean touchAboveFalsingThreshold;
private final float falsingThresholdPx;
- private boolean touchUsesFalsing;
private final float acceptThresholdPx;
private final float rejectThresholdPx;
@@ -249,7 +247,6 @@
motionAborted = false;
startMotion(pointerY, false, currentProgress);
touchAboveFalsingThreshold = false;
- touchUsesFalsing = listener.shouldUseFalsing(event);
if (velocityTracker == null) {
initVelocityTracker();
}
diff --git a/java/com/android/incallui/answer/impl/answermethod/TwoButtonMethod.java b/java/com/android/incallui/answer/impl/answermethod/TwoButtonMethod.java
index 0521849..ba59691 100644
--- a/java/com/android/incallui/answer/impl/answermethod/TwoButtonMethod.java
+++ b/java/com/android/incallui/answer/impl/answermethod/TwoButtonMethod.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
+import android.annotation.SuppressLint;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
@@ -172,6 +174,7 @@
}
}
+ @SuppressLint("CheckResult")
@Override
public void onClick(View view) {
if (view == answerButton) {
@@ -181,7 +184,7 @@
rejectCall();
LogUtil.v("TwoButtonMethod.onClick", "two_buttonMethod Call rejected");
} else {
- Assert.fail("Unknown click from view: " + view);
+ throw Assert.createIllegalStateFailException("Unknown click from view: " + view);
}
buttonClicked = true;
}
diff --git a/java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java b/java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java
index ae0d1c8..3f9d76d 100644
--- a/java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/AccelerationClassifier.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.util.ArrayMap;
import android.view.MotionEvent;
+
import java.util.Map;
/**
diff --git a/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java b/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java
index 8c997c7..cacb24d 100644
--- a/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/AnglesClassifier.java
@@ -19,6 +19,7 @@
import android.util.ArrayMap;
import android.view.MotionEvent;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
diff --git a/java/com/android/incallui/answer/impl/classifier/ClassifierData.java b/java/com/android/incallui/answer/impl/classifier/ClassifierData.java
index 462204a..da63b37 100644
--- a/java/com/android/incallui/answer/impl/classifier/ClassifierData.java
+++ b/java/com/android/incallui/answer/impl/classifier/ClassifierData.java
@@ -19,6 +19,7 @@
import android.util.SparseArray;
import android.view.MotionEvent;
+
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
diff --git a/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java b/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java
index ac76a01..cf3185a 100644
--- a/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java
+++ b/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java
@@ -18,6 +18,7 @@
package com.android.incallui.answer.impl.classifier;
import android.os.SystemClock;
+
import java.util.ArrayList;
/**
diff --git a/java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java b/java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java
index b63f15d..9c5322e 100644
--- a/java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/ProximityClassifier.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.view.MotionEvent;
+
import java.util.concurrent.TimeUnit;
/**
diff --git a/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java b/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java
index 2fc7b0f..69d9d05 100644
--- a/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java
+++ b/java/com/android/incallui/answer/impl/classifier/SpeedAnglesClassifier.java
@@ -19,6 +19,7 @@
import android.util.ArrayMap;
import android.view.MotionEvent;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
diff --git a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
index a6a33f4..f2316bc 100644
--- a/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
+++ b/java/com/android/incallui/answerproximitysensor/AnswerProximitySensor.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,13 +22,13 @@
import android.os.PowerManager;
import android.os.Trace;
import android.view.Display;
+
import com.android.dialer.common.LogUtil;
+import com.android.incallui.R;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCallListener;
import com.android.incallui.call.state.DialerCallState;
-import com.android.incallui.R;
-
/**
* This class prevents users from accidentally answering calls by keeping the screen off until the
* proximity sensor is unblocked. If the screen is already on or if this is a call waiting call then
diff --git a/java/com/android/incallui/answerproximitysensor/PseudoScreenState.java b/java/com/android/incallui/answerproximitysensor/PseudoScreenState.java
index 676a1a3..53ddc91 100644
--- a/java/com/android/incallui/answerproximitysensor/PseudoScreenState.java
+++ b/java/com/android/incallui/answerproximitysensor/PseudoScreenState.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,9 @@
package com.android.incallui.answerproximitysensor;
import android.util.ArraySet;
+
+import com.android.incallui.InCallActivity;
+
import java.util.Set;
/**
diff --git a/java/com/android/incallui/async/PausableExecutor.java b/java/com/android/incallui/async/PausableExecutor.java
index 9f51b87..f6622fe 100644
--- a/java/com/android/incallui/async/PausableExecutor.java
+++ b/java/com/android/incallui/async/PausableExecutor.java
@@ -16,20 +16,11 @@
package com.android.incallui.async;
-import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
-/**
- * Executor that can be used to easily synchronize testing and production code. Production code
- * should call {@link #milestone()} at points in the code where the state of the system is worthy of
- * testing.
- */
-public interface PausableExecutor extends Executor {
-
- /**
- * Method called from asynchronous production code to inform this executor that it has reached a
- * point that puts the system into a state worth testing. TestableExecutors intended for use in a
- * testing environment should cause the calling thread to block. In the production environment
- * this should be a no-op.
- */
- void milestone();
+/** {@link PausableExecutor} intended for use in production environments. */
+public class PausableExecutor {
+ public void execute(Runnable command) {
+ Executors.newSingleThreadExecutor().execute(command);
+ }
}
diff --git a/java/com/android/incallui/async/PausableExecutorImpl.java b/java/com/android/incallui/async/PausableExecutorImpl.java
deleted file mode 100644
index 8628ad6..0000000
--- a/java/com/android/incallui/async/PausableExecutorImpl.java
+++ /dev/null
@@ -1,31 +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.incallui.async;
-
-import java.util.concurrent.Executors;
-
-/** {@link PausableExecutor} intended for use in production environments. */
-public class PausableExecutorImpl implements PausableExecutor {
-
- @Override
- public void milestone() {}
-
- @Override
- public void execute(Runnable command) {
- Executors.newSingleThreadExecutor().execute(command);
- }
-}
diff --git a/java/com/android/incallui/audiomode/AudioModeProvider.java b/java/com/android/incallui/audiomode/AudioModeProvider.java
index cefee0d..7b153a6 100644
--- a/java/com/android/incallui/audiomode/AudioModeProvider.java
+++ b/java/com/android/incallui/audiomode/AudioModeProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,9 @@
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.telecom.CallAudioState;
+
import com.android.dialer.common.LogUtil;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java
index c5836e3..452be1b 100644
--- a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java
+++ b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java
@@ -35,6 +35,7 @@
import android.widget.TextView;
import androidx.annotation.Nullable;
+import androidx.core.widget.TextViewCompat;
import com.android.dialer.R;
import com.android.dialer.common.FragmentUtils;
@@ -42,7 +43,6 @@
import com.android.dialer.theme.base.ThemeComponent;
import com.android.incallui.call.TelecomAdapter;
import com.android.incallui.util.BluetoothUtil;
-
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import java.util.Collection;
@@ -109,15 +109,15 @@
}
initItem(
- (TextView) view.findViewById(R.id.audioroute_speaker),
+ view.findViewById(R.id.audioroute_speaker),
CallAudioState.ROUTE_SPEAKER,
audioState);
initItem(
- (TextView) view.findViewById(R.id.audioroute_headset),
+ view.findViewById(R.id.audioroute_headset),
CallAudioState.ROUTE_WIRED_HEADSET,
audioState);
initItem(
- (TextView) view.findViewById(R.id.audioroute_earpiece),
+ view.findViewById(R.id.audioroute_earpiece),
CallAudioState.ROUTE_EARPIECE,
audioState);
@@ -178,10 +178,10 @@
private void setColor(TextView item, boolean isSelected) {
int color = isSelected
- ? ThemeComponent.get(getContext()).theme().getColorAccent()
- : getContext().getColor(R.color.nav_item);
+ ? ThemeComponent.get(requireContext()).theme().getColorAccent()
+ : requireContext().getColor(R.color.nav_item);
item.setTextColor(color);
- item.setCompoundDrawableTintList(ColorStateList.valueOf(color));
- item.setCompoundDrawableTintMode(Mode.SRC_ATOP);
+ TextViewCompat.setCompoundDrawableTintList(item, ColorStateList.valueOf(color));
+ TextViewCompat.setCompoundDrawableTintMode(item, Mode.SRC_ATOP);
}
}
diff --git a/java/com/android/incallui/baseui/BaseFragment.java b/java/com/android/incallui/baseui/BaseFragment.java
index ac05984..0dfa28d 100644
--- a/java/com/android/incallui/baseui/BaseFragment.java
+++ b/java/com/android/incallui/baseui/BaseFragment.java
@@ -18,7 +18,10 @@
package com.android.incallui.baseui;
import android.os.Bundle;
+import android.view.View;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
/** Parent for all fragments that use Presenters and Ui design. */
@@ -46,8 +49,8 @@
}
@Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
presenter.onUiReady(getUi());
}
@@ -55,7 +58,6 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
- presenter.onRestoreInstanceState(savedInstanceState);
if (savedInstanceState.getBoolean(KEY_FRAGMENT_HIDDEN)) {
getParentFragmentManager().beginTransaction().hide(this).commit();
}
@@ -71,7 +73,6 @@
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- presenter.onSaveInstanceState(outState);
outState.putBoolean(KEY_FRAGMENT_HIDDEN, isHidden());
}
}
diff --git a/java/com/android/incallui/baseui/Presenter.java b/java/com/android/incallui/baseui/Presenter.java
index e4df938..ab67ea4 100644
--- a/java/com/android/incallui/baseui/Presenter.java
+++ b/java/com/android/incallui/baseui/Presenter.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +17,6 @@
package com.android.incallui.baseui;
-import android.os.Bundle;
-
/** Base class for Presenters. */
public abstract class Presenter<U extends Ui> {
@@ -44,10 +43,6 @@
*/
public void onUiUnready(U ui) {}
- public void onSaveInstanceState(Bundle outState) {}
-
- public void onRestoreInstanceState(Bundle savedInstanceState) {}
-
public U getUi() {
return ui;
}
diff --git a/java/com/android/incallui/bindings/ContactUtils.java b/java/com/android/incallui/bindings/ContactUtils.java
index d2d365d..3b5197d 100644
--- a/java/com/android/incallui/bindings/ContactUtils.java
+++ b/java/com/android/incallui/bindings/ContactUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.location.Address;
import android.util.Pair;
+
import java.util.Calendar;
import java.util.List;
diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java
index 1ff6c47..2649da5 100644
--- a/java/com/android/incallui/call/CallList.java
+++ b/java/com/android/incallui/call/CallList.java
@@ -32,13 +32,13 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.promotion.impl.RttPromotion;
import com.android.dialer.shortcuts.ShortcutUsageReporter;
import com.android.incallui.call.state.DialerCallState;
import com.android.incallui.videotech.utils.SessionModificationState;
+
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -70,10 +70,10 @@
* resizing, 1 means we only expect a single thread to access the map so make only a single shard
*/
private final Set<Listener> listeners =
- Collections.newSetFromMap(new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
private final Set<DialerCall> pendingDisconnectCalls =
- Collections.newSetFromMap(new ConcurrentHashMap<DialerCall, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
private UiListener uiListeners;
/** Handles the timeout for destroying disconnected calls. */
@@ -159,7 +159,6 @@
// Don't log an already logged call. logCall() might be called multiple times
// for the same call due to a bug.
if (call.getLogState() != null && !call.getLogState().isLogged) {
- getLegacyBindings(context).logCall(call);
call.getLogState().isLogged = true;
}
@@ -176,21 +175,6 @@
}
}
- InCallUiLegacyBindings getLegacyBindings(Context context) {
- Objects.requireNonNull(context);
-
- Context application = context.getApplicationContext();
- InCallUiLegacyBindings legacyInstance = null;
- if (application instanceof InCallUiLegacyBindingsFactory) {
- legacyInstance = ((InCallUiLegacyBindingsFactory) application).newInCallUiLegacyBindings();
- }
-
- if (legacyInstance == null) {
- legacyInstance = new InCallUiLegacyBindingsStub();
- }
- return legacyInstance;
- }
-
/**
* Handles the case where an internal call has become an exteral call. We need to
*
@@ -205,7 +189,6 @@
// Don't log an already logged call. logCall() might be called multiple times
// for the same call due to a bug.
if (call.getLogState() != null && !call.getLogState().isLogged) {
- getLegacyBindings(context).logCall(call);
call.getLogState().isLogged = true;
}
diff --git a/java/com/android/incallui/call/CallRecorder.java b/java/com/android/incallui/call/CallRecorder.java
index 105f756..f20c421 100644
--- a/java/com/android/incallui/call/CallRecorder.java
+++ b/java/com/android/incallui/call/CallRecorder.java
@@ -26,14 +26,13 @@
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
-import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.android.dialer.R;
-import com.android.dialer.callrecord.CallRecordingDataStore;
import com.android.dialer.callrecord.CallRecording;
+import com.android.dialer.callrecord.CallRecordingDataStore;
import com.android.dialer.callrecord.ICallRecorderService;
import com.android.dialer.callrecord.impl.CallRecorderService;
import com.android.dialer.location.GeoUtil;
diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java
index 485a6c7..4a0bd6e 100644
--- a/java/com/android/incallui/call/DialerCall.java
+++ b/java/com/android/incallui/call/DialerCall.java
@@ -39,6 +39,8 @@
import android.telecom.StatusHints;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.widget.Toast;
@@ -47,6 +49,7 @@
import androidx.annotation.Nullable;
import com.android.contacts.common.compat.CallCompat;
+import com.android.dialer.R;
import com.android.dialer.assisteddialing.TransformationInfo;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallIntentParser;
@@ -63,7 +66,6 @@
import com.android.dialer.rtt.RttTranscriptUtil;
import com.android.dialer.telecom.TelecomCallUtil;
import com.android.dialer.telecom.TelecomUtil;
-import com.android.dialer.theme.common.R;
import com.android.dialer.util.PermissionsUtil;
import com.android.incallui.audiomode.AudioModeProvider;
import com.android.incallui.call.state.DialerCallState;
@@ -73,9 +75,9 @@
import com.android.incallui.videotech.empty.EmptyVideoTech;
import com.android.incallui.videotech.ims.ImsVideoTech;
import com.android.incallui.videotech.utils.VideoUtils;
-import com.google.common.base.Optional;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
+
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -359,7 +361,7 @@
this.context = context;
this.dialerCallDelegate = dialerCallDelegate;
this.telecomCall = telecomCall;
- id = ID_PREFIX + Integer.toString(idCounter++);
+ id = ID_PREFIX + idCounter++;
// Must be after assigning mTelecomCall
videoTechManager = new VideoTechManager(this);
@@ -1366,6 +1368,7 @@
return videoTech;
}
+ @SuppressLint("MissingPermission")
public String getCallbackNumber() {
if (callbackNumber == null) {
// Show the emergency callback number if either:
@@ -1375,8 +1378,13 @@
boolean showCallbackNumber = hasProperty(Details.PROPERTY_EMERGENCY_CALLBACK_MODE);
if (isEmergencyCall() || showCallbackNumber) {
- callbackNumber =
- context.getSystemService(TelecomManager.class).getLine1Number(getAccountHandle());
+ PhoneAccountHandle accountHandle = getAccountHandle();
+ if (accountHandle != null) {
+ int subId = context.getSystemService(TelephonyManager.class).getSubscriptionId(
+ accountHandle);
+ SubscriptionManager subMgr = context.getSystemService(SubscriptionManager.class);
+ callbackNumber = subMgr.getPhoneNumber(subId);
+ }
}
if (callbackNumber == null) {
diff --git a/java/com/android/incallui/call/ExternalCallList.java b/java/com/android/incallui/call/ExternalCallList.java
index 96a5c19..cad4842 100644
--- a/java/com/android/incallui/call/ExternalCallList.java
+++ b/java/com/android/incallui/call/ExternalCallList.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@
import com.android.contacts.common.compat.CallCompat;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -39,7 +41,7 @@
private final Set<Call> externalCalls = new ArraySet<>();
private final Set<ExternalCallListener> externalCallListeners =
- Collections.newSetFromMap(new ConcurrentHashMap<ExternalCallListener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
/** Handles {@link android.telecom.Call.Callback} callbacks. */
private final Call.Callback telecomCallCallback =
new Call.Callback() {
diff --git a/java/com/android/incallui/call/InCallUiLegacyBindings.java b/java/com/android/incallui/call/InCallUiLegacyBindings.java
deleted file mode 100644
index 1b0ed45..0000000
--- a/java/com/android/incallui/call/InCallUiLegacyBindings.java
+++ /dev/null
@@ -1,26 +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.incallui.call;
-
-/**
- * These are old bindings between InCallUi and the container application. All new bindings should be
- * added to the bindings module and not here.
- */
-public interface InCallUiLegacyBindings {
-
- void logCall(DialerCall call);
-}
diff --git a/java/com/android/incallui/call/InCallUiLegacyBindingsFactory.java b/java/com/android/incallui/call/InCallUiLegacyBindingsFactory.java
deleted file mode 100644
index 8604976..0000000
--- a/java/com/android/incallui/call/InCallUiLegacyBindingsFactory.java
+++ /dev/null
@@ -1,26 +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.incallui.call;
-
-/**
- * This interface should be implementated by the Application subclass. It allows the in call UI
- * module to get references to the InCallUiLegacyBindings.
- */
-public interface InCallUiLegacyBindingsFactory {
-
- InCallUiLegacyBindings newInCallUiLegacyBindings();
-}
diff --git a/java/com/android/incallui/call/InCallUiLegacyBindingsStub.java b/java/com/android/incallui/call/InCallUiLegacyBindingsStub.java
deleted file mode 100644
index 8869c64..0000000
--- a/java/com/android/incallui/call/InCallUiLegacyBindingsStub.java
+++ /dev/null
@@ -1,24 +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.incallui.call;
-
-/** Default implementation for in call UI legacy bindings. */
-public class InCallUiLegacyBindingsStub implements InCallUiLegacyBindings {
-
- @Override
- public void logCall(DialerCall call) {}
-}
diff --git a/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java b/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java
index 59b83ac..fd377b1 100644
--- a/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java
+++ b/java/com/android/incallui/call/InCallVideoCallCallbackNotifier.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +37,7 @@
* resizing, 1 means we only expect a single thread to access the map so make only a single shard
*/
private final Set<SurfaceChangeListener> surfaceChangeListeners =
- Collections.newSetFromMap(new ConcurrentHashMap<SurfaceChangeListener, Boolean>(8, 0.9f, 1));
+ Collections.newSetFromMap(new ConcurrentHashMap<>(8, 0.9f, 1));
/** Private constructor. Instance should only be acquired through getRunningInstance(). */
private InCallVideoCallCallbackNotifier() {}
diff --git a/java/com/android/incallui/call/TelecomAdapter.java b/java/com/android/incallui/call/TelecomAdapter.java
index 507f64d..a76cd17 100644
--- a/java/com/android/incallui/call/TelecomAdapter.java
+++ b/java/com/android/incallui/call/TelecomAdapter.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +30,7 @@
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+
import java.util.List;
/** Wrapper around Telecom APIs. */
diff --git a/java/com/android/incallui/callpending/CallPendingActivity.java b/java/com/android/incallui/callpending/CallPendingActivity.java
index eb140a9..7fba003 100644
--- a/java/com/android/incallui/callpending/CallPendingActivity.java
+++ b/java/com/android/incallui/callpending/CallPendingActivity.java
@@ -115,7 +115,8 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pending_incall_screen);
- registerReceiver(finishReceiver, new IntentFilter(ACTION_FINISH_BROADCAST));
+ registerReceiver(finishReceiver, new IntentFilter(ACTION_FINISH_BROADCAST),
+ RECEIVER_NOT_EXPORTED);
}
@Override
@@ -213,12 +214,6 @@
public void onInCallButtonUiUnready() {}
@Override
- public void onSaveInstanceState(Bundle outState) {}
-
- @Override
- public void onRestoreInstanceState(Bundle savedInstanceState) {}
-
- @Override
public void addCallClicked() {}
@Override
@@ -307,15 +302,9 @@
public void onSecondaryInfoClicked() {}
@Override
- public void onCallStateButtonClicked() {}
-
- @Override
public void onManageConferenceClicked() {}
@Override
- public void onShrinkAnimationComplete() {}
-
- @Override
public void onInCallScreenResumed() {}
@Override
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index 13adc4a..27142c8 100644
--- a/java/com/android/incallui/contactgrid/ContactGridManager.java
+++ b/java/com/android/incallui/contactgrid/ContactGridManager.java
@@ -41,7 +41,6 @@
import com.android.dialer.common.LogUtil;
import com.android.dialer.glidephotomanager.GlidePhotoManagerComponent;
import com.android.dialer.glidephotomanager.PhotoInfo;
-import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.widget.BidiTextView;
import com.android.incallui.incall.protocol.ContactPhotoType;
import com.android.incallui.incall.protocol.PrimaryCallState;
@@ -96,11 +95,10 @@
private PrimaryInfo primaryInfo = PrimaryInfo.empty();
private PrimaryCallState primaryCallState = PrimaryCallState.empty();
- private final LetterTileDrawable letterTile;
private boolean isInMultiWindowMode;
- public ContactGridManager(
- View view, @Nullable ImageView avatarImageView, int avatarSize, boolean showAnonymousAvatar) {
+ public ContactGridManager(View view, @Nullable ImageView avatarImageView, int avatarSize,
+ boolean showAnonymousAvatar) {
context = view.getContext();
Assert.isNotNull(context);
@@ -121,7 +119,6 @@
topRowSpace = view.findViewById(R.id.contactgrid_top_row_space);
contactGridLayout = (View) contactNameTextView.getParent();
- letterTile = new LetterTileDrawable(context.getResources());
isTimerStarted = false;
deviceNumberTextView = view.findViewById(R.id.contactgrid_device_number_text);
diff --git a/java/com/android/incallui/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java
index bf036ed..51dca28 100644
--- a/java/com/android/incallui/contactgrid/TopRow.java
+++ b/java/com/android/incallui/contactgrid/TopRow.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -177,18 +178,10 @@
private static CharSequence getLabelForIncomingVideo(
Context context, @SessionModificationState int sessionModificationState, boolean isWifi) {
- if (sessionModificationState == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
- if (isWifi) {
- return context.getString(R.string.contact_grid_incoming_wifi_video_call);
- } else {
- return context.getString(R.string.contact_grid_incoming_video_call);
- }
+ if (isWifi) {
+ return context.getString(R.string.contact_grid_incoming_wifi_video_call);
} else {
- if (isWifi) {
- return context.getString(R.string.contact_grid_incoming_wifi_video_call);
- } else {
- return context.getString(R.string.contact_grid_incoming_video_call);
- }
+ return context.getString(R.string.contact_grid_incoming_video_call);
}
}
@@ -274,8 +267,7 @@
return getLabelForIncomingVideo(context, state.sessionModificationState(), state.isWifi());
case SessionModificationState.NO_REQUEST:
default:
- Assert.fail();
- return null;
+ throw Assert.createIllegalStateFailException();
}
}
diff --git a/java/com/android/incallui/disconnectdialog/DisconnectMessage.java b/java/com/android/incallui/disconnectdialog/DisconnectMessage.java
index 97d58f2..0a2beb0 100644
--- a/java/com/android/incallui/disconnectdialog/DisconnectMessage.java
+++ b/java/com/android/incallui/disconnectdialog/DisconnectMessage.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,9 @@
import android.content.Context;
import android.telecom.DisconnectCause;
import android.util.Pair;
+
import com.android.incallui.call.DialerCall;
+
import java.util.Locale;
/**
diff --git a/java/com/android/incallui/incall/impl/ButtonChooser.java b/java/com/android/incallui/incall/impl/ButtonChooser.java
index 3a18f00..d27bca7 100644
--- a/java/com/android/incallui/incall/impl/ButtonChooser.java
+++ b/java/com/android/incallui/incall/impl/ButtonChooser.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +22,12 @@
import com.android.dialer.common.Assert;
import com.android.incallui.incall.impl.MappedButtonConfig.MappingInfo;
import com.android.incallui.incall.protocol.InCallButtonIds;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
+
import javax.annotation.concurrent.Immutable;
/**
@@ -83,7 +86,7 @@
for (int i = 0; i < configuredSlots.size() && placedButtons.size() < numUiButtons; ++i) {
int slotNumber = configuredSlots.get(i);
List<Integer> potentialButtons = config.getButtonsForSlot(slotNumber);
- Collections.sort(potentialButtons, config.getSlotComparator());
+ potentialButtons.sort(config.getSlotComparator());
for (int j = 0; j < potentialButtons.size(); ++j) {
if (allowedButtons.contains(potentialButtons.get(j))) {
placedButtons.add(potentialButtons.get(j));
@@ -100,7 +103,7 @@
@NonNull Set<Integer> disabledButtons,
@NonNull List<Integer> placedButtons,
@NonNull List<Integer> conflicts) {
- Collections.sort(conflicts, config.getConflictComparator());
+ conflicts.sort(config.getConflictComparator());
for (Integer conflict : conflicts) {
if (placedButtons.size() >= numUiButtons) {
return;
diff --git a/java/com/android/incallui/incall/impl/ButtonController.java b/java/com/android/incallui/incall/impl/ButtonController.java
index 1b018d3..d77ec84 100644
--- a/java/com/android/incallui/incall/impl/ButtonController.java
+++ b/java/com/android/incallui/incall/impl/ButtonController.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
package com.android.incallui.incall.impl;
+import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.graphics.drawable.AnimationDrawable;
import android.telecom.CallAudioState;
@@ -234,9 +236,10 @@
}
}
+ @SuppressLint("CheckResult")
@Override
public void setChecked(boolean isChecked) {
- Assert.fail();
+ Assert.createAssertionFailException("Fail");
}
@Override
diff --git a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java
index f1c70d8..4cb8132 100644
--- a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java
+++ b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +38,7 @@
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
+import androidx.core.content.res.ResourcesCompat;
import com.android.dialer.R;
@@ -71,10 +73,10 @@
CharSequence labelText;
boolean enabled;
- backgroundMore =
- getResources().getDrawable(R.drawable.incall_button_background_more, context.getTheme());
- background =
- getResources().getDrawable(R.drawable.incall_button_background, context.getTheme());
+ backgroundMore = ResourcesCompat.getDrawable(getResources(),
+ R.drawable.incall_button_background_more, context.getTheme());
+ background = ResourcesCompat.getDrawable(getResources(),
+ R.drawable.incall_button_background, context.getTheme());
TypedArray typedArray =
context.obtainStyledAttributes(attrs, R.styleable.CheckableLabeledButton);
diff --git a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java
index cd8ff81..1d0ebc8 100644
--- a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java
+++ b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java
@@ -23,7 +23,6 @@
import android.view.View;
import android.view.ViewGroup;
-import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java
index 4e1cabe..e02369a 100644
--- a/java/com/android/incallui/incall/impl/InCallFragment.java
+++ b/java/com/android/incallui/incall/impl/InCallFragment.java
@@ -152,7 +152,6 @@
FragmentUtils.getParent(this, InCallButtonUiDelegateFactory.class)
.newInCallButtonUiDelegate();
if (savedInstanceState != null) {
- inCallButtonUiDelegate.onRestoreInstanceState(savedInstanceState);
stateRestored = true;
}
}
@@ -267,19 +266,13 @@
}
@Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- inCallButtonUiDelegate.onSaveInstanceState(outState);
- }
-
- @Override
public void onClick(View view) {
if (view == endCallButton) {
LogUtil.i("InCallFragment.onClick", "end call button clicked");
inCallScreenDelegate.onEndCallClicked();
} else {
LogUtil.e("InCallFragment.onClick", "unknown view: " + view);
- Assert.fail();
+ Assert.createAssertionFailException("");
}
}
@@ -536,7 +529,7 @@
return buttonController;
}
}
- Assert.fail();
+ Assert.createAssertionFailException("");
return null;
}
diff --git a/java/com/android/incallui/incall/protocol/InCallButtonUi.java b/java/com/android/incallui/incall/protocol/InCallButtonUi.java
index 98a5ed9..19a55ee 100644
--- a/java/com/android/incallui/incall/protocol/InCallButtonUi.java
+++ b/java/com/android/incallui/incall/protocol/InCallButtonUi.java
@@ -19,7 +19,6 @@
import android.telecom.CallAudioState;
-import androidx.annotation.ColorInt;
import androidx.fragment.app.Fragment;
/** Interface for the call button UI. */
diff --git a/java/com/android/incallui/incall/protocol/InCallButtonUiDelegate.java b/java/com/android/incallui/incall/protocol/InCallButtonUiDelegate.java
index 4e25ff0..341aacf 100644
--- a/java/com/android/incallui/incall/protocol/InCallButtonUiDelegate.java
+++ b/java/com/android/incallui/incall/protocol/InCallButtonUiDelegate.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +18,6 @@
package com.android.incallui.incall.protocol;
import android.content.Context;
-import android.os.Bundle;
import android.telecom.CallAudioState;
/** Callbacks from the module out to the container. */
@@ -27,10 +27,6 @@
void onInCallButtonUiUnready();
- void onSaveInstanceState(Bundle outState);
-
- void onRestoreInstanceState(Bundle savedInstanceState);
-
void addCallClicked();
void muteClicked(boolean checked, boolean clickedByUser);
diff --git a/java/com/android/incallui/incall/protocol/InCallScreenDelegate.java b/java/com/android/incallui/incall/protocol/InCallScreenDelegate.java
index c491eab..32d8ddd 100644
--- a/java/com/android/incallui/incall/protocol/InCallScreenDelegate.java
+++ b/java/com/android/incallui/incall/protocol/InCallScreenDelegate.java
@@ -29,12 +29,8 @@
void onSecondaryInfoClicked();
- void onCallStateButtonClicked();
-
void onManageConferenceClicked();
- void onShrinkAnimationComplete();
-
void onInCallScreenResumed();
void onInCallScreenPaused();
diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
index 8fe45f0..ba9c524 100644
--- a/java/com/android/incallui/incall/protocol/PrimaryCallState.java
+++ b/java/com/android/incallui/incall/protocol/PrimaryCallState.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +31,7 @@
import com.android.incallui.call.state.DialerCallState;
import com.android.incallui.videotech.utils.SessionModificationState;
import com.google.auto.value.AutoValue;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Locale;
diff --git a/java/com/android/incallui/incall/protocol/PrimaryInfo.java b/java/com/android/incallui/incall/protocol/PrimaryInfo.java
index 05787bc..fbd16e1 100644
--- a/java/com/android/incallui/incall/protocol/PrimaryInfo.java
+++ b/java/com/android/incallui/incall/protocol/PrimaryInfo.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@
import com.android.dialer.common.LogUtil;
import com.android.dialer.multimedia.MultimediaData;
import com.google.auto.value.AutoValue;
+
import java.util.Locale;
/** Information about the primary call. */
diff --git a/java/com/android/incallui/incall/protocol/SecondaryInfo.java b/java/com/android/incallui/incall/protocol/SecondaryInfo.java
index f33f999..76eeecf 100644
--- a/java/com/android/incallui/incall/protocol/SecondaryInfo.java
+++ b/java/com/android/incallui/incall/protocol/SecondaryInfo.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import com.android.dialer.common.LogUtil;
import com.google.auto.value.AutoValue;
+
import java.util.Locale;
/** Information about the secondary call. */
diff --git a/java/com/android/incallui/multisim/SwapSimWorker.java b/java/com/android/incallui/multisim/SwapSimWorker.java
index df76dc3..6aca4d6 100644
--- a/java/com/android/incallui/multisim/SwapSimWorker.java
+++ b/java/com/android/incallui/multisim/SwapSimWorker.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +39,7 @@
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCallListener;
import com.android.incallui.incalluilock.InCallUiLock;
+
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
diff --git a/java/com/android/incallui/ringtone/DialerRingtoneManager.java b/java/com/android/incallui/ringtone/DialerRingtoneManager.java
index 56ac8f1..6356be2 100644
--- a/java/com/android/incallui/ringtone/DialerRingtoneManager.java
+++ b/java/com/android/incallui/ringtone/DialerRingtoneManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.state.DialerCallState;
+
import java.util.Objects;
/**
diff --git a/java/com/android/incallui/ringtone/InCallTonePlayer.java b/java/com/android/incallui/ringtone/InCallTonePlayer.java
index 3f7d81a..0d4bb2c 100644
--- a/java/com/android/incallui/ringtone/InCallTonePlayer.java
+++ b/java/com/android/incallui/ringtone/InCallTonePlayer.java
@@ -107,15 +107,8 @@
Log.v(this, "Starting tone " + info);
toneGenerator = toneGeneratorFactory.newInCallToneGenerator(info.stream, info.volume);
toneGenerator.startTone(info.tone);
- /*
- * During tests, this will block until the tests call mExecutor.ackMilestone. This call
- * allows for synchronization to the point where the tone has started playing.
- */
- executor.milestone();
if (numPlayingTones != null) {
numPlayingTones.await(info.toneLengthMillis, TimeUnit.MILLISECONDS);
- // Allows for synchronization to the point where the tone has completed playing.
- executor.milestone();
}
} catch (InterruptedException e) {
Log.w(this, "Interrupted while playing in-call tone.");
@@ -126,8 +119,6 @@
if (numPlayingTones != null) {
numPlayingTones.countDown();
}
- // Allows for synchronization to the point where this background thread has cleaned up.
- executor.milestone();
}
}
diff --git a/java/com/android/incallui/rtt/impl/AudioSelectMenu.java b/java/com/android/incallui/rtt/impl/AudioSelectMenu.java
index b9cd358..cc2866a 100644
--- a/java/com/android/incallui/rtt/impl/AudioSelectMenu.java
+++ b/java/com/android/incallui/rtt/impl/AudioSelectMenu.java
@@ -21,6 +21,7 @@
import android.telecom.CallAudioState;
import android.view.View;
import android.widget.PopupWindow;
+
import com.android.incallui.incall.protocol.InCallButtonUiDelegate;
/** Audio select menu for RTT call. */
diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java
index 5ca8be0..5715c14 100644
--- a/java/com/android/incallui/rtt/impl/RttChatFragment.java
+++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java
@@ -132,9 +132,6 @@
inCallButtonUiDelegate =
FragmentUtils.getParent(this, InCallButtonUiDelegateFactory.class)
.newInCallButtonUiDelegate();
- if (savedInstanceState != null) {
- inCallButtonUiDelegate.onRestoreInstanceState(savedInstanceState);
- }
inCallScreenDelegate =
FragmentUtils.getParentUnsafe(this, InCallScreenDelegateFactory.class)
.newInCallScreenDelegate();
diff --git a/java/com/android/incallui/rtt/impl/RttOverflowMenu.java b/java/com/android/incallui/rtt/impl/RttOverflowMenu.java
index e9f9d04..4654b0a 100644
--- a/java/com/android/incallui/rtt/impl/RttOverflowMenu.java
+++ b/java/com/android/incallui/rtt/impl/RttOverflowMenu.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.telecom.CallAudioState;
import android.view.View;
import android.widget.PopupWindow;
+
import com.android.incallui.incall.protocol.InCallButtonUiDelegate;
import com.android.incallui.incall.protocol.InCallScreenDelegate;
import com.android.incallui.rtt.impl.RttCheckableButton.OnCheckedChangeListener;
diff --git a/java/com/android/incallui/rtt/protocol/RttChatMessage.java b/java/com/android/incallui/rtt/protocol/RttChatMessage.java
index 61c2402..c9f3e2b 100644
--- a/java/com/android/incallui/rtt/protocol/RttChatMessage.java
+++ b/java/com/android/incallui/rtt/protocol/RttChatMessage.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import com.android.dialer.rtt.RttTranscript;
import com.android.dialer.rtt.RttTranscriptMessage;
import com.google.common.base.Splitter;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
diff --git a/java/com/android/incallui/spam/AndroidManifest.xml b/java/com/android/incallui/spam/AndroidManifest.xml
index 66c9983..978f4a9 100644
--- a/java/com/android/incallui/spam/AndroidManifest.xml
+++ b/java/com/android/incallui/spam/AndroidManifest.xml
@@ -33,9 +33,5 @@
android:theme="@style/AfterCallNotificationTheme">
</activity>
- <service
- android:exported="false"
- android:name=".SpamNotificationService"/>
-
</application>
</manifest>
diff --git a/java/com/android/incallui/spam/SpamNotificationActivity.java b/java/com/android/incallui/spam/SpamNotificationActivity.java
index 63b0235..6c39028 100644
--- a/java/com/android/incallui/spam/SpamNotificationActivity.java
+++ b/java/com/android/incallui/spam/SpamNotificationActivity.java
@@ -22,7 +22,6 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
-import android.provider.CallLog;
import android.provider.ContactsContract;
import android.telephony.PhoneNumberUtils;
@@ -64,15 +63,6 @@
private static final String CALL_INFO_KEY_CALL_ID = "call_id";
private static final String CALL_INFO_KEY_START_TIME_MILLIS = "call_start_time_millis";
private static final String CALL_INFO_CONTACT_LOOKUP_RESULT_TYPE = "contact_lookup_result_type";
- private final DialogInterface.OnDismissListener dismissListener =
- new DialogInterface.OnDismissListener() {
- @Override
- public void onDismiss(DialogInterface dialog) {
- if (!isFinishing()) {
- finish();
- }
- }
- };
private FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler;
/**
diff --git a/java/com/android/incallui/spam/SpamNotificationService.java b/java/com/android/incallui/spam/SpamNotificationService.java
deleted file mode 100644
index e338390..0000000
--- a/java/com/android/incallui/spam/SpamNotificationService.java
+++ /dev/null
@@ -1,123 +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.incallui.spam;
-
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.os.IBinder;
-import android.provider.CallLog;
-
-import androidx.annotation.Nullable;
-
-import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler;
-import com.android.dialer.common.LogUtil;
-import com.android.dialer.location.GeoUtil;
-import com.android.dialer.logging.ContactLookupResult;
-import com.android.dialer.notification.DialerNotificationManager;
-import com.android.incallui.call.DialerCall;
-
-/**
- * This service determines if the device is locked/unlocked and takes an action based on the state.
- * A service is used to to determine this, as opposed to an activity, because the user must unlock
- * the device before a notification can start an activity. This is not the case for a service, and
- * intents can be sent to this service even from the lock screen. This allows users to quickly
- * report a number as spam or not spam from their lock screen.
- */
-public class SpamNotificationService extends Service {
-
- private static final String TAG = "SpamNotificationSvc";
-
- private static final String EXTRA_PHONE_NUMBER = "service_phone_number";
- private static final String EXTRA_CALL_ID = "service_call_id";
- private static final String EXTRA_CALL_START_TIME_MILLIS = "service_call_start_time_millis";
- private static final String EXTRA_NOTIFICATION_TAG = "service_notification_tag";
- private static final String EXTRA_NOTIFICATION_ID = "service_notification_id";
- private static final String EXTRA_CONTACT_LOOKUP_RESULT_TYPE =
- "service_contact_lookup_result_type";
-
- private String notificationTag;
- private int notificationId;
-
- /** Creates an intent to start this service. */
- public static Intent createServiceIntent(
- Context context,
- @Nullable DialerCall call,
- String action,
- String notificationTag,
- int notificationId) {
- Intent intent = new Intent(context, SpamNotificationService.class);
- intent.setAction(action);
- intent.putExtra(EXTRA_NOTIFICATION_TAG, notificationTag);
- intent.putExtra(EXTRA_NOTIFICATION_ID, notificationId);
-
- if (call != null) {
- intent.putExtra(EXTRA_PHONE_NUMBER, call.getNumber());
- intent.putExtra(EXTRA_CALL_ID, call.getUniqueCallId());
- intent.putExtra(EXTRA_CALL_START_TIME_MILLIS, call.getTimeAddedMs());
- intent.putExtra(
- EXTRA_CONTACT_LOOKUP_RESULT_TYPE, call.getLogState().contactLookupResult.getNumber());
- }
- return intent;
- }
-
- @Nullable
- @Override
- public IBinder onBind(Intent intent) {
- // Return null because clients cannot bind to this service
- return null;
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- LogUtil.d(TAG, "onStartCommand");
- if (intent == null) {
- LogUtil.d(TAG, "Null intent");
- stopSelf();
- // Return {@link #START_NOT_STICKY} so service is not restarted.
- return START_NOT_STICKY;
- }
- String number = intent.getStringExtra(EXTRA_PHONE_NUMBER);
- notificationTag = intent.getStringExtra(EXTRA_NOTIFICATION_TAG);
- notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, 1);
- String countryIso = GeoUtil.getCurrentCountryIso(this);
- ContactLookupResult.Type contactLookupResultType =
- ContactLookupResult.Type.forNumber(intent.getIntExtra(EXTRA_CONTACT_LOOKUP_RESULT_TYPE, 0));
-
- // Cancel notification only if we are not showing spam blocking promo. Otherwise we will show
- // spam blocking promo notification in place.
- DialerNotificationManager.cancel(this, notificationTag, notificationId);
-
- switch (intent.getAction()) {
- case SpamNotificationActivity.ACTION_MARK_NUMBER_AS_SPAM:
- new FilteredNumberAsyncQueryHandler(this).blockNumber(null, number);
- break;
- case SpamNotificationActivity.ACTION_MARK_NUMBER_AS_NOT_SPAM:
- break;
- default: // fall out
- }
- // TODO: call stopSelf() after async tasks complete (a bug)
- stopSelf();
- return START_NOT_STICKY;
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- LogUtil.d(TAG, "onDestroy");
- }
-}
diff --git a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java
index dd42c35..3490dca 100644
--- a/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java
+++ b/java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java
@@ -18,7 +18,9 @@
package com.android.incallui.video.impl;
import android.Manifest.permission;
+import android.annotation.SuppressLint;
import android.content.Context;
+import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.drawable.Animatable;
import android.os.Bundle;
@@ -33,6 +35,7 @@
import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewTreeObserver;
+import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
@@ -42,7 +45,6 @@
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
-import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@@ -168,9 +170,6 @@
inCallButtonUiDelegate =
FragmentUtils.getParent(this, InCallButtonUiDelegateFactory.class)
.newInCallButtonUiDelegate();
- if (savedInstanceState != null) {
- inCallButtonUiDelegate.onRestoreInstanceState(savedInstanceState);
- }
}
@Nullable
@@ -186,27 +185,27 @@
controls = view.findViewById(R.id.videocall_video_controls);
controls.setVisibility(getActivity().isInMultiWindowMode() ? View.GONE : View.VISIBLE);
controlsContainer = view.findViewById(R.id.videocall_video_controls_container);
- speakerButton = (CheckableImageButton) view.findViewById(R.id.videocall_speaker_button);
- muteButton = (CheckableImageButton) view.findViewById(R.id.videocall_mute_button);
+ speakerButton = view.findViewById(R.id.videocall_speaker_button);
+ muteButton = view.findViewById(R.id.videocall_mute_button);
muteButton.setOnCheckedChangeListener(this);
mutePreviewOverlay = view.findViewById(R.id.videocall_video_preview_mute_overlay);
- cameraOffButton = (CheckableImageButton) view.findViewById(R.id.videocall_mute_video);
+ cameraOffButton = view.findViewById(R.id.videocall_mute_video);
cameraOffButton.setOnCheckedChangeListener(this);
previewOffOverlay = view.findViewById(R.id.videocall_video_preview_off_overlay);
- swapCameraButton = (ImageButton) view.findViewById(R.id.videocall_switch_video);
+ swapCameraButton = view.findViewById(R.id.videocall_switch_video);
swapCameraButton.setOnClickListener(this);
view.findViewById(R.id.videocall_switch_controls)
.setVisibility(getActivity().isInMultiWindowMode() ? View.GONE : View.VISIBLE);
switchOnHoldButton = view.findViewById(R.id.videocall_switch_on_hold);
onHoldContainer = view.findViewById(R.id.videocall_on_hold_banner);
- remoteVideoOff = (TextView) view.findViewById(R.id.videocall_remote_video_off);
+ remoteVideoOff = view.findViewById(R.id.videocall_remote_video_off);
remoteVideoOff.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
endCallButton = view.findViewById(R.id.videocall_end_call);
endCallButton.setOnClickListener(this);
- previewSurfaceView = (SurfaceView) view.findViewById(R.id.videocall_video_preview);
+ previewSurfaceView = view.findViewById(R.id.videocall_video_preview);
previewSurfaceView.setZOrderMediaOverlay(true);
previewOffOverlay.setOnClickListener(v -> checkCameraPermission());
- remoteSurfaceView = (SurfaceView) view.findViewById(R.id.videocall_video_remote);
+ remoteSurfaceView = view.findViewById(R.id.videocall_video_remote);
remoteSurfaceView.setOnClickListener(
surfaceView -> {
videoCallScreenDelegate.resetAutoFullscreenTimer();
@@ -220,7 +219,7 @@
});
greenScreenBackgroundView = view.findViewById(R.id.videocall_green_screen_background);
fullscreenBackgroundView = view.findViewById(R.id.videocall_fullscreen_background);
- previewRoot = (FrameLayout) view.findViewById(R.id.videocall_preview_root);
+ previewRoot = view.findViewById(R.id.videocall_preview_root);
// We need the texture view size to be able to scale the remote video. At this point the view
// layout won't be complete so add a layout listener.
@@ -270,12 +269,6 @@
}
@Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- inCallButtonUiDelegate.onSaveInstanceState(outState);
- }
-
- @Override
public void onDestroyView() {
super.onDestroyView();
LogUtil.i("SurfaceViewVideoCallFragment.onDestroyView", null);
@@ -448,17 +441,22 @@
private Point getPreviewOffsetStartShown() {
// No insets in multiwindow mode, and rootWindowInsets will get the display's insets.
- if (getActivity().isInMultiWindowMode()) {
+ if (requireActivity().isInMultiWindowMode()) {
return new Point();
}
+ if (getView() == null) {
+ return null;
+ }
+ Insets insets = getView().getRootWindowInsets().getInsetsIgnoringVisibility(
+ WindowInsets.Type.systemBars());
if (isLandscape()) {
int stableInsetEnd =
getView().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL
- ? getView().getRootWindowInsets().getStableInsetLeft()
- : -getView().getRootWindowInsets().getStableInsetRight();
+ ? insets.left
+ : -insets.right;
return new Point(stableInsetEnd, 0);
} else {
- return new Point(0, -getView().getRootWindowInsets().getStableInsetBottom());
+ return new Point(0, -insets.bottom);
}
}
@@ -901,7 +899,7 @@
private boolean isLandscape() {
// Choose orientation based on display orientation, not window orientation
- int rotation = getActivity().getWindowManager().getDefaultDisplay().getRotation();
+ int rotation = requireActivity().getDisplay().getRotation();
return rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270;
}
@@ -971,6 +969,7 @@
muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE);
}
+ @SuppressLint("CheckResult")
private static void animateSetVisibility(final View view, final int visibility) {
if (view.getVisibility() == visibility) {
return;
@@ -985,8 +984,7 @@
startAlpha = 0;
endAlpha = 1;
} else {
- Assert.fail();
- return;
+ throw Assert.createIllegalStateFailException();
}
view.setAlpha(startAlpha);
diff --git a/java/com/android/incallui/video/impl/VideoCallFragment.java b/java/com/android/incallui/video/impl/VideoCallFragment.java
index cea7d33..3b11743 100644
--- a/java/com/android/incallui/video/impl/VideoCallFragment.java
+++ b/java/com/android/incallui/video/impl/VideoCallFragment.java
@@ -54,7 +54,6 @@
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
-import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@@ -217,9 +216,6 @@
inCallButtonUiDelegate =
FragmentUtils.getParent(this, InCallButtonUiDelegateFactory.class)
.newInCallButtonUiDelegate();
- if (savedInstanceState != null) {
- inCallButtonUiDelegate.onRestoreInstanceState(savedInstanceState);
- }
}
@Nullable
@@ -256,14 +252,13 @@
onHoldContainer = view.findViewById(R.id.videocall_on_hold_banner);
remoteVideoOff = (TextView) view.findViewById(R.id.videocall_remote_video_off);
remoteVideoOff.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
- remoteOffBlurredImageView =
- (ImageView) view.findViewById(R.id.videocall_remote_off_blurred_image_view);
+ remoteOffBlurredImageView = view.findViewById(R.id.videocall_remote_off_blurred_image_view);
endCallButton = view.findViewById(R.id.videocall_end_call);
endCallButton.setOnClickListener(this);
- previewTextureView = (TextureView) view.findViewById(R.id.videocall_video_preview);
+ previewTextureView = view.findViewById(R.id.videocall_video_preview);
previewTextureView.setClipToOutline(true);
previewOffOverlay.setOnClickListener(v -> checkCameraPermission());
- remoteTextureView = (TextureView) view.findViewById(R.id.videocall_video_remote);
+ remoteTextureView = view.findViewById(R.id.videocall_video_remote);
greenScreenBackgroundView = view.findViewById(R.id.videocall_green_screen_background);
fullscreenBackgroundView = view.findViewById(R.id.videocall_fullscreen_background);
@@ -341,12 +336,6 @@
}
@Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- inCallButtonUiDelegate.onSaveInstanceState(outState);
- }
-
- @Override
public void onDestroyView() {
super.onDestroyView();
LogUtil.i("VideoCallFragment.onDestroyView", null);
@@ -477,7 +466,6 @@
View view = getView();
if (view != null) {
// Code is more expressive with all flags present, even though some may be combined
- // noinspection PointlessBitwiseExpression
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
}
diff --git a/java/com/android/incallui/video/impl/VideoChargesAlertDialogFragment.java b/java/com/android/incallui/video/impl/VideoChargesAlertDialogFragment.java
index d23e590..01744a7 100644
--- a/java/com/android/incallui/video/impl/VideoChargesAlertDialogFragment.java
+++ b/java/com/android/incallui/video/impl/VideoChargesAlertDialogFragment.java
@@ -41,7 +41,8 @@
public class VideoChargesAlertDialogFragment extends DialogFragment {
/** Preference key for whether to show the alert dialog for video charges next time. */
- private static final String KEY_DO_NOT_SHOW_VIDEO_CHARGES_ALERT = "key_do_not_show_video_charges_alert";
+ private static final String KEY_DO_NOT_SHOW_VIDEO_CHARGES_ALERT =
+ "key_do_not_show_video_charges_alert";
/** Key in the arguments bundle for call id. */
private static final String ARG_CALL_ID = "call_id";
diff --git a/java/com/android/incallui/video/protocol/VideoCallScreenDelegate.java b/java/com/android/incallui/video/protocol/VideoCallScreenDelegate.java
index 9dd5450..24f6627 100644
--- a/java/com/android/incallui/video/protocol/VideoCallScreenDelegate.java
+++ b/java/com/android/incallui/video/protocol/VideoCallScreenDelegate.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.view.SurfaceView;
+
import com.android.incallui.videosurface.protocol.VideoSurfaceTexture;
/** Callbacks from the module out to the container. */
diff --git a/java/com/android/incallui/videosurface/bindings/VideoSurfaceBindings.java b/java/com/android/incallui/videosurface/bindings/VideoSurfaceBindings.java
index 96fccb4..656cf07 100644
--- a/java/com/android/incallui/videosurface/bindings/VideoSurfaceBindings.java
+++ b/java/com/android/incallui/videosurface/bindings/VideoSurfaceBindings.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.incallui.videosurface.bindings;
import android.view.TextureView;
+
import com.android.incallui.videosurface.impl.VideoScale;
import com.android.incallui.videosurface.impl.VideoSurfaceTextureImpl;
import com.android.incallui.videosurface.protocol.VideoSurfaceTexture;
diff --git a/java/com/android/incallui/videosurface/impl/VideoScale.java b/java/com/android/incallui/videosurface/impl/VideoScale.java
index 1444f59..8094cdc 100644
--- a/java/com/android/incallui/videosurface/impl/VideoScale.java
+++ b/java/com/android/incallui/videosurface/impl/VideoScale.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.graphics.Matrix;
import android.view.TextureView;
+
import com.android.dialer.common.LogUtil;
/** Utilities to scale the preview and remote video. */
diff --git a/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java b/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java
index 18d09a7..61382c6 100644
--- a/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java
+++ b/java/com/android/incallui/videosurface/impl/VideoSurfaceTextureImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +22,11 @@
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
+
import com.android.dialer.common.LogUtil;
import com.android.incallui.videosurface.protocol.VideoSurfaceDelegate;
import com.android.incallui.videosurface.protocol.VideoSurfaceTexture;
+
import java.util.Locale;
import java.util.Objects;
@@ -48,7 +51,7 @@
@Override
public void setDelegate(VideoSurfaceDelegate delegate) {
- LogUtil.i("VideoSurfaceTextureImpl.setDelegate", "delegate: " + delegate + " " + toString());
+ LogUtil.i("VideoSurfaceTextureImpl.setDelegate", "delegate: " + delegate + " " + this);
this.delegate = delegate;
}
@@ -66,7 +69,7 @@
public void setSurfaceDimensions(Point surfaceDimensions) {
LogUtil.i(
"VideoSurfaceTextureImpl.setSurfaceDimensions",
- "surfaceDimensions: " + surfaceDimensions + " " + toString());
+ "surfaceDimensions: " + surfaceDimensions + " " + this);
this.surfaceDimensions = surfaceDimensions;
if (surfaceDimensions != null && savedSurfaceTexture != null) {
savedSurfaceTexture.setDefaultBufferSize(surfaceDimensions.x, surfaceDimensions.y);
@@ -136,7 +139,7 @@
private boolean createSurface(int width, int height) {
LogUtil.i(
"VideoSurfaceTextureImpl.createSurface",
- "width: " + width + ", height: " + height + " " + toString());
+ "width: " + width + ", height: " + height + " " + this);
savedSurfaceTexture.setDefaultBufferSize(width, height);
if (savedSurface != null) {
savedSurface.release();
@@ -149,7 +152,7 @@
if (delegate != null) {
delegate.onSurfaceCreated(this);
} else {
- LogUtil.e("VideoSurfaceTextureImpl.onSurfaceCreated", "delegate is null. " + toString());
+ LogUtil.e("VideoSurfaceTextureImpl.onSurfaceCreated", "delegate is null. " + this);
}
}
@@ -157,7 +160,7 @@
if (delegate != null) {
delegate.onSurfaceReleased(this);
} else {
- LogUtil.e("VideoSurfaceTextureImpl.onSurfaceReleased", "delegate is null. " + toString());
+ LogUtil.e("VideoSurfaceTextureImpl.onSurfaceReleased", "delegate is null. " + this);
}
}
@@ -182,7 +185,7 @@
"newSurfaceTexture: "
+ newSurfaceTexture
+ " "
- + VideoSurfaceTextureImpl.this.toString());
+ + VideoSurfaceTextureImpl.this);
// Where there is no saved {@link SurfaceTexture} available, use the newly created one.
// If a saved {@link SurfaceTexture} is available, we are re-creating after an
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
index 9baef64..deff1d8 100644
--- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
+++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
@@ -26,6 +26,7 @@
import android.telecom.InCallService.VideoCall;
import android.telecom.VideoProfile;
import android.telecom.VideoProfile.CameraCapabilities;
+
import com.android.dialer.common.LogUtil;
import com.android.incallui.videotech.VideoTech.VideoTechListener;
import com.android.incallui.videotech.utils.SessionModificationState;
diff --git a/java/com/android/voicemail/VoicemailComponent.java b/java/com/android/voicemail/VoicemailComponent.java
index 0e09627..e2963e8 100644
--- a/java/com/android/voicemail/VoicemailComponent.java
+++ b/java/com/android/voicemail/VoicemailComponent.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +18,10 @@
package com.android.voicemail;
import android.content.Context;
+
import com.android.dialer.inject.HasRootComponent;
import com.android.dialer.inject.IncludeInDialerRoot;
+
import dagger.Subcomponent;
/** Subcomponent that can be used to access the voicemail implementation. */
diff --git a/java/com/android/voicemail/VoicemailPowerCycleReceiver.java b/java/com/android/voicemail/VoicemailPowerCycleReceiver.java
index e9362b4..ed0905b 100644
--- a/java/com/android/voicemail/VoicemailPowerCycleReceiver.java
+++ b/java/com/android/voicemail/VoicemailPowerCycleReceiver.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+
import com.android.dialer.common.Assert;
/** Receives {@link Intent#ACTION_BOOT_COMPLETED} and {@link Intent#ACTION_SHUTDOWN} */
diff --git a/java/com/android/voicemail/VoicemailSecretCodeReceiver.java b/java/com/android/voicemail/VoicemailSecretCodeReceiver.java
index 6d14241..3bbf5c6 100644
--- a/java/com/android/voicemail/VoicemailSecretCodeReceiver.java
+++ b/java/com/android/voicemail/VoicemailSecretCodeReceiver.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,14 +17,17 @@
package com.android.voicemail;
+import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+
import com.android.dialer.common.LogUtil;
/** Receives android.provider.Telephony.SECRET_CODE */
public class VoicemailSecretCodeReceiver extends BroadcastReceiver {
+ @SuppressLint("UnsafeProtectedBroadcastReceiver")
@Override
public void onReceive(Context context, Intent intent) {
String host = intent.getData().getHost();
diff --git a/java/com/android/voicemail/impl/ActivationTask.java b/java/com/android/voicemail/impl/ActivationTask.java
index 895f406..5476111 100644
--- a/java/com/android/voicemail/impl/ActivationTask.java
+++ b/java/com/android/voicemail/impl/ActivationTask.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
package com.android.voicemail.impl;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -37,6 +39,7 @@
import com.android.voicemail.impl.sms.StatusSmsFetcher;
import com.android.voicemail.impl.sync.SyncTask;
import com.android.voicemail.impl.sync.VvmAccountManager;
+
import java.io.IOException;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
@@ -272,6 +275,7 @@
context.sendBroadcast(intent);
}
+ @SuppressLint("MissingPermission")
private static boolean hasSignal(Context context, PhoneAccountHandle phoneAccountHandle) {
TelephonyManager telephonyManager =
context
diff --git a/java/com/android/voicemail/impl/CarrierIdentifier.java b/java/com/android/voicemail/impl/CarrierIdentifier.java
index bbc55e8..81f8193 100644
--- a/java/com/android/voicemail/impl/CarrierIdentifier.java
+++ b/java/com/android/voicemail/impl/CarrierIdentifier.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
import androidx.annotation.Nullable;
import com.google.auto.value.AutoValue;
+
import java.util.Optional;
/** Identifies a carrier. */
diff --git a/java/com/android/voicemail/impl/CarrierVvmPackageInstalledReceiver.java b/java/com/android/voicemail/impl/CarrierVvmPackageInstalledReceiver.java
index c9c09b3..bd3af3b 100644
--- a/java/com/android/voicemail/impl/CarrierVvmPackageInstalledReceiver.java
+++ b/java/com/android/voicemail/impl/CarrierVvmPackageInstalledReceiver.java
@@ -16,6 +16,7 @@
package com.android.voicemail.impl;
+import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -27,6 +28,7 @@
*/
public class CarrierVvmPackageInstalledReceiver extends BroadcastReceiver {
+ @SuppressLint("UnsafeProtectedBroadcastReceiver")
@Override
public void onReceive(Context context, Intent intent) {
String packageName = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME);
diff --git a/java/com/android/voicemail/impl/DefaultOmtpEventHandler.java b/java/com/android/voicemail/impl/DefaultOmtpEventHandler.java
index 13aaf05..d595467 100644
--- a/java/com/android/voicemail/impl/DefaultOmtpEventHandler.java
+++ b/java/com/android/voicemail/impl/DefaultOmtpEventHandler.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Context;
import android.provider.VoicemailContract;
import android.provider.VoicemailContract.Status;
+
import com.android.voicemail.impl.OmtpEvents.Type;
public class DefaultOmtpEventHandler {
diff --git a/java/com/android/voicemail/impl/DeviceProvisionedJobService.java b/java/com/android/voicemail/impl/DeviceProvisionedJobService.java
index 80b8b6c..1540f5b 100644
--- a/java/com/android/voicemail/impl/DeviceProvisionedJobService.java
+++ b/java/com/android/voicemail/impl/DeviceProvisionedJobService.java
@@ -29,6 +29,7 @@
import android.provider.Settings;
import android.provider.Settings.Global;
import android.telecom.PhoneAccountHandle;
+
import com.android.dialer.constants.ScheduledJobIds;
/**
diff --git a/java/com/android/voicemail/impl/DialerVvmConfigManager.java b/java/com/android/voicemail/impl/DialerVvmConfigManager.java
index 019db36..2f6858f 100644
--- a/java/com/android/voicemail/impl/DialerVvmConfigManager.java
+++ b/java/com/android/voicemail/impl/DialerVvmConfigManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,14 +28,16 @@
import com.android.dialer.R;
import com.android.voicemail.impl.utils.XmlUtils;
import com.google.common.collect.ComparisonChain;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedSet;
import java.util.TreeSet;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
/** Load and caches dialer vvm config from res/xml/vvm_config.xml */
public class DialerVvmConfigManager {
diff --git a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
index c6110c9..8c91ebf 100644
--- a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
+++ b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
@@ -39,6 +39,7 @@
import com.android.voicemail.impl.protocol.VisualVoicemailProtocolFactory;
import com.android.voicemail.impl.sms.StatusMessage;
import com.android.voicemail.impl.sync.VvmAccountManager;
+
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
@@ -159,10 +160,7 @@
* known protocol.
*/
public boolean isValid() {
- if (protocol == null) {
- return false;
- }
- return true;
+ return protocol != null;
}
@Nullable
@@ -490,8 +488,7 @@
continue;
}
return true;
- } catch (NameNotFoundException e) {
- continue;
+ } catch (NameNotFoundException ignored) {
}
}
return false;
diff --git a/java/com/android/voicemail/impl/PackageReplacedReceiver.java b/java/com/android/voicemail/impl/PackageReplacedReceiver.java
index 2ece94d..148257f 100644
--- a/java/com/android/voicemail/impl/PackageReplacedReceiver.java
+++ b/java/com/android/voicemail/impl/PackageReplacedReceiver.java
@@ -17,6 +17,7 @@
package com.android.voicemail.impl;
+import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -41,6 +42,7 @@
*/
public class PackageReplacedReceiver extends BroadcastReceiver {
+ @SuppressLint({"MissingPermission", "UnsafeProtectedBroadcastReceiver"})
@Override
public void onReceive(Context context, Intent intent) {
VvmLog.i("PackageReplacedReceiver.onReceive", "package replaced, starting activation");
diff --git a/java/com/android/voicemail/impl/StatusCheckJobService.java b/java/com/android/voicemail/impl/StatusCheckJobService.java
index fb2016b..bae1a7d 100644
--- a/java/com/android/voicemail/impl/StatusCheckJobService.java
+++ b/java/com/android/voicemail/impl/StatusCheckJobService.java
@@ -1,18 +1,22 @@
-/**
+/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
- * <p>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
+ * 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
*
- * <p>http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * <p>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
+ * 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.voicemail.impl;
+import android.annotation.SuppressLint;
import android.app.job.JobInfo;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
@@ -21,8 +25,10 @@
import android.content.Context;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+
import com.android.dialer.constants.ScheduledJobIds;
import com.android.voicemail.impl.sync.VvmAccountManager;
+
import java.util.concurrent.TimeUnit;
/**
@@ -50,6 +56,7 @@
.build());
}
+ @SuppressLint("MissingPermission")
@Override
public boolean onStartJob(JobParameters params) {
for (PhoneAccountHandle phoneAccountHandle :
diff --git a/java/com/android/voicemail/impl/StatusCheckTask.java b/java/com/android/voicemail/impl/StatusCheckTask.java
index 0a66659..aca9b1f 100644
--- a/java/com/android/voicemail/impl/StatusCheckTask.java
+++ b/java/com/android/voicemail/impl/StatusCheckTask.java
@@ -1,29 +1,35 @@
-/**
+/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
- * <p>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
+ * 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
*
- * <p>http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * <p>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
+ * 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.voicemail.impl;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telecom.PhoneAccountHandle;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
+
import com.android.dialer.proguard.UsedByReflection;
import com.android.voicemail.impl.scheduling.BaseTask;
import com.android.voicemail.impl.sms.StatusMessage;
import com.android.voicemail.impl.sms.StatusSmsFetcher;
import com.android.voicemail.impl.sync.VvmAccountManager;
+
import java.io.IOException;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
@@ -49,6 +55,7 @@
context.sendBroadcast(intent);
}
+ @SuppressLint("MissingPermission")
@Override
public void onExecuteInBackgroundThread() {
TelephonyManager telephonyManager =
diff --git a/java/com/android/voicemail/impl/Voicemail.java b/java/com/android/voicemail/impl/Voicemail.java
index a2282a9..ff8d01b 100644
--- a/java/com/android/voicemail/impl/Voicemail.java
+++ b/java/com/android/voicemail/impl/Voicemail.java
@@ -163,7 +163,7 @@
builderId = builderId == null ? -1 : builderId;
builderTimestamp = builderTimestamp == null ? 0 : builderTimestamp;
builderDuration = builderDuration == null ? 0 : builderDuration;
- builderIsRead = builderIsRead == null ? false : builderIsRead;
+ builderIsRead = builderIsRead != null && builderIsRead;
return new Voicemail(
builderTimestamp,
builderNumber,
@@ -326,8 +326,8 @@
} else {
uri = null;
}
- isRead = in.readInt() > 0 ? true : false;
- hasContent = in.readInt() > 0 ? true : false;
+ isRead = in.readInt() > 0;
+ hasContent = in.readInt() > 0;
transcription = (String) readCharSequence(in);
}
diff --git a/java/com/android/voicemail/impl/VoicemailClientImpl.java b/java/com/android/voicemail/impl/VoicemailClientImpl.java
index 43ed4b4..65181d6 100644
--- a/java/com/android/voicemail/impl/VoicemailClientImpl.java
+++ b/java/com/android/voicemail/impl/VoicemailClientImpl.java
@@ -16,6 +16,7 @@
*/
package com.android.voicemail.impl;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -156,6 +157,7 @@
return new PinChangerImpl(context, phoneAccountHandle);
}
+ @SuppressLint("MissingPermission")
@Override
public void appendOmtpVoicemailSelectionClause(
Context context, StringBuilder where, List<String> selectionArgs) {
@@ -187,6 +189,7 @@
}
}
+ @SuppressLint("MissingPermission")
@Override
public void appendOmtpVoicemailStatusSelectionClause(
Context context, StringBuilder where, List<String> selectionArgs) {
diff --git a/java/com/android/voicemail/impl/VoicemailClientReceiver.java b/java/com/android/voicemail/impl/VoicemailClientReceiver.java
index 688636e..0f1804b 100644
--- a/java/com/android/voicemail/impl/VoicemailClientReceiver.java
+++ b/java/com/android/voicemail/impl/VoicemailClientReceiver.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.content.Context;
import android.content.Intent;
import android.telecom.PhoneAccountHandle;
+
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.voicemail.VoicemailClient;
diff --git a/java/com/android/voicemail/impl/VoicemailModule.java b/java/com/android/voicemail/impl/VoicemailModule.java
index a2a803a..2d11946 100644
--- a/java/com/android/voicemail/impl/VoicemailModule.java
+++ b/java/com/android/voicemail/impl/VoicemailModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,13 +18,16 @@
package com.android.voicemail.impl;
import android.content.Context;
+
import com.android.dialer.inject.ApplicationContext;
import com.android.voicemail.VoicemailClient;
import com.android.voicemail.VoicemailPermissionHelper;
import com.android.voicemail.stub.StubVoicemailClient;
+
+import javax.inject.Singleton;
+
import dagger.Module;
import dagger.Provides;
-import javax.inject.Singleton;
/** This module provides an instance of the voicemail client. */
@Module
diff --git a/java/com/android/voicemail/impl/VvmLog.java b/java/com/android/voicemail/impl/VvmLog.java
index 7d47904..1a7514a 100644
--- a/java/com/android/voicemail/impl/VvmLog.java
+++ b/java/com/android/voicemail/impl/VvmLog.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import com.android.dialer.common.LogUtil;
import com.android.dialer.persistentlog.PersistentLogger;
import com.android.voicemail.impl.utils.IndentingPrintWriter;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayDeque;
diff --git a/java/com/android/voicemail/impl/VvmPackageInstallHandler.java b/java/com/android/voicemail/impl/VvmPackageInstallHandler.java
index d6d5b77..db61845 100644
--- a/java/com/android/voicemail/impl/VvmPackageInstallHandler.java
+++ b/java/com/android/voicemail/impl/VvmPackageInstallHandler.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +17,11 @@
package com.android.voicemail.impl;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+
import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil;
/**
@@ -37,6 +40,7 @@
* Iterates through all phone account and disable VVM on a account if {@code packageName} is
* listed as a carrier VVM package.
*/
+ @SuppressLint("MissingPermission")
public static void handlePackageInstalled(Context context) {
// This get called every time an app is installed and will be noisy. Don't log until the app
// is identified as a carrier VVM app.
diff --git a/java/com/android/voicemail/impl/VvmPhoneStateListener.java b/java/com/android/voicemail/impl/VvmPhoneStateListener.java
index ff8b106..cabaea3 100644
--- a/java/com/android/voicemail/impl/VvmPhoneStateListener.java
+++ b/java/com/android/voicemail/impl/VvmPhoneStateListener.java
@@ -20,6 +20,7 @@
import android.telecom.PhoneAccountHandle;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
+
import com.android.voicemail.impl.sync.SyncTask;
import com.android.voicemail.impl.sync.VoicemailStatusQueryHelper;
import com.android.voicemail.impl.sync.VvmAccountManager;
diff --git a/java/com/android/voicemail/impl/configui/ConfigOverrideFragment.java b/java/com/android/voicemail/impl/configui/ConfigOverrideFragment.java
index db77930..6597593 100644
--- a/java/com/android/voicemail/impl/configui/ConfigOverrideFragment.java
+++ b/java/com/android/voicemail/impl/configui/ConfigOverrideFragment.java
@@ -17,6 +17,7 @@
package com.android.voicemail.impl.configui;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
@@ -32,7 +33,6 @@
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreferenceCompat;
import com.android.dialer.R;
@@ -105,8 +105,9 @@
* Loads the config for the currently carrier into the override values, from the dialer or the
* carrier config app. This is a "reset" button to load the defaults.
*/
+ @SuppressLint("MissingPermission")
private void loadCurrentConfig() {
- Context context = getActivity();
+ Context context = requireActivity();
PhoneAccountHandle phoneAccountHandle =
context
.getSystemService(TelecomManager.class)
diff --git a/java/com/android/voicemail/impl/configui/VoicemailSecretCodeActivity.java b/java/com/android/voicemail/impl/configui/VoicemailSecretCodeActivity.java
index beeb956..d6b0c4b 100644
--- a/java/com/android/voicemail/impl/configui/VoicemailSecretCodeActivity.java
+++ b/java/com/android/voicemail/impl/configui/VoicemailSecretCodeActivity.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Intent;
import android.preference.PreferenceActivity;
import android.provider.VoicemailContract;
+
import java.util.List;
/** Activity launched by simulator->voicemail, provides debug features. */
diff --git a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
index 4b8f762..147f323 100644
--- a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
+++ b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
@@ -16,6 +16,7 @@
*/
package com.android.voicemail.impl.fetch;
+import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -41,6 +42,7 @@
import com.android.voicemail.impl.imap.ImapHelper.InitializingException;
import com.android.voicemail.impl.sync.VvmAccountManager;
import com.android.voicemail.impl.sync.VvmNetworkRequestCallback;
+
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
@@ -153,6 +155,7 @@
* format. There's a chance of M phone account collisions on multi-SIM devices, but visual
* voicemail is not supported on M multi-SIM.
*/
+ @SuppressLint("MissingPermission")
@Nullable
private static PhoneAccountHandle getAccountFromMarshmallowAccount(
Context context, PhoneAccountHandle oldAccount) {
diff --git a/java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java b/java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java
index e15af21..61e0669 100644
--- a/java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java
+++ b/java/com/android/voicemail/impl/fetch/VoicemailFetchedCallback.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +16,7 @@
*/
package com.android.voicemail.impl.fetch;
+import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -29,9 +31,11 @@
import com.android.voicemail.impl.R;
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.imap.VoicemailPayload;
+
+import org.apache.commons.io.IOUtils;
+
import java.io.IOException;
import java.io.OutputStream;
-import org.apache.commons.io.IOUtils;
/**
* Callback for when a voicemail payload is fetched. It copies the returned stream to the data file
@@ -58,6 +62,7 @@
*
* @param voicemailPayload The object containing the content data for the voicemail
*/
+ @SuppressLint("MissingPermission")
public void setVoicemailContent(@Nullable VoicemailPayload voicemailPayload) {
Assert.isWorkerThread();
if (voicemailPayload == null) {
diff --git a/java/com/android/voicemail/impl/imap/ImapHelper.java b/java/com/android/voicemail/impl/imap/ImapHelper.java
index 4ebba33..95e7bbb 100644
--- a/java/com/android/voicemail/impl/imap/ImapHelper.java
+++ b/java/com/android/voicemail/impl/imap/ImapHelper.java
@@ -54,6 +54,9 @@
import com.android.voicemail.impl.mail.store.imap.ImapResponse;
import com.android.voicemail.impl.mail.utils.LogUtils;
import com.android.voicemail.impl.sync.OmtpVvmSyncService.TranscriptionFetchedCallback;
+
+import org.apache.commons.io.IOUtils;
+
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
@@ -62,7 +65,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
-import org.apache.commons.io.IOUtils;
/** A helper interface to abstract commands sent across IMAP interface for a given account. */
public class ImapHelper implements Closeable {
@@ -133,7 +135,7 @@
} catch (NumberFormatException e) {
handleEvent(OmtpEvents.DATA_INVALID_PORT);
LogUtils.w(TAG, "Could not parse port number");
- throw new InitializingException("cannot initialize ImapHelper:" + e.toString());
+ throw new InitializingException("cannot initialize ImapHelper:" + e);
}
}
@@ -150,6 +152,7 @@
return false;
}
return !capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING);
+
}
public OmtpVvmCarrierConfigHelper getConfig() {
@@ -206,7 +209,7 @@
* @return A list of voicemail objects containing data about voicemails stored on the server.
*/
public List<Voicemail> fetchAllVoicemails() {
- List<Voicemail> result = new ArrayList<Voicemail>();
+ List<Voicemail> result = new ArrayList<>();
Message[] messages;
try {
folder = openImapFolder(ImapFolder.MODE_READ_WRITE);
@@ -327,7 +330,7 @@
VoicemailPayload voicemailPayload = fetchVoicemailPayload(message);
callback.setVoicemailContent(voicemailPayload);
return true;
- } catch (MessagingException e) {
+ } catch (MessagingException ignored) {
} finally {
closeImapFolder();
}
diff --git a/java/com/android/voicemail/impl/mail/Address.java b/java/com/android/voicemail/impl/mail/Address.java
index 1e5a259..c92cb9e 100644
--- a/java/com/android/voicemail/impl/mail/Address.java
+++ b/java/com/android/voicemail/impl/mail/Address.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +21,14 @@
import android.text.TextUtils;
import android.text.util.Rfc822Token;
import android.text.util.Rfc822Tokenizer;
-import java.util.ArrayList;
-import java.util.regex.Pattern;
+
import org.apache.james.mime4j.codec.DecodeMonitor;
import org.apache.james.mime4j.codec.DecoderUtil;
import org.apache.james.mime4j.codec.EncoderUtil;
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+
/**
* This class represent email address.
*
@@ -123,7 +126,7 @@
return EMPTY_ADDRESS_ARRAY;
}
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(addressList);
- ArrayList<Address> addresses = new ArrayList<Address>();
+ ArrayList<Address> addresses = new ArrayList<>();
for (int i = 0, length = tokens.length; i < length; ++i) {
Rfc822Token token = tokens[i];
String address = token.getAddress();
@@ -137,7 +140,7 @@
}
}
}
- return addresses.toArray(new Address[addresses.size()]);
+ return addresses.toArray(new Address[0]);
}
/** Checks whether a string email address is valid. E.g. name@domain.com is valid. */
diff --git a/java/com/android/voicemail/impl/mail/Base64Body.java b/java/com/android/voicemail/impl/mail/Base64Body.java
index 5c14296..82d6d8b 100644
--- a/java/com/android/voicemail/impl/mail/Base64Body.java
+++ b/java/com/android/voicemail/impl/mail/Base64Body.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +18,12 @@
import android.util.Base64;
import android.util.Base64OutputStream;
+
+import org.apache.commons.io.IOUtils;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import org.apache.commons.io.IOUtils;
public class Base64Body implements Body {
private final InputStream source;
diff --git a/java/com/android/voicemail/impl/mail/Body.java b/java/com/android/voicemail/impl/mail/Body.java
index 3ad81bc..d4b04fc 100644
--- a/java/com/android/voicemail/impl/mail/Body.java
+++ b/java/com/android/voicemail/impl/mail/Body.java
@@ -20,7 +20,7 @@
import java.io.OutputStream;
public interface Body {
- public InputStream getInputStream() throws MessagingException;
+ InputStream getInputStream() throws MessagingException;
- public void writeTo(OutputStream out) throws IOException, MessagingException;
+ void writeTo(OutputStream out) throws IOException, MessagingException;
}
diff --git a/java/com/android/voicemail/impl/mail/MailTransport.java b/java/com/android/voicemail/impl/mail/MailTransport.java
index b67c08a..1598058 100644
--- a/java/com/android/voicemail/impl/mail/MailTransport.java
+++ b/java/com/android/voicemail/impl/mail/MailTransport.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,11 +19,13 @@
import android.content.Context;
import android.net.Network;
import android.net.TrafficStats;
+
import com.android.dialer.constants.TrafficStatsTags;
import com.android.voicemail.impl.OmtpEvents;
import com.android.voicemail.impl.imap.ImapHelper;
import com.android.voicemail.impl.mail.store.ImapStore;
import com.android.voicemail.impl.mail.utils.LogUtils;
+
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
@@ -33,6 +36,7 @@
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
+
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLException;
@@ -99,9 +103,9 @@
* SSL connection if indicated.
*/
public void open() throws MessagingException {
- LogUtils.d(TAG, "*** IMAP open " + host + ":" + String.valueOf(port));
+ LogUtils.d(TAG, "*** IMAP open " + host + ":" + port);
- List<InetSocketAddress> socketAddresses = new ArrayList<InetSocketAddress>();
+ List<InetSocketAddress> socketAddresses = new ArrayList<>();
if (network == null) {
socketAddresses.add(new InetSocketAddress(host, port));
diff --git a/java/com/android/voicemail/impl/mail/Message.java b/java/com/android/voicemail/impl/mail/Message.java
index 3cd5700..9b7f168 100644
--- a/java/com/android/voicemail/impl/mail/Message.java
+++ b/java/com/android/voicemail/impl/mail/Message.java
@@ -76,7 +76,7 @@
private HashSet<String> getFlagSet() {
if (flags == null) {
- flags = new HashSet<String>();
+ flags = new HashSet<>();
}
return flags;
}
diff --git a/java/com/android/voicemail/impl/mail/PackedString.java b/java/com/android/voicemail/impl/mail/PackedString.java
index 5b74b56..66b5512 100644
--- a/java/com/android/voicemail/impl/mail/PackedString.java
+++ b/java/com/android/voicemail/impl/mail/PackedString.java
@@ -17,6 +17,7 @@
package com.android.voicemail.impl.mail;
import android.util.ArrayMap;
+
import java.util.Map;
/**
@@ -39,7 +40,7 @@
private final String string;
private ArrayMap<String, String> exploded;
- private static final ArrayMap<String, String> EMPTY_MAP = new ArrayMap<String, String>();
+ private static final ArrayMap<String, String> EMPTY_MAP = new ArrayMap<>();
/**
* Create a packed string using an already-packed string (e.g. from database)
@@ -74,7 +75,7 @@
if (exploded == null) {
exploded = explode(string);
}
- return new ArrayMap<String, String>(exploded);
+ return new ArrayMap<>(exploded);
}
/** Read out all values into a map. */
@@ -82,7 +83,7 @@
if (packed == null || packed.length() == 0) {
return EMPTY_MAP;
}
- ArrayMap<String, String> map = new ArrayMap<String, String>();
+ ArrayMap<String, String> map = new ArrayMap<>();
int length = packed.length();
int elementStartIndex = 0;
@@ -123,7 +124,7 @@
/** Create a builder that's empty (for filling) */
public Builder() {
- map = new ArrayMap<String, String>();
+ map = new ArrayMap<>();
}
/** Create a builder using the values of an existing PackedString (for editing). */
diff --git a/java/com/android/voicemail/impl/mail/Part.java b/java/com/android/voicemail/impl/mail/Part.java
index 3be5c57..4a681b6 100644
--- a/java/com/android/voicemail/impl/mail/Part.java
+++ b/java/com/android/voicemail/impl/mail/Part.java
@@ -19,33 +19,33 @@
import java.io.OutputStream;
public interface Part extends Fetchable {
- public void addHeader(String name, String value) throws MessagingException;
+ void addHeader(String name, String value) throws MessagingException;
- public void removeHeader(String name) throws MessagingException;
+ void removeHeader(String name) throws MessagingException;
- public void setHeader(String name, String value) throws MessagingException;
+ void setHeader(String name, String value) throws MessagingException;
- public Body getBody() throws MessagingException;
+ Body getBody() throws MessagingException;
- public String getContentType() throws MessagingException;
+ String getContentType() throws MessagingException;
- public String getDisposition() throws MessagingException;
+ String getDisposition() throws MessagingException;
- public String getContentId() throws MessagingException;
+ String getContentId() throws MessagingException;
- public String[] getHeader(String name) throws MessagingException;
+ String[] getHeader(String name) throws MessagingException;
- public void setExtendedHeader(String name, String value) throws MessagingException;
+ void setExtendedHeader(String name, String value) throws MessagingException;
- public String getExtendedHeader(String name) throws MessagingException;
+ String getExtendedHeader(String name) throws MessagingException;
- public int getSize() throws MessagingException;
+ int getSize() throws MessagingException;
- public boolean isMimeType(String mimeType) throws MessagingException;
+ boolean isMimeType(String mimeType) throws MessagingException;
- public String getMimeType() throws MessagingException;
+ String getMimeType() throws MessagingException;
- public void setBody(Body body) throws MessagingException;
+ void setBody(Body body) throws MessagingException;
- public void writeTo(OutputStream out) throws IOException, MessagingException;
+ void writeTo(OutputStream out) throws IOException, MessagingException;
}
diff --git a/java/com/android/voicemail/impl/mail/TempDirectory.java b/java/com/android/voicemail/impl/mail/TempDirectory.java
index f12e45b..e8151d5 100644
--- a/java/com/android/voicemail/impl/mail/TempDirectory.java
+++ b/java/com/android/voicemail/impl/mail/TempDirectory.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
package com.android.voicemail.impl.mail;
import android.content.Context;
+
import java.io.File;
/**
diff --git a/java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java b/java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java
index d1521bd..ccecff2 100644
--- a/java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java
+++ b/java/com/android/voicemail/impl/mail/internet/BinaryTempFileBody.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,17 +18,19 @@
import android.util.Base64;
import android.util.Base64OutputStream;
+
import com.android.voicemail.impl.mail.Body;
import com.android.voicemail.impl.mail.MessagingException;
import com.android.voicemail.impl.mail.TempDirectory;
+
+import org.apache.commons.io.IOUtils;
+
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import org.apache.commons.io.IOUtils;
+import java.nio.file.Files;
/**
* A Body that is backed by a temp file. The Body exposes a getOutputStream method that allows the
@@ -51,13 +54,13 @@
public OutputStream getOutputStream() throws IOException {
file = File.createTempFile("body", null, TempDirectory.getTempDirectory());
file.deleteOnExit();
- return new FileOutputStream(file);
+ return Files.newOutputStream(file.toPath());
}
@Override
public InputStream getInputStream() throws MessagingException {
try {
- return new BinaryTempFileBodyInputStream(new FileInputStream(file));
+ return new BinaryTempFileBodyInputStream(Files.newInputStream(file.toPath()));
} catch (IOException ioe) {
throw new MessagingException("Unable to open body", ioe);
}
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java b/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java
index 5445611..f80afb3 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeBodyPart.java
@@ -20,6 +20,7 @@
import com.android.voicemail.impl.mail.BodyPart;
import com.android.voicemail.impl.mail.MessagingException;
import com.android.voicemail.impl.mail.Multipart;
+
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
@@ -113,12 +114,7 @@
@Override
public String getDisposition() throws MessagingException {
- String contentDisposition = getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION);
- if (contentDisposition == null) {
- return null;
- } else {
- return contentDisposition;
- }
+ return getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION);
}
@Override
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeHeader.java b/java/com/android/voicemail/impl/mail/internet/MimeHeader.java
index 17d2556..101b5ab 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeHeader.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeHeader.java
@@ -17,6 +17,7 @@
package com.android.voicemail.impl.mail.internet;
import com.android.voicemail.impl.mail.MessagingException;
+
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
@@ -46,7 +47,7 @@
HEADER_ANDROID_ATTACHMENT_STORE_DATA
};
- protected final ArrayList<Field> fields = new ArrayList<Field>();
+ protected final ArrayList<Field> fields = new ArrayList<>();
public void clear() {
fields.clear();
@@ -73,7 +74,7 @@
}
public String[] getHeader(String name) throws MessagingException {
- ArrayList<String> values = new ArrayList<String>();
+ ArrayList<String> values = new ArrayList<>();
for (Field field : fields) {
if (field.name.equalsIgnoreCase(name)) {
values.add(field.value);
@@ -86,7 +87,7 @@
}
public void removeHeader(String name) throws MessagingException {
- ArrayList<Field> removeFields = new ArrayList<Field>();
+ ArrayList<Field> removeFields = new ArrayList<>();
for (Field field : fields) {
if (field.name.equalsIgnoreCase(name)) {
removeFields.add(field);
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeMessage.java b/java/com/android/voicemail/impl/mail/internet/MimeMessage.java
index 7f6c098..9ca3d58 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeMessage.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeMessage.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +29,16 @@
import com.android.voicemail.impl.mail.Multipart;
import com.android.voicemail.impl.mail.Part;
import com.android.voicemail.impl.mail.utils.LogUtils;
+
+import org.apache.james.mime4j.MimeException;
+import org.apache.james.mime4j.dom.field.DateTimeField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
+import org.apache.james.mime4j.io.EOLConvertingInputStream;
+import org.apache.james.mime4j.parser.ContentHandler;
+import org.apache.james.mime4j.parser.MimeStreamParser;
+import org.apache.james.mime4j.stream.BodyDescriptor;
+import org.apache.james.mime4j.stream.Field;
+
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
@@ -38,14 +49,6 @@
import java.util.Locale;
import java.util.Stack;
import java.util.regex.Pattern;
-import org.apache.james.mime4j.MimeException;
-import org.apache.james.mime4j.dom.field.DateTimeField;
-import org.apache.james.mime4j.field.DefaultFieldParser;
-import org.apache.james.mime4j.io.EOLConvertingInputStream;
-import org.apache.james.mime4j.parser.ContentHandler;
-import org.apache.james.mime4j.parser.MimeStreamParser;
-import org.apache.james.mime4j.stream.BodyDescriptor;
-import org.apache.james.mime4j.stream.Field;
/**
* An implementation of Message that stores all of its metadata in RFC 822 and RFC 2045 style
@@ -107,7 +110,7 @@
sb.append(c);
}
sb.append(".");
- sb.append(Long.toString(System.currentTimeMillis()));
+ sb.append(System.currentTimeMillis());
sb.append("@email.android.com>");
return sb.toString();
}
@@ -453,7 +456,7 @@
}
class MimeMessageBuilder implements ContentHandler {
- private final Stack<Object> stack = new Stack<Object>();
+ private final Stack<Object> stack = new Stack<>();
public MimeMessageBuilder() {}
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeMultipart.java b/java/com/android/voicemail/impl/mail/internet/MimeMultipart.java
index 6cb2c27..0ff3ce0 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeMultipart.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeMultipart.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import com.android.voicemail.impl.mail.BodyPart;
import com.android.voicemail.impl.mail.MessagingException;
import com.android.voicemail.impl.mail.Multipart;
+
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
diff --git a/java/com/android/voicemail/impl/mail/internet/MimeUtility.java b/java/com/android/voicemail/impl/mail/internet/MimeUtility.java
index bd85e47..0d9e0dc 100644
--- a/java/com/android/voicemail/impl/mail/internet/MimeUtility.java
+++ b/java/com/android/voicemail/impl/mail/internet/MimeUtility.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.util.Base64;
import android.util.Base64DataException;
import android.util.Base64InputStream;
+
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.mail.Body;
import com.android.voicemail.impl.mail.BodyPart;
@@ -26,6 +28,14 @@
import com.android.voicemail.impl.mail.MessagingException;
import com.android.voicemail.impl.mail.Multipart;
import com.android.voicemail.impl.mail.Part;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.james.mime4j.codec.DecodeMonitor;
+import org.apache.james.mime4j.codec.DecoderUtil;
+import org.apache.james.mime4j.codec.EncoderUtil;
+import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
+import org.apache.james.mime4j.util.CharsetUtil;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -33,12 +43,6 @@
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.commons.io.IOUtils;
-import org.apache.james.mime4j.codec.DecodeMonitor;
-import org.apache.james.mime4j.codec.DecoderUtil;
-import org.apache.james.mime4j.codec.EncoderUtil;
-import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
-import org.apache.james.mime4j.util.CharsetUtil;
public class MimeUtility {
private static final String LOG_TAG = "Email";
@@ -253,18 +257,12 @@
}
}
- } catch (OutOfMemoryError oom) {
+ } catch (OutOfMemoryError | Exception oom) {
/*
* If we are not able to process the body there's nothing we can do about it. Return
* null and let the upper layers handle the missing content.
*/
- VvmLog.e(LOG_TAG, "Unable to getTextFromPart " + oom.toString());
- } catch (Exception e) {
- /*
- * If we are not able to process the body there's nothing we can do about it. Return
- * null and let the upper layers handle the missing content.
- */
- VvmLog.e(LOG_TAG, "Unable to getTextFromPart " + e.toString());
+ VvmLog.e(LOG_TAG, "Unable to getTextFromPart " + oom);
}
return null;
}
diff --git a/java/com/android/voicemail/impl/mail/internet/TextBody.java b/java/com/android/voicemail/impl/mail/internet/TextBody.java
index b3bccb7..c778bc9 100644
--- a/java/com/android/voicemail/impl/mail/internet/TextBody.java
+++ b/java/com/android/voicemail/impl/mail/internet/TextBody.java
@@ -17,13 +17,15 @@
package com.android.voicemail.impl.mail.internet;
import android.util.Base64;
+
import com.android.voicemail.impl.mail.Body;
import com.android.voicemail.impl.mail.MessagingException;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
public class TextBody implements Body {
final String body;
@@ -34,7 +36,7 @@
@Override
public void writeTo(OutputStream out) throws IOException, MessagingException {
- byte[] bytes = body.getBytes("UTF-8");
+ byte[] bytes = body.getBytes(StandardCharsets.UTF_8);
out.write(Base64.encode(bytes, Base64.CRLF));
}
@@ -50,11 +52,7 @@
/** Returns an InputStream that reads this body's text in UTF-8 format. */
@Override
public InputStream getInputStream() throws MessagingException {
- try {
- byte[] b = body.getBytes("UTF-8");
- return new ByteArrayInputStream(b);
- } catch (UnsupportedEncodingException usee) {
- return null;
- }
+ byte[] b = body.getBytes(StandardCharsets.UTF_8);
+ return new ByteArrayInputStream(b);
}
}
diff --git a/java/com/android/voicemail/impl/mail/store/ImapConnection.java b/java/com/android/voicemail/impl/mail/store/ImapConnection.java
index 31511b7..4a4debb 100644
--- a/java/com/android/voicemail/impl/mail/store/ImapConnection.java
+++ b/java/com/android/voicemail/impl/mail/store/ImapConnection.java
@@ -18,6 +18,7 @@
import android.util.ArraySet;
import android.util.Base64;
+
import com.android.voicemail.impl.OmtpEvents;
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.mail.AuthenticationFailedException;
@@ -31,12 +32,14 @@
import com.android.voicemail.impl.mail.store.imap.ImapResponseParser;
import com.android.voicemail.impl.mail.store.imap.ImapUtility;
import com.android.voicemail.impl.mail.utils.LogUtils;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
+
import javax.net.ssl.SSLException;
/** A cacheable class that stores the details for a single IMAP connection. */
@@ -180,7 +183,7 @@
}
/** Logs into the IMAP server */
- private void doLogin() throws IOException, MessagingException, AuthenticationFailedException {
+ private void doLogin() throws IOException, MessagingException {
try {
if (capabilities.contains(ImapConstants.CAPABILITY_AUTH_DIGEST_MD5)) {
doDigestMd5Auth();
@@ -301,7 +304,7 @@
}
}
- LogUtils.d(TAG, "Capabilities: " + capabilities.toString());
+ LogUtils.d(TAG, "Capabilities: " + capabilities);
}
private boolean hasCapability(String capability) {
@@ -380,7 +383,7 @@
* @throws MessagingException
*/
List<ImapResponse> getCommandResponses() throws IOException, MessagingException {
- final List<ImapResponse> responses = new ArrayList<ImapResponse>();
+ final List<ImapResponse> responses = new ArrayList<>();
ImapResponse response;
do {
response = parser.readResponse(false);
diff --git a/java/com/android/voicemail/impl/mail/store/ImapFolder.java b/java/com/android/voicemail/impl/mail/store/ImapFolder.java
index bf99dde..8bf4756 100644
--- a/java/com/android/voicemail/impl/mail/store/ImapFolder.java
+++ b/java/com/android/voicemail/impl/mail/store/ImapFolder.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +45,7 @@
import com.android.voicemail.impl.mail.store.imap.ImapResponse;
import com.android.voicemail.impl.mail.store.imap.ImapString;
import com.android.voicemail.impl.mail.utils.Utility;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -79,7 +81,7 @@
/** Callback for each message retrieval. */
public interface MessageRetrievalListener {
- public void messageRetrieved(Message message);
+ void messageRetrieved(Message message);
}
private void destroyResponses() {
@@ -152,7 +154,7 @@
String[] getSearchUids(List<ImapResponse> responses) {
// S: * SEARCH 2 3 6
- final ArrayList<String> uids = new ArrayList<String>();
+ final ArrayList<String> uids = new ArrayList<>();
for (ImapResponse response : responses) {
if (!response.isDataResponse(0, ImapConstants.SEARCH)) {
continue;
@@ -220,7 +222,7 @@
}
public Message[] getMessagesInternal(String[] uids) {
- final ArrayList<Message> messages = new ArrayList<Message>(uids.length);
+ final ArrayList<Message> messages = new ArrayList<>(uids.length);
for (int i = 0; i < uids.length; i++) {
final String uid = uids[i];
final ImapMessage message = new ImapMessage(uid, this);
@@ -245,7 +247,7 @@
return;
}
checkOpen();
- ArrayMap<String, Message> messageMap = new ArrayMap<String, Message>();
+ ArrayMap<String, Message> messageMap = new ArrayMap<>();
for (Message m : messages) {
messageMap.put(m.getUid(), m);
}
@@ -261,7 +263,7 @@
* Part - UID FETCH (BODY.PEEK[ID]) where ID = mime part ID
*/
- final LinkedHashSet<String> fetchFields = new LinkedHashSet<String>();
+ final LinkedHashSet<String> fetchFields = new LinkedHashSet<>();
fetchFields.add(ImapConstants.UID);
if (fp.contains(FetchProfile.Item.FLAGS)) {
@@ -300,7 +302,7 @@
Locale.US,
ImapConstants.UID_FETCH + " %s (%s)",
ImapStore.joinMessageUids(messages),
- Utility.combine(fetchFields.toArray(new String[fetchFields.size()]), ' ')),
+ Utility.combine(fetchFields.toArray(new String[0]), ' ')),
false);
ImapResponse response;
do {
@@ -650,7 +652,7 @@
} else if (part instanceof MimeBodyPart) {
((MimeBodyPart) part).setSize(size);
} else {
- throw new MessagingException("Unknown part type " + part.toString());
+ throw new MessagingException("Unknown part type " + part);
}
}
part.setHeader(MimeHeader.HEADER_ANDROID_ATTACHMENT_STORE_DATA, id);
diff --git a/java/com/android/voicemail/impl/mail/store/ImapStore.java b/java/com/android/voicemail/impl/mail/store/ImapStore.java
index 3561da1..cf86acd 100644
--- a/java/com/android/voicemail/impl/mail/store/ImapStore.java
+++ b/java/com/android/voicemail/impl/mail/store/ImapStore.java
@@ -19,14 +19,17 @@
import android.content.Context;
import android.net.Network;
+
import com.android.voicemail.impl.imap.ImapHelper;
import com.android.voicemail.impl.mail.MailTransport;
import com.android.voicemail.impl.mail.Message;
import com.android.voicemail.impl.mail.MessagingException;
import com.android.voicemail.impl.mail.internet.MimeMessage;
+
+import org.apache.james.mime4j.MimeException;
+
import java.io.IOException;
import java.io.InputStream;
-import org.apache.james.mime4j.MimeException;
public class ImapStore {
/**
diff --git a/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java b/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java
index 7be99b5..067ab8f 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java
@@ -26,6 +26,7 @@
import com.android.voicemail.impl.mail.MailTransport;
import com.android.voicemail.impl.mail.MessagingException;
import com.android.voicemail.impl.mail.store.ImapStore;
+
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapConstants.java b/java/com/android/voicemail/impl/mail/store/imap/ImapConstants.java
index 2dc2254..d5f70b0 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapConstants.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapConstants.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.voicemail.impl.mail.store.imap;
import com.android.voicemail.impl.mail.store.ImapStore;
+
import java.util.Locale;
public final class ImapConstants {
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapList.java b/java/com/android/voicemail/impl/mail/store/imap/ImapList.java
index 9fcd562..a5c7f15 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapList.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapList.java
@@ -36,7 +36,7 @@
}
};
- private ArrayList<ImapElement> list = new ArrayList<ImapElement>();
+ private ArrayList<ImapElement> list = new ArrayList<>();
/* package */ void add(ImapElement e) {
if (e == null) {
@@ -177,11 +177,6 @@
return list.toString();
}
- /** Return the text representations of the contents concatenated with ",". */
- public final String flatten() {
- return flatten(new StringBuilder()).toString();
- }
-
/**
* Returns text representations (i.e. getString()) of contents joined together with "," as the
* separator.
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java b/java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java
index 46f3fc5..8c569f7 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapMemoryLiteral.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +19,11 @@
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.mail.FixedLengthInputStream;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
/** Subclass of {@link ImapString} used for literals backed by an in-memory byte array. */
public class ImapMemoryLiteral extends ImapString {
@@ -53,12 +55,7 @@
@Override
public String getString() {
- try {
- return new String(data, "US-ASCII");
- } catch (UnsupportedEncodingException e) {
- VvmLog.e(TAG, "Unsupported encoding: ", e);
- }
- return null;
+ return new String(data, StandardCharsets.US_ASCII);
}
@Override
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java b/java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java
index 68d6bab..4c1bf7e 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapResponseParser.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +18,12 @@
package com.android.voicemail.impl.mail.store.imap;
import android.text.TextUtils;
+
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.mail.FixedLengthInputStream;
import com.android.voicemail.impl.mail.MessagingException;
import com.android.voicemail.impl.mail.PeekableInputStream;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -47,7 +50,7 @@
* We store all {@link ImapResponse} in it. {@link #destroyResponses()} must be called from time
* to time to destroy them and clear it.
*/
- private final ArrayList<ImapResponse> responsesToDestroy = new ArrayList<ImapResponse>();
+ private final ArrayList<ImapResponse> responsesToDestroy = new ArrayList<>();
/**
* Exception thrown when we receive BYE. It derives from IOException, so it'll be treated in the
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java b/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java
index 9fb5c7b..77362c4 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapSimpleString.java
@@ -17,10 +17,9 @@
package com.android.voicemail.impl.mail.store.imap;
-import com.android.voicemail.impl.VvmLog;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
/** Subclass of {@link ImapString} used for non literals. */
public class ImapSimpleString extends ImapString {
@@ -44,12 +43,7 @@
@Override
public InputStream getAsStream() {
- try {
- return new ByteArrayInputStream(string.getBytes("US-ASCII"));
- } catch (UnsupportedEncodingException e) {
- VvmLog.e(TAG, "Unsupported encoding: ", e);
- }
- return null;
+ return new ByteArrayInputStream(string.getBytes(StandardCharsets.US_ASCII));
}
@Override
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapString.java b/java/com/android/voicemail/impl/mail/store/imap/ImapString.java
index 099e569..cb032b9 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapString.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapString.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.voicemail.impl.mail.store.imap;
import com.android.voicemail.impl.VvmLog;
+
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.text.ParseException;
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java b/java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java
index 61d4d4a..b742164 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapTempFileLiteral.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,15 +20,17 @@
import com.android.voicemail.impl.mail.TempDirectory;
import com.android.voicemail.impl.mail.utils.LogUtils;
import com.android.voicemail.impl.mail.utils.Utility;
+
+import org.apache.commons.io.IOUtils;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import org.apache.commons.io.IOUtils;
+import java.nio.file.Files;
/** Subclass of {@link ImapString} used for literals backed by a temp file. */
public class ImapTempFileLiteral extends ImapString {
@@ -46,7 +49,7 @@
// so it'd simply cause a memory leak.
// deleteOnExit() simply adds filenames to a static list and the list will never shrink.
// mFile.deleteOnExit();
- OutputStream out = new FileOutputStream(file);
+ OutputStream out = Files.newOutputStream(file.toPath());
IOUtils.copy(stream, out);
out.close();
}
diff --git a/java/com/android/voicemail/impl/mail/store/imap/ImapUtility.java b/java/com/android/voicemail/impl/mail/store/imap/ImapUtility.java
index a325cc2..596d84d 100644
--- a/java/com/android/voicemail/impl/mail/store/imap/ImapUtility.java
+++ b/java/com/android/voicemail/impl/mail/store/imap/ImapUtility.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +17,9 @@
package com.android.voicemail.impl.mail.store.imap;
import com.android.voicemail.impl.mail.utils.LogUtils;
+
import java.util.ArrayList;
+import java.util.Arrays;
/** Utility methods for use with IMAP. */
public class ImapUtility {
@@ -60,7 +63,7 @@
* </pre>
*/
public static String[] getImapSequenceValues(String set) {
- ArrayList<String> list = new ArrayList<String>();
+ ArrayList<String> list = new ArrayList<>();
if (set != null) {
String[] setItems = set.split(",");
for (String item : setItems) {
@@ -74,9 +77,7 @@
}
} else {
// range
- for (String rangeItem : getImapRangeValues(item)) {
- list.add(rangeItem);
- }
+ list.addAll(Arrays.asList(getImapRangeValues(item)));
}
}
}
@@ -95,7 +96,7 @@
* </pre>
*/
public static String[] getImapRangeValues(String range) {
- ArrayList<String> list = new ArrayList<String>();
+ ArrayList<String> list = new ArrayList<>();
try {
if (range != null) {
int colonPos = range.indexOf(':');
diff --git a/java/com/android/voicemail/impl/mail/utils/LogUtils.java b/java/com/android/voicemail/impl/mail/utils/LogUtils.java
index 8d95f57..f675e3a 100644
--- a/java/com/android/voicemail/impl/mail/utils/LogUtils.java
+++ b/java/com/android/voicemail/impl/mail/utils/LogUtils.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* <p>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
@@ -16,7 +17,9 @@
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
+
import com.android.voicemail.impl.VvmLog;
+
import java.util.List;
public class LogUtils {
diff --git a/java/com/android/voicemail/impl/mail/utils/Utility.java b/java/com/android/voicemail/impl/mail/utils/Utility.java
index 4db1681..2dbd773 100644
--- a/java/com/android/voicemail/impl/mail/utils/Utility.java
+++ b/java/com/android/voicemail/impl/mail/utils/Utility.java
@@ -17,10 +17,11 @@
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
/** Simple utility methods used in email functions. */
public class Utility {
- public static final Charset ASCII = Charset.forName("US-ASCII");
+ public static final Charset ASCII = StandardCharsets.US_ASCII;
public static final String[] EMPTY_STRINGS = new String[0];
diff --git a/java/com/android/voicemail/impl/protocol/CvvmProtocol.java b/java/com/android/voicemail/impl/protocol/CvvmProtocol.java
index ae5c6d9..548d67b 100644
--- a/java/com/android/voicemail/impl/protocol/CvvmProtocol.java
+++ b/java/com/android/voicemail/impl/protocol/CvvmProtocol.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.telecom.PhoneAccountHandle;
+
import com.android.voicemail.impl.OmtpConstants;
import com.android.voicemail.impl.sms.OmtpCvvmMessageSender;
import com.android.voicemail.impl.sms.OmtpMessageSender;
@@ -46,14 +47,13 @@
@Override
public String getCommand(String command) {
- if (command == OmtpConstants.IMAP_CHANGE_TUI_PWD_FORMAT) {
- return IMAP_CHANGE_TUI_PWD_FORMAT;
- }
- if (command == OmtpConstants.IMAP_CLOSE_NUT) {
- return IMAP_CLOSE_NUT;
- }
- if (command == OmtpConstants.IMAP_CHANGE_VM_LANG_FORMAT) {
- return IMAP_CHANGE_VM_LANG_FORMAT;
+ switch (command) {
+ case OmtpConstants.IMAP_CHANGE_TUI_PWD_FORMAT:
+ return IMAP_CHANGE_TUI_PWD_FORMAT;
+ case OmtpConstants.IMAP_CLOSE_NUT:
+ return IMAP_CLOSE_NUT;
+ case OmtpConstants.IMAP_CHANGE_VM_LANG_FORMAT:
+ return IMAP_CHANGE_VM_LANG_FORMAT;
}
return super.getCommand(command);
}
diff --git a/java/com/android/voicemail/impl/protocol/OmtpProtocol.java b/java/com/android/voicemail/impl/protocol/OmtpProtocol.java
index 971edcf..86ad10e 100644
--- a/java/com/android/voicemail/impl/protocol/OmtpProtocol.java
+++ b/java/com/android/voicemail/impl/protocol/OmtpProtocol.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.telecom.PhoneAccountHandle;
+
import com.android.voicemail.impl.OmtpConstants;
import com.android.voicemail.impl.sms.OmtpMessageSender;
import com.android.voicemail.impl.sms.OmtpStandardMessageSender;
diff --git a/java/com/android/voicemail/impl/protocol/ProtocolHelper.java b/java/com/android/voicemail/impl/protocol/ProtocolHelper.java
index 4d2e7cc..72ee5cb 100644
--- a/java/com/android/voicemail/impl/protocol/ProtocolHelper.java
+++ b/java/com/android/voicemail/impl/protocol/ProtocolHelper.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.voicemail.impl.protocol;
import android.text.TextUtils;
+
import com.android.voicemail.impl.OmtpVvmCarrierConfigHelper;
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.sms.OmtpMessageSender;
diff --git a/java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java b/java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java
index 0b8014c..8502857 100644
--- a/java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java
+++ b/java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +30,7 @@
import com.android.voicemail.impl.OmtpVvmCarrierConfigHelper;
import com.android.voicemail.impl.VoicemailStatus;
import com.android.voicemail.impl.VvmLog;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -69,7 +71,8 @@
VMG_COMMUNICATION_ERROR,
SPG_URL_NOT_FOUND,
VMG_UNKNOWN_ERROR,
- PIN_NOT_SET
+ PIN_NOT_SET,
+ SUBSCRIBER_UNKNOWN
})
public @interface ErrorCode {}
diff --git a/java/com/android/voicemail/impl/protocol/Vvm3Protocol.java b/java/com/android/voicemail/impl/protocol/Vvm3Protocol.java
index 3fd00a7..4ae6542 100644
--- a/java/com/android/voicemail/impl/protocol/Vvm3Protocol.java
+++ b/java/com/android/voicemail/impl/protocol/Vvm3Protocol.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +45,7 @@
import com.android.voicemail.impl.sync.VvmNetworkRequest;
import com.android.voicemail.impl.sync.VvmNetworkRequest.NetworkWrapper;
import com.android.voicemail.impl.sync.VvmNetworkRequest.RequestFailedException;
+
import java.io.IOException;
import java.security.SecureRandom;
import java.util.Locale;
diff --git a/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java b/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
index 93862bf..c2c42f7 100644
--- a/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
+++ b/java/com/android/voicemail/impl/protocol/Vvm3Subscriber.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,6 +46,10 @@
import com.android.volley.toolbox.RequestFuture;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+
import java.io.IOException;
import java.net.CookieHandler;
import java.net.CookieManager;
@@ -60,8 +65,6 @@
import java.util.concurrent.TimeoutException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.json.JSONArray;
-import org.json.JSONException;
/**
* Class to subscribe to basic VVM3 visual voicemail, for example, Verizon. Subscription is required
diff --git a/java/com/android/voicemail/impl/scheduling/BaseTask.java b/java/com/android/voicemail/impl/scheduling/BaseTask.java
index 96ebc84..44db358 100644
--- a/java/com/android/voicemail/impl/scheduling/BaseTask.java
+++ b/java/com/android/voicemail/impl/scheduling/BaseTask.java
@@ -30,6 +30,7 @@
import com.android.dialer.proguard.UsedByReflection;
import com.android.voicemail.impl.Assert;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/voicemail/impl/scheduling/BlockerTask.java b/java/com/android/voicemail/impl/scheduling/BlockerTask.java
index 1c8bada..27d48bc 100644
--- a/java/com/android/voicemail/impl/scheduling/BlockerTask.java
+++ b/java/com/android/voicemail/impl/scheduling/BlockerTask.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.os.Bundle;
+
import com.android.dialer.proguard.UsedByReflection;
import com.android.voicemail.impl.VvmLog;
diff --git a/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java b/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java
index df4d5c8..0ebcb22 100644
--- a/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java
+++ b/java/com/android/voicemail/impl/scheduling/MinimalIntervalPolicy.java
@@ -19,6 +19,7 @@
import android.content.Intent;
import android.os.Bundle;
+
import com.android.voicemail.impl.scheduling.Task.TaskId;
/**
diff --git a/java/com/android/voicemail/impl/scheduling/PostponePolicy.java b/java/com/android/voicemail/impl/scheduling/PostponePolicy.java
index 8ff1478..a7d9982 100644
--- a/java/com/android/voicemail/impl/scheduling/PostponePolicy.java
+++ b/java/com/android/voicemail/impl/scheduling/PostponePolicy.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
package com.android.voicemail.impl.scheduling;
import android.os.Bundle;
+
import com.android.voicemail.impl.VvmLog;
/**
diff --git a/java/com/android/voicemail/impl/scheduling/RetryPolicy.java b/java/com/android/voicemail/impl/scheduling/RetryPolicy.java
index ec4d72d..d163072 100644
--- a/java/com/android/voicemail/impl/scheduling/RetryPolicy.java
+++ b/java/com/android/voicemail/impl/scheduling/RetryPolicy.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.telecom.PhoneAccountHandle;
+
import com.android.voicemail.impl.VoicemailStatus;
import com.android.voicemail.impl.VvmLog;
diff --git a/java/com/android/voicemail/impl/scheduling/TaskExecutor.java b/java/com/android/voicemail/impl/scheduling/TaskExecutor.java
index e7b3833..f572190 100644
--- a/java/com/android/voicemail/impl/scheduling/TaskExecutor.java
+++ b/java/com/android/voicemail/impl/scheduling/TaskExecutor.java
@@ -32,6 +32,7 @@
import com.android.voicemail.impl.Assert;
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.scheduling.TaskQueue.NextTask;
+
import java.util.List;
/**
diff --git a/java/com/android/voicemail/impl/scheduling/TaskQueue.java b/java/com/android/voicemail/impl/scheduling/TaskQueue.java
index 872d025..075d6f6 100644
--- a/java/com/android/voicemail/impl/scheduling/TaskQueue.java
+++ b/java/com/android/voicemail/impl/scheduling/TaskQueue.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.scheduling.Task.TaskId;
import com.android.voicemail.impl.scheduling.Tasks.TaskCreationException;
+
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/java/com/android/voicemail/impl/scheduling/TaskReceiver.java b/java/com/android/voicemail/impl/scheduling/TaskReceiver.java
index d838b9e..549d083 100644
--- a/java/com/android/voicemail/impl/scheduling/TaskReceiver.java
+++ b/java/com/android/voicemail/impl/scheduling/TaskReceiver.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +21,10 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.scheduling.Tasks.TaskCreationException;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/java/com/android/voicemail/impl/scheduling/TaskSchedulerJobService.java b/java/com/android/voicemail/impl/scheduling/TaskSchedulerJobService.java
index 434d9af..8ad0d66 100644
--- a/java/com/android/voicemail/impl/scheduling/TaskSchedulerJobService.java
+++ b/java/com/android/voicemail/impl/scheduling/TaskSchedulerJobService.java
@@ -130,7 +130,7 @@
.apply();
extras.putParcelableArray(
- EXTRA_TASK_EXTRAS_ARRAY, pendingTasks.toArray(new Bundle[pendingTasks.size()]));
+ EXTRA_TASK_EXTRAS_ARRAY, pendingTasks.toArray(new Bundle[0]));
JobInfo.Builder builder =
new JobInfo.Builder(
ScheduledJobIds.VVM_TASK_SCHEDULER_JOB,
diff --git a/java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java b/java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java
index 8fbd87e..bb51b1b 100644
--- a/java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java
+++ b/java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
import android.content.Context;
import android.provider.VoicemailContract.Voicemails;
import android.telecom.PhoneAccountHandle;
+
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutor.Worker;
diff --git a/java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java b/java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java
index 3660ea9..6c28fc7 100644
--- a/java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java
+++ b/java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java
@@ -16,6 +16,7 @@
package com.android.voicemail.impl.sms;
+import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@@ -133,6 +134,7 @@
context.sendBroadcast(intent);
}
+ @SuppressLint("MissingPermission")
@Nullable
private static String getVoicemailNumber(Context context, PhoneAccountHandle phoneAccountHandle) {
TelephonyManager telephonyManager =
diff --git a/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java b/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java
index 0bab169..98fd372 100644
--- a/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java
+++ b/java/com/android/voicemail/impl/sms/OmtpMessageReceiver.java
@@ -25,6 +25,7 @@
import android.os.UserManager;
import android.telecom.PhoneAccountHandle;
import android.telephony.VisualVoicemailSms;
+
import com.android.voicemail.impl.ActivationTask;
import com.android.voicemail.impl.OmtpConstants;
import com.android.voicemail.impl.OmtpService;
diff --git a/java/com/android/voicemail/impl/sms/StatusMessage.java b/java/com/android/voicemail/impl/sms/StatusMessage.java
index 6d0d56e..0226e6f 100644
--- a/java/com/android/voicemail/impl/sms/StatusMessage.java
+++ b/java/com/android/voicemail/impl/sms/StatusMessage.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
package com.android.voicemail.impl.sms;
import android.os.Bundle;
+
import com.android.voicemail.impl.OmtpConstants;
import com.android.voicemail.impl.VisualVoicemailPreferences;
import com.android.voicemail.impl.VvmLog;
diff --git a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
index 9a41c11..8b3e845 100644
--- a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
+++ b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
@@ -38,6 +38,7 @@
import com.android.voicemail.impl.OmtpVvmCarrierConfigHelper;
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.protocol.VisualVoicemailProtocol;
+
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.CancellationException;
@@ -71,7 +72,8 @@
this.phoneAccountHandle = phoneAccountHandle;
IntentFilter filter = new IntentFilter(ACTION_REQUEST_SENT_INTENT);
filter.addAction(OmtpService.ACTION_SMS_RECEIVED);
- context.registerReceiver(this, filter, PERMISSION_DIALER_ORIGIN, /* scheduler= */ null);
+ context.registerReceiver(this, filter, PERMISSION_DIALER_ORIGIN, /* scheduler= */ null,
+ Context.RECEIVER_NOT_EXPORTED);
}
@Override
@@ -116,9 +118,14 @@
return;
}
- VisualVoicemailSms sms = intent.getExtras().getParcelable(OmtpService.EXTRA_VOICEMAIL_SMS);
+ if (intent.getExtras() == null) {
+ return;
+ }
- if (!phoneAccountHandle.equals(sms.getPhoneAccountHandle())) {
+ VisualVoicemailSms sms = intent.getExtras().getParcelable(OmtpService.EXTRA_VOICEMAIL_SMS,
+ VisualVoicemailSms.class);
+
+ if (sms == null || !phoneAccountHandle.equals(sms.getPhoneAccountHandle())) {
return;
}
String eventType = sms.getPrefix();
diff --git a/java/com/android/voicemail/impl/sms/SyncMessage.java b/java/com/android/voicemail/impl/sms/SyncMessage.java
index f7fbaa4..261ad9d 100644
--- a/java/com/android/voicemail/impl/sms/SyncMessage.java
+++ b/java/com/android/voicemail/impl/sms/SyncMessage.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import androidx.annotation.Nullable;
import com.android.voicemail.impl.OmtpConstants;
+
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;
diff --git a/java/com/android/voicemail/impl/sync/OmtpVvmSyncReceiver.java b/java/com/android/voicemail/impl/sync/OmtpVvmSyncReceiver.java
index 1b59ecc..6dc8130 100644
--- a/java/com/android/voicemail/impl/sync/OmtpVvmSyncReceiver.java
+++ b/java/com/android/voicemail/impl/sync/OmtpVvmSyncReceiver.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,22 +17,26 @@
package com.android.voicemail.impl.sync;
+import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.provider.VoicemailContract;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+
import com.android.voicemail.VoicemailComponent;
import com.android.voicemail.impl.ActivationTask;
import com.android.voicemail.impl.VvmLog;
import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil;
+
import java.util.List;
public class OmtpVvmSyncReceiver extends BroadcastReceiver {
private static final String TAG = "OmtpVvmSyncReceiver";
+ @SuppressLint("MissingPermission")
@Override
public void onReceive(final Context context, Intent intent) {
if (!VoicemailComponent.get(context).getVoicemailClient().isVoicemailModuleEnabled()) {
diff --git a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java
index 561ba63..822a177 100644
--- a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java
+++ b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java
@@ -22,6 +22,7 @@
import android.telecom.PhoneAccountHandle;
import android.text.TextUtils;
import android.util.ArrayMap;
+
import com.android.voicemail.VoicemailComponent;
import com.android.voicemail.impl.ActivationTask;
import com.android.voicemail.impl.Assert;
@@ -39,6 +40,7 @@
import com.android.voicemail.impl.sync.VvmNetworkRequest.NetworkWrapper;
import com.android.voicemail.impl.sync.VvmNetworkRequest.RequestFailedException;
import com.android.voicemail.impl.utils.VoicemailDatabaseUtil;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -292,7 +294,7 @@
/** Builds a map from provider data to message for the given collection of voicemails. */
private Map<String, Voicemail> buildMap(List<Voicemail> messages) {
- Map<String, Voicemail> map = new ArrayMap<String, Voicemail>();
+ Map<String, Voicemail> map = new ArrayMap<>();
for (Voicemail message : messages) {
map.put(message.getSourceData(), message);
}
diff --git a/java/com/android/voicemail/impl/sync/SyncOneTask.java b/java/com/android/voicemail/impl/sync/SyncOneTask.java
index 95f4ceb..7452e14 100644
--- a/java/com/android/voicemail/impl/sync/SyncOneTask.java
+++ b/java/com/android/voicemail/impl/sync/SyncOneTask.java
@@ -21,6 +21,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.telecom.PhoneAccountHandle;
+
import com.android.dialer.proguard.UsedByReflection;
import com.android.voicemail.impl.Voicemail;
import com.android.voicemail.impl.VoicemailStatus;
diff --git a/java/com/android/voicemail/impl/sync/SyncTask.java b/java/com/android/voicemail/impl/sync/SyncTask.java
index b04c434..501feba 100644
--- a/java/com/android/voicemail/impl/sync/SyncTask.java
+++ b/java/com/android/voicemail/impl/sync/SyncTask.java
@@ -21,6 +21,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.telecom.PhoneAccountHandle;
+
import com.android.dialer.proguard.UsedByReflection;
import com.android.voicemail.impl.scheduling.BaseTask;
import com.android.voicemail.impl.scheduling.MinimalIntervalPolicy;
diff --git a/java/com/android/voicemail/impl/sync/UploadTask.java b/java/com/android/voicemail/impl/sync/UploadTask.java
index d8f06db..03f0b22 100644
--- a/java/com/android/voicemail/impl/sync/UploadTask.java
+++ b/java/com/android/voicemail/impl/sync/UploadTask.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.telecom.PhoneAccountHandle;
+
import com.android.dialer.proguard.UsedByReflection;
import com.android.voicemail.impl.VoicemailStatus;
import com.android.voicemail.impl.VvmLog;
diff --git a/java/com/android/voicemail/impl/sync/VoicemailProviderChangeReceiver.java b/java/com/android/voicemail/impl/sync/VoicemailProviderChangeReceiver.java
index 7fde1fe..4bf7ea8 100644
--- a/java/com/android/voicemail/impl/sync/VoicemailProviderChangeReceiver.java
+++ b/java/com/android/voicemail/impl/sync/VoicemailProviderChangeReceiver.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
import android.content.Intent;
import android.provider.VoicemailContract;
import android.telecom.PhoneAccountHandle;
+
import com.android.voicemail.VoicemailComponent;
import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil;
diff --git a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java
index 43ba5af..5cb0363 100644
--- a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java
+++ b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java
@@ -30,6 +30,7 @@
import com.android.dialer.common.Assert;
import com.android.voicemail.impl.Voicemail;
+
import java.util.ArrayList;
import java.util.List;
@@ -96,7 +97,7 @@
return null;
}
try {
- List<Voicemail> voicemails = new ArrayList<Voicemail>();
+ List<Voicemail> voicemails = new ArrayList<>();
while (cursor.moveToNext()) {
final long id = cursor.getLong(_ID);
final String sourceData = cursor.getString(SOURCE_DATA);
@@ -135,7 +136,7 @@
sb.append(voicemails.get(i).getId());
}
- String selectionStatement = String.format(Voicemails._ID + " IN (%s)", sb.toString());
+ String selectionStatement = String.format(Voicemails._ID + " IN (%s)", sb);
return contentResolver.delete(Voicemails.CONTENT_URI, selectionStatement, null);
}
@@ -210,7 +211,7 @@
String phoneAccountComponentName = phoneAccount.getComponentName().flattenToString();
String phoneAccountId = phoneAccount.getId();
String sourceData = voicemail.getSourceData();
- if (phoneAccountComponentName == null || phoneAccountId == null || sourceData == null) {
+ if (phoneAccountId == null || sourceData == null) {
return true;
}
try {
@@ -223,11 +224,7 @@
+ "=?";
String[] whereArgs = {phoneAccountComponentName, phoneAccountId, sourceData};
cursor = contentResolver.query(sourceUri, PROJECTION, whereClause, whereArgs, null);
- if (cursor.getCount() == 0) {
- return true;
- } else {
- return false;
- }
+ return cursor.getCount() == 0;
} finally {
if (cursor != null) {
cursor.close();
diff --git a/java/com/android/voicemail/impl/sync/VvmAccountManager.java b/java/com/android/voicemail/impl/sync/VvmAccountManager.java
index 351a280..90abda7 100644
--- a/java/com/android/voicemail/impl/sync/VvmAccountManager.java
+++ b/java/com/android/voicemail/impl/sync/VvmAccountManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +16,7 @@
*/
package com.android.voicemail.impl.sync;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.os.UserManager;
import android.telecom.PhoneAccountHandle;
@@ -33,6 +35,7 @@
import com.android.voicemail.impl.VisualVoicemailPreferences;
import com.android.voicemail.impl.VoicemailStatus;
import com.android.voicemail.impl.sms.StatusMessage;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -93,6 +96,7 @@
return preferences.getBoolean(IS_ACCOUNT_ACTIVATED, false);
}
+ @SuppressLint("MissingPermission")
@NonNull
public static List<PhoneAccountHandle> getActiveAccounts(Context context) {
List<PhoneAccountHandle> results = new ArrayList<>();
diff --git a/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java b/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java
index 0d72426..a342efa 100644
--- a/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java
+++ b/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@
import com.android.voicemail.impl.OmtpVvmCarrierConfigHelper;
import com.android.voicemail.impl.VoicemailStatus;
import com.android.voicemail.impl.VvmLog;
+
import java.io.Closeable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
diff --git a/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java b/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java
index b57da66..d19dae7 100644
--- a/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java
+++ b/java/com/android/voicemail/impl/sync/VvmNetworkRequestCallback.java
@@ -152,7 +152,7 @@
}
public void requestNetwork() {
- if (requestSent == true) {
+ if (requestSent) {
VvmLog.e(TAG, "requestNetwork() called twice");
return;
}
diff --git a/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java b/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java
index ab00c6b..cad7bd0 100644
--- a/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java
+++ b/java/com/android/voicemail/impl/utils/IndentingPrintWriter.java
@@ -69,7 +69,7 @@
}
public void printPair(String key, Object value) {
- print(key + "=" + String.valueOf(value) + " ");
+ print(key + "=" + value + " ");
}
public void printPair(String key, Object[] value) {
diff --git a/java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java b/java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java
index 711d6a8..2cce2b9 100644
--- a/java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java
+++ b/java/com/android/voicemail/impl/utils/VoicemailDatabaseUtil.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +23,9 @@
import android.net.Uri;
import android.provider.VoicemailContract.Voicemails;
import android.telecom.PhoneAccountHandle;
+
import com.android.voicemail.impl.Voicemail;
+
import java.util.List;
public class VoicemailDatabaseUtil {
diff --git a/java/com/android/voicemail/impl/utils/VvmDumpHandler.java b/java/com/android/voicemail/impl/utils/VvmDumpHandler.java
deleted file mode 100644
index 5290f2c..0000000
--- a/java/com/android/voicemail/impl/utils/VvmDumpHandler.java
+++ /dev/null
@@ -1,43 +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.voicemail.impl.utils;
-
-import android.content.Context;
-import android.telecom.PhoneAccountHandle;
-import android.telecom.TelecomManager;
-import com.android.voicemail.impl.OmtpVvmCarrierConfigHelper;
-import com.android.voicemail.impl.VvmLog;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
-public class VvmDumpHandler {
-
- public static void dump(Context context, FileDescriptor fd, PrintWriter writer, String[] args) {
- IndentingPrintWriter indentedWriter = new IndentingPrintWriter(writer, " ");
- indentedWriter.println("******* OmtpVvm *******");
- indentedWriter.println("======= Configs =======");
- indentedWriter.increaseIndent();
- for (PhoneAccountHandle handle :
- context.getSystemService(TelecomManager.class).getCallCapablePhoneAccounts()) {
- OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(context, handle);
- indentedWriter.println(config.toString());
- }
- indentedWriter.decreaseIndent();
- indentedWriter.println("======== Logs =========");
- VvmLog.dump(fd, indentedWriter, args);
- }
-}
diff --git a/java/com/android/voicemail/impl/utils/XmlUtils.java b/java/com/android/voicemail/impl/utils/XmlUtils.java
index 4abb34c..d10c444 100644
--- a/java/com/android/voicemail/impl/utils/XmlUtils.java
+++ b/java/com/android/voicemail/impl/utils/XmlUtils.java
@@ -18,11 +18,13 @@
package com.android.voicemail.impl.utils;
import android.util.ArrayMap;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
public class XmlUtils {
@@ -199,7 +201,7 @@
}
private static Object readThisPrimitiveValueXml(XmlPullParser parser, String tagName)
- throws XmlPullParserException, java.io.IOException {
+ throws XmlPullParserException {
try {
if (tagName.equals("int")) {
return Integer.parseInt(parser.getAttributeValue(null, "value"));
diff --git a/java/com/android/voicemail/stub/StubVoicemailClient.java b/java/com/android/voicemail/stub/StubVoicemailClient.java
index 76661c5..d1bb277 100644
--- a/java/com/android/voicemail/stub/StubVoicemailClient.java
+++ b/java/com/android/voicemail/stub/StubVoicemailClient.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +27,9 @@
import com.android.dialer.common.Assert;
import com.android.voicemail.PinChanger;
import com.android.voicemail.VoicemailClient;
+
import java.util.List;
+
import javax.inject.Inject;
/**
diff --git a/java/com/android/voicemail/stub/StubVoicemailModule.java b/java/com/android/voicemail/stub/StubVoicemailModule.java
index 6c1552c..6f60d7a 100644
--- a/java/com/android/voicemail/stub/StubVoicemailModule.java
+++ b/java/com/android/voicemail/stub/StubVoicemailModule.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +18,11 @@
package com.android.voicemail.stub;
import com.android.voicemail.VoicemailClient;
+
+import javax.inject.Singleton;
+
import dagger.Binds;
import dagger.Module;
-import javax.inject.Singleton;
/**
* A no-op version of the voicemail module for build targets that don't support the new OTMP client.