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 /** 19 * Class for testing the "text policy" file. 20 */ 21 public class TinyFrameworkForTextPolicy { TinyFrameworkForTextPolicy()22 public TinyFrameworkForTextPolicy() { 23 } 24 25 public int stub = 1; 26 27 // Removed fields cannot have an initial value, because otherwise .ctor will fail to set it at 28 // runtime. 29 public int remove; 30 addOne(int value)31 public int addOne(int value) { 32 return value + 1; 33 } 34 toBeRemoved(String foo)35 public void toBeRemoved(String foo) { 36 throw new RuntimeException(); 37 } 38 toBeIgnoredObj()39 public String toBeIgnoredObj() { 40 throw new RuntimeException(); 41 } 42 toBeIgnoredV()43 public void toBeIgnoredV() { 44 throw new RuntimeException(); 45 } 46 toBeIgnoredZ()47 public boolean toBeIgnoredZ() { 48 throw new RuntimeException(); 49 } 50 toBeIgnoredB()51 public byte toBeIgnoredB() { 52 throw new RuntimeException(); 53 } 54 toBeIgnoredC()55 public char toBeIgnoredC() { 56 throw new RuntimeException(); 57 } 58 toBeIgnoredS()59 public short toBeIgnoredS() { 60 throw new RuntimeException(); 61 } 62 toBeIgnoredI()63 public int toBeIgnoredI() { 64 throw new RuntimeException(); 65 } 66 toBeIgnoredF()67 public float toBeIgnoredF() { 68 throw new RuntimeException(); 69 } 70 toBeIgnoredD()71 public double toBeIgnoredD() { 72 throw new RuntimeException(); 73 } 74 addTwo(int value)75 public int addTwo(int value) { 76 throw new RuntimeException("not supported on host side"); 77 } 78 addTwo_host(int value)79 public int addTwo_host(int value) { 80 return value + 2; 81 } 82 nativeAddThree(int value)83 public static native int nativeAddThree(int value); 84 addThree_host(int value)85 public static int addThree_host(int value) { 86 return value + 3; 87 } 88 unsupportedMethod()89 public String unsupportedMethod() { 90 return "This value shouldn't be seen on the host side."; 91 } 92 } 93