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