Snap for 11273583 from 0c0ed7f7abf526422d91b9d559a24b7acbc2471d to mainline-cellbroadcast-release

Change-Id: Ia184f16b1af470be2b5ab6f9beb6fb622f0d0fe1
diff --git a/java/Android.bp b/java/Android.bp
index dbe6e92..eee1e0e 100644
--- a/java/Android.bp
+++ b/java/Android.bp
@@ -80,8 +80,12 @@
     name: "framework-api-annotations",
     srcs: [
         "android/annotation/Discouraged.java",
+        "android/annotation/FlaggedApi.java",
+        "android/annotation/IntDef.java",
         "android/annotation/SystemApi.java",
         "android/annotation/TestApi.java",
+        // aconfig annotations
+        "com/android/aconfig/annotations/*.java",
     ],
 
     visibility: [
diff --git a/java/com/android/modules/expresslog/Android.bp b/java/com/android/modules/expresslog/Android.bp
index cacc7f8..59504bd 100644
--- a/java/com/android/modules/expresslog/Android.bp
+++ b/java/com/android/modules/expresslog/Android.bp
@@ -28,12 +28,16 @@
     libs: [
         "framework-statsd",
     ],
+    static_libs: [
+        "expresslog-catalog",
+    ],
 }
 
 genrule {
     name: "statslog-expresslog-java-gen",
     tools: ["stats-log-api-gen"],
     cmd: "$(location stats-log-api-gen) --java $(out) --module expresslog" +
-        " --javaPackage com.android.modules.expresslog --javaClass StatsExpressLog",
+        " --javaPackage com.android.modules.expresslog" +
+        " --javaClass StatsExpressLog",
     out: ["com/android/modules/expresslog/StatsExpressLog.java"],
 }
diff --git a/java/com/android/modules/expresslog/Counter.java b/java/com/android/modules/expresslog/Counter.java
index b788c3f..bcacb8b 100644
--- a/java/com/android/modules/expresslog/Counter.java
+++ b/java/com/android/modules/expresslog/Counter.java
@@ -18,8 +18,6 @@
 
 import android.annotation.NonNull;
 
-import com.android.modules.expresslog.StatsExpressLog;
-
 /** Counter encapsulates StatsD write API calls */
 public final class Counter {
 
@@ -49,7 +47,8 @@
      * @param amount to increment counter
      */
     public static void logIncrement(@NonNull String metricId, long amount) {
-        final long metricIdHash = Utils.hashString(metricId);
+        final long metricIdHash =
+                MetricIds.getMetricIdHash(metricId, MetricIds.METRIC_TYPE_COUNTER);
         StatsExpressLog.write(StatsExpressLog.EXPRESS_EVENT_REPORTED, metricIdHash, amount);
     }
 
@@ -60,7 +59,8 @@
      * @param amount to increment counter
      */
     public static void logIncrementWithUid(@NonNull String metricId, int uid, long amount) {
-        final long metricIdHash = Utils.hashString(metricId);
+        final long metricIdHash =
+                MetricIds.getMetricIdHash(metricId, MetricIds.METRIC_TYPE_COUNTER_WITH_UID);
         StatsExpressLog.write(
             StatsExpressLog.EXPRESS_UID_EVENT_REPORTED, metricIdHash, amount, uid);
     }
diff --git a/java/com/android/modules/expresslog/Histogram.java b/java/com/android/modules/expresslog/Histogram.java
index be300bf..4f61c85 100644
--- a/java/com/android/modules/expresslog/Histogram.java
+++ b/java/com/android/modules/expresslog/Histogram.java
@@ -20,14 +20,12 @@
 import android.annotation.IntRange;
 import android.annotation.NonNull;
 
-import com.android.modules.expresslog.StatsExpressLog;
-
 import java.util.Arrays;
 
 /** Histogram encapsulates StatsD write API calls */
 public final class Histogram {
 
-    private final long mMetricIdHash;
+    private final String mMetricId;
     private final BinOptions mBinOptions;
 
     /**
@@ -37,7 +35,7 @@
      * @param binOptions to calculate bin index for samples
      */
     public Histogram(@NonNull String metricId, @NonNull BinOptions binOptions) {
-        mMetricIdHash = Utils.hashString(metricId);
+        mMetricId = metricId;
         mBinOptions = binOptions;
     }
 
@@ -47,9 +45,10 @@
      * @param sample value
      */
     public void logSample(float sample) {
+        final long hash = MetricIds.getMetricIdHash(mMetricId, MetricIds.METRIC_TYPE_HISTOGRAM);
         final int binIndex = mBinOptions.getBinForSample(sample);
-        StatsExpressLog.write(StatsExpressLog.EXPRESS_HISTOGRAM_SAMPLE_REPORTED, mMetricIdHash,
-                /*count*/ 1, binIndex);
+        StatsExpressLog.write(
+                StatsExpressLog.EXPRESS_HISTOGRAM_SAMPLE_REPORTED, hash, /*count*/ 1, binIndex);
     }
 
     /**
@@ -59,9 +58,15 @@
      * @param sample value
      */
     public void logSampleWithUid(int uid, float sample) {
+        final long hash =
+                MetricIds.getMetricIdHash(mMetricId, MetricIds.METRIC_TYPE_HISTOGRAM_WITH_UID);
         final int binIndex = mBinOptions.getBinForSample(sample);
-        StatsExpressLog.write(StatsExpressLog.EXPRESS_UID_HISTOGRAM_SAMPLE_REPORTED,
-                mMetricIdHash, /*count*/ 1, binIndex, uid);
+        StatsExpressLog.write(
+                StatsExpressLog.EXPRESS_UID_HISTOGRAM_SAMPLE_REPORTED,
+                hash, /*count*/
+                1,
+                binIndex,
+                uid);
     }
 
     /** Used by Histogram to map data sample to corresponding bin */
diff --git a/java/com/android/modules/expresslog/Utils.java b/java/com/android/modules/expresslog/Utils.java
deleted file mode 100644
index fde90fc..0000000
--- a/java/com/android/modules/expresslog/Utils.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2023 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.modules.expresslog;
-
-final class Utils {
-    static native long hashString(String stringToHash);
-}
diff --git a/java/com/android/modules/utils/FastDataInput.java b/java/com/android/modules/utils/FastDataInput.java
index daa86d5..1437f80 100644
--- a/java/com/android/modules/utils/FastDataInput.java
+++ b/java/com/android/modules/utils/FastDataInput.java
@@ -207,6 +207,10 @@
 
             return s;
         } else {
+            if (ref >= mStringRefs.length) {
+                throw new IOException("Invalid interned string reference " + ref + " for "
+                        + mStringRefs.length + " interned strings");
+            }
             return mStringRefs[ref];
         }
     }
diff --git a/java/com/android/modules/utils/testing/AbstractExtendedMockitoRule.java b/java/com/android/modules/utils/testing/AbstractExtendedMockitoRule.java
index 7a0f41b..2242ca0 100644
--- a/java/com/android/modules/utils/testing/AbstractExtendedMockitoRule.java
+++ b/java/com/android/modules/utils/testing/AbstractExtendedMockitoRule.java
@@ -77,7 +77,6 @@
     private final Set<Class<?>> mMockedStaticClasses;
     private final Set<Class<?>> mSpiedStaticClasses;
     private final List<StaticMockFixture> mStaticMockFixtures;
-    private final @Nullable SessionBuilderVisitor mSessionBuilderConfigurator;
     private final boolean mClearInlineMocks;
 
     private MockitoSession mMockitoSession;
@@ -88,7 +87,6 @@
         mMockitoFramework = builder.mMockitoFramework;
         mMockitoSession = builder.mMockitoSession;
         mAfterSessionFinishedCallback = builder.mAfterSessionFinishedCallback;
-        mSessionBuilderConfigurator = builder.mSessionBuilderConfigurator;
         mMockedStaticClasses = builder.mMockedStaticClasses;
         mSpiedStaticClasses = builder.mSpiedStaticClasses;
         mStaticMockFixtures = builder.mStaticMockFixtures == null ? Collections.emptyList()
@@ -98,7 +96,6 @@
                 + ", mockedStaticClasses=" + mMockedStaticClasses
                 + ", spiedStaticClasses=" + mSpiedStaticClasses
                 + ", staticMockFixtures=" + mStaticMockFixtures
-                + ", sessionBuilderConfigurator=" + mSessionBuilderConfigurator
                 + ", afterSessionFinishedCallback=" + mAfterSessionFinishedCallback
                 + ", mockitoFramework=" + mMockitoFramework
                 + ", mockitoSession=" + mMockitoSession
@@ -133,8 +130,16 @@
         return Collections.unmodifiableSet(staticClasses);
     }
 
-
-
+    /**
+     * Gets whether the rule should clear the inline mocks after the given test.
+     *
+     * <p>By default, it returns {@code} (unless the rule was built with
+     * {@link AbstractBuilder#dontClearInlineMocks()}, but subclasses can override to change the
+     * behavior (for example, to decide based on custom annotations).
+     */
+    protected boolean getClearInlineMethodsAtTheEnd(Description description) {
+        return mClearInlineMocks;
+    }
 
     @Override
     public Statement apply(Statement base, Description description) {
@@ -211,10 +216,6 @@
             Log.v(TAG, "Calling spyStatic() on " + clazz);
             sessionBuilder.spyStatic(clazz);
         }
-        if (mSessionBuilderConfigurator != null) {
-            Log.v(TAG, "Visiting " + mSessionBuilderConfigurator + " with " + sessionBuilder);
-            mSessionBuilderConfigurator.visit(sessionBuilder);
-        }
     }
 
     private void setUpMockBehaviors() {
@@ -247,12 +248,13 @@
                 }
             }
         } finally {
-            clearInlineMocks();
+            clearInlineMocks(description);
         }
     }
 
-    private void clearInlineMocks() {
-        if (!mClearInlineMocks) {
+    private void clearInlineMocks(Description description) {
+        boolean clearIt = getClearInlineMethodsAtTheEnd(description);
+        if (!clearIt) {
             Log.d(TAG, "NOT calling clearInlineMocks() as set on builder");
             return;
         }
@@ -278,7 +280,6 @@
         Strictness mStrictness = Strictness.LENIENT;
         @Nullable MockitoFramework mMockitoFramework;
         @Nullable MockitoSession mMockitoSession;
-        @Nullable SessionBuilderVisitor mSessionBuilderConfigurator;
         @Nullable Runnable mAfterSessionFinishedCallback;
         boolean mClearInlineMocks = true;
 
@@ -312,11 +313,9 @@
          * com.android.dx.mockito.inline.extended.StaticMockitoSessionBuilder#mockStatic(Class)}.
          *
          * @throws IllegalStateException if the same class was already passed to
-         *   {@link #mockStatic(Class)} or {@link #spyStatic(Class)} or if
-         *   {@link #configureSessionBuilder(SessionBuilderVisitor)} was called before.
+         *   {@link #mockStatic(Class)} or {@link #spyStatic(Class)}.
          */
         public final B mockStatic(Class<?> clazz) {
-            checkConfigureSessionBuilderNotCalled();
             mMockedStaticClasses.add(checkClassNotMockedOrSpied(clazz));
             return thisBuilder();
         }
@@ -326,11 +325,9 @@
          * com.android.dx.mockito.inline.extended.StaticMockitoSessionBuilder#spyStatic(Class)}.
          *
          * @throws IllegalStateException if the same class was already passed to
-         *   {@link #mockStatic(Class)} or {@link #spyStatic(Class)} or if
-         *   {@link #configureSessionBuilder(SessionBuilderVisitor)} was called before.
+         *   {@link #mockStatic(Class)} or {@link #spyStatic(Class)}.
          */
         public final B spyStatic(Class<?> clazz) {
-            checkConfigureSessionBuilderNotCalled();
             mSpiedStaticClasses.add(checkClassNotMockedOrSpied(clazz));
             return thisBuilder();
         }
@@ -352,25 +349,6 @@
             return thisBuilder();
         }
 
-        // TODO(b/281577492): remove once CachedAppOptimizerTest doesn't use anymore
-        /**
-         * Alternative for {@link #spyStatic(Class)} / {@link #mockStatic(Class)}; typically used
-         * when the same setup is shared by multiple tests.
-         *
-         * @deprecated use {@link #addStaticMockFixtures(Supplier...)} instead
-         *
-         * @throws IllegalStateException if {@link #mockStatic(Class)} or {@link #spyStatic(Class)}
-         * was called before.
-         */
-        @Deprecated
-        public final B configureSessionBuilder(
-                SessionBuilderVisitor sessionBuilderConfigurator) {
-            checkState(mMockedStaticClasses.isEmpty(), "mockStatic() already called");
-            checkState(mSpiedStaticClasses.isEmpty(), "spyStatic() already called");
-            mSessionBuilderConfigurator = Objects.requireNonNull(sessionBuilderConfigurator);
-            return thisBuilder();
-        }
-
         /**
          * Runs the given {@code runnable} after the session finished.
          *
@@ -416,11 +394,6 @@
             return (B) this;
         }
 
-        private void checkConfigureSessionBuilderNotCalled() {
-            checkState(mSessionBuilderConfigurator == null,
-                    "configureSessionBuilder() already called");
-        }
-
         private Class<?> checkClassNotMockedOrSpied(Class<?> clazz) {
             Objects.requireNonNull(clazz);
             checkState(!mMockedStaticClasses.contains(clazz), "class %s already mocked", clazz);
@@ -429,17 +402,6 @@
         }
     }
 
-    /**
-     * Visitor for {@link StaticMockitoSessionBuilder}.
-     */
-    public interface SessionBuilderVisitor {
-
-        /**
-         * Visits it.
-         */
-        void visit(StaticMockitoSessionBuilder builder);
-    }
-
     // Copied from com.android.internal.util.Preconditions, as that method is not available on RVC
     private static void checkState(boolean expression, String messageTemplate,
             Object... messageArgs) {
diff --git a/javatests/com/android/modules/expresslog/Android.bp b/javatests/com/android/modules/expresslog/Android.bp
index dd52750..9396e17 100644
--- a/javatests/com/android/modules/expresslog/Android.bp
+++ b/javatests/com/android/modules/expresslog/Android.bp
@@ -37,40 +37,7 @@
         "android.test.runner",
     ],
 
-    jni_libs: [
-        "libexpresslog_test_jni",
-    ],
-
     test_suites: [
         "general-tests",
     ],
 }
-
-cc_library_shared {
-    name: "libexpresslog_test_jni",
-
-    sdk_version: "current",
-    min_sdk_version: "30",
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wextra",
-
-        "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash",
-    ],
-    srcs: [
-        "jni/onload.cpp",
-    ],
-    header_libs: [
-        "liblog_headers",
-        "libnativehelper_header_only",
-    ],
-    shared_libs: [
-        "liblog",
-    ],
-    static_libs: [
-        "libexpresslog_jni",
-        "libtextclassifier_hash_static",
-    ],
-}
diff --git a/javatests/com/android/modules/expresslog/ScaledRangeOptionsTest.java b/javatests/com/android/modules/expresslog/ScaledRangeOptionsTest.java
index 8defce7..1c42788 100644
--- a/javatests/com/android/modules/expresslog/ScaledRangeOptionsTest.java
+++ b/javatests/com/android/modules/expresslog/ScaledRangeOptionsTest.java
@@ -27,10 +27,6 @@
 @RunWith(JUnit4.class)
 @SmallTest
 public class ScaledRangeOptionsTest {
-    static {
-        System.loadLibrary("expresslog_test_jni");
-    }
-
     private static final String TAG = ScaledRangeOptionsTest.class.getSimpleName();
 
     @Test
diff --git a/javatests/com/android/modules/expresslog/UniformOptionsTest.java b/javatests/com/android/modules/expresslog/UniformOptionsTest.java
index 3cc03ec..cad4c3f 100644
--- a/javatests/com/android/modules/expresslog/UniformOptionsTest.java
+++ b/javatests/com/android/modules/expresslog/UniformOptionsTest.java
@@ -26,10 +26,6 @@
 @RunWith(JUnit4.class)
 @SmallTest
 public class UniformOptionsTest {
-    static {
-        System.loadLibrary("expresslog_test_jni");
-    }
-
     private static final String TAG = UniformOptionsTest.class.getSimpleName();
 
     @Test
diff --git a/javatests/com/android/modules/expresslog/jni/.clang-format b/javatests/com/android/modules/expresslog/jni/.clang-format
deleted file mode 100644
index cead3a0..0000000
--- a/javatests/com/android/modules/expresslog/jni/.clang-format
+++ /dev/null
@@ -1,17 +0,0 @@
-BasedOnStyle: Google
-AllowShortIfStatementsOnASingleLine: true
-AllowShortFunctionsOnASingleLine: false
-AllowShortLoopsOnASingleLine: true
-BinPackArguments: true
-BinPackParameters: true
-ColumnLimit: 100
-CommentPragmas: NOLINT:.*
-ContinuationIndentWidth: 8
-DerivePointerAlignment: false
-IndentWidth: 4
-PointerAlignment: Left
-TabWidth: 4
-AccessModifierOffset: -4
-IncludeCategories:
-  - Regex:    '^"Log\.h"'
-    Priority:    -1
diff --git a/javatests/com/android/modules/expresslog/jni/onload.cpp b/javatests/com/android/modules/expresslog/jni/onload.cpp
deleted file mode 100644
index a112467..0000000
--- a/javatests/com/android/modules/expresslog/jni/onload.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2023 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.
- */
-
-#define LOG_TAG "TeX"
-
-#include <jni.h>
-#include <log/log.h>
-
-namespace android {
-extern int register_com_android_modules_expresslog_Utils(JNIEnv* env);
-}  // namespace android
-
-using namespace android;
-
-extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) {
-    JNIEnv* env = NULL;
-    jint result = -1;
-
-    if (vm->GetEnv((void**)&env, JNI_VERSION_1_4) != JNI_OK) {
-        ALOGE("GetEnv failed!");
-        return result;
-    }
-    ALOG_ASSERT(env, "Could not retrieve the env!");
-
-    register_com_android_modules_expresslog_Utils(env);
-    return JNI_VERSION_1_4;
-}
diff --git a/javatests/com/android/modules/utils/testing/ExtendedMockitoRuleTest.java b/javatests/com/android/modules/utils/testing/ExtendedMockitoRuleTest.java
index 6a80268..26d0cc3 100644
--- a/javatests/com/android/modules/utils/testing/ExtendedMockitoRuleTest.java
+++ b/javatests/com/android/modules/utils/testing/ExtendedMockitoRuleTest.java
@@ -65,7 +65,6 @@
 
     private @Mock Statement mStatement;
     private @Mock Runnable mRunnable;
-    private @Mock ExtendedMockitoRule.SessionBuilderVisitor mSessionBuilderVisitor;
     private @Mock StaticMockFixture mStaticMockFixture1;
     private @Mock StaticMockFixture mStaticMockFixture2;
     private @Mock StaticMockFixture mStaticMockFixture3;
@@ -100,12 +99,6 @@
     }
 
     @Test
-    public void testBuilder_configureSessionBuilder_null() {
-        assertThrows(NullPointerException.class,
-                () -> mBuilder.configureSessionBuilder(null));
-    }
-
-    @Test
     public void testBuilder_mockStatic_null() {
         assertThrows(NullPointerException.class, () -> mBuilder.mockStatic(null));
     }
@@ -420,18 +413,6 @@
     }
 
     @Test
-    public void testSpyStatic_afterConfigureSessionBuilder() throws Throwable {
-        assertThrows(IllegalStateException.class, () -> mBuilder
-                .configureSessionBuilder(mSessionBuilderVisitor).spyStatic(StaticClass.class));
-    }
-
-    @Test
-    public void testMockStatic_afterConfigureSessionBuilder() throws Throwable {
-        assertThrows(IllegalStateException.class, () -> mBuilder
-                .configureSessionBuilder(mSessionBuilderVisitor).mockStatic(StaticClass.class));
-    }
-
-    @Test
     public void testAddStaticMockFixtures_once() throws Throwable {
         InOrder inOrder = inOrder(mStaticMockFixture1, mStaticMockFixture2);
 
@@ -515,26 +496,6 @@
     }
 
     @Test
-    public void testConfigureSessionBuilder_afterMockStatic() throws Throwable {
-        assertThrows(IllegalStateException.class, () -> mBuilder.mockStatic(StaticClass.class)
-                .configureSessionBuilder(mSessionBuilderVisitor));
-    }
-
-    @Test
-    public void testConfigureSessionBuilder_afterSpyStatic() throws Throwable {
-        assertThrows(IllegalStateException.class, () -> mBuilder.spyStatic(StaticClass.class)
-                .configureSessionBuilder(mSessionBuilderVisitor));
-    }
-
-    @Test
-    public void testConfigureSessionBuilder() throws Throwable {
-        mUnsafeBuilder.configureSessionBuilder(mSessionBuilderVisitor)
-                .build().apply(mStatement, mDescription).evaluate();
-
-        verify(mSessionBuilderVisitor).visit(notNull());
-    }
-
-    @Test
     public void testAfterSessionFinished() throws Throwable {
         mUnsafeBuilder.afterSessionFinished(mRunnable).build().apply(mStatement, mDescription)
                 .evaluate();
@@ -639,6 +600,16 @@
         assertWithMessage("mockito framework cleared").that(mockitoFramework.called).isTrue();
     }
 
+    @Test
+    public void testGetClearInlineMethodsAtTheEnd() throws Throwable {
+        assertWithMessage("getClearInlineMethodsAtTheEnd() by default")
+                .that(mBuilder.build().getClearInlineMethodsAtTheEnd(mDescription)).isTrue();
+        assertWithMessage("getClearInlineMethodsAtTheEnd() when built with dontClearInlineMocks()")
+                .that(mBuilder.dontClearInlineMocks().build()
+                        .getClearInlineMethodsAtTheEnd(mDescription))
+                .isFalse();
+    }
+
     private void applyRuleOnTestThatDoesntUseExpectation(@Nullable Strictness strictness)
             throws Throwable {
         Log.d(TAG, "applyRuleOnTestThatDoesntUseExpectation(): strictness= " + strictness);
diff --git a/jni/expresslog/.clang-format b/jni/expresslog/.clang-format
deleted file mode 100644
index cead3a0..0000000
--- a/jni/expresslog/.clang-format
+++ /dev/null
@@ -1,17 +0,0 @@
-BasedOnStyle: Google
-AllowShortIfStatementsOnASingleLine: true
-AllowShortFunctionsOnASingleLine: false
-AllowShortLoopsOnASingleLine: true
-BinPackArguments: true
-BinPackParameters: true
-ColumnLimit: 100
-CommentPragmas: NOLINT:.*
-ContinuationIndentWidth: 8
-DerivePointerAlignment: false
-IndentWidth: 4
-PointerAlignment: Left
-TabWidth: 4
-AccessModifierOffset: -4
-IncludeCategories:
-  - Regex:    '^"Log\.h"'
-    Priority:    -1
diff --git a/jni/expresslog/Android.bp b/jni/expresslog/Android.bp
deleted file mode 100644
index 7bef576..0000000
--- a/jni/expresslog/Android.bp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Copyright (C) 2023 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.
-
-// JNI library for Utils.hashString
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-cc_library_static {
-    name: "libexpresslog_jni",
-
-    sdk_version: "current",
-    min_sdk_version: "30",
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wextra",
-
-        "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash",
-    ],
-    srcs: [
-        "com_android_modules_expresslog_Utils.cpp",
-    ],
-    header_libs: [
-        "liblog_headers",
-        "libnativehelper_header_only",
-        "libtextclassifier_hash_headers",
-    ],
-    shared_libs: [
-        "liblog",
-    ],
-    static_libs: [
-        "libtextclassifier_hash_static",
-    ],
-    visibility: ["//visibility:public"],
-    apex_available: [
-        "//apex_available:anyapex",
-        "//apex_available:platform",
-    ],
-}
diff --git a/jni/expresslog/com_android_modules_expresslog_Utils.cpp b/jni/expresslog/com_android_modules_expresslog_Utils.cpp
deleted file mode 100644
index ed4d0ed..0000000
--- a/jni/expresslog/com_android_modules_expresslog_Utils.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2023 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.
- */
-
-#define LOG_NAMESPACE "TeX.tag."
-#define LOG_TAG "TeX"
-
-#include <log/log.h>
-#include <nativehelper/scoped_local_ref.h>
-#include <nativehelper/scoped_utf_chars.h>
-#include <utils/hash/farmhash.h>
-
-// ----------------------------------------------------------------------------
-// JNI Glue
-// ----------------------------------------------------------------------------
-
-static jclass gStringClass = nullptr;
-
-/**
- * Class:     com_android_modules_expresslog_Utils
- * Method:    hashString
- * Signature: (Ljava/lang/String;)J
- */
-static jlong hashString(JNIEnv* env, jclass /*class*/, jstring metricNameObj) {
-    ScopedUtfChars name(env, metricNameObj);
-    if (name.c_str() == nullptr) {
-        return 0;
-    }
-
-    return static_cast<jlong>(farmhash::Fingerprint64(name.c_str(), name.size()));
-}
-
-static const JNINativeMethod gMethods[] = {
-        {"hashString", "(Ljava/lang/String;)J", (void*)hashString},
-};
-
-namespace android {
-
-int register_com_android_modules_expresslog_Utils(JNIEnv* env, const char* const utilsClassName) {
-    static const char* const kStringClassName = "java/lang/String";
-
-    ScopedLocalRef<jclass> utilsCls(env, env->FindClass(utilsClassName));
-    if (utilsCls.get() == nullptr) {
-        ALOGE("jni expresslog registration failure, class not found '%s'", utilsClassName);
-        return JNI_ERR;
-    }
-
-    jclass stringClass = env->FindClass(kStringClassName);
-    if (stringClass == nullptr) {
-        ALOGE("jni expresslog registration failure, class not found '%s'", kStringClassName);
-        return JNI_ERR;
-    }
-    gStringClass = static_cast<jclass>(env->NewGlobalRef(stringClass));
-    if (gStringClass == nullptr) {
-        ALOGE("jni expresslog Unable to create global reference '%s'", kStringClassName);
-        return JNI_ERR;
-    }
-
-    const jint count = sizeof(gMethods) / sizeof(gMethods[0]);
-    int status = env->RegisterNatives(utilsCls.get(), gMethods, count);
-    if (status < 0) {
-        ALOGE("jni expresslog registration failure, status: %d", status);
-        return JNI_ERR;
-    }
-    return JNI_VERSION_1_4;
-}
-
-int register_com_android_modules_expresslog_Utils(JNIEnv* env) {
-    static const char* const kUtilsClassName = "com/android/modules/expresslog/Utils";
-    return register_com_android_modules_expresslog_Utils(env, kUtilsClassName);
-}
-
-}  // namespace android