1 /*
2  * Copyright (C) 2019 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 
17 package android.net;
18 
19 import android.net.ResolverHostsParcel;
20 
21 /**
22  * Knobs for OEM to control alternative behavior.
23  *
24  * {@hide}
25  */
26 @JavaDerive(equals=true, toString=true)
27 parcelable ResolverOptionsParcel {
28     /**
29      * An IP/hostname mapping table for DNS local lookup customization.
30      * WARNING: this is intended for local testing and other special situations.
31      * Future versions of the DnsResolver module may break your assumptions.
32      * Injecting static mappings for public hostnames is generally A VERY BAD IDEA,
33      * since it makes it impossible for the domain owners to migrate the domain.
34      * It is also not an effective domain blocking mechanism, because apps can
35      * easily hardcode IPs or bypass the system DNS resolver.
36      */
37     ResolverHostsParcel[] hosts = {};
38 
39     /**
40      * Truncated UDP DNS response handling mode. Handling of UDP responses with the TC (truncated)
41      * bit set. The values are defined in {@code IDnsResolver.aidl}
42      * 0: TC_MODE_DEFAULT
43      * 1: TC_MODE_UDP_TCP
44      * Other values are invalid.
45      */
46     int tcMode = 0;
47 
48     /**
49      * The default behavior is that plaintext DNS queries are sent by the application's UID using
50      * fchown(). DoT are sent with an UID of AID_DNS. This option control the plaintext uid of DNS
51      * query.
52      * Setting this option to true decreases battery life because it results in the device sending
53      * UDP DNS queries even if the app that made the DNS lookup does not have network access.
54      * Anecdotal data from the field suggests that about 15% of DNS lookups are in this category.
55      * This option also results in data usage for UDP DNS queries being attributed to the OS instead
56      * of to the requesting app.
57      * false: set application uid on DNS sockets (default)
58      * true: set AID_DNS on DNS sockets
59      */
60     boolean enforceDnsUid = false;
61 }
62