Merge 25Q1 (ab/BP1A.250305.020) to aosp-main-future

Bug: 385190204
Merged-In: I686066d2cb99b7ab6cf8b05e3beebb51e0900d36
Change-Id: I0f213881178cb60c1e4ccab3eb48292cc9b39e80
diff --git a/OWNERS b/OWNERS
index a338d4f..6d4ba83 100644
--- a/OWNERS
+++ b/OWNERS
@@ -4,4 +4,3 @@
 mhagerott@google.com
 wjang@google.com
 johnshao@google.com
-yaolu@google.com
diff --git a/proguard.flags b/proguard.flags
index 9543f9d..cdd4a9f 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -107,13 +107,19 @@
 -keep class com.android.common.widget.CompositeCursorAdapter { *; }
 
 # Any class or method annotated with NeededForReflection.
--keep @com.android.contacts.test.NeededForReflection class *
+# TODO(b/373579455): Evaluate if <init> needs to be kept.
+-keep @com.android.contacts.test.NeededForReflection class * {
+  void <init>();
+}
 -keepclassmembers class * {
-@com.android.contacts.test.NeededForReflection *;
+  @com.android.contacts.test.NeededForReflection *;
 }
 
 # Keep classes and methods that have the guava @VisibleForTesting annotation
--keep @com.google.common.annotations.VisibleForTesting class *
+# TODO(b/373579455): Evaluate if <init> needs to be kept.
+-keep @com.google.common.annotations.VisibleForTesting class * {
+  void <init>();
+}
 -keepclassmembers class * {
   @com.google.common.annotations.VisibleForTesting *;
 }
diff --git a/src/com/android/contacts/model/RawContactModifier.java b/src/com/android/contacts/model/RawContactModifier.java
index 789bd10..171a810 100644
--- a/src/com/android/contacts/model/RawContactModifier.java
+++ b/src/com/android/contacts/model/RawContactModifier.java
@@ -1038,10 +1038,30 @@
             return;
         }
 
+        boolean supportPrefix = false;
+        boolean supportFamilyName = false;
+        boolean supportMiddleName = false;
+        boolean supportGivenName = false;
+        boolean supportSuffix = false;
         boolean supportPhoneticFamilyName = false;
         boolean supportPhoneticMiddleName = false;
         boolean supportPhoneticGivenName = false;
         for (EditField editField : newDataKind.fieldList) {
+            if (StructuredName.PREFIX.equals(editField.column)) {
+                supportPrefix = true;
+            }
+            if (StructuredName.FAMILY_NAME.equals(editField.column)) {
+                supportFamilyName = true;
+            }
+            if (StructuredName.MIDDLE_NAME.equals(editField.column)) {
+                supportMiddleName = true;
+            }
+            if (StructuredName.GIVEN_NAME.equals(editField.column)) {
+                supportGivenName = true;
+            }
+            if (StructuredName.SUFFIX.equals(editField.column)) {
+                supportSuffix = true;
+            }
             if (StructuredName.PHONETIC_FAMILY_NAME.equals(editField.column)) {
                 supportPhoneticFamilyName = true;
             }
@@ -1053,6 +1073,21 @@
             }
         }
 
+        if (!supportPrefix) {
+            values.remove(StructuredName.PREFIX);
+        }
+        if (!supportFamilyName) {
+            values.remove(StructuredName.FAMILY_NAME);
+        }
+        if (!supportMiddleName) {
+            values.remove(StructuredName.MIDDLE_NAME);
+        }
+        if (!supportGivenName) {
+            values.remove(StructuredName.GIVEN_NAME);
+        }
+        if (!supportSuffix) {
+            values.remove(StructuredName.SUFFIX);
+        }
         if (!supportPhoneticFamilyName) {
             values.remove(StructuredName.PHONETIC_FAMILY_NAME);
         }
diff --git a/tests/src/com/android/contacts/DynamicShortcutsTests.java b/tests/src/com/android/contacts/DynamicShortcutsTests.java
index 8673c5e..df9d33a 100644
--- a/tests/src/com/android/contacts/DynamicShortcutsTests.java
+++ b/tests/src/com/android/contacts/DynamicShortcutsTests.java
@@ -17,8 +17,8 @@
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.equalTo;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
diff --git a/tests/src/com/android/contacts/activities/SimImportActivityTest.java b/tests/src/com/android/contacts/activities/SimImportActivityTest.java
index 9e2f73b..4b7060f 100644
--- a/tests/src/com/android/contacts/activities/SimImportActivityTest.java
+++ b/tests/src/com/android/contacts/activities/SimImportActivityTest.java
@@ -22,7 +22,7 @@
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.allOf;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 
diff --git a/tests/src/com/android/contacts/database/SimContactDaoTests.java b/tests/src/com/android/contacts/database/SimContactDaoTests.java
index 680ba10..17906af 100644
--- a/tests/src/com/android/contacts/database/SimContactDaoTests.java
+++ b/tests/src/com/android/contacts/database/SimContactDaoTests.java
@@ -26,8 +26,8 @@
 import static org.hamcrest.Matchers.equalTo;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;