Fix Os.getDefault() BlockGuard test.

A test was asserting that libcore.io.getDefault() was instanceof BlockguardOs.
This test failed if it was run after a different Os had been installed via
Os.compareAndSetDefault(), which currently doesn't happen in AOSP but happens
on internal / downstream branches.

A recent change [1] to OsTest did not touch the test method in question
but seems to have affected some ordering such that the test started
failing.

This CL fixes this by replacing the test with one that asserts that
Os.getDefault().rename(String,String) results in particular BlockGuard
invocations; the test now cares about the particular BlockGuard
invocations but does no longer care whether Os.getDefault() is directly
instanceof BlockguardOs or whether the notification happens some other
way, eg. via delegation to BlockguardOs or by directly calling
BlockGuard.

This CL also moves the test from OsTest.java to BlockGuardOsTest.java,
since that class already had most of the required test setup
boilerplate and because BlockGuard is part of what it tests.

[1] http://r.android.com/937425 commit 62db047bc129fe96cca0f4a347e9b1fb30163acb

Bug: 129926881
Bug: 129523169
Test: atest CtsLibcoreTestCases:libcore.libcore.io.{,BlockGuard}OsTest

Change-Id: I1cc3799b6d0905c01b998ecc561217f90e02dcbe
2 files changed