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 18 19 import com.google.android.lint.model.Method 20 21 const val CLASS_STUB = "Stub" 22 const val CLASS_CONTEXT = "android.content.Context" 23 const val CLASS_ACTIVITY_MANAGER_SERVICE = "com.android.server.am.ActivityManagerService" 24 const val CLASS_ACTIVITY_MANAGER_INTERNAL = "android.app.ActivityManagerInternal" 25 26 // Enforce permission APIs 27 val ENFORCE_PERMISSION_METHODS = listOf( 28 Method(CLASS_CONTEXT, "checkPermission"), 29 Method(CLASS_CONTEXT, "checkCallingPermission"), 30 Method(CLASS_CONTEXT, "checkCallingOrSelfPermission"), 31 Method(CLASS_CONTEXT, "enforcePermission"), 32 Method(CLASS_CONTEXT, "enforceCallingPermission"), 33 Method(CLASS_CONTEXT, "enforceCallingOrSelfPermission"), 34 Method(CLASS_ACTIVITY_MANAGER_SERVICE, "checkPermission"), 35 Method(CLASS_ACTIVITY_MANAGER_INTERNAL, "enforceCallingPermission") 36 ) 37 38 const val ANNOTATION_PERMISSION_METHOD = "android.annotation.PermissionMethod" 39 const val ANNOTATION_PERMISSION_NAME = "android.annotation.PermissionName" 40 const val ANNOTATION_PERMISSION_RESULT = "android.content.pm.PackageManager.PermissionResult" 41