Search in sources :

Example 1 with SetPermissionLookup

use of com.android.tools.klint.checks.PermissionHolder.SetPermissionLookup in project kotlin by JetBrains.

the class SupportAnnotationDetector method getPermissions.

private PermissionHolder getPermissions(@NonNull JavaContext context) {
    if (mPermissions == null) {
        Set<String> permissions = Sets.newHashSetWithExpectedSize(30);
        Set<String> revocable = Sets.newHashSetWithExpectedSize(4);
        LintClient client = context.getClient();
        // Gather permissions from all projects that contribute to the
        // main project.
        Project mainProject = context.getMainProject();
        for (File manifest : mainProject.getManifestFiles()) {
            addPermissions(client, permissions, revocable, manifest);
        }
        for (Project library : mainProject.getAllLibraries()) {
            for (File manifest : library.getManifestFiles()) {
                addPermissions(client, permissions, revocable, manifest);
            }
        }
        AndroidVersion minSdkVersion = mainProject.getMinSdkVersion();
        AndroidVersion targetSdkVersion = mainProject.getTargetSdkVersion();
        mPermissions = new SetPermissionLookup(permissions, revocable, minSdkVersion, targetSdkVersion);
    }
    return mPermissions;
}
Also used : LintClient(com.android.tools.klint.client.api.LintClient) SetPermissionLookup(com.android.tools.klint.checks.PermissionHolder.SetPermissionLookup) AndroidVersion(com.android.sdklib.AndroidVersion) File(java.io.File)

Aggregations

AndroidVersion (com.android.sdklib.AndroidVersion)1 SetPermissionLookup (com.android.tools.klint.checks.PermissionHolder.SetPermissionLookup)1 LintClient (com.android.tools.klint.client.api.LintClient)1 File (java.io.File)1