1 /**
2  * Copyright (c) 2021, 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.tracing;
18 
19 import android.os.ParcelFileDescriptor;
20 
21 /*
22  * Parameters for a trace report.
23  *
24  * See ITracingServiceProxy::reportTrace for more details.
25  *
26  * @hide
27  */
28 parcelable TraceReportParams {
29   // The package name containing the reporter service (see |reporterClassName|).
30   String reporterPackageName;
31 
32   // The class name of the reporter service. The framework will bind to this service and pass the
33   // trace fd and metadata to this class.
34   // This class should be "trusted" (in practice this means being a priv_app + having DUMP and
35   // USAGE_STATS permissions).
36   String reporterClassName;
37 
38   // The file descriptor for the trace file. This will be an unlinked file fd (i.e. created
39   // with O_TMPFILE); the intention is that reporter classes link this fd into a app-private
40   // folder for reporting when conditions are right (e.g. charging, on unmetered networks etc).
41   ParcelFileDescriptor fd;
42 
43   // The least-significant-bytes of the UUID of this trace.
44   long uuidLsb;
45 
46   // The most-significant-bytes of the UUID of this trace.
47   long uuidMsb;
48 
49   // Flag indicating whether, instead of passing the fd from the trace collector, to pass a
50   // pipe fd from system_server and send the file over it.
51   //
52   // This flag is necessary because there is no good way to write a CTS test where a helper
53   // priv_app (in terms of SELinux) is needed (this is because priv_apps are supposed to be
54   // preinstalled on the system partition). By creating a pipe in system_server we work around
55   // this restriction. Note that there is a maximum allowed file size if this flag is set
56   // (see TracingServiceProxy). Further note that, even though SELinux may be worked around,
57   // manifest (i.e. framework) permissions are still checked even if this flag is set.
58   boolean usePipeForTesting;
59 }