Dialer: Replace com.google.common.base.Optional with java type

* Recommended by AS
* Remove the Guava warning where applicable
* Also reduce the size of the LatinSmartDialMap by collapsing the
  various cases using a variation of the python script
* We also get two characters more out of it: 'Ƞ' and 'ȡ' - these look
  valid so keep them

Change-Id: I4de142a6eeb99320b3859adbd868a9db51319693
diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
index 2bb5f6a..4a465a2 100644
--- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
+++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
@@ -52,7 +52,8 @@
 import com.android.dialer.phonenumberutil.PhoneNumberHelper;
 import com.android.dialer.protos.ProtoParsers;
 import com.android.dialer.telecom.TelecomUtil;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /**
  * Dialog that allows the user to select a phone accounts for a given action. Optionally provides
diff --git a/java/com/android/dialer/activecalls/ActiveCallInfo.java b/java/com/android/dialer/activecalls/ActiveCallInfo.java
index ccf3501..7c93ceb 100644
--- a/java/com/android/dialer/activecalls/ActiveCallInfo.java
+++ b/java/com/android/dialer/activecalls/ActiveCallInfo.java
@@ -21,11 +21,11 @@
 import androidx.annotation.Nullable;
 
 import com.google.auto.value.AutoValue;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** Info of an active call */
 @AutoValue
-@SuppressWarnings("Guava")
 public abstract class ActiveCallInfo {
 
   /** The {@link PhoneAccountHandle} the call is made with */
@@ -40,7 +40,7 @@
   public abstract static class Builder {
 
     public Builder setPhoneAccountHandle(@Nullable PhoneAccountHandle phoneAccountHandle) {
-      return setPhoneAccountHandle(Optional.fromNullable(phoneAccountHandle));
+      return setPhoneAccountHandle(Optional.ofNullable(phoneAccountHandle));
     }
 
     public abstract Builder setPhoneAccountHandle(Optional<PhoneAccountHandle> phoneAccountHandle);
diff --git a/java/com/android/dialer/calllogutils/CallLogEntryText.java b/java/com/android/dialer/calllogutils/CallLogEntryText.java
index 15d6538..54ce680 100644
--- a/java/com/android/dialer/calllogutils/CallLogEntryText.java
+++ b/java/com/android/dialer/calllogutils/CallLogEntryText.java
@@ -25,11 +25,11 @@
 import com.android.dialer.R;
 import com.android.dialer.calllog.model.CoalescedRow;
 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.List;
+import java.util.Optional;
 
 /**
  * Computes the primary text and secondary text for call log entries.
diff --git a/java/com/android/dialer/calllogutils/PhoneNumberDisplayUtil.java b/java/com/android/dialer/calllogutils/PhoneNumberDisplayUtil.java
index 934945c..54c6987 100644
--- a/java/com/android/dialer/calllogutils/PhoneNumberDisplayUtil.java
+++ b/java/com/android/dialer/calllogutils/PhoneNumberDisplayUtil.java
@@ -25,7 +25,8 @@
 import android.text.TextUtils;
 
 import com.android.dialer.phonenumberutil.PhoneNumberHelper;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** Helper for formatting and managing the display of phone numbers. */
 public class PhoneNumberDisplayUtil {
@@ -57,7 +58,7 @@
     if (presentation == Calls.PRESENTATION_PAYPHONE) {
       return Optional.of(appContext.getResources().getString(R.string.payphone));
     }
-    return Optional.absent();
+    return Optional.empty();
   }
 
   /**
diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java
index 1462368..2470ec0 100644
--- a/java/com/android/dialer/main/impl/MainSearchController.java
+++ b/java/com/android/dialer/main/impl/MainSearchController.java
@@ -55,10 +55,10 @@
 import com.android.dialer.util.DialerUtils;
 import com.android.dialer.util.TransactionSafeActivity;
 import com.google.android.material.floatingactionbutton.FloatingActionButton;
-import com.google.common.base.Optional;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * Search controller for handling all the logic related to entering and exiting the search UI.
@@ -159,7 +159,7 @@
 
     fab.hide();
     toolbar.slideUp(animate, fragmentContainer);
-    toolbar.expand(animate, Optional.absent(), /* requestFocus */ false);
+    toolbar.expand(animate, Optional.empty(), /* requestFocus */ false);
 
     activity.setTitle(R.string.dialpad_activity_title);
 
@@ -389,7 +389,7 @@
   @Override
   public void onSearchBarClicked() {
     LogUtil.enterBlock("MainSearchController.onSearchBarClicked");
-    openSearch(Optional.absent());
+    openSearch(Optional.empty());
   }
 
   private void openSearch(Optional<String> query) {
@@ -411,8 +411,7 @@
       transaction.show(searchFragment);
     }
 
-    searchFragment.setQuery(
-        query.isPresent() ? query.get() : "", CallInitiationType.Type.REGULAR_SEARCH);
+    searchFragment.setQuery(query.orElse(""), CallInitiationType.Type.REGULAR_SEARCH);
 
     if (activity.isSafeToCommitTransactions()) {
       transaction.commit();
@@ -540,7 +539,7 @@
     if (savedInstanceState.getBoolean(KEY_IS_TOOLBAR_EXPANDED, false)) {
       // If the toolbar is slide up, that means the dialpad is showing. Thus we don't want to
       // request focus or we'll break physical/bluetooth keyboards typing.
-      toolbar.expand(/* animate */ false, Optional.absent(), /* requestFocus */ !isSlideUp);
+      toolbar.expand(/* animate */ false, Optional.empty(), /* requestFocus */ !isSlideUp);
     }
   }
 
diff --git a/java/com/android/dialer/main/impl/toolbar/MainToolbar.java b/java/com/android/dialer/main/impl/toolbar/MainToolbar.java
index 01e6015..4082d7e 100644
--- a/java/com/android/dialer/main/impl/toolbar/MainToolbar.java
+++ b/java/com/android/dialer/main/impl/toolbar/MainToolbar.java
@@ -34,7 +34,8 @@
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.util.ViewUtil;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** Toolbar for {@link com.android.dialer.main.impl.MainActivity}. */
 public final class MainToolbar extends Toolbar implements PopupMenu.OnMenuItemClickListener {
diff --git a/java/com/android/dialer/main/impl/toolbar/SearchBarView.java b/java/com/android/dialer/main/impl/toolbar/SearchBarView.java
index 3662ec8..245eeda 100644
--- a/java/com/android/dialer/main/impl/toolbar/SearchBarView.java
+++ b/java/com/android/dialer/main/impl/toolbar/SearchBarView.java
@@ -38,7 +38,8 @@
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.UiUtil;
 import com.android.dialer.util.DialerUtils;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** Search bar for {@link MainToolbar}. Mostly used to handle expand and collapse animation. */
 final class SearchBarView extends FrameLayout {
@@ -137,9 +138,7 @@
           @Override
           public void onAnimationEnd(Animator animation) {
             super.onAnimationEnd(animation);
-            if (text.isPresent()) {
-              searchBox.setText(text.get());
-            }
+            text.ifPresent(s -> searchBox.setText(s));
             // Don't request focus unless we're actually showing the search box, otherwise
             // physical/bluetooth keyboards will type into this box when the dialpad is open.
             if (requestFocus) {
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index 671c6c6..4ad1163 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -154,9 +154,9 @@
               coordinator,
               pendingAction,
               result.getDialogOptionsBuilder().get().build(),
-              result.getDataId().orNull(),
+              result.getDataId().orElse(null),
               phoneNumber,
-              result.getSuggestion().orNull());
+              result.getSuggestion().orElse(null));
         },
         (throwable) -> {
           throw new RuntimeException(throwable);
diff --git a/java/com/android/dialer/precall/impl/MalformedNumberRectifier.java b/java/com/android/dialer/precall/impl/MalformedNumberRectifier.java
index 3658158..e76df75 100644
--- a/java/com/android/dialer/precall/impl/MalformedNumberRectifier.java
+++ b/java/com/android/dialer/precall/impl/MalformedNumberRectifier.java
@@ -25,9 +25,10 @@
 import com.android.dialer.callintent.CallIntentBuilder;
 import com.android.dialer.precall.PreCallAction;
 import com.android.dialer.precall.PreCallCoordinator;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 
+import java.util.Optional;
+
 /**
  * Fix common malformed number before it is dialed. Rewrite the number to the first handler that can
  * handle it
diff --git a/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java b/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java
index 0412b1f..d53d7d3 100644
--- a/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java
+++ b/java/com/android/dialer/precall/impl/UkRegionPrefixInInternationalFormatHandler.java
@@ -22,7 +22,8 @@
 
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.precall.impl.MalformedNumberRectifier.MalformedNumberHandler;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /**
  * It is customary in UK to present numbers as "+44 (0) xx xxxx xxxx". This is actually a amalgam of
@@ -39,7 +40,7 @@
   @Override
   public Optional<String> handle(Context context, String number) {
     if (!PhoneNumberUtils.normalizeNumber(number).startsWith(MALFORMED_PREFIX)) {
-      return Optional.absent();
+      return Optional.empty();
     }
     LogUtil.i("UkRegionPrefixInInternationalFormatHandler.handle", "removing (0) in UK numbers");
 
diff --git a/java/com/android/dialer/preferredsim/PreferredAccountUtil.java b/java/com/android/dialer/preferredsim/PreferredAccountUtil.java
index 7fc1547..1a5ce98 100644
--- a/java/com/android/dialer/preferredsim/PreferredAccountUtil.java
+++ b/java/com/android/dialer/preferredsim/PreferredAccountUtil.java
@@ -26,9 +26,10 @@
 import androidx.annotation.Nullable;
 
 import com.android.dialer.common.LogUtil;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 
+import java.util.Optional;
+
 /**
  * Utilities for looking up and validating preferred {@link PhoneAccountHandle}. Contacts should
  * follow the same logic.
@@ -46,19 +47,19 @@
                                                                   @Nullable String idString) {
     if (TextUtils.isEmpty(componentNameString) || TextUtils.isEmpty(idString)) {
       LogUtil.i("PreferredAccountUtil.getValidPhoneAccount", "empty componentName or id");
-      return Optional.absent();
+      return Optional.empty();
     }
     ComponentName componentName = ComponentName.unflattenFromString(componentNameString);
     if (componentName == null) {
       LogUtil.e("PreferredAccountUtil.getValidPhoneAccount", "cannot parse component name");
-      return Optional.absent();
+      return Optional.empty();
     }
     PhoneAccountHandle phoneAccountHandle = new PhoneAccountHandle(componentName, idString);
 
     if (isPhoneAccountValid(context, phoneAccountHandle)) {
       return Optional.of(phoneAccountHandle);
     }
-    return Optional.absent();
+    return Optional.empty();
   }
 
   public static boolean isPhoneAccountValid(
diff --git a/java/com/android/dialer/preferredsim/PreferredAccountWorker.java b/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
index e7bed83..0e66291 100644
--- a/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
+++ b/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
@@ -22,13 +22,13 @@
 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;
+import java.util.Optional;
 
 /** Query a preferred SIM to make a call with. */
-@SuppressWarnings({"missingPermission", "Guava"})
+@SuppressWarnings("missingPermission")
 public interface PreferredAccountWorker {
 
   /** Result of the query. */
diff --git a/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java b/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java
index cc649b3..019ced4 100644
--- a/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java
+++ b/java/com/android/dialer/preferredsim/impl/PreferredAccountWorkerImpl.java
@@ -57,7 +57,6 @@
 import com.android.dialer.preferredsim.suggestion.SuggestionProvider;
 import com.android.dialer.preferredsim.suggestion.SuggestionProvider.Suggestion;
 import com.android.dialer.util.PermissionsUtil;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -65,11 +64,12 @@
 
 import java.util.List;
 import java.util.Objects;
+import java.util.Optional;
 
 import javax.inject.Inject;
 
 /** Implements {@link PreferredAccountWorker}. */
-@SuppressWarnings({"missingPermission", "Guava"})
+@SuppressWarnings("missingPermission")
 public class PreferredAccountWorkerImpl implements PreferredAccountWorker {
 
   private final Context appContext;
@@ -116,7 +116,7 @@
             .getSystemService(TelecomManager.class)
             .getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
     if (defaultPhoneAccount != null) {
-      return useDefaultSim(defaultPhoneAccount, candidates, dataId.orNull());
+      return useDefaultSim(defaultPhoneAccount, candidates, dataId.orElse(null));
     }
 
     Optional<Suggestion> suggestion =
@@ -124,18 +124,14 @@
             .getSuggestionProvider()
             .getSuggestion(appContext, phoneNumber);
     if (suggestion.isPresent() && suggestion.get().shouldAutoSelect) {
-      return useSuggestedSim(suggestion.get(), candidates, dataId.orNull());
+      return useSuggestedSim(suggestion.get(), candidates, dataId.orElse(null));
     }
 
     Builder resultBuilder =
         Result.builder(
-            createDialogOptionsBuilder(candidates, dataId.orNull(), suggestion.orNull()));
-    if (suggestion.isPresent()) {
-      resultBuilder.setSuggestion(suggestion.get());
-    }
-    if (dataId.isPresent()) {
-      resultBuilder.setDataId(dataId.get());
-    }
+            createDialogOptionsBuilder(candidates, dataId.orElse(null), suggestion.orElse(null)));
+    suggestion.ifPresent(resultBuilder::setSuggestion);
+    dataId.ifPresent(resultBuilder::setDataId);
     return resultBuilder.build();
   }
 
@@ -221,15 +217,15 @@
     Assert.isWorkerThread();
 
     if (!isPreferredSimEnabled(appContext)) {
-      return Optional.absent();
+      return Optional.empty();
     }
     if (!PermissionsUtil.hasContactsReadPermissions(appContext)) {
       LogUtil.i("PreferredAccountWorker.doInBackground", "missing READ_CONTACTS permission");
-      return Optional.absent();
+      return Optional.empty();
     }
 
     if (TextUtils.isEmpty(phoneNumber)) {
-      return Optional.absent();
+      return Optional.empty();
     }
     try (Cursor cursor =
         appContext
@@ -241,7 +237,7 @@
                 null,
                 null)) {
       if (cursor == null) {
-        return Optional.absent();
+        return Optional.empty();
       }
       ImmutableSet<String> validAccountTypes = PreferredAccountUtil.getValidAccountTypes();
       String result = null;
@@ -257,11 +253,11 @@
           // TODO(twyen): if there are multiple entries attempt to grab from the contact that
           // initiated the call.
           LogUtil.i("CallingAccountSelector.getDataId", "lookup result not unique, ignoring");
-          return Optional.absent();
+          return Optional.empty();
         }
         result = cursor.getString(0);
       }
-      return Optional.fromNullable(result);
+      return Optional.ofNullable(result);
     }
   }
 
@@ -270,7 +266,7 @@
     Assert.isWorkerThread();
     Optional<Long> rawContactId = getRawContactId(contentResolver, dataId);
     if (!rawContactId.isPresent()) {
-      return Optional.absent();
+      return Optional.empty();
     }
     try (Cursor cursor =
         contentResolver.query(
@@ -280,9 +276,9 @@
             null,
             null)) {
       if (cursor == null || !cursor.moveToFirst()) {
-        return Optional.absent();
+        return Optional.empty();
       }
-      return Optional.fromNullable(cursor.getString(0));
+      return Optional.ofNullable(cursor.getString(0));
     }
   }
 
@@ -297,7 +293,7 @@
             null,
             null)) {
       if (cursor == null || !cursor.moveToFirst()) {
-        return Optional.absent();
+        return Optional.empty();
       }
       return Optional.of(cursor.getLong(0));
     }
@@ -322,10 +318,10 @@
                 new String[] {dataId},
                 null)) {
       if (cursor == null) {
-        return Optional.absent();
+        return Optional.empty();
       }
       if (!cursor.moveToFirst()) {
-        return Optional.absent();
+        return Optional.empty();
       }
       return PreferredAccountUtil.getValidPhoneAccount(
           context, cursor.getString(0), cursor.getString(1));
@@ -375,7 +371,7 @@
       return true;
     }
     for (ActiveCallInfo activeCall : activeCalls) {
-      if (Objects.equals(phoneAccountHandle, activeCall.phoneAccountHandle().orNull())) {
+      if (Objects.equals(phoneAccountHandle, activeCall.phoneAccountHandle().orElse(null))) {
         return true;
       }
     }
@@ -388,12 +384,12 @@
 
     if (activeCalls.isEmpty()) {
       LogUtil.e("CallingAccountSelector.getActiveCallLabel", "active calls no longer exist");
-      return Optional.absent();
+      return Optional.empty();
     }
     ActiveCallInfo activeCall = activeCalls.get(0);
     if (!activeCall.phoneAccountHandle().isPresent()) {
       LogUtil.e("CallingAccountSelector.getActiveCallLabel", "active call has no phone account");
-      return Optional.absent();
+      return Optional.empty();
     }
     PhoneAccount phoneAccount =
         appContext
@@ -401,7 +397,7 @@
             .getPhoneAccount(activeCall.phoneAccountHandle().get());
     if (phoneAccount == null) {
       LogUtil.e("CallingAccountSelector.getActiveCallLabel", "phone account not found");
-      return Optional.absent();
+      return Optional.empty();
     }
     return Optional.of(phoneAccount.getLabel().toString());
   }
diff --git a/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java b/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java
index 20b072b..ffd19c3 100644
--- a/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java
+++ b/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.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,10 +27,10 @@
 import com.android.dialer.R;
 import com.android.dialer.common.Assert;
 import com.android.dialer.common.LogUtil;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** Provides hints to the user when selecting a SIM to make a call. */
-@SuppressWarnings("Guava")
 public interface SuggestionProvider {
 
   String EXTRA_SIM_SUGGESTION_REASON = "sim_suggestion_reason";
@@ -85,13 +86,13 @@
   /**
    * Return the hint for {@code phoneAccountHandle}. Absent if no hint is available for the account.
    */
-  static Optional<String> getHint(
-      Context context, PhoneAccountHandle phoneAccountHandle, @Nullable Suggestion suggestion) {
+  static Optional<String> getHint(Context context, PhoneAccountHandle phoneAccountHandle,
+                                  @Nullable Suggestion suggestion) {
     if (suggestion == null) {
-      return Optional.absent();
+      return Optional.empty();
     }
     if (!phoneAccountHandle.equals(suggestion.phoneAccountHandle)) {
-      return Optional.absent();
+      return Optional.empty();
     }
     switch (suggestion.reason) {
       case INTRA_CARRIER:
@@ -101,7 +102,7 @@
         return Optional.of(context.getString(R.string.pre_call_select_phone_account_hint_frequent));
       default:
         LogUtil.w("CallingAccountSelector.getHint", "unhandled reason " + suggestion.reason);
-        return Optional.absent();
+        return Optional.empty();
     }
   }
 }
diff --git a/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java b/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
index efb75cd..86e45d1 100644
--- a/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
+++ b/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
@@ -24,7 +24,8 @@
 import androidx.annotation.WorkerThread;
 
 import com.android.dialer.preferredsim.suggestion.SuggestionProvider;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 import javax.inject.Inject;
 
@@ -37,7 +38,7 @@
   @WorkerThread
   @Override
   public Optional<Suggestion> getSuggestion(Context context, String number) {
-    return Optional.absent();
+    return Optional.empty();
   }
 
   @Override
diff --git a/java/com/android/dialer/simulator/service/SimulatorService.java b/java/com/android/dialer/simulator/service/SimulatorService.java
index 51936fb..ee4b8c6 100644
--- a/java/com/android/dialer/simulator/service/SimulatorService.java
+++ b/java/com/android/dialer/simulator/service/SimulatorService.java
@@ -34,11 +34,11 @@
 import androidx.annotation.Nullable;
 
 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;
+import java.util.Optional;
 
 /**
  * A secured android service that gives clients simulator api access through binder if clients do
@@ -167,7 +167,7 @@
         return Optional.of(processInfo.processName);
       }
     }
-    return Optional.absent();
+    return Optional.empty();
   }
 
   private static boolean isCertificateValid(
diff --git a/java/com/android/dialer/smartdial/map/BulgarianSmartDialMap.java b/java/com/android/dialer/smartdial/map/BulgarianSmartDialMap.java
index d34d325..a8cf00b 100644
--- a/java/com/android/dialer/smartdial/map/BulgarianSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/BulgarianSmartDialMap.java
@@ -20,10 +20,10 @@
 import androidx.collection.SimpleArrayMap;
 
 import com.android.dialer.dialpadview.DialpadCharMappings;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** A {@link SmartDialMap} for the Bulgarian alphabet. */
-@SuppressWarnings("Guava")
 final class BulgarianSmartDialMap extends SmartDialMap {
 
   private static BulgarianSmartDialMap instance;
@@ -41,7 +41,7 @@
   @Override
   Optional<Character> normalizeCharacter(char ch) {
     ch = Character.toLowerCase(ch);
-    return isValidDialpadAlphabeticChar(ch) ? Optional.of(ch) : Optional.absent();
+    return isValidDialpadAlphabeticChar(ch) ? Optional.of(ch) : Optional.empty();
   }
 
   @Override
diff --git a/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java b/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java
index b47ea88..5f36cc7 100644
--- a/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/CompositeSmartDialMap.java
@@ -22,7 +22,8 @@
 import androidx.collection.SimpleArrayMap;
 
 import com.android.dialer.i18n.LocaleUtils;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /**
  * A utility class that combines the functionality of two implementations of {@link SmartDialMap} so
@@ -34,7 +35,6 @@
  * <p>Note that the second implementation can be absent if it is not defined for the system's 1st
  * language preference.
  */
-@SuppressWarnings("Guava")
 public class CompositeSmartDialMap {
 
   private static final SmartDialMap DEFAULT_MAP = LatinSmartDialMap.getInstance();
@@ -161,6 +161,6 @@
     String languageCode = LocaleUtils.getLocale(context).getISO3Language();
     return EXTRA_MAPS.containsKey(languageCode)
         ? Optional.of(EXTRA_MAPS.get(languageCode))
-        : Optional.absent();
+        : Optional.empty();
   }
 }
diff --git a/java/com/android/dialer/smartdial/map/LatinSmartDialMap.java b/java/com/android/dialer/smartdial/map/LatinSmartDialMap.java
index aa60f4f..6aad001 100644
--- a/java/com/android/dialer/smartdial/map/LatinSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/LatinSmartDialMap.java
@@ -20,10 +20,10 @@
 import androidx.collection.SimpleArrayMap;
 
 import com.android.dialer.dialpadview.DialpadCharMappings;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** A {@link SmartDialMap} for the Latin alphabet, which is for T9 dialpad searching. */
-@SuppressWarnings("Guava")
 final class LatinSmartDialMap extends SmartDialMap {
 
   private static LatinSmartDialMap instance;
@@ -63,683 +63,372 @@
 
     switch (ch) {
       case 'À':
-        return Optional.of('a');
       case 'Á':
-        return Optional.of('a');
       case 'Â':
-        return Optional.of('a');
       case 'Ã':
-        return Optional.of('a');
       case 'Ä':
-        return Optional.of('a');
       case 'Å':
-        return Optional.of('a');
-      case 'Ç':
-        return Optional.of('c');
-      case 'È':
-        return Optional.of('e');
-      case 'É':
-        return Optional.of('e');
-      case 'Ê':
-        return Optional.of('e');
-      case 'Ë':
-        return Optional.of('e');
-      case 'Ì':
-        return Optional.of('i');
-      case 'Í':
-        return Optional.of('i');
-      case 'Î':
-        return Optional.of('i');
-      case 'Ï':
-        return Optional.of('i');
-      case 'Ð':
-        return Optional.of('d');
-      case 'Ñ':
-        return Optional.of('n');
-      case 'Ò':
-        return Optional.of('o');
-      case 'Ó':
-        return Optional.of('o');
-      case 'Ô':
-        return Optional.of('o');
-      case 'Õ':
-        return Optional.of('o');
-      case 'Ö':
-        return Optional.of('o');
-      case '×':
-        return Optional.of('x');
-      case 'Ø':
-        return Optional.of('o');
-      case 'Ù':
-        return Optional.of('u');
-      case 'Ú':
-        return Optional.of('u');
-      case 'Û':
-        return Optional.of('u');
-      case 'Ü':
-        return Optional.of('u');
-      case 'Ý':
-        return Optional.of('u');
       case 'à':
-        return Optional.of('a');
       case 'á':
-        return Optional.of('a');
       case 'â':
-        return Optional.of('a');
       case 'ã':
-        return Optional.of('a');
       case 'ä':
-        return Optional.of('a');
       case 'å':
-        return Optional.of('a');
-      case 'ç':
-        return Optional.of('c');
-      case 'è':
-        return Optional.of('e');
-      case 'é':
-        return Optional.of('e');
-      case 'ê':
-        return Optional.of('e');
-      case 'ë':
-        return Optional.of('e');
-      case 'ì':
-        return Optional.of('i');
-      case 'í':
-        return Optional.of('i');
-      case 'î':
-        return Optional.of('i');
-      case 'ï':
-        return Optional.of('i');
-      case 'ð':
-        return Optional.of('d');
-      case 'ñ':
-        return Optional.of('n');
-      case 'ò':
-        return Optional.of('o');
-      case 'ó':
-        return Optional.of('o');
-      case 'ô':
-        return Optional.of('o');
-      case 'õ':
-        return Optional.of('o');
-      case 'ö':
-        return Optional.of('o');
-      case 'ø':
-        return Optional.of('o');
-      case 'ù':
-        return Optional.of('u');
-      case 'ú':
-        return Optional.of('u');
-      case 'û':
-        return Optional.of('u');
-      case 'ü':
-        return Optional.of('u');
-      case 'ý':
-        return Optional.of('y');
-      case 'ÿ':
-        return Optional.of('y');
       case 'Ā':
-        return Optional.of('a');
       case 'ā':
-        return Optional.of('a');
       case 'Ă':
-        return Optional.of('a');
       case 'ă':
-        return Optional.of('a');
       case 'Ą':
-        return Optional.of('a');
       case 'ą':
-        return Optional.of('a');
-      case 'Ć':
-        return Optional.of('c');
-      case 'ć':
-        return Optional.of('c');
-      case 'Ĉ':
-        return Optional.of('c');
-      case 'ĉ':
-        return Optional.of('c');
-      case 'Ċ':
-        return Optional.of('c');
-      case 'ċ':
-        return Optional.of('c');
-      case 'Č':
-        return Optional.of('c');
-      case 'č':
-        return Optional.of('c');
-      case 'Ď':
-        return Optional.of('d');
-      case 'ď':
-        return Optional.of('d');
-      case 'Đ':
-        return Optional.of('d');
-      case 'đ':
-        return Optional.of('d');
-      case 'Ē':
-        return Optional.of('e');
-      case 'ē':
-        return Optional.of('e');
-      case 'Ĕ':
-        return Optional.of('e');
-      case 'ĕ':
-        return Optional.of('e');
-      case 'Ė':
-        return Optional.of('e');
-      case 'ė':
-        return Optional.of('e');
-      case 'Ę':
-        return Optional.of('e');
-      case 'ę':
-        return Optional.of('e');
-      case 'Ě':
-        return Optional.of('e');
-      case 'ě':
-        return Optional.of('e');
-      case 'Ĝ':
-        return Optional.of('g');
-      case 'ĝ':
-        return Optional.of('g');
-      case 'Ğ':
-        return Optional.of('g');
-      case 'ğ':
-        return Optional.of('g');
-      case 'Ġ':
-        return Optional.of('g');
-      case 'ġ':
-        return Optional.of('g');
-      case 'Ģ':
-        return Optional.of('g');
-      case 'ģ':
-        return Optional.of('g');
-      case 'Ĥ':
-        return Optional.of('h');
-      case 'ĥ':
-        return Optional.of('h');
-      case 'Ħ':
-        return Optional.of('h');
-      case 'ħ':
-        return Optional.of('h');
-      case 'Ĩ':
-        return Optional.of('i');
-      case 'ĩ':
-        return Optional.of('i');
-      case 'Ī':
-        return Optional.of('i');
-      case 'ī':
-        return Optional.of('i');
-      case 'Ĭ':
-        return Optional.of('i');
-      case 'ĭ':
-        return Optional.of('i');
-      case 'Į':
-        return Optional.of('i');
-      case 'į':
-        return Optional.of('i');
-      case 'İ':
-        return Optional.of('i');
-      case 'ı':
-        return Optional.of('i');
-      case 'Ĵ':
-        return Optional.of('j');
-      case 'ĵ':
-        return Optional.of('j');
-      case 'Ķ':
-        return Optional.of('k');
-      case 'ķ':
-        return Optional.of('k');
-      case 'ĸ':
-        return Optional.of('k');
-      case 'Ĺ':
-        return Optional.of('l');
-      case 'ĺ':
-        return Optional.of('l');
-      case 'Ļ':
-        return Optional.of('l');
-      case 'ļ':
-        return Optional.of('l');
-      case 'Ľ':
-        return Optional.of('l');
-      case 'ľ':
-        return Optional.of('l');
-      case 'Ŀ':
-        return Optional.of('l');
-      case 'ŀ':
-        return Optional.of('l');
-      case 'Ł':
-        return Optional.of('l');
-      case 'ł':
-        return Optional.of('l');
-      case 'Ń':
-        return Optional.of('n');
-      case 'ń':
-        return Optional.of('n');
-      case 'Ņ':
-        return Optional.of('n');
-      case 'ņ':
-        return Optional.of('n');
-      case 'Ň':
-        return Optional.of('n');
-      case 'ň':
-        return Optional.of('n');
-      case 'Ō':
-        return Optional.of('o');
-      case 'ō':
-        return Optional.of('o');
-      case 'Ŏ':
-        return Optional.of('o');
-      case 'ŏ':
-        return Optional.of('o');
-      case 'Ő':
-        return Optional.of('o');
-      case 'ő':
-        return Optional.of('o');
-      case 'Ŕ':
-        return Optional.of('r');
-      case 'ŕ':
-        return Optional.of('r');
-      case 'Ŗ':
-        return Optional.of('r');
-      case 'ŗ':
-        return Optional.of('r');
-      case 'Ř':
-        return Optional.of('r');
-      case 'ř':
-        return Optional.of('r');
-      case 'Ś':
-        return Optional.of('s');
-      case 'ś':
-        return Optional.of('s');
-      case 'Ŝ':
-        return Optional.of('s');
-      case 'ŝ':
-        return Optional.of('s');
-      case 'Ş':
-        return Optional.of('s');
-      case 'ş':
-        return Optional.of('s');
-      case 'Š':
-        return Optional.of('s');
-      case 'š':
-        return Optional.of('s');
-      case 'Ţ':
-        return Optional.of('t');
-      case 'ţ':
-        return Optional.of('t');
-      case 'Ť':
-        return Optional.of('t');
-      case 'ť':
-        return Optional.of('t');
-      case 'Ŧ':
-        return Optional.of('t');
-      case 'ŧ':
-        return Optional.of('t');
-      case 'Ũ':
-        return Optional.of('u');
-      case 'ũ':
-        return Optional.of('u');
-      case 'Ū':
-        return Optional.of('u');
-      case 'ū':
-        return Optional.of('u');
-      case 'Ŭ':
-        return Optional.of('u');
-      case 'ŭ':
-        return Optional.of('u');
-      case 'Ů':
-        return Optional.of('u');
-      case 'ů':
-        return Optional.of('u');
-      case 'Ű':
-        return Optional.of('u');
-      case 'ű':
-        return Optional.of('u');
-      case 'Ų':
-        return Optional.of('u');
-      case 'ų':
-        return Optional.of('u');
-      case 'Ŵ':
-        return Optional.of('w');
-      case 'ŵ':
-        return Optional.of('w');
-      case 'Ŷ':
-        return Optional.of('y');
-      case 'ŷ':
-        return Optional.of('y');
-      case 'Ÿ':
-        return Optional.of('y');
-      case 'Ź':
-        return Optional.of('z');
-      case 'ź':
-        return Optional.of('z');
-      case 'Ż':
-        return Optional.of('z');
-      case 'ż':
-        return Optional.of('z');
-      case 'Ž':
-        return Optional.of('z');
-      case 'ž':
-        return Optional.of('z');
-      case 'ſ':
-        return Optional.of('s');
-      case 'ƀ':
-        return Optional.of('b');
-      case 'Ɓ':
-        return Optional.of('b');
-      case 'Ƃ':
-        return Optional.of('b');
-      case 'ƃ':
-        return Optional.of('b');
-      case 'Ɔ':
-        return Optional.of('o');
-      case 'Ƈ':
-        return Optional.of('c');
-      case 'ƈ':
-        return Optional.of('c');
-      case 'Ɖ':
-        return Optional.of('d');
-      case 'Ɗ':
-        return Optional.of('d');
-      case 'Ƌ':
-        return Optional.of('d');
-      case 'ƌ':
-        return Optional.of('d');
-      case 'ƍ':
-        return Optional.of('d');
-      case 'Ɛ':
-        return Optional.of('e');
-      case 'Ƒ':
-        return Optional.of('f');
-      case 'ƒ':
-        return Optional.of('f');
-      case 'Ɠ':
-        return Optional.of('g');
-      case 'Ɣ':
-        return Optional.of('g');
-      case 'Ɩ':
-        return Optional.of('i');
-      case 'Ɨ':
-        return Optional.of('i');
-      case 'Ƙ':
-        return Optional.of('k');
-      case 'ƙ':
-        return Optional.of('k');
-      case 'ƚ':
-        return Optional.of('l');
-      case 'ƛ':
-        return Optional.of('l');
-      case 'Ɯ':
-        return Optional.of('w');
-      case 'Ɲ':
-        return Optional.of('n');
-      case 'ƞ':
-        return Optional.of('n');
-      case 'Ɵ':
-        return Optional.of('o');
-      case 'Ơ':
-        return Optional.of('o');
-      case 'ơ':
-        return Optional.of('o');
-      case 'Ƥ':
-        return Optional.of('p');
-      case 'ƥ':
-        return Optional.of('p');
-      case 'ƫ':
-        return Optional.of('t');
-      case 'Ƭ':
-        return Optional.of('t');
-      case 'ƭ':
-        return Optional.of('t');
-      case 'Ʈ':
-        return Optional.of('t');
-      case 'Ư':
-        return Optional.of('u');
-      case 'ư':
-        return Optional.of('u');
-      case 'Ʊ':
-        return Optional.of('y');
-      case 'Ʋ':
-        return Optional.of('v');
-      case 'Ƴ':
-        return Optional.of('y');
-      case 'ƴ':
-        return Optional.of('y');
-      case 'Ƶ':
-        return Optional.of('z');
-      case 'ƶ':
-        return Optional.of('z');
-      case 'ƿ':
-        return Optional.of('w');
       case 'Ǎ':
-        return Optional.of('a');
       case 'ǎ':
-        return Optional.of('a');
-      case 'Ǐ':
-        return Optional.of('i');
-      case 'ǐ':
-        return Optional.of('i');
-      case 'Ǒ':
-        return Optional.of('o');
-      case 'ǒ':
-        return Optional.of('o');
-      case 'Ǔ':
-        return Optional.of('u');
-      case 'ǔ':
-        return Optional.of('u');
-      case 'Ǖ':
-        return Optional.of('u');
-      case 'ǖ':
-        return Optional.of('u');
-      case 'Ǘ':
-        return Optional.of('u');
-      case 'ǘ':
-        return Optional.of('u');
-      case 'Ǚ':
-        return Optional.of('u');
-      case 'ǚ':
-        return Optional.of('u');
-      case 'Ǜ':
-        return Optional.of('u');
-      case 'ǜ':
-        return Optional.of('u');
       case 'Ǟ':
-        return Optional.of('a');
       case 'ǟ':
-        return Optional.of('a');
       case 'Ǡ':
-        return Optional.of('a');
       case 'ǡ':
-        return Optional.of('a');
-      case 'Ǥ':
-        return Optional.of('g');
-      case 'ǥ':
-        return Optional.of('g');
-      case 'Ǧ':
-        return Optional.of('g');
-      case 'ǧ':
-        return Optional.of('g');
-      case 'Ǩ':
-        return Optional.of('k');
-      case 'ǩ':
-        return Optional.of('k');
-      case 'Ǫ':
-        return Optional.of('o');
-      case 'ǫ':
-        return Optional.of('o');
-      case 'Ǭ':
-        return Optional.of('o');
-      case 'ǭ':
-        return Optional.of('o');
-      case 'ǰ':
-        return Optional.of('j');
-      case 'Dz':
-        return Optional.of('d');
-      case 'Ǵ':
-        return Optional.of('g');
-      case 'ǵ':
-        return Optional.of('g');
-      case 'Ƿ':
-        return Optional.of('w');
-      case 'Ǹ':
-        return Optional.of('n');
-      case 'ǹ':
-        return Optional.of('n');
       case 'Ǻ':
-        return Optional.of('a');
       case 'ǻ':
-        return Optional.of('a');
-      case 'Ǿ':
-        return Optional.of('o');
-      case 'ǿ':
-        return Optional.of('o');
       case 'Ȁ':
-        return Optional.of('a');
       case 'ȁ':
-        return Optional.of('a');
       case 'Ȃ':
-        return Optional.of('a');
       case 'ȃ':
-        return Optional.of('a');
-      case 'Ȅ':
-        return Optional.of('e');
-      case 'ȅ':
-        return Optional.of('e');
-      case 'Ȇ':
-        return Optional.of('e');
-      case 'ȇ':
-        return Optional.of('e');
-      case 'Ȉ':
-        return Optional.of('i');
-      case 'ȉ':
-        return Optional.of('i');
-      case 'Ȋ':
-        return Optional.of('i');
-      case 'ȋ':
-        return Optional.of('i');
-      case 'Ȍ':
-        return Optional.of('o');
-      case 'ȍ':
-        return Optional.of('o');
-      case 'Ȏ':
-        return Optional.of('o');
-      case 'ȏ':
-        return Optional.of('o');
-      case 'Ȑ':
-        return Optional.of('r');
-      case 'ȑ':
-        return Optional.of('r');
-      case 'Ȓ':
-        return Optional.of('r');
-      case 'ȓ':
-        return Optional.of('r');
-      case 'Ȕ':
-        return Optional.of('u');
-      case 'ȕ':
-        return Optional.of('u');
-      case 'Ȗ':
-        return Optional.of('u');
-      case 'ȗ':
-        return Optional.of('u');
-      case 'Ș':
-        return Optional.of('s');
-      case 'ș':
-        return Optional.of('s');
-      case 'Ț':
-        return Optional.of('t');
-      case 'ț':
-        return Optional.of('t');
-      case 'Ȝ':
-        return Optional.of('y');
-      case 'ȝ':
-        return Optional.of('y');
-      case 'Ȟ':
-        return Optional.of('h');
-      case 'ȟ':
-        return Optional.of('h');
-      case 'Ȥ':
-        return Optional.of('z');
-      case 'ȥ':
-        return Optional.of('z');
       case 'Ȧ':
-        return Optional.of('a');
       case 'ȧ':
-        return Optional.of('a');
-      case 'Ȩ':
-        return Optional.of('e');
-      case 'ȩ':
-        return Optional.of('e');
-      case 'Ȫ':
-        return Optional.of('o');
-      case 'ȫ':
-        return Optional.of('o');
-      case 'Ȭ':
-        return Optional.of('o');
-      case 'ȭ':
-        return Optional.of('o');
-      case 'Ȯ':
-        return Optional.of('o');
-      case 'ȯ':
-        return Optional.of('o');
-      case 'Ȱ':
-        return Optional.of('o');
-      case 'ȱ':
-        return Optional.of('o');
-      case 'Ȳ':
-        return Optional.of('y');
-      case 'ȳ':
-        return Optional.of('y');
       case 'A':
         return Optional.of('a');
+      case 'ƀ':
+      case 'Ɓ':
+      case 'Ƃ':
+      case 'ƃ':
       case 'B':
         return Optional.of('b');
+      case 'Ç':
+      case 'ç':
+      case 'Ć':
+      case 'ć':
+      case 'Ĉ':
+      case 'ĉ':
+      case 'Ċ':
+      case 'ċ':
+      case 'Č':
+      case 'č':
+      case 'Ƈ':
+      case 'ƈ':
       case 'C':
         return Optional.of('c');
+      case 'Ð':
+      case 'ð':
+      case 'Ď':
+      case 'ď':
+      case 'Đ':
+      case 'đ':
+      case 'Ɖ':
+      case 'Ɗ':
+      case 'Ƌ':
+      case 'ƌ':
+      case 'ƍ':
+      case 'ȡ':
       case 'D':
         return Optional.of('d');
+      case 'È':
+      case 'É':
+      case 'Ê':
+      case 'Ë':
+      case 'è':
+      case 'é':
+      case 'ê':
+      case 'ë':
+      case 'Ē':
+      case 'ē':
+      case 'Ĕ':
+      case 'ĕ':
+      case 'Ė':
+      case 'ė':
+      case 'Ę':
+      case 'ę':
+      case 'Ě':
+      case 'ě':
+      case 'Ɛ':
+      case 'Ȅ':
+      case 'ȅ':
+      case 'Ȇ':
+      case 'ȇ':
+      case 'Ȩ':
+      case 'ȩ':
       case 'E':
         return Optional.of('e');
+      case 'Ƒ':
+      case 'ƒ':
       case 'F':
         return Optional.of('f');
+      case 'Ĝ':
+      case 'ĝ':
+      case 'Ğ':
+      case 'ğ':
+      case 'Ġ':
+      case 'ġ':
+      case 'Ģ':
+      case 'ģ':
+      case 'Ɠ':
+      case 'Ɣ':
+      case 'Ǥ':
+      case 'ǥ':
+      case 'Ǧ':
+      case 'ǧ':
+      case 'Ǵ':
+      case 'ǵ':
       case 'G':
         return Optional.of('g');
+      case 'Ĥ':
+      case 'ĥ':
+      case 'Ħ':
+      case 'ħ':
+      case 'Ȟ':
+      case 'ȟ':
       case 'H':
         return Optional.of('h');
+      case 'Ì':
+      case 'Í':
+      case 'Î':
+      case 'Ï':
+      case 'ì':
+      case 'í':
+      case 'î':
+      case 'ï':
+      case 'Ĩ':
+      case 'ĩ':
+      case 'Ī':
+      case 'ī':
+      case 'Ĭ':
+      case 'ĭ':
+      case 'Į':
+      case 'į':
+      case 'İ':
+      case 'ı':
+      case 'Ɩ':
+      case 'Ɨ':
+      case 'Ǐ':
+      case 'ǐ':
+      case 'Ȉ':
+      case 'ȉ':
+      case 'Ȋ':
+      case 'ȋ':
       case 'I':
         return Optional.of('i');
+      case 'Ĵ':
+      case 'ĵ':
+      case 'ǰ':
       case 'J':
         return Optional.of('j');
+      case 'Ķ':
+      case 'ķ':
+      case 'ĸ':
+      case 'Ƙ':
+      case 'ƙ':
+      case 'Ǩ':
+      case 'ǩ':
       case 'K':
         return Optional.of('k');
+      case 'Ĺ':
+      case 'ĺ':
+      case 'Ļ':
+      case 'ļ':
+      case 'Ľ':
+      case 'ľ':
+      case 'Ŀ':
+      case 'ŀ':
+      case 'Ł':
+      case 'ł':
+      case 'ƚ':
+      case 'ƛ':
       case 'L':
         return Optional.of('l');
       case 'M':
         return Optional.of('m');
+      case 'Ñ':
+      case 'ñ':
+      case 'Ń':
+      case 'ń':
+      case 'Ņ':
+      case 'ņ':
+      case 'Ň':
+      case 'ň':
+      case 'Ɲ':
+      case 'ƞ':
+      case 'Ǹ':
+      case 'ǹ':
+      case 'Ƞ':
       case 'N':
         return Optional.of('n');
+      case 'Ò':
+      case 'Ó':
+      case 'Ô':
+      case 'Õ':
+      case 'Ö':
+      case 'Ø':
+      case 'ò':
+      case 'ó':
+      case 'ô':
+      case 'õ':
+      case 'ö':
+      case 'ø':
+      case 'Ō':
+      case 'ō':
+      case 'Ŏ':
+      case 'ŏ':
+      case 'Ő':
+      case 'ő':
+      case 'Ɔ':
+      case 'Ɵ':
+      case 'Ơ':
+      case 'ơ':
+      case 'Ǒ':
+      case 'ǒ':
+      case 'Ǫ':
+      case 'ǫ':
+      case 'Ǭ':
+      case 'ǭ':
+      case 'Ǿ':
+      case 'ǿ':
+      case 'Ȍ':
+      case 'ȍ':
+      case 'Ȏ':
+      case 'ȏ':
+      case 'Ȫ':
+      case 'ȫ':
+      case 'Ȭ':
+      case 'ȭ':
+      case 'Ȯ':
+      case 'ȯ':
+      case 'Ȱ':
+      case 'ȱ':
       case 'O':
         return Optional.of('o');
+      case 'Ƥ':
+      case 'ƥ':
       case 'P':
         return Optional.of('p');
       case 'Q':
         return Optional.of('q');
+      case 'Ŕ':
+      case 'ŕ':
+      case 'Ŗ':
+      case 'ŗ':
+      case 'Ř':
+      case 'ř':
+      case 'Ȑ':
+      case 'ȑ':
+      case 'Ȓ':
+      case 'ȓ':
       case 'R':
         return Optional.of('r');
+      case 'Ś':
+      case 'ś':
+      case 'Ŝ':
+      case 'ŝ':
+      case 'Ş':
+      case 'ş':
+      case 'Š':
+      case 'š':
+      case 'ſ':
+      case 'Ș':
+      case 'ș':
       case 'S':
         return Optional.of('s');
+      case 'Ţ':
+      case 'ţ':
+      case 'Ť':
+      case 'ť':
+      case 'Ŧ':
+      case 'ŧ':
+      case 'ƫ':
+      case 'Ƭ':
+      case 'ƭ':
+      case 'Ʈ':
+      case 'Ț':
+      case 'ț':
       case 'T':
         return Optional.of('t');
+      case 'Ù':
+      case 'Ú':
+      case 'Û':
+      case 'Ü':
+      case 'ù':
+      case 'ú':
+      case 'û':
+      case 'ü':
+      case 'Ũ':
+      case 'ũ':
+      case 'Ū':
+      case 'ū':
+      case 'Ŭ':
+      case 'ŭ':
+      case 'Ů':
+      case 'ů':
+      case 'Ű':
+      case 'ű':
+      case 'Ų':
+      case 'ų':
+      case 'Ư':
+      case 'ư':
+      case 'Ǔ':
+      case 'ǔ':
+      case 'Ǖ':
+      case 'ǖ':
+      case 'Ǘ':
+      case 'ǘ':
+      case 'Ǚ':
+      case 'ǚ':
+      case 'Ǜ':
+      case 'ǜ':
+      case 'Ȕ':
+      case 'ȕ':
+      case 'Ȗ':
+      case 'ȗ':
       case 'U':
         return Optional.of('u');
+      case 'Ʋ':
       case 'V':
         return Optional.of('v');
+      case 'Ŵ':
+      case 'ŵ':
+      case 'Ɯ':
+      case 'ƿ':
+      case 'Ƿ':
       case 'W':
         return Optional.of('w');
+      case '×':
       case 'X':
         return Optional.of('x');
+      case 'Ý':
+      case 'ý':
+      case 'ÿ':
+      case 'Ŷ':
+      case 'ŷ':
+      case 'Ÿ':
+      case 'Ʊ':
+      case 'Ƴ':
+      case 'ƴ':
+      case 'Ȝ':
+      case 'ȝ':
+      case 'Ȳ':
+      case 'ȳ':
       case 'Y':
         return Optional.of('y');
+      case 'Ź':
+      case 'ź':
+      case 'Ż':
+      case 'ż':
+      case 'Ž':
+      case 'ž':
+      case 'Ƶ':
+      case 'ƶ':
+      case 'Ȥ':
+      case 'ȥ':
       case 'Z':
         return Optional.of('z');
       default:
-        return Optional.absent();
+        return Optional.empty();
     }
   }
 
diff --git a/java/com/android/dialer/smartdial/map/RussianSmartDialMap.java b/java/com/android/dialer/smartdial/map/RussianSmartDialMap.java
index 914f2f3..15b174e 100644
--- a/java/com/android/dialer/smartdial/map/RussianSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/RussianSmartDialMap.java
@@ -20,10 +20,10 @@
 import androidx.collection.SimpleArrayMap;
 
 import com.android.dialer.dialpadview.DialpadCharMappings;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** A {@link SmartDialMap} for the Russian alphabet. */
-@SuppressWarnings("Guava")
 final class RussianSmartDialMap extends SmartDialMap {
 
   private static RussianSmartDialMap instance;
@@ -41,7 +41,7 @@
   @Override
   Optional<Character> normalizeCharacter(char ch) {
     ch = Character.toLowerCase(ch);
-    return isValidDialpadAlphabeticChar(ch) ? Optional.of(ch) : Optional.absent();
+    return isValidDialpadAlphabeticChar(ch) ? Optional.of(ch) : Optional.empty();
   }
 
   @Override
diff --git a/java/com/android/dialer/smartdial/map/SmartDialMap.java b/java/com/android/dialer/smartdial/map/SmartDialMap.java
index dc9eeb7..2d99ca2 100644
--- a/java/com/android/dialer/smartdial/map/SmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/SmartDialMap.java
@@ -19,10 +19,10 @@
 
 import androidx.collection.SimpleArrayMap;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 
 /** Definition for utilities that supports smart dial in different languages. */
-@SuppressWarnings("Guava")
+
 abstract class SmartDialMap {
 
   /**
@@ -58,7 +58,7 @@
    * <p>The provided character is expected to be a normalized character. See {@link
    * SmartDialMap#normalizeCharacter(char)} for details.
    *
-   * <p>An {@link Optional#absent()} is returned if the provided character can't be mapped to a key
+   * <p>An {@link Optional#empty()} ()} is returned if the provided character can't be mapped to a key
    * on the dialpad.
    */
   protected Optional<Byte> getDialpadIndex(char ch) {
@@ -70,7 +70,7 @@
       return Optional.of((byte) (getCharToKeyMap().get(ch) - '0'));
     }
 
-    return Optional.absent();
+    return Optional.empty();
   }
 
   /**
@@ -79,20 +79,20 @@
    * <p>The provided character is expected to be a normalized character. See {@link
    * SmartDialMap#normalizeCharacter(char)} for details.
    *
-   * <p>An {@link Optional#absent()} is returned if the provided character can't be mapped to a key
+   * <p>An {@link Optional#empty()} ()} is returned if the provided character can't be mapped to a key
    * on the dialpad.
    */
   protected Optional<Character> getDialpadNumericCharacter(char ch) {
     return isValidDialpadAlphabeticChar(ch)
         ? Optional.of(getCharToKeyMap().get(ch))
-        : Optional.absent();
+        : Optional.empty();
   }
 
   /**
    * Converts uppercase characters to lower case ones, and on a best effort basis, strips accents
    * from accented characters.
    *
-   * <p>An {@link Optional#absent()} is returned if the provided character can't be mapped to a key
+   * <p>An {@link Optional#empty()} ()} is returned if the provided character can't be mapped to a key
    * on the dialpad.
    */
   abstract Optional<Character> normalizeCharacter(char ch);
diff --git a/java/com/android/dialer/smartdial/map/UkrainianSmartDialMap.java b/java/com/android/dialer/smartdial/map/UkrainianSmartDialMap.java
index 69d2ccf..90b1555 100644
--- a/java/com/android/dialer/smartdial/map/UkrainianSmartDialMap.java
+++ b/java/com/android/dialer/smartdial/map/UkrainianSmartDialMap.java
@@ -20,7 +20,8 @@
 import androidx.collection.SimpleArrayMap;
 
 import com.android.dialer.dialpadview.DialpadCharMappings;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /** A {@link SmartDialMap} for the Ukrainian alphabet. */
 final class UkrainianSmartDialMap extends SmartDialMap {
@@ -40,7 +41,7 @@
   @Override
   Optional<Character> normalizeCharacter(char ch) {
     ch = Character.toLowerCase(ch);
-    return isValidDialpadAlphabeticChar(ch) ? Optional.of(ch) : Optional.absent();
+    return isValidDialpadAlphabeticChar(ch) ? Optional.of(ch) : Optional.empty();
   }
 
   @Override
diff --git a/java/com/android/dialer/speeddial/SpeedDialAdapter.java b/java/com/android/dialer/speeddial/SpeedDialAdapter.java
index 2404c7f..7d5336a 100644
--- a/java/com/android/dialer/speeddial/SpeedDialAdapter.java
+++ b/java/com/android/dialer/speeddial/SpeedDialAdapter.java
@@ -180,7 +180,7 @@
     speedDialUiItems.sort(
         (o1, o2) -> {
           if (o1.isStarred() && o2.isStarred()) {
-            return Integer.compare(o1.pinnedPosition().or(-1), o2.pinnedPosition().or(-1));
+            return Integer.compare(o1.pinnedPosition().orElse(-1), o2.pinnedPosition().orElse(-1));
           }
           return Boolean.compare(o2.isStarred(), o1.isStarred());
         });
diff --git a/java/com/android/dialer/speeddial/database/SpeedDialEntry.java b/java/com/android/dialer/speeddial/database/SpeedDialEntry.java
index 132a283..dfaa825 100644
--- a/java/com/android/dialer/speeddial/database/SpeedDialEntry.java
+++ b/java/com/android/dialer/speeddial/database/SpeedDialEntry.java
@@ -23,10 +23,10 @@
 import androidx.annotation.Nullable;
 
 import com.google.auto.value.AutoValue;
-import com.google.common.base.Optional;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.util.Optional;
 
 /** POJO representation of database rows returned by {@link SpeedDialEntryDao}. */
 @AutoValue
@@ -61,7 +61,7 @@
   public abstract Builder toBuilder();
 
   public static Builder builder() {
-    return new AutoValue_SpeedDialEntry.Builder().setPinnedPosition(Optional.absent());
+    return new AutoValue_SpeedDialEntry.Builder().setPinnedPosition(Optional.empty());
   }
 
   /** Builder class for speed dial entry. */
diff --git a/java/com/android/dialer/speeddial/database/SpeedDialEntryDatabaseHelper.java b/java/com/android/dialer/speeddial/database/SpeedDialEntryDatabaseHelper.java
index f84cbab..2f189a2 100644
--- a/java/com/android/dialer/speeddial/database/SpeedDialEntryDatabaseHelper.java
+++ b/java/com/android/dialer/speeddial/database/SpeedDialEntryDatabaseHelper.java
@@ -27,12 +27,12 @@
 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;
+import java.util.Optional;
 
 /**
  * {@link SpeedDialEntryDao} implemented as an SQLite database.
@@ -45,7 +45,7 @@
   /**
    * If the pinned position is absent, then we need to write an impossible value in the table like
    * -1 so that it doesn't default to 0. When we read this value from the table, we'll translate it
-   * to Optional.absent() in the resulting {@link SpeedDialEntry}.
+   * to Optional.empty() in the resulting {@link SpeedDialEntry}.
    */
   private static final int PINNED_POSITION_ABSENT = -1;
 
@@ -128,14 +128,14 @@
               Channel.builder()
                   .setNumber(number)
                   .setPhoneType(cursor.getInt(POSITION_PHONE_TYPE))
-                  .setLabel(Optional.fromNullable(cursor.getString(POSITION_PHONE_LABEL)).or(""))
+                  .setLabel(Optional.ofNullable(cursor.getString(POSITION_PHONE_LABEL)).orElse(""))
                   .setTechnology(cursor.getInt(POSITION_PHONE_TECHNOLOGY))
                   .build();
         }
 
         Optional<Integer> pinnedPosition = Optional.of(cursor.getInt(POSITION_PINNED_POSITION));
-        if (pinnedPosition.or(PINNED_POSITION_ABSENT) == PINNED_POSITION_ABSENT) {
-          pinnedPosition = Optional.absent();
+        if (pinnedPosition.orElse(PINNED_POSITION_ABSENT) == PINNED_POSITION_ABSENT) {
+          pinnedPosition = Optional.empty();
         }
 
         SpeedDialEntry entry =
@@ -246,7 +246,7 @@
     if (includeId) {
       values.put(ID, entry.id());
     }
-    values.put(PINNED_POSITION, entry.pinnedPosition().or(PINNED_POSITION_ABSENT));
+    values.put(PINNED_POSITION, entry.pinnedPosition().orElse(PINNED_POSITION_ABSENT));
     values.put(CONTACT_ID, entry.contactId());
     values.put(LOOKUP_KEY, entry.lookupKey());
     if (entry.defaultChannel() != null) {
diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
index 59f9d53..5ba16b4 100644
--- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
+++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItem.java
@@ -34,12 +34,12 @@
 import com.android.dialer.speeddial.database.SpeedDialEntry;
 import com.android.dialer.speeddial.database.SpeedDialEntry.Channel;
 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;
+import java.util.Optional;
 import java.util.Set;
 
 /**
@@ -97,7 +97,7 @@
   public static Builder builder() {
     return new AutoValue_SpeedDialUiItem.Builder()
         .setChannels(ImmutableList.of())
-        .setPinnedPosition(Optional.absent());
+        .setPinnedPosition(Optional.empty());
   }
 
   /**
diff --git a/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java b/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java
index 47d102a..55b6da6 100644
--- a/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java
+++ b/java/com/android/dialer/speeddial/loader/SpeedDialUiItemMutator.java
@@ -50,7 +50,6 @@
 import com.android.dialer.speeddial.database.SpeedDialEntryDao;
 import com.android.dialer.speeddial.database.SpeedDialEntryDatabaseHelper;
 import com.android.dialer.util.CallUtil;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.Futures;
@@ -62,6 +61,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.Set;
 
 import javax.inject.Inject;
diff --git a/java/com/android/dialer/telecom/TelecomCallUtil.java b/java/com/android/dialer/telecom/TelecomCallUtil.java
index 600ed6f..6868a5c 100644
--- a/java/com/android/dialer/telecom/TelecomCallUtil.java
+++ b/java/com/android/dialer/telecom/TelecomCallUtil.java
@@ -29,7 +29,8 @@
 
 import com.android.dialer.common.Assert;
 import com.android.dialer.location.GeoUtil;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /**
  * Class to provide a standard interface for obtaining information from the underlying
@@ -89,7 +90,7 @@
     }
     String rawNumber = getNumber(call);
     if (TextUtils.isEmpty(rawNumber)) {
-      return Optional.absent();
+      return Optional.empty();
     }
     return Optional.of(PhoneNumberUtils.normalizeNumber(rawNumber));
   }
@@ -100,16 +101,16 @@
    * GeoUtil#getCurrentCountryIso(Context)} is used.
    *
    * <p>If the number cannot be formatted (because for example it is invalid), returns {@link
-   * Optional#absent()}.
+   * Optional#empty()} ()}.
    */
   @WorkerThread
   public static Optional<String> getValidE164Number(Context appContext, Call call) {
     Assert.isWorkerThread();
     String rawNumber = getNumber(call);
     if (TextUtils.isEmpty(rawNumber)) {
-      return Optional.absent();
+      return Optional.empty();
     }
-    return Optional.fromNullable(
+    return Optional.ofNullable(
         PhoneNumberUtils.formatNumberToE164(rawNumber, GeoUtil.getCurrentCountryIso(appContext)));
   }
 }
diff --git a/java/com/android/dialer/telecom/TelecomUtil.java b/java/com/android/dialer/telecom/TelecomUtil.java
index b71a007..dd481d9 100644
--- a/java/com/android/dialer/telecom/TelecomUtil.java
+++ b/java/com/android/dialer/telecom/TelecomUtil.java
@@ -41,19 +41,19 @@
 
 import com.android.dialer.common.LogUtil;
 import com.android.dialer.util.PermissionsUtil;
-import com.google.common.base.Optional;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.Optional;
 
 /**
  * Performs permission checks before calling into TelecomManager. Each method is self-explanatory -
  * perform the required check and return the fallback default if the permission is missing,
  * otherwise return the value from TelecomManager.
  */
-@SuppressWarnings({"MissingPermission", "Guava"})
+@SuppressWarnings("MissingPermission")
 public abstract class TelecomUtil {
 
   private static final String TAG = "TelecomUtil";
@@ -143,8 +143,8 @@
 
   public static List<PhoneAccountHandle> getCallCapablePhoneAccounts(Context context) {
     if (PermissionsUtil.hasReadPhoneStatePermissions(context)) {
-      return Optional.fromNullable(getTelecomManager(context).getCallCapablePhoneAccounts())
-          .or(new ArrayList<>());
+      return Optional.ofNullable(getTelecomManager(context).getCallCapablePhoneAccounts())
+          .orElse(new ArrayList<>());
     }
     return new ArrayList<>();
   }
@@ -196,22 +196,22 @@
   public static Optional<SubscriptionInfo> getSubscriptionInfo(
           @NonNull Context context, @NonNull PhoneAccountHandle phoneAccountHandle) {
     if (TextUtils.isEmpty(phoneAccountHandle.getId())) {
-      return Optional.absent();
+      return Optional.empty();
     }
     if (!PermissionsUtil.hasReadPhoneStatePermissions(context)) {
-      return Optional.absent();
+      return Optional.empty();
     }
     SubscriptionManager subscriptionManager = context.getSystemService(SubscriptionManager.class);
     List<SubscriptionInfo> subscriptionInfos = subscriptionManager.getActiveSubscriptionInfoList();
     if (subscriptionInfos == null) {
-      return Optional.absent();
+      return Optional.empty();
     }
     for (SubscriptionInfo info : subscriptionInfos) {
       if (phoneAccountHandle.getId().startsWith(info.getIccId())) {
         return Optional.of(info);
       }
     }
-    return Optional.absent();
+    return Optional.empty();
   }
 
   /**
diff --git a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java
index 4c9f0ba..a0cfc82 100644
--- a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java
+++ b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java
@@ -42,10 +42,10 @@
 import com.android.voicemail.VoicemailClient;
 import com.android.voicemail.VoicemailClient.ActivationStateListener;
 import com.android.voicemail.VoicemailComponent;
-import com.google.common.base.Optional;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.util.Optional;
 
 /**
  * Fragment for voicemail settings. Requires {@link VoicemailClient#PARAM_PHONE_ACCOUNT_HANDLE} set
diff --git a/java/com/android/incallui/ActiveCallsCallListListener.java b/java/com/android/incallui/ActiveCallsCallListListener.java
index 8c381a24..b7f452e 100644
--- a/java/com/android/incallui/ActiveCallsCallListListener.java
+++ b/java/com/android/incallui/ActiveCallsCallListListener.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,11 +26,11 @@
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.DialerCall;
 import com.android.incallui.call.state.DialerCallState;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 
+import java.util.Optional;
+
 /** Updates {@link com.android.dialer.activecalls.ActiveCalls} */
-@SuppressWarnings("Guava")
 public class ActiveCallsCallListListener implements CallList.Listener {
 
   private final Context appContext;
diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java
index 8213678..0f1a156 100644
--- a/java/com/android/incallui/InCallActivity.java
+++ b/java/com/android/incallui/InCallActivity.java
@@ -379,8 +379,8 @@
           waitingForAccountCall.setPreferredAccountRecorder(
               new PreferredAccountRecorder(
                   waitingForAccountCall.getNumber(),
-                  result.getSuggestion().orNull(),
-                  result.getDataId().orNull()));
+                  result.getSuggestion().orElse(null),
+                  result.getDataId().orElse(null)));
           selectPhoneAccountDialogFragment =
               SelectPhoneAccountDialogFragment.newInstance(
                   result.getDialogOptionsBuilder().get().setCallId(callId).build(),
diff --git a/java/com/android/voicemail/impl/CarrierIdentifierMatcher.java b/java/com/android/voicemail/impl/CarrierIdentifierMatcher.java
index 5953755..2f57b1e 100644
--- a/java/com/android/voicemail/impl/CarrierIdentifierMatcher.java
+++ b/java/com/android/voicemail/impl/CarrierIdentifierMatcher.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,8 @@
 package com.android.voicemail.impl;
 
 import com.google.auto.value.AutoValue;
-import com.google.common.base.Optional;
+
+import java.util.Optional;
 
 /**
  * Matches a {@link CarrierIdentifier}. Full equality check on CarrierIdentifiers is often unfit