Skip NetworkStatsBinderTest if the binder interface is not accessible.

Following up from aosp/3313055, the binder interface getUidStats(II)J
is removed from the module. Currently, the test catches
NoSuchMethodException for reflection.
But did not properly skip for NoSuchMethodError which is thrown by
the java runtime when a method was present during compilation is
no longer available.

Test: cts-tradefed run commandAndExit cts -m CtsNetTestCases -t \
     android.net.cts.NetworkStatsBinderTestinderTest
Bug: 378982661
Change-Id: I7b8baa7ab98ce0114541bf1a9568db6f832213b6
This commit is contained in:
Junyu Lai 2024-11-26 16:25:20 +08:00
commit 05b57b7724

View file

@ -114,7 +114,7 @@ public class NetworkStatsBinderTest {
} catch (ClassNotFoundException e) {
/* not vulnerable if hidden API no longer available */
return;
} catch (NoSuchMethodException e) {
} catch (NoSuchMethodException | NoSuchMethodError e) {
/* not vulnerable if hidden API no longer available */
return;
} catch (RemoteException e) {