xref: /aosp_15_r20/frameworks/base/ravenwood/tools/hoststubgen/framework-policy-override.txt (revision d57664e9bc4670b3ecf6748a746a57c557b6bc9e)
1# --------------------------------------------------------------------------------------------------
2# This file contains rules to process `framework-all.jar` to generate the host side test "stub" and
3# "impl" jars, without using Java annotations.
4#
5# Useful when:
6# - The class is auto-generated and annotations can't be added.
7#   (We need to figure out what to do on auto-generated classes.)
8# - Want to quickly change filter rules without having to rebuild framework.jar.
9#
10# Using this file, one can control the visibility of APIs on a per-class, per-field and per-method
11# basis, but in most cases, per-class directives would be sufficient. That is:
12#
13# - To put the entire class, including its members and nested classes, in the "stub" jar,
14#   so that the test / target code can use the API, use `stubclass`.
15#
16# class package.class	stubclass
17#
18# - To put the entire class, including its members and nested classes, in the "impl" jar,
19#   but not in the "stub" jar, use `keepclass`. Use this when you don't want to expose an API to
20#   tests/target directly, but it's still needed at runtime, because it's used by other "stub" APIs
21#   directly or indirectly.
22#
23# class package.class	keepclass
24#
25# All other classes will be removed from both the stub jar and impl jar.
26#
27# --------------------------------------------------------------------------------------------------
28
29# --------------------------------------------------------------------------------------------------
30# Directions on auto-generated classes, where we can't use Java annotations (yet).
31# --------------------------------------------------------------------------------------------------
32class android.Manifest stubclass
33class android.R        stubclass
34class android.os.PersistableBundleProto	keepclass
35
36# This is in module-utils, where using a HostStubGen annotation would be complicated, so we
37# add a direction here rather than using a java annotation.
38# The build file says it's deprecated, anyway...? Figure out what to do with it.
39class com.android.internal.util.Preconditions keepclass
40
41# --------------------------------------------------------------------------------------------------
42# Actual framework classes
43# --------------------------------------------------------------------------------------------------
44
45# Put basic exception classes in the "impl" jar.
46# We don't put them in stub yet (until something actually needs them).
47class android.os.DeadObjectException          keepclass
48class android.os.DeadSystemRuntimeException   keepclass
49class android.os.NetworkOnMainThreadException keepclass
50class android.os.RemoteException              keepclass
51class android.os.ServiceSpecificException     keepclass
52class android.util.AndroidException           keepclass
53class android.util.AndroidRuntimeException    keepclass
54class android.os.DeadSystemException          keepclass
55
56
57# For now, we only want to expose ArrayMap and Log, but they and their tests depend on
58# more classes.
59
60class android.util.ArrayMap             stubclass
61
62# Used by ArrayMap. No need to put them in the stub, but we need them in impl.
63class android.util.MapCollections         keepclass
64class android.util.ContainerHelpers       keepclass
65class android.util.EmptyArray             stubclass
66class com.android.internal.util.XmlUtils  keepclass
67class com.android.internal.util.FastMath  keepclass
68class android.util.MathUtils              keepclass
69
70
71class android.util.Log          stubclass
72class android.util.Slog         stubclass
73# We don't use Log's native code, yet. Instead, the following line enables the Java substitution.
74# Comment it out to disable Java substitution of Log's native methods.
75class android.util.Log	!com.android.hoststubgen.nativesubstitution.Log_host
76
77# Used by log
78class com.android.internal.util.FastPrintWriter         keepclass
79class com.android.internal.util.LineBreakBufferedWriter keepclass
80
81class android.util.EventLog stubclass
82class android.util.EventLog !com.android.hoststubgen.nativesubstitution.EventLog_host
83class android.util.EventLog$Event stubclass
84
85# Expose Context because it's referred to by AndroidTestCase, but don't need to expose any of
86# its members.
87class android.content.Context        keep
88
89# Expose Parcel, Parcel and there relevant classes, which are used by ArrayMapTets.
90class android.os.Parcelable     StubClass
91class android.os.Parcel         StubClass
92class android.os.Parcel         !com.android.hoststubgen.nativesubstitution.Parcel_host
93
94class android.os.IBinder        stubClass
95class android.os.IInterface     stubclass
96
97class android.os.BadParcelableException     stubclass
98class android.os.BadTypeParcelableException stubclass
99
100class android.os.BaseBundle        stubclass
101class android.os.Bundle            stubclass
102class android.os.PersistableBundle stubclass
103
104class android.os.MessageQueue stubclass
105class android.os.MessageQueue !com.android.hoststubgen.nativesubstitution.MessageQueue_host
106