Fix class merging bug with min API<N and default library methods

Bug: b/435466316
Change-Id: I84a90c82123e01ab42b3d21b68efef249fadaa65
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/PreventClassMethodAndDefaultMethodCollisions.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/PreventClassMethodAndDefaultMethodCollisions.java
index 064b2e0..656e8ab 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/PreventClassMethodAndDefaultMethodCollisions.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/PreventClassMethodAndDefaultMethodCollisions.java
@@ -1,7 +1,6 @@
 // Copyright (c) 2020, the R8 project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-
 package com.android.tools.r8.horizontalclassmerging.policies;
 
 import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
@@ -182,10 +181,4 @@
     }
     return removeTrivialGroups(newGroups.values());
   }
-
-  @Override
-  public boolean shouldSkipPolicy() {
-    return appView.options().isGeneratingDex()
-        && !appView.options().canUseDefaultAndStaticInterfaceMethods();
-  }
 }
diff --git a/src/test/java/com/android/tools/r8/classmerging/horizontal/DefaultInterfaceMethodCollisionWithClassMethodAfterClassMergingTest.java b/src/test/java/com/android/tools/r8/classmerging/horizontal/DefaultInterfaceMethodCollisionWithClassMethodAfterClassMergingTest.java
index 0c96b97..7c8d366 100644
--- a/src/test/java/com/android/tools/r8/classmerging/horizontal/DefaultInterfaceMethodCollisionWithClassMethodAfterClassMergingTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/horizontal/DefaultInterfaceMethodCollisionWithClassMethodAfterClassMergingTest.java
@@ -12,6 +12,7 @@
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.apimodel.ApiModelingTestHelper;
 import com.android.tools.r8.utils.AndroidApiLevel;
+import com.android.tools.r8.utils.codeinspector.HorizontallyMergedClassesInspector;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -57,12 +58,7 @@
         .addLibraryFiles(ToolHelper.getMostRecentAndroidJar())
         .addKeepClassAndMembersRules(Main.class)
         .addHorizontallyMergedClassesInspector(
-            inspector ->
-                inspector
-                    .applyIf(
-                        !parameters.canUseDefaultAndStaticInterfaceMethods(),
-                        i -> i.assertIsCompleteMergeGroup(A.class, B.class))
-                    .assertNoOtherClassesMerged())
+            HorizontallyMergedClassesInspector::assertNoClassesMerged)
         .apply(ApiModelingTestHelper.setMockApiLevelForClass(I.class, AndroidApiLevel.B))
         .apply(
             ApiModelingTestHelper.setMockApiLevelForMethod(
@@ -73,7 +69,7 @@
         .applyIf(
             parameters.canUseDefaultAndStaticInterfaceMethods(),
             rr -> rr.assertSuccessWithOutputLines("I", "B"),
-            rr -> rr.assertSuccessWithOutputLines("B", "B"));
+            rr -> rr.assertSuccessWithOutputLines("Caught java.lang.AbstractMethodError", "B"));
   }
 
   static class Main {
@@ -81,7 +77,7 @@
     public static void main(String[] args) {
       try {
         test(new A());
-      } catch (Exception e) {
+      } catch (AbstractMethodError e) {
         System.out.println("Caught " + e.getClass().getName());
       }
       test(new B());