Merge "transcoding: Allow acquire service on low ram device."
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index dadea67..4255d88 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -1731,12 +1731,12 @@
         if (config.orientation != Configuration.ORIENTATION_LANDSCAPE) {
             return false;
         }
-        if ((mInputEditorInfo != null
-                && (mInputEditorInfo.imeOptions & EditorInfo.IME_FLAG_NO_FULLSCREEN) != 0)
+        if (mInputEditorInfo != null
+                && ((mInputEditorInfo.imeOptions & EditorInfo.IME_FLAG_NO_FULLSCREEN) != 0
                 // If app window has portrait orientation, regardless of what display orientation
                 // is, IME shouldn't use fullscreen-mode.
                 || (mInputEditorInfo.internalImeOptions
-                        & EditorInfo.IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT) != 0) {
+                        & EditorInfo.IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT) != 0)) {
             return false;
         }
         return true;
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 4f857ed..fa73eaf 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1148,7 +1148,7 @@
 
     <!-- The maximum offset in either direction that elements are moved vertically to prevent
          burn-in on AOD. -->
-    <dimen name="burn_in_prevention_offset_y_large_clock">42dp</dimen>
+    <dimen name="burn_in_prevention_offset_y_clock">42dp</dimen>
 
     <!-- Clock maximum font size (dp is intentional, to prevent any further scaling) -->
     <dimen name="large_clock_text_size">150dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index f77c052..d348954 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -32,12 +32,6 @@
  * Utility class to calculate the clock position and top padding of notifications on Keyguard.
  */
 public class KeyguardClockPositionAlgorithm {
-    /**
-     * How much the clock height influences the shade position.
-     * 0 means nothing, 1 means move the shade up by the height of the clock
-     * 0.5f means move the shade up by half of the size of the clock.
-     */
-    private static float CLOCK_HEIGHT_WEIGHT = 0.7f;
 
     /**
      * Margin between the bottom of the status view and the notification shade.
@@ -45,11 +39,6 @@
     private int mStatusViewBottomMargin;
 
     /**
-     * Height of the parent view - display size in px.
-     */
-    private int mHeight;
-
-    /**
      * Height of {@link KeyguardStatusView}.
      */
     private int mKeyguardStatusHeight;
@@ -68,21 +57,6 @@
     private int mUserSwitchPreferredY;
 
     /**
-     * Whether or not there is a custom clock face on keyguard.
-     */
-    private boolean mHasCustomClock;
-
-    /**
-     * Whether or not the NSSL contains any visible notifications.
-     */
-    private boolean mHasVisibleNotifs;
-
-    /**
-     * Height of notification stack: Sum of height of each notification.
-     */
-    private int mNotificationStackHeight;
-
-    /**
      * Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher
      * avatar.
      */
@@ -94,12 +68,6 @@
     private int mCutoutTopInset = 0;
 
     /**
-     * Maximum bottom padding to avoid overlap with {@link KeyguardBottomAreaView} or
-     * the ambient indication.
-     */
-    private int mMaxShadeBottom;
-
-    /**
      * Recommended distance from the status bar.
      */
     private int mContainerTopPadding;
@@ -115,14 +83,9 @@
     private int mBurnInPreventionOffsetX;
 
     /**
-     * Burn-in prevention y translation.
+     * Burn-in prevention y translation for clock layouts.
      */
-    private int mBurnInPreventionOffsetY;
-
-    /**
-     * Burn-in prevention y translation for large clock layouts.
-     */
-    private int mBurnInPreventionOffsetYLargeClock;
+    private int mBurnInPreventionOffsetYClock;
 
     /**
      * Doze/AOD transition amount.
@@ -160,34 +123,26 @@
                 res.getDimensionPixelSize(R.dimen.keyguard_clock_top_margin) / 2;
         mBurnInPreventionOffsetX = res.getDimensionPixelSize(
                 R.dimen.burn_in_prevention_offset_x);
-        mBurnInPreventionOffsetY = res.getDimensionPixelSize(
-                R.dimen.burn_in_prevention_offset_y);
-        mBurnInPreventionOffsetYLargeClock = res.getDimensionPixelSize(
-                R.dimen.burn_in_prevention_offset_y_large_clock);
+        mBurnInPreventionOffsetYClock = res.getDimensionPixelSize(
+                R.dimen.burn_in_prevention_offset_y_clock);
     }
 
     /**
      * Sets up algorithm values.
      */
-    public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom,
-            int notificationStackHeight, float panelExpansion, int parentHeight,
+    public void setup(int keyguardStatusBarHeaderHeight, float panelExpansion,
             int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY,
-            boolean hasCustomClock, boolean hasVisibleNotifs, float dark,
-            float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding,
-            float qsExpansion, int cutoutTopInset, boolean isSplitShade) {
+            float dark, float overStretchAmount, boolean bypassEnabled,
+            int unlockedStackScrollerPadding, float qsExpansion, int cutoutTopInset,
+            boolean isSplitShade) {
         mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding,
                 userSwitchHeight);
-        mMaxShadeBottom = maxShadeBottom;
-        mNotificationStackHeight = notificationStackHeight;
         mPanelExpansion = panelExpansion;
-        mHeight = parentHeight;
         mKeyguardStatusHeight = keyguardStatusHeight + mStatusViewBottomMargin;
         mUserSwitchHeight = userSwitchHeight;
         mUserSwitchPreferredY = userSwitchPreferredY;
-        mHasCustomClock = hasCustomClock;
-        mHasVisibleNotifs = hasVisibleNotifs;
         mDarkAmount = dark;
-        mOverStretchAmount = overStrechAmount;
+        mOverStretchAmount = overStretchAmount;
         mBypassEnabled = bypassEnabled;
         mUnlockedStackScrollerPadding = unlockedStackScrollerPadding;
         mQsExpansion = qsExpansion;
@@ -244,8 +199,8 @@
 
         // This will keep the clock at the top but out of the cutout area
         float shift = 0;
-        if (clockY - mBurnInPreventionOffsetYLargeClock < mCutoutTopInset) {
-            shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYLargeClock);
+        if (clockY - mBurnInPreventionOffsetYClock < mCutoutTopInset) {
+            shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYClock);
         }
         float clockYDark = clockY + burnInPreventionOffsetY() + shift;
 
@@ -281,7 +236,7 @@
     }
 
     private float burnInPreventionOffsetY() {
-        int offset = mBurnInPreventionOffsetYLargeClock;
+        int offset = mBurnInPreventionOffsetYClock;
 
         return getBurnInOffset(offset * 2, false /* xAxis */) - offset;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index b5eb90e..4ce3375 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -1406,8 +1406,6 @@
     }
 
     private void updateClockAppearance() {
-        int totalHeight = mView.getHeight();
-        int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
         int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard;
         boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
         final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
@@ -1428,14 +1426,11 @@
                 mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()
                         ? 1.0f : mInterpolatedDarkAmount;
         mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard,
-                totalHeight - bottomPadding,
-                mNotificationStackScrollLayoutController.getIntrinsicContentHeight(),
                 expandedFraction,
-                totalHeight,
                 mKeyguardStatusViewController.getLockscreenHeight(),
                 userIconHeight,
-                userSwitcherPreferredY, hasCustomClock(),
-                hasVisibleNotifications, darkamount, mOverStretchAmount,
+                userSwitcherPreferredY,
+                darkamount, mOverStretchAmount,
                 bypassEnabled, getUnlockedStackScrollerPadding(),
                 computeQsExpansionFraction(),
                 mDisplayTopInset,
diff --git a/packages/SystemUI/tests/AndroidManifest.xml b/packages/SystemUI/tests/AndroidManifest.xml
index 2c9c980..763a5cb 100644
--- a/packages/SystemUI/tests/AndroidManifest.xml
+++ b/packages/SystemUI/tests/AndroidManifest.xml
@@ -101,9 +101,9 @@
                   android:excludeFromRecents="true" />
 
         <provider
-            android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer"
+            android:name="androidx.startup.InitializationProvider"
             tools:replace="android:authorities"
-            android:authorities="${applicationId}.lifecycle-tests"
+            android:authorities="${applicationId}.startup-tests"
             android:exported="false"
             android:enabled="false"
             android:multiprocess="true" />
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
index 690b841..f34f21b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
@@ -31,42 +31,31 @@
 @SmallTest
 @RunWith(AndroidTestingRunner.class)
 public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
-
     private static final int SCREEN_HEIGHT = 2000;
     private static final int EMPTY_MARGIN = 0;
     private static final int EMPTY_HEIGHT = 0;
     private static final float ZERO_DRAG = 0.f;
     private static final float OPAQUE = 1.f;
     private static final float TRANSPARENT = 0.f;
-    private static final boolean HAS_CUSTOM_CLOCK = false;
-    private static final boolean HAS_VISIBLE_NOTIFS = false;
-
     private KeyguardClockPositionAlgorithm mClockPositionAlgorithm;
     private KeyguardClockPositionAlgorithm.Result mClockPosition;
-    private int mNotificationStackHeight;
     private float mPanelExpansion;
     private int mKeyguardStatusHeight;
     private float mDark;
-    private boolean mHasCustomClock;
-    private boolean mHasVisibleNotifs;
     private float mQsExpansion;
-    private int mCutoutTopInset = 0; // in pixels
+    private int mCutoutTopInsetPx = 0;
     private boolean mIsSplitShade = false;
 
     @Before
     public void setUp() {
         mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm();
         mClockPosition = new KeyguardClockPositionAlgorithm.Result();
-
-        mHasCustomClock = HAS_CUSTOM_CLOCK;
-        mHasVisibleNotifs = HAS_VISIBLE_NOTIFS;
     }
 
     @Test
     public void clockPositionTopOfScreenOnAOD() {
-        // GIVEN on AOD and both stack scroll and clock have 0 height
+        // GIVEN on AOD and clock has 0 height
         givenAOD();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = EMPTY_HEIGHT;
         // WHEN the clock position algorithm is run
         positionClock();
@@ -79,11 +68,10 @@
 
     @Test
     public void clockPositionBelowCutout() {
-        // GIVEN on AOD and both stack scroll and clock have 0 height
+        // GIVEN on AOD and clock has 0 height
         givenAOD();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = EMPTY_HEIGHT;
-        mCutoutTopInset = 300;
+        mCutoutTopInsetPx = 300;
         // WHEN the clock position algorithm is run
         positionClock();
         // THEN the clock Y position is below the cutout
@@ -97,7 +85,6 @@
     public void clockPositionAdjustsForKeyguardStatusOnAOD() {
         // GIVEN on AOD with a clock of height 100
         givenAOD();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = 100;
         // WHEN the clock position algorithm is run
         positionClock();
@@ -112,7 +99,6 @@
     public void clockPositionLargeClockOnAOD() {
         // GIVEN on AOD with a full screen clock
         givenAOD();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = SCREEN_HEIGHT;
         // WHEN the clock position algorithm is run
         positionClock();
@@ -125,9 +111,8 @@
 
     @Test
     public void clockPositionTopOfScreenOnLockScreen() {
-        // GIVEN on lock screen with stack scroll and clock of 0 height
+        // GIVEN on lock screen with clock of 0 height
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = EMPTY_HEIGHT;
         // WHEN the clock position algorithm is run
         positionClock();
@@ -138,24 +123,9 @@
     }
 
     @Test
-    public void clockPositionWithStackScrollExpandOnLockScreen() {
-        // GIVEN on lock screen with stack scroll of height 500
-        givenLockScreen();
-        mNotificationStackHeight = 500;
-        mKeyguardStatusHeight = EMPTY_HEIGHT;
-        // WHEN the clock position algorithm is run
-        positionClock();
-        // THEN the clock Y position stays to the top
-        assertThat(mClockPosition.clockY).isEqualTo(0);
-        // AND the clock is positioned on the left.
-        assertThat(mClockPosition.clockX).isEqualTo(0);
-    }
-
-    @Test
     public void clockPositionWithPartialDragOnLockScreen() {
         // GIVEN dragging up on lock screen
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = EMPTY_HEIGHT;
         mPanelExpansion = 0.5f;
         // WHEN the clock position algorithm is run
@@ -171,7 +141,6 @@
     public void clockPositionWithFullDragOnLockScreen() {
         // GIVEN the lock screen is dragged up
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = EMPTY_HEIGHT;
         mPanelExpansion = 0.f;
         // WHEN the clock position algorithm is run
@@ -184,7 +153,6 @@
     public void largeClockOnLockScreenIsTransparent() {
         // GIVEN on lock screen with a full screen clock
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = SCREEN_HEIGHT;
         // WHEN the clock position algorithm is run
         positionClock();
@@ -194,9 +162,8 @@
 
     @Test
     public void notifPositionTopOfScreenOnAOD() {
-        // GIVEN on AOD and both stack scroll and clock have 0 height
+        // GIVEN on AOD and clock has 0 height
         givenAOD();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = EMPTY_HEIGHT;
         // WHEN the position algorithm is run
         positionClock();
@@ -208,7 +175,6 @@
     public void notifPositionIndependentOfKeyguardStatusHeightOnAOD() {
         // GIVEN on AOD and clock has a nonzero height
         givenAOD();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = 100;
         // WHEN the position algorithm is run
         positionClock();
@@ -220,7 +186,6 @@
     public void notifPositionWithLargeClockOnAOD() {
         // GIVEN on AOD and clock has a nonzero height
         givenAOD();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = SCREEN_HEIGHT;
         // WHEN the position algorithm is run
         positionClock();
@@ -230,9 +195,8 @@
 
     @Test
     public void notifPositionMiddleOfScreenOnLockScreen() {
-        // GIVEN on lock screen and both stack scroll and clock have 0 height
+        // GIVEN on lock screen and clock has 0 height
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = EMPTY_HEIGHT;
         // WHEN the position algorithm is run
         positionClock();
@@ -241,47 +205,20 @@
     }
 
     @Test
-    public void notifPositionAdjustsForStackHeightOnLockScreen() {
-        // GIVEN on lock screen and stack scroller has a nonzero height
-        givenLockScreen();
-        mNotificationStackHeight = 500;
-        mKeyguardStatusHeight = EMPTY_HEIGHT;
-        // WHEN the position algorithm is run
-        positionClock();
-        // THEN the notif padding adjusts for keyguard status height
-        assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
-    }
-
-    @Test
     public void notifPositionAdjustsForClockHeightOnLockScreen() {
         // GIVEN on lock screen and stack scroller has a nonzero height
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = 200;
         // WHEN the position algorithm is run
         positionClock();
-        // THEN the notif padding adjusts for both clock and notif stack.
-        assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
-    }
-
-    @Test
-    public void notifPositionAdjustsForStackHeightAndClockHeightOnLockScreen() {
-        // GIVEN on lock screen and stack scroller has a nonzero height
-        givenLockScreen();
-        mNotificationStackHeight = 500;
-        mKeyguardStatusHeight = 200;
-        // WHEN the position algorithm is run
-        positionClock();
-        // THEN the notifs are placed below the statusview
         assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
     }
 
     @Test
     public void notifPositionAlignedWithClockInSplitShadeMode() {
-        // GIVEN on lock screen and split shade mode
         givenLockScreen();
         mIsSplitShade = true;
-        mHasCustomClock = true;
+        mKeyguardStatusHeight = 200;
         // WHEN the position algorithm is run
         positionClock();
         // THEN the notif padding DOESN'T adjust for keyguard status height.
@@ -292,7 +229,6 @@
     public void notifPositionWithLargeClockOnLockScreen() {
         // GIVEN on lock screen and clock has a nonzero height
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = SCREEN_HEIGHT;
         // WHEN the position algorithm is run
         positionClock();
@@ -304,7 +240,6 @@
     public void notifPositionWithFullDragOnLockScreen() {
         // GIVEN the lock screen is dragged up
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = EMPTY_HEIGHT;
         mPanelExpansion = 0.f;
         // WHEN the clock position algorithm is run
@@ -317,19 +252,17 @@
     public void notifPositionWithLargeClockFullDragOnLockScreen() {
         // GIVEN the lock screen is dragged up and a full screen clock
         givenLockScreen();
-        mNotificationStackHeight = EMPTY_HEIGHT;
         mKeyguardStatusHeight = SCREEN_HEIGHT;
         mPanelExpansion = 0.f;
         // WHEN the clock position algorithm is run
         positionClock();
-        // THEN the notif padding is zero.
         assertThat(mClockPosition.stackScrollerPadding).isEqualTo(
                 (int) (mKeyguardStatusHeight * .667f));
     }
 
     @Test
     public void clockHiddenWhenQsIsExpanded() {
-        // GIVEN on the lock screen with a custom clock and visible notifications
+        // GIVEN on the lock screen with visible notifications
         givenLockScreen();
         mQsExpansion = 1;
         // WHEN the clock position algorithm is run
@@ -349,12 +282,11 @@
     }
 
     private void positionClock() {
-        mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
-                mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight,
+        mClockPositionAlgorithm.setup(EMPTY_MARGIN, mPanelExpansion, mKeyguardStatusHeight,
                 0 /* userSwitchHeight */, 0 /* userSwitchPreferredY */,
-                mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */,
+                mDark, ZERO_DRAG, false /* bypassEnabled */,
                 0 /* unlockedStackScrollerPadding */, mQsExpansion,
-                mCutoutTopInset, mIsSplitShade);
+                mCutoutTopInsetPx, mIsSplitShade);
         mClockPositionAlgorithm.run(mClockPosition);
     }
 }
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 689890f..c87a6fa 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -154,7 +154,7 @@
         "android.hardware.configstore-V1.0-java",
         "android.hardware.contexthub-V1.0-java",
         "android.hardware.rebootescrow-V1-java",
-        "android.hardware.soundtrigger-V2.4-java",
+        "android.hardware.soundtrigger-V2.3-java",
         "android.hardware.power.stats-V1-java",
         "android.hidl.manager-V1.2-java",
         "capture_state_listener-aidl-java",
diff --git a/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerHw2Compat.java b/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerHw2Compat.java
index 7a1f775..c638201 100644
--- a/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerHw2Compat.java
+++ b/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerHw2Compat.java
@@ -60,7 +60,6 @@
     private @Nullable android.hardware.soundtrigger.V2_1.ISoundTriggerHw mUnderlying_2_1;
     private @Nullable android.hardware.soundtrigger.V2_2.ISoundTriggerHw mUnderlying_2_2;
     private @Nullable android.hardware.soundtrigger.V2_3.ISoundTriggerHw mUnderlying_2_3;
-    private @Nullable android.hardware.soundtrigger.V2_4.ISoundTriggerHw mUnderlying_2_4;
 
     // HAL <=2.1 requires us to pass a callback argument to startRecognition. We will store the one
     // passed on load and then pass it on start. We don't bother storing the callback on newer
@@ -89,13 +88,10 @@
             ICaptureStateNotifier notifier) {
         SoundTriggerHw2Compat compat = new SoundTriggerHw2Compat(binder, rebootRunnable);
         ISoundTriggerHal result = compat;
-        // Add max model limiter for versions <2.4.
-        if (compat.mUnderlying_2_4 == null) {
-            result = new SoundTriggerHalMaxModelLimiter(result,
-                    compat.mProperties.maxSoundModels);
-        }
-        // Add concurrent capture handler for versions <2.4 which do not support concurrent capture.
-        if (compat.mUnderlying_2_4 == null && !compat.mProperties.concurrentCapture) {
+        // Add max model limiter for versions.
+        result = new SoundTriggerHalMaxModelLimiter(result, compat.mProperties.maxSoundModels);
+        // Add concurrent capture handler for HALs which do not support concurrent capture.
+        if (!compat.mProperties.concurrentCapture) {
             result = new SoundTriggerHalConcurrentCaptureHandler(result, notifier);
         }
         return result;
@@ -113,21 +109,11 @@
         // version, so we go down the versions in descending order to find the latest one supported,
         // and then simply up-cast it to obtain all the versions that are earlier.
 
-        // Attempt 2.4
-        android.hardware.soundtrigger.V2_4.ISoundTriggerHw as2_4 =
-                android.hardware.soundtrigger.V2_4.ISoundTriggerHw.asInterface(binder);
-        if (as2_4 != null) {
-            mUnderlying_2_0 =
-                    mUnderlying_2_1 = mUnderlying_2_2 = mUnderlying_2_3 = mUnderlying_2_4 = as2_4;
-            return;
-        }
-
         // Attempt 2.3
         android.hardware.soundtrigger.V2_3.ISoundTriggerHw as2_3 =
                 android.hardware.soundtrigger.V2_3.ISoundTriggerHw.asInterface(binder);
         if (as2_3 != null) {
             mUnderlying_2_0 = mUnderlying_2_1 = mUnderlying_2_2 = mUnderlying_2_3 = as2_3;
-            mUnderlying_2_4 = null;
             return;
         }
 
@@ -136,7 +122,7 @@
                 android.hardware.soundtrigger.V2_2.ISoundTriggerHw.asInterface(binder);
         if (as2_2 != null) {
             mUnderlying_2_0 = mUnderlying_2_1 = mUnderlying_2_2 = as2_2;
-            mUnderlying_2_3 = mUnderlying_2_4 = null;
+            mUnderlying_2_3 = null;
             return;
         }
 
@@ -145,7 +131,7 @@
                 android.hardware.soundtrigger.V2_1.ISoundTriggerHw.asInterface(binder);
         if (as2_1 != null) {
             mUnderlying_2_0 = mUnderlying_2_1 = as2_1;
-            mUnderlying_2_2 = mUnderlying_2_3 = mUnderlying_2_4 = null;
+            mUnderlying_2_2 = mUnderlying_2_3 = null;
             return;
         }
 
@@ -154,7 +140,7 @@
                 android.hardware.soundtrigger.V2_0.ISoundTriggerHw.asInterface(binder);
         if (as2_0 != null) {
             mUnderlying_2_0 = as2_0;
-            mUnderlying_2_1 = mUnderlying_2_2 = mUnderlying_2_3 = mUnderlying_2_4 = null;
+            mUnderlying_2_1 = mUnderlying_2_2 = mUnderlying_2_3 = null;
             return;
         }
 
@@ -213,16 +199,8 @@
 
     @Override
     public void registerCallback(GlobalCallback callback) {
-        try {
-            try {
-                as2_4().registerGlobalCallback(new GlobalCallbackWrapper(callback));
-            } catch (NotSupported e) {
-                // In versions < 2.4 the events represented by this callback don't exist, we can
-                // safely ignore this.
-            }
-        } catch (RemoteException e) {
-            throw e.rethrowAsRuntimeException();
-        }
+        // In versions 2.x the events represented by this callback don't exist, we can
+        // safely ignore this.
     }
 
     @Override
@@ -232,29 +210,18 @@
         try {
             AtomicInteger retval = new AtomicInteger(-1);
             AtomicInteger handle = new AtomicInteger(0);
-
             try {
-                as2_4().loadSoundModel_2_4(hidlModel, new ModelCallbackWrapper(callback),
+                as2_1().loadSoundModel_2_1(hidlModel, new ModelCallbackWrapper(callback),
+                        0,
                         (r, h) -> {
                             retval.set(r);
                             handle.set(h);
                         });
-                handleHalStatusAllowBusy(retval.get(), "loadSoundModel_2_4");
-            } catch (NotSupported e) {
-                // Fall-back to the 2.1 version:
-                try {
-                    as2_1().loadSoundModel_2_1(hidlModel, new ModelCallbackWrapper(callback),
-                            0,
-                            (r, h) -> {
-                                retval.set(r);
-                                handle.set(h);
-                            });
-                    handleHalStatus(retval.get(), "loadSoundModel_2_1");
-                    mModelCallbacks.put(handle.get(), callback);
-                } catch (NotSupported ee) {
-                    // Fall-back to the 2.0 version:
-                    return loadSoundModel_2_0(hidlModel, callback);
-                }
+                handleHalStatus(retval.get(), "loadSoundModel_2_1");
+                mModelCallbacks.put(handle.get(), callback);
+            } catch (NotSupported ee) {
+                // Fall-back to the 2.0 version:
+                return loadSoundModel_2_0(hidlModel, callback);
             }
             return handle.get();
         } catch (RemoteException e) {
@@ -270,27 +237,17 @@
             AtomicInteger retval = new AtomicInteger(-1);
             AtomicInteger handle = new AtomicInteger(0);
             try {
-                as2_4().loadPhraseSoundModel_2_4(hidlModel, new ModelCallbackWrapper(callback),
+                as2_1().loadPhraseSoundModel_2_1(hidlModel, new ModelCallbackWrapper(callback),
+                        0,
                         (r, h) -> {
                             retval.set(r);
                             handle.set(h);
                         });
-                handleHalStatusAllowBusy(retval.get(), "loadPhraseSoundModel_2_4");
-            } catch (NotSupported e) {
-                // Fall-back to the 2.1 version:
-                try {
-                    as2_1().loadPhraseSoundModel_2_1(hidlModel, new ModelCallbackWrapper(callback),
-                            0,
-                            (r, h) -> {
-                                retval.set(r);
-                                handle.set(h);
-                            });
-                    handleHalStatus(retval.get(), "loadPhraseSoundModel_2_1");
-                    mModelCallbacks.put(handle.get(), callback);
-                } catch (NotSupported ee) {
-                    // Fall-back to the 2.0 version:
-                    return loadPhraseSoundModel_2_0(hidlModel, callback);
-                }
+                handleHalStatus(retval.get(), "loadPhraseSoundModel_2_1");
+                mModelCallbacks.put(handle.get(), callback);
+            } catch (NotSupported ee) {
+                // Fall-back to the 2.0 version:
+                return loadPhraseSoundModel_2_0(hidlModel, callback);
             }
             return handle.get();
         } catch (RemoteException e) {
@@ -328,17 +285,11 @@
                 ConversionUtil.aidl2hidlRecognitionConfig(config, deviceHandle, ioHandle);
         try {
             try {
-                int retval = as2_4().startRecognition_2_4(modelHandle, hidlConfig);
-                handleHalStatusAllowBusy(retval, "startRecognition_2_4");
-            } catch (NotSupported e) {
-                // Fall-back to the 2.3 version:
-                try {
-                    int retval = as2_3().startRecognition_2_3(modelHandle, hidlConfig);
-                    handleHalStatus(retval, "startRecognition_2_3");
-                } catch (NotSupported ee) {
-                    // Fall-back to the 2.0 version:
-                    startRecognition_2_1(modelHandle, hidlConfig);
-                }
+                int retval = as2_3().startRecognition_2_3(modelHandle, hidlConfig);
+                handleHalStatus(retval, "startRecognition_2_3");
+            } catch (NotSupported ee) {
+                // Fall-back to the 2.0 version:
+                startRecognition_2_1(modelHandle, hidlConfig);
             }
         } catch (RemoteException e) {
             throw e.rethrowAsRuntimeException();
@@ -551,14 +502,6 @@
         return mUnderlying_2_3;
     }
 
-    private @NonNull
-    android.hardware.soundtrigger.V2_4.ISoundTriggerHw as2_4() throws NotSupported {
-        if (mUnderlying_2_4 == null) {
-            throw new NotSupported("Underlying driver version < 2.4");
-        }
-        return mUnderlying_2_4;
-    }
-
     /**
      * A checked exception representing the requested interface version not being supported.
      * At the public interface layer, use {@link #throwAsRecoverableException()} to propagate it to
@@ -580,22 +523,8 @@
         }
     }
 
-    private static class GlobalCallbackWrapper extends
-            android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback.Stub {
-        private final @NonNull GlobalCallback mDelegate;
-
-        private GlobalCallbackWrapper(@NonNull GlobalCallback delegate) {
-            mDelegate = delegate;
-        }
-
-        @Override
-        public void onResourcesAvailable() {
-            mDelegate.onResourcesAvailable();
-        }
-    }
-
     private static class ModelCallbackWrapper extends
-            android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback.Stub {
+            android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback.Stub {
         private final @NonNull ModelCallback mDelegate;
 
         private ModelCallbackWrapper(
@@ -604,11 +533,6 @@
         }
 
         @Override
-        public void modelUnloaded(int modelHandle) {
-            mDelegate.modelUnloaded(modelHandle);
-        }
-
-        @Override
         public void recognitionCallback_2_1(
                 android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback.RecognitionEvent event,
                 int cookie) {
diff --git a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/SoundHw2CompatTest.java b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/SoundHw2CompatTest.java
index 1947481..3f8cf9c 100644
--- a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/SoundHw2CompatTest.java
+++ b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/SoundHw2CompatTest.java
@@ -76,7 +76,7 @@
     public static Iterable<Object[]> data() {
         List<Object[]> result = new LinkedList<>();
 
-        for (String version : new String[]{"V2_0", "V2_1", "V2_2", "V2_3", "V2_4",}) {
+        for (String version : new String[]{"V2_0", "V2_1", "V2_2", "V2_3",}) {
             for (boolean concurrentCapture : new boolean[]{false, true}) {
                 result.add(new Object[]{version, concurrentCapture});
             }
@@ -113,9 +113,7 @@
                         || descriptor.equals("android.hardware.soundtrigger@2.2::ISoundTriggerHw")
                         && mHalDriver instanceof android.hardware.soundtrigger.V2_2.ISoundTriggerHw
                         || descriptor.equals("android.hardware.soundtrigger@2.3::ISoundTriggerHw")
-                        && mHalDriver instanceof android.hardware.soundtrigger.V2_3.ISoundTriggerHw
-                        || descriptor.equals("android.hardware.soundtrigger@2.4::ISoundTriggerHw")
-                        && mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
+                        && mHalDriver instanceof android.hardware.soundtrigger.V2_3.ISoundTriggerHw) {
                     return mHalDriver;
                 }
                 return null;
@@ -269,44 +267,9 @@
         return handle;
     }
 
-    private int loadGenericModel_2_4(ISoundTriggerHal.ModelCallback canonicalCallback)
-            throws Exception {
-        final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
-                (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
-        final int handle = 29;
-        ArgumentCaptor<android.hardware.soundtrigger.V2_1.ISoundTriggerHw.SoundModel> modelCaptor =
-                ArgumentCaptor.forClass(
-                        android.hardware.soundtrigger.V2_1.ISoundTriggerHw.SoundModel.class);
-        ArgumentCaptor<android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback> callbackCaptor =
-                ArgumentCaptor.forClass(
-                        android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback.class);
-
-        doAnswer(invocation -> {
-            android.hardware.soundtrigger.V2_4.ISoundTriggerHw.loadSoundModel_2_4Callback
-                    resultCallback = invocation.getArgument(2);
-
-            // This is the return of this method.
-            resultCallback.onValues(0, handle);
-            return null;
-        }).when(driver_2_4).loadSoundModel_2_4(any(), any(), any());
-
-        assertEquals(handle,
-                mCanonical.loadSoundModel(TestUtil.createGenericSoundModel(), canonicalCallback));
-
-        verify(driver_2_4).loadSoundModel_2_4(modelCaptor.capture(), callbackCaptor.capture(),
-                any());
-
-        TestUtil.validateGenericSoundModel_2_1(modelCaptor.getValue());
-        validateCallback_2_4(callbackCaptor.getValue(), canonicalCallback);
-        return handle;
-    }
-
     private int loadGenericModel(ISoundTriggerHal.ModelCallback canonicalCallback)
             throws Exception {
-        if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
-            return loadGenericModel_2_4(canonicalCallback);
-        } else if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
+        if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
             return loadGenericModel_2_1(canonicalCallback);
         } else {
             return loadGenericModel_2_0(canonicalCallback);
@@ -322,8 +285,6 @@
 
     @Test
     public void testMaxModels() throws Exception {
-        assumeFalse(mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw);
-
         // Register global callback.
         ISoundTriggerHal.GlobalCallback globalCallback = mock(
                 ISoundTriggerHal.GlobalCallback.class);
@@ -358,37 +319,6 @@
         verify(globalCallback).onResourcesAvailable();
     }
 
-    private void testLoadGenericModelBusy_2_4() throws Exception {
-        final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
-                (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
-        doAnswer(invocation -> {
-            android.hardware.soundtrigger.V2_4.ISoundTriggerHw.loadSoundModel_2_4Callback
-                    resultCallback = invocation.getArgument(2);
-
-            // This is the return of this method.
-            resultCallback.onValues(-OsConstants.EBUSY, 0);
-            return null;
-        }).when(driver_2_4).loadSoundModel_2_4(any(), any(), any());
-
-        ISoundTriggerHal.ModelCallback canonicalCallback = mock(
-                ISoundTriggerHal.ModelCallback.class);
-        try {
-            mCanonical.loadSoundModel(TestUtil.createGenericSoundModel(), canonicalCallback);
-            fail("Expected an exception");
-        } catch (RecoverableException e) {
-            assertEquals(Status.RESOURCE_CONTENTION, e.errorCode);
-        }
-        verify(driver_2_4).loadSoundModel_2_4(any(), any(), any());
-    }
-
-    @Test
-    public void testLoadGenericModelBusy() throws Exception {
-        if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
-            testLoadGenericModelBusy_2_4();
-        }
-    }
-
     private int loadPhraseModel_2_0(ISoundTriggerHal.ModelCallback canonicalCallback)
             throws Exception {
         final int handle = 29;
@@ -452,43 +382,8 @@
         return handle;
     }
 
-    private int loadPhraseModel_2_4(ISoundTriggerHal.ModelCallback canonicalCallback)
-            throws Exception {
-        final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
-                (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
-        final int handle = 29;
-        ArgumentCaptor<android.hardware.soundtrigger.V2_1.ISoundTriggerHw.PhraseSoundModel>
-                modelCaptor = ArgumentCaptor.forClass(
-                android.hardware.soundtrigger.V2_1.ISoundTriggerHw.PhraseSoundModel.class);
-        ArgumentCaptor<android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback> callbackCaptor =
-                ArgumentCaptor.forClass(
-                        android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback.class);
-
-        doAnswer(invocation -> {
-            android.hardware.soundtrigger.V2_4.ISoundTriggerHw.loadPhraseSoundModel_2_4Callback
-                    resultCallback = invocation.getArgument(2);
-
-            // This is the return of this method.
-            resultCallback.onValues(0, handle);
-            return null;
-        }).when(driver_2_4).loadPhraseSoundModel_2_4(any(), any(), any());
-
-        assertEquals(handle, mCanonical.loadPhraseSoundModel(TestUtil.createPhraseSoundModel(),
-                canonicalCallback));
-
-        verify(driver_2_4).loadPhraseSoundModel_2_4(modelCaptor.capture(), callbackCaptor.capture(),
-                any());
-
-        TestUtil.validatePhraseSoundModel_2_1(modelCaptor.getValue());
-        validateCallback_2_4(callbackCaptor.getValue(), canonicalCallback);
-        return handle;
-    }
-
     public int loadPhraseModel(ISoundTriggerHal.ModelCallback canonicalCallback) throws Exception {
-        if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
-            return loadPhraseModel_2_4(canonicalCallback);
-        } else if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
+        if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
             return loadPhraseModel_2_1(canonicalCallback);
         } else {
             return loadPhraseModel_2_0(canonicalCallback);
@@ -502,37 +397,6 @@
         loadPhraseModel(canonicalCallback);
     }
 
-    private void testLoadPhraseModelBusy_2_4() throws Exception {
-        final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
-                (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
-        doAnswer(invocation -> {
-            android.hardware.soundtrigger.V2_4.ISoundTriggerHw.loadPhraseSoundModel_2_4Callback
-                    resultCallback = invocation.getArgument(2);
-
-            // This is the return of this method.
-            resultCallback.onValues(-OsConstants.EBUSY, 0);
-            return null;
-        }).when(driver_2_4).loadPhraseSoundModel_2_4(any(), any(), any());
-
-        ISoundTriggerHal.ModelCallback canonicalCallback = mock(
-                ISoundTriggerHal.ModelCallback.class);
-        try {
-            mCanonical.loadPhraseSoundModel(TestUtil.createPhraseSoundModel(), canonicalCallback);
-            fail("Expected an exception");
-        } catch (RecoverableException e) {
-            assertEquals(Status.RESOURCE_CONTENTION, e.errorCode);
-        }
-        verify(driver_2_4).loadPhraseSoundModel_2_4(any(), any(), any());
-    }
-
-    @Test
-    public void testLoadPhraseModelBusy() throws Exception {
-        if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
-            testLoadPhraseModelBusy_2_4();
-        }
-    }
-
     @Test
     public void testUnloadModel() throws Exception {
         mCanonical.unloadSoundModel(14);
@@ -596,25 +460,9 @@
         TestUtil.validateRecognitionConfig_2_3(configCaptor.getValue(), 808, 909);
     }
 
-    private void startRecognition_2_4(int handle) throws Exception {
-        final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
-                (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-        ArgumentCaptor<android.hardware.soundtrigger.V2_3.RecognitionConfig> configCaptor =
-                ArgumentCaptor.forClass(android.hardware.soundtrigger.V2_3.RecognitionConfig.class);
-
-        when(driver_2_4.startRecognition_2_4(eq(handle), any())).thenReturn(0);
-
-        RecognitionConfig config = TestUtil.createRecognitionConfig();
-        mCanonical.startRecognition(handle, 21, 22, config);
-        verify(driver_2_4).startRecognition_2_4(eq(handle), configCaptor.capture());
-        TestUtil.validateRecognitionConfig_2_3(configCaptor.getValue(), 21, 22);
-    }
-
     private void startRecognition(int handle, ISoundTriggerHal.ModelCallback canonicalCallback)
             throws Exception {
-        if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
-            startRecognition_2_4(handle);
-        } else if (mHalDriver instanceof android.hardware.soundtrigger.V2_3.ISoundTriggerHw) {
+        if (mHalDriver instanceof android.hardware.soundtrigger.V2_3.ISoundTriggerHw) {
             startRecognition_2_3(handle);
         } else if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
             startRecognition_2_1(handle, canonicalCallback);
@@ -634,41 +482,9 @@
         startRecognition(handle, canonicalCallback);
     }
 
-    private void testStartRecognitionBusy_2_4() throws Exception {
-        final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
-                (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
-        final int handle = 68;
-        when(driver_2_4.startRecognition_2_4(eq(handle), any())).thenReturn(-OsConstants.EBUSY);
-
-        RecognitionConfig config = TestUtil.createRecognitionConfig();
-        try {
-            mCanonical.startRecognition(handle, 34, 35, config);
-            fail("Expected an exception");
-        } catch (RecoverableException e) {
-            assertEquals(Status.RESOURCE_CONTENTION, e.errorCode);
-        }
-        verify(driver_2_4).startRecognition_2_4(eq(handle), any());
-    }
-
-    @Test
-    public void testStartRecognitionBusy() throws Exception {
-        if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
-            testStartRecognitionBusy_2_4();
-        }
-    }
-
-    @Test
-    public void testNoRegisterCaptureStateListener() {
-        assumeTrue(mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw
-                || mSupportConcurrentCapture);
-        verify(mCaptureStateNotifier, never()).registerListener(any());
-    }
-
     @Test
     public void testConcurrentCaptureAbort() throws Exception {
-        assumeFalse(mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw
-                || mSupportConcurrentCapture);
+        assumeFalse(mSupportConcurrentCapture);
         verify(mCaptureStateNotifier, atLeast(1)).registerListener(any());
 
         // Register global callback.
@@ -707,8 +523,7 @@
 
     @Test
     public void testConcurrentCaptureReject() throws Exception {
-        assumeFalse(mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw
-                || mSupportConcurrentCapture);
+        assumeFalse(mSupportConcurrentCapture);
         verify(mCaptureStateNotifier, atLeast(1)).registerListener(any());
 
         // Register global callback.
@@ -858,28 +673,9 @@
         // We just care that it doesn't throw.
     }
 
-    private void testGlobalCallback_2_4() throws Exception {
-        android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
-                (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
-        ISoundTriggerHal.GlobalCallback canonicalCallback = mock(
-                ISoundTriggerHal.GlobalCallback.class);
-        mCanonical.registerCallback(canonicalCallback);
-
-        ArgumentCaptor<android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback>
-                callbackCaptor = ArgumentCaptor.forClass(
-                android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback.class);
-        verify(driver_2_4).registerGlobalCallback(callbackCaptor.capture());
-        validateGlobalCallback_2_4(callbackCaptor.getValue(), canonicalCallback);
-    }
-
     @Test
     public void testGlobalCallback() throws Exception {
-        if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
-            testGlobalCallback_2_4();
-        } else {
-            testGlobalCallback_2_0();
-        }
+        testGlobalCallback_2_0();
     }
 
     @Test
@@ -908,14 +704,6 @@
         verify(mHalDriver).interfaceDescriptor();
     }
 
-    private void validateGlobalCallback_2_4(
-            android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback hwCallback,
-            ISoundTriggerHal.GlobalCallback canonicalCallback) throws Exception {
-        hwCallback.onResourcesAvailable();
-        mCanonical.flushCallbacks();
-        verify(canonicalCallback).onResourcesAvailable();
-    }
-
     private void validateCallback_2_0(
             android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback hwCallback,
             ISoundTriggerHal.ModelCallback canonicalCallback) throws Exception {
@@ -985,48 +773,6 @@
         clearInvocations(canonicalCallback);
     }
 
-    private void validateCallback_2_4(
-            android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback hwCallback,
-            ISoundTriggerHal.ModelCallback canonicalCallback) throws Exception {
-        {
-            final int handle = 85;
-            final int status =
-                    android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback.RecognitionStatus.ABORT;
-            ArgumentCaptor<RecognitionEvent> eventCaptor = ArgumentCaptor.forClass(
-                    RecognitionEvent.class);
-
-            hwCallback.recognitionCallback_2_1(TestUtil.createRecognitionEvent_2_1(handle, status),
-                    99);
-            mCanonical.flushCallbacks();
-            verify(canonicalCallback).recognitionCallback(eq(handle), eventCaptor.capture());
-            TestUtil.validateRecognitionEvent(eventCaptor.getValue(), RecognitionStatus.ABORTED);
-        }
-
-        {
-            final int handle = 92;
-            final int status =
-                    android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback.RecognitionStatus.SUCCESS;
-            ArgumentCaptor<PhraseRecognitionEvent> eventCaptor = ArgumentCaptor.forClass(
-                    PhraseRecognitionEvent.class);
-
-            hwCallback.phraseRecognitionCallback_2_1(
-                    TestUtil.createPhraseRecognitionEvent_2_1(handle, status), 99);
-            mCanonical.flushCallbacks();
-            verify(canonicalCallback).phraseRecognitionCallback(eq(handle), eventCaptor.capture());
-            TestUtil.validatePhraseRecognitionEvent(eventCaptor.getValue(),
-                    RecognitionStatus.SUCCESS);
-        }
-
-        {
-            final int handle = 23;
-            hwCallback.modelUnloaded(handle);
-            mCanonical.flushCallbacks();
-            verify(canonicalCallback).modelUnloaded(handle);
-        }
-        verifyNoMoreInteractions(canonicalCallback);
-        clearInvocations(canonicalCallback);
-    }
-
     public static class CaptureStateNotifier implements ICaptureStateNotifier {
         private final List<Listener> mListeners = new LinkedList<>();
 
diff --git a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/TestUtil.java b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/TestUtil.java
index 6ed9dde..f54f144 100644
--- a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/TestUtil.java
+++ b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/TestUtil.java
@@ -22,7 +22,7 @@
 
 import android.annotation.NonNull;
 import android.hardware.soundtrigger.V2_1.ISoundTriggerHw;
-import android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback;
+import android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback;
 import android.media.AudioFormat;
 import android.media.MediaFormat;
 import android.media.audio.common.AudioChannelLayout;