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     public int keep = 2;
28 
29     // Removed fields cannot have an initial value, because otherwise .ctor will fail to set it at
30     // runtime.
31     public int remove;
32 
addOne(int value)33     public int addOne(int value) {
34         return addOneInner(value);
35     }
36 
addOneInner(int value)37     public int addOneInner(int value) {
38         return value + 1;
39     }
40 
toBeRemoved(String foo)41     public void toBeRemoved(String foo) {
42         throw new RuntimeException();
43     }
44 
addTwo(int value)45     public int addTwo(int value) {
46         throw new RuntimeException("not supported on host side");
47     }
48 
addTwo_host(int value)49     public int addTwo_host(int value) {
50         return value + 2;
51     }
52 
nativeAddThree(int value)53     public static native int nativeAddThree(int value);
54 
addThree_host(int value)55     public static int addThree_host(int value) {
56         return value + 3;
57     }
58 
unsupportedMethod()59     public String unsupportedMethod() {
60         return "This value shouldn't be seen on the host side.";
61     }
62 
visibleButUsesUnsupportedMethod()63     public String visibleButUsesUnsupportedMethod() {
64         return unsupportedMethod();
65     }
66 }
67