1 /* 2 * Copyright (C) 2023 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 package com.android.hoststubgen.test.tinyframework; 17 18 import android.hosttest.annotation.HostSideTestNativeSubstitutionClass; 19 import android.hosttest.annotation.HostSideTestThrow; 20 import android.hosttest.annotation.HostSideTestWholeClassStub; 21 22 @HostSideTestWholeClassStub 23 @HostSideTestNativeSubstitutionClass("TinyFrameworkNative_host") 24 public class TinyFrameworkNative { nativeAddTwo(int arg)25 public static native int nativeAddTwo(int arg); 26 nativeAddTwo_should_be_like_this(int arg)27 public static int nativeAddTwo_should_be_like_this(int arg) { 28 return TinyFrameworkNative_host.nativeAddTwo(arg); 29 } 30 nativeLongPlus(long arg1, long arg2)31 public static native long nativeLongPlus(long arg1, long arg2); 32 nativeLongPlus_should_be_like_this(long arg1, long arg2)33 public static long nativeLongPlus_should_be_like_this(long arg1, long arg2) { 34 return TinyFrameworkNative_host.nativeLongPlus(arg1, arg2); 35 } 36 37 int value; 38 setValue(int v)39 public void setValue(int v) { 40 this.value = v; 41 } 42 nativeNonStaticAddToValue(int arg)43 public native int nativeNonStaticAddToValue(int arg); 44 nativeNonStaticAddToValue_should_be_like_this(int arg)45 public int nativeNonStaticAddToValue_should_be_like_this(int arg) { 46 return TinyFrameworkNative_host.nativeNonStaticAddToValue(this, arg); 47 } 48 49 @HostSideTestThrow nativeStillNotSupported()50 public static native void nativeStillNotSupported(); 51 nativeStillNotSupported_should_be_like_this()52 public static void nativeStillNotSupported_should_be_like_this() { 53 throw new RuntimeException(); 54 } 55 nativeBytePlus(byte arg1, byte arg2)56 public static native byte nativeBytePlus(byte arg1, byte arg2); 57 } 58