Update to Tink 1.3.0

Bug: 143475970
Test: Existing integration tests pass
Change-Id: I07053d7c0435e1d4db37bdf7eef3754aa820e58c
diff --git a/security/crypto/build.gradle b/security/crypto/build.gradle
index 36bdcba..58954fe 100644
--- a/security/crypto/build.gradle
+++ b/security/crypto/build.gradle
@@ -26,11 +26,10 @@
 }
 
 dependencies {
-    api("androidx.annotation:annotation:1.0.0")
+    api("androidx.annotation:annotation:1.1.0")
 
-    implementation("com.google.crypto.tink:tink-android:1.2.2")
+    implementation("com.google.crypto.tink:tink-android:1.3.0")
 
-    androidTestImplementation("androidx.test.ext:junit:1.1.0")
     androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
     androidTestImplementation(ANDROIDX_TEST_CORE)
     androidTestImplementation(ANDROIDX_TEST_RUNNER)
diff --git a/security/crypto/src/main/java/androidx/security/crypto/EncryptedFile.java b/security/crypto/src/main/java/androidx/security/crypto/EncryptedFile.java
index 972e2df..77eddfe 100644
--- a/security/crypto/src/main/java/androidx/security/crypto/EncryptedFile.java
+++ b/security/crypto/src/main/java/androidx/security/crypto/EncryptedFile.java
@@ -29,7 +29,6 @@
 import com.google.crypto.tink.config.TinkConfig;
 import com.google.crypto.tink.integration.android.AndroidKeysetManager;
 import com.google.crypto.tink.proto.KeyTemplate;
-import com.google.crypto.tink.streamingaead.StreamingAeadFactory;
 import com.google.crypto.tink.streamingaead.StreamingAeadKeyTemplates;
 
 import java.io.File;
@@ -171,12 +170,10 @@
                     .withMasterKeyUri(KEYSTORE_PATH_URI + mMasterKeyAlias)
                     .build().getKeysetHandle();
 
-            StreamingAead streamingAead = StreamingAeadFactory.getPrimitive(
-                    streadmingAeadKeysetHandle);
+            StreamingAead streamingAead =
+                    streadmingAeadKeysetHandle.getPrimitive(StreamingAead.class);
 
-            EncryptedFile file = new EncryptedFile(mFile, mKeysetAlias, streamingAead,
-                    mContext);
-            return file;
+            return new EncryptedFile(mFile, mKeysetAlias, streamingAead, mContext);
         }
     }
 
diff --git a/security/crypto/src/main/java/androidx/security/crypto/EncryptedSharedPreferences.java b/security/crypto/src/main/java/androidx/security/crypto/EncryptedSharedPreferences.java
index 7467fc0..e65cd68 100644
--- a/security/crypto/src/main/java/androidx/security/crypto/EncryptedSharedPreferences.java
+++ b/security/crypto/src/main/java/androidx/security/crypto/EncryptedSharedPreferences.java
@@ -31,10 +31,8 @@
 import com.google.crypto.tink.Aead;
 import com.google.crypto.tink.DeterministicAead;
 import com.google.crypto.tink.KeysetHandle;
-import com.google.crypto.tink.aead.AeadFactory;
 import com.google.crypto.tink.aead.AeadKeyTemplates;
 import com.google.crypto.tink.config.TinkConfig;
-import com.google.crypto.tink.daead.DeterministicAeadFactory;
 import com.google.crypto.tink.daead.DeterministicAeadKeyTemplates;
 import com.google.crypto.tink.integration.android.AndroidKeysetManager;
 import com.google.crypto.tink.proto.KeyTemplate;
@@ -127,8 +125,8 @@
                 .withMasterKeyUri(KEYSTORE_PATH_URI + masterKeyAlias)
                 .build().getKeysetHandle();
 
-        DeterministicAead daead = DeterministicAeadFactory.getPrimitive(daeadKeysetHandle);
-        Aead aead = AeadFactory.getPrimitive(aeadKeysetHandle);
+        DeterministicAead daead = daeadKeysetHandle.getPrimitive(DeterministicAead.class);
+        Aead aead = aeadKeysetHandle.getPrimitive(Aead.class);
 
         return new EncryptedSharedPreferences(fileName, masterKeyAlias,
                 context.getSharedPreferences(fileName, Context.MODE_PRIVATE), aead, daead);