Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39fab142 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Migrate PermissionAnnotationDetector to global lint checks" into main am: 243cceeb

parents 1a3ff505 243cceeb
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -19,11 +19,6 @@ java_library_static {
    defaults: [
        "platform_service_defaults",
    ],
    lint: {
        error_checks: ["MissingPermissionAnnotation"],
        baseline_filename: "lint-baseline.xml",

    },
    srcs: [
        ":services.accessibility-sources",
        "//frameworks/base/packages/SettingsLib/RestrictedLockUtils:SettingsLibRestrictedLockUtilsSrc",
+0 −1
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ import java.util.StringJoiner;
 *
 * NOTE: This class has to be created and poked only from the main thread.
 */
@SuppressWarnings("MissingPermissionAnnotation")
class AccessibilityInputFilter extends InputFilter implements EventStreamTransformation {

    private static final String TAG = AccessibilityInputFilter.class.getSimpleName();
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import java.util.List;
/**
 * Encapsulate fingerprint gesture logic
 */
@SuppressWarnings("MissingPermissionAnnotation")
public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallback.Stub
        implements Handler.Callback{
    private static final int MSG_REGISTER = 1;
+23 −0
Original line number Diff line number Diff line
@@ -103,3 +103,26 @@ fun getHelperMethodFix(

    return fix.build()
}

/**
 * PermissionAnnotationDetector uses this method to determine whether a specific file should be
 * checked for unannotated methods. Only files located in directories whose paths begin with one
 * of these prefixes will be considered.
 */
fun isSystemServicePath(context: JavaContext): Boolean {
    val systemServicePathPrefixes = setOf(
        "frameworks/base/services",
        "frameworks/base/apex",
        "frameworks/opt/wear",
        "packages/modules"
    )

    val filePath = context.file.path

    // We perform `filePath.contains` instead of `filePath.startsWith` since getting the
    // relative path of a source file is non-trivial. That is because `context.file.path`
    // returns the path to where soong builds the file (i.e. /out/soong/...). Moreover, the
    // logic to extract the relative path would need to consider several /out/soong/...
    // locations patterns.
    return systemServicePathPrefixes.any { filePath.contains(it) }
}
+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import com.android.tools.lint.client.api.IssueRegistry
import com.android.tools.lint.client.api.Vendor
import com.android.tools.lint.detector.api.CURRENT_API
import com.google.android.lint.parcel.SaferParcelChecker
import com.google.android.lint.aidl.PermissionAnnotationDetector
import com.google.auto.service.AutoService

@AutoService(IssueRegistry::class)
@@ -38,7 +37,6 @@ class AndroidFrameworkIssueRegistry : IssueRegistry() {
        SaferParcelChecker.ISSUE_UNSAFE_API_USAGE,
        // TODO: Currently crashes due to OOM issue
        // PackageVisibilityDetector.ISSUE_PACKAGE_NAME_NO_PACKAGE_VISIBILITY_FILTERS,
        PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION,
        PermissionMethodDetector.ISSUE_PERMISSION_METHOD_USAGE,
        PermissionMethodDetector.ISSUE_CAN_BE_PERMISSION_METHOD,
        FeatureAutomotiveDetector.ISSUE,
Loading