1 /* 2 * Copyright (C) 2025 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.HostSideTestKeep; 19 import android.hosttest.annotation.HostSideTestPartiallyAllowlisted; 20 import android.hosttest.annotation.HostSideTestWholeClassKeep; 21 22 /** 23 * Contains subclasses for tests for "partially-allowlisted". 24 */ 25 public class TinyFrameworkPartiallyAllowlisted { 26 /** */ 27 @HostSideTestPartiallyAllowlisted 28 @HostSideTestKeep 29 public static class PartiallyAllowlisted { 30 /** */ foo1(int value)31 public static int foo1(int value) { 32 return value + 1; 33 } 34 35 /** */ 36 @HostSideTestKeep foo2(int value)37 public static int foo2(int value) { 38 return value + 2; 39 } 40 } 41 42 /** */ 43 @HostSideTestPartiallyAllowlisted 44 @HostSideTestWholeClassKeep // This should be disallowed. 45 public static class PartialWithWholeClass_bad { 46 } 47 48 /** */ 49 // Missing @HostSideTestPartiallyAllowlisted 50 @HostSideTestKeep 51 public static class PartiallyAllowlistedWithoutAnnot_bad { 52 /** */ foo1(int value)53 public static int foo1(int value) { 54 return value + 1; 55 } 56 57 /** */ 58 @HostSideTestKeep foo2(int value)59 public static int foo2(int value) { 60 return value + 2; 61 } 62 } 63 64 /** */ 65 public static class NoAnnotations { 66 } 67 } 68