1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.hardware.cts; 18 19 import android.content.Context; 20 import android.content.pm.PackageManager; 21 import android.hardware.Sensor; 22 import android.hardware.SensorManager; 23 24 /** 25 * Check sensor native library funcationality. 26 * 27 * This is the place to implement sensor NDK CTS tests. 28 */ 29 public class SensorNativeTest extends SensorTestCase { 30 private SensorManager mSensorManager; 31 private boolean mAreHifiSensorsSupported; 32 private boolean mVrHighPerformanceModeSupported; 33 nativeSetUp()34 protected native long nativeSetUp(); nativeTearDown(long instance)35 protected native void nativeTearDown(long instance); nativeTest(long instance)36 private native void nativeTest(long instance); 37 private long mNativeInstance; 38 39 static { 40 System.loadLibrary("cts-sensors-ndk-jni"); 41 } 42 43 @Override setUp()44 public void setUp() throws Exception { 45 super.setUp(); 46 mNativeInstance = nativeSetUp(); 47 assertTrue("create native instance failed", mNativeInstance != 0); 48 } 49 50 @Override tearDown()51 public void tearDown() throws Exception { 52 nativeTearDown(mNativeInstance); 53 } 54 testNative()55 public void testNative() throws AssertionError { 56 nativeTest(mNativeInstance); 57 } 58 } 59