• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 com.google.android.lint.aidl
18 
19 const val ANNOTATION_ENFORCE_PERMISSION = "android.annotation.EnforcePermission"
20 const val ANNOTATION_REQUIRES_NO_PERMISSION = "android.annotation.RequiresNoPermission"
21 const val ANNOTATION_PERMISSION_MANUALLY_ENFORCED = "android.annotation.PermissionManuallyEnforced"
22 
23 val AIDL_PERMISSION_ANNOTATIONS = listOf(
24         ANNOTATION_ENFORCE_PERMISSION,
25         ANNOTATION_REQUIRES_NO_PERMISSION,
26         ANNOTATION_PERMISSION_MANUALLY_ENFORCED
27 )
28 
29 const val BINDER_CLASS = "android.os.Binder"
30 const val IINTERFACE_INTERFACE = "android.os.IInterface"
31 
32 const val AIDL_PERMISSION_HELPER_SUFFIX = "_enforcePermission"
33 
34 /**
35  * If a non java (e.g. c++) backend is enabled, the @EnforcePermission
36  * annotation cannot be used.  At time of writing, the mechanism
37  * is not implemented for non java backends.
38  * TODO: b/242564874 (have lint know which interfaces have the c++ backend enabled)
39  * rather than hard coding this list?
40  */
41 val EXCLUDED_CPP_INTERFACES = listOf(
42         "AdbTransportType",
43         "FingerprintAndPairDevice",
44         "IAdbCallback",
45         "IAdbManager",
46         "PairDevice",
47         "IStatsBootstrapAtomService",
48         "StatsBootstrapAtom",
49         "StatsBootstrapAtomValue",
50         "FixedSizeArrayExample",
51         "PlaybackTrackMetadata",
52         "RecordTrackMetadata",
53         "SinkMetadata",
54         "SourceMetadata",
55         "IUpdateEngineStable",
56         "IUpdateEngineStableCallback",
57         "AudioCapabilities",
58         "ConfidenceLevel",
59         "ModelParameter",
60         "ModelParameterRange",
61         "Phrase",
62         "PhraseRecognitionEvent",
63         "PhraseRecognitionExtra",
64         "PhraseSoundModel",
65         "Properties",
66         "RecognitionConfig",
67         "RecognitionEvent",
68         "RecognitionMode",
69         "RecognitionStatus",
70         "SoundModel",
71         "SoundModelType",
72         "Status",
73         "IThermalService",
74         "IPowerManager",
75         "ITunerResourceManager"
76 )
77