@Override public boolean isLibrary() { return super.isLibrary() || projectDescription != null && projectDescription.type == ProjectDescription.Type.LIBRARY; }
@Override public void afterCheckProject(@NonNull Context context) { if (!context.getProject().isLibrary() && mHaveClasses && mReferencedClasses != null && !mReferencedClasses.isEmpty() && context.getDriver().getScope().contains(Scope.CLASS_FILE)) {
Project mainProject = context.getMainProject(); if (context.getProject() == mainProject && mHaveClasses && !mainProject.isLibrary() && mReferencedClasses != null && !mReferencedClasses.isEmpty() && context.getDriver().getScope().contains(Scope.CLASS_FILE)) {
@Override public void visitElement(@NonNull XmlContext context, @NonNull Element element) { String tagName = element.getTagName(); if (NODE_METADATA.equals(tagName) && !mDoAutomotiveAppCheck) { checkAutoMetadataTag(element); } else if (TAG_AUTOMOTIVE_APP.equals(tagName)) { checkAutomotiveAppElement(context, element); } else if (NODE_APPLICATION.equals(tagName)) { // Disable reporting the error if the Issue was suppressed at // the application level. if (context.getMainProject() == context.getProject() && !context.getProject().isLibrary()) { mMainApplicationHandle = context.createLocationHandle(element); mMainApplicationHandle.setClientData(element); } } else if (TAG_SERVICE.equals(tagName)) { checkServiceForBrowserServiceIntentFilter(element); } else if (TAG_INTENT_FILTER.equals(tagName)) { checkForMediaSearchIntentFilter(element); } }
Project project = context.getProject(); boolean checkCustomAttrs = context.isEnabled(CUSTOM_VIEW) && project.isLibrary() || context.isEnabled(RES_AUTO) && project.isGradleProject();
Project project = context.getProject(); boolean checkCustomAttrs = context.isEnabled(CUSTOM_VIEW) && project.isLibrary() || context.isEnabled(RES_AUTO) && project.isGradleProject();
public List<File> findRuleJars(@NonNull Project project) { if (project.isGradleProject()) { if (project.isLibrary()) { AndroidLibrary model = project.getGradleLibraryModel(); if (model != null) {
XmlContext xmlContext = (XmlContext) context; if (!context.getMainProject().isLibrary()) {
&& !context.getProject().isLibrary() && mMainApplicationHandle != null && mDoAutomotiveAppCheck) {
@Override public void afterCheckProject(@NonNull Context context) { // Don't report issues on libraries if (context.getProject() == context.getMainProject() && !context.getMainProject().isLibrary() && mApplicationTagHandle != null) { if (!mSuppress && mHasNativeLibs) { context.report(ISSUE, mApplicationTagHandle.resolve(), "Missing attribute android:extractNativeLibs=\"false\"" + " on the `<application>` tag."); } } }
@Override public void afterCheckProject(@NonNull Context context) { if (!mSeenAllowBackup && context.isEnabled(ALLOW_BACKUP) && !context.getProject().isLibrary() && context.getMainProject().getMinSdk() >= 4) { Location location = getMainApplicationTagLocation(context); context.report(ALLOW_BACKUP, location, "Should explicitly set `android:allowBackup` to `true` or " + "`false` (it's `true` by default, and that can have some security " + "implications for the application's data)"); } if (!context.getMainProject().isLibrary() && !mSeenAppIcon && context.isEnabled(APPLICATION_ICON)) { Location location = getMainApplicationTagLocation(context); context.report(APPLICATION_ICON, location, "Should explicitly set `android:icon`, there is no default"); } }
project.readManifest(context.document); if ((!project.isLibrary() || (main != null && main.isMergingManifests())) && scope.contains(Scope.MANIFEST)) {
@Override public void afterCheckProject(@NonNull Context context) { if (!mSeenAllowBackup && context.isEnabled(ALLOW_BACKUP) && !context.getProject().isLibrary() && context.getMainProject().getMinSdk() >= 4) { Location location = getMainApplicationTagLocation(context); context.report(ALLOW_BACKUP, location, "Should explicitly set `android:allowBackup` to `true` or " + "`false` (it's `true` by default, and that can have some security " + "implications for the application's data)"); } if (!context.getMainProject().isLibrary() && !mSeenAppIcon && context.isEnabled(APPLICATION_ICON)) { Location location = getMainApplicationTagLocation(context); context.report(APPLICATION_ICON, location, "Should explicitly set `android:icon`, there is no default"); } }
@Override public void visitElement(@NonNull XmlContext context, @NonNull Element element) { // Don't check library manifests if (context.getProject() != context.getMainProject() || context.getMainProject().isLibrary()) { return; } if (context.getDriver().isSuppressed(context, ISSUE, element)) { mSuppress = true; return; } if (TAG_APPLICATION.equals(element.getNodeName())) { Node extractAttr = element.getAttributeNodeNS(ANDROID_URI, AndroidManifest.ATTRIBUTE_EXTRACT_NATIVE_LIBS); //noinspection VariableNotUsedInsideIf if (extractAttr != null) { mSuppress = true; } else { mApplicationTagHandle = context.createLocationHandle(element); } } } }
if (sIncludeInactiveReferences && project.isGradleProject() && !project.isLibrary()) { AndroidProject model = project.getGradleProjectModel(); Variant variant = project.getCurrentVariant();
recordLocation = true; if (recordLocation && !context.getProject().isLibrary() && (mApplicationTagHandle == null || isMainManifest(context, context.file))) { mApplicationTagHandle = context.createLocationHandle(element);
|| mHasLeanbackLauncherActivity; if (!context.getMainProject().isLibrary() && isTvApp) { XmlContext xmlContext = (XmlContext) context;
recordLocation = true; if (recordLocation && !context.getProject().isLibrary() && (mApplicationTagHandle == null || isMainManifest(context, context.file))) { mApplicationTagHandle = context.createLocationHandle(element); && !context.getProject().isLibrary() && context.getMainProject().getTargetSdk() >= 23) { if (hasGcmReceiver(element)) {
if (!applicationHasActionView && !context.getProject().isLibrary()) {