Fix the NullPointerException errors.

The NullPointerExceptions happened when the test devices did not have
the sensor corresponding to the sensor type under the test. When the
sensor was  not found, the SensorRatePermissionDirectReportTestHelper
class returned a null object, which aborted the setUp() and test
methods, but this null object was used to call a method in tearDown(),
hence the NullPointerException.

Similarly for EventConnectionTest, when sensor is not found, setUp() was
aborted, thus the SensorRatePermissionEventConnectionTestHelper was
null, but was used in tearDown(), hence the NullPointerException.

For the ResamplingTest which extends SensorTestCase class, when Assume.assumeTrue() failed, instead of
aborting the test, it threw an exception. We fixed this by removing the
Assume.assumeTrue and just return when the sensor is not found.

Test: atest CtsSensorRatePermissionTestCases on cf_x86_auto-userdebug
Bug: 136069189
Change-Id: I311cc87d53898d9dc363e2ae051b599e6a2179e8
5 files changed