Fix logic around SDK visibility of interface methods.
- FindIncompatibleMethod needs to look for an accessible interface SDK method
instead of all interface methods.
- We need to check which API list a method belongs to in FindAccessibleInterfaceMethod
as the public API bit in the access flags can be updated for
optimizations.
Test: 817-hiddenapi
Bug: 218589191
Change-Id: I274b234657c6dc3fe61278924774896488d4c708
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index f4a13e9..428136a 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -9118,7 +9118,8 @@
if (kIsDebugBuild) {
ArtMethod* method =
klass->FindInterfaceMethod(dex_cache, method_idx, image_pointer_size_);
- DCHECK(CheckNoSuchMethod(method, dex_cache, class_loader));
+ CHECK(CheckNoSuchMethod(method, dex_cache, class_loader) ||
+ (klass->FindAccessibleInterfaceMethod(method, image_pointer_size_) == nullptr));
}
return nullptr;
}