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 PERMISSION_PREFIX_LITERAL = "android.permission." 33 34 const val AIDL_PERMISSION_HELPER_SUFFIX = "_enforcePermission" 35 36 /** 37 * If a non java (e.g. c++) backend is enabled, the @EnforcePermission 38 * annotation cannot be used. At time of writing, the mechanism 39 * is not implemented for non java backends. 40 * TODO: b/242564874 (have lint know which interfaces have the c++ backend enabled) 41 * rather than hard coding this list? 42 */ 43 val EXCLUDED_CPP_INTERFACES = listOf( 44 "AdbTransportType", 45 "FingerprintAndPairDevice", 46 "IAdbCallback", 47 "IAdbManager", 48 "PairDevice", 49 "IStatsBootstrapAtomService", 50 "StatsBootstrapAtom", 51 "StatsBootstrapAtomValue", 52 "FixedSizeArrayExample", 53 "PlaybackTrackMetadata", 54 "RecordTrackMetadata", 55 "SinkMetadata", 56 "SourceMetadata", 57 "IUpdateEngineStable", 58 "IUpdateEngineStableCallback", 59 "AudioCapabilities", 60 "ConfidenceLevel", 61 "ModelParameter", 62 "ModelParameterRange", 63 "Phrase", 64 "PhraseRecognitionEvent", 65 "PhraseRecognitionExtra", 66 "PhraseSoundModel", 67 "Properties", 68 "RecognitionConfig", 69 "RecognitionEvent", 70 "RecognitionMode", 71 "RecognitionStatus", 72 "SoundModel", 73 "SoundModelType", 74 "Status", 75 "IThermalService", 76 "IPowerManager", 77 "ITunerResourceManager", 78 // b/278147400 79 "IActivityManager", 80 "IUidObserver", 81 "IDrm", 82 "IVsyncCallback", 83 "IVsyncService", 84 "ICallback", 85 "IIPCTest", 86 "ISafeInterfaceTest", 87 "IGpuService", 88 "IConsumerListener", 89 "IGraphicBufferConsumer", 90 "ITransactionComposerListener", 91 "SensorEventConnection", 92 "SensorServer", 93 "ICamera", 94 "ICameraClient", 95 "ICameraRecordingProxy", 96 "ICameraRecordingProxyListener", 97 "ICrypto", 98 "IOMXObserver", 99 "IStreamListener", 100 "IStreamSource", 101 "IAudioService", 102 "IDataSource", 103 "IDrmClient", 104 "IMediaCodecList", 105 "IMediaDrmService", 106 "IMediaExtractor", 107 "IMediaExtractorService", 108 "IMediaHTTPConnection", 109 "IMediaHTTPService", 110 "IMediaLogService", 111 "IMediaMetadataRetriever", 112 "IMediaMetricsService", 113 "IMediaPlayer", 114 "IMediaPlayerClient", 115 "IMediaPlayerService", 116 "IMediaRecorder", 117 "IMediaRecorderClient", 118 "IMediaResourceMonitor", 119 "IMediaSource", 120 "IRemoteDisplay", 121 "IRemoteDisplayClient", 122 "IResourceManagerClient", 123 "IResourceManagerService", 124 "IComplexTypeInterface", 125 "IPermissionController", 126 "IPingResponder", 127 "IProcessInfoService", 128 "ISchedulingPolicyService", 129 "IStringConstants", 130 "IObbActionListener", 131 "IStorageEventListener", 132 "IStorageManager", 133 "IStorageShutdownObserver", 134 "IPersistentVrStateCallbacks", 135 "IVrManager", 136 "IVrStateCallbacks", 137 "ISurfaceComposer", 138 "IMemory", 139 "IMemoryHeap", 140 "IProcfsInspector", 141 "IAppOpsCallback", 142 "IAppOpsService", 143 "IBatteryStats", 144 "IResultReceiver", 145 "IShellCallback", 146 "IDrmManagerService", 147 "IDrmServiceListener", 148 "IAAudioClient", 149 "IAAudioService", 150 "VtsFuzzer", 151 ) 152