aboutsummaryrefslogtreecommitdiffstats
path: root/lint/libs/lint_checks/src/com/android
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge "27629: DrawAllocation doesn't catch allocations done in View.layout()"Tor Norbye2012-04-021-2/+46
|\ \
| * | 27629: DrawAllocation doesn't catch allocations done in View.layout()Tor Norbye2012-04-021-2/+46
| |/ | | | | | | Change-Id: I2784712f5b298e7103c12d04bc7ae7fbeefd9cdf
* | Add lint detector for Toast.makeText() without show()Tor Norbye2012-04-022-1/+171
| | | | | | | | | | | | | | | | | | | | | | This changeset looks for Toast.makeText() calls where there is no corresponding show() afterwards on the Toast object, which is a common mistake. It also looks for attempts to pass a custom duration value, which is wrong: only Toast.LENGTH_SHORT or Toast.LENGTH_LONG are valid. Change-Id: I3a68e8934ddac76d1277f0fd292c329f30b192ee
* | Add exported content provider check to registryJon Larimer2012-04-021-1/+2
| | | | | | | | Change-Id: I3d3f0ead1397ee994ea58d57228457421ca9411a
* | Merge "Add content provider permission check"Jon Larimer2012-04-021-2/+66
|\ \ | |/ |/|
| * Add content provider permission checkJon Larimer2012-04-011-2/+66
| | | | | | | | | | | | This check looks for exported content providers with no permissions. Change-Id: I1b318b80dc8dc560c42a05db2e4dfa5bd7f45f9d
* | Merge "27584: Detect misplaced <uses-library> manifest tag at build time"Tor Norbye2012-04-022-3/+56
|\ \ | |/ |/|
| * 27584: Detect misplaced <uses-library> manifest tag at build timeTor Norbye2012-03-232-3/+56
| | | | | | | | | | | | | | (Also identifies other misplaced elements -- activities, services, uses-screens, etc etc) Change-Id: Ie9fee95c05715001be6af23c1cdd86e895e43509
* | 27613: Lint false alarm on android:enabled being deprecatedTor Norbye2012-03-231-1/+4
|/ | | | Change-Id: I871f390c964cfbb8d6c4883ce426bbaa8869f446
* Fix lint issues 27108, 27109 and 27110Tor Norbye2012-03-193-23/+30
| | | | | | | | | | 27108: lint confused by escaped percent signs 27109: Lint misreports resources as unused when the fully qualified class name is used 27110: Lint attribute to ignore an unused resource doesn't work for reference XML drawables Change-Id: Id8457d8305e5d2770bc8ab547a0735c63117682c
* Add getSharedPreferences to worldreadable/writable checkJon Larimer2012-03-151-7/+13
| | | | | | | Add getSharedPreferences() to the method list in the WorldReadable/WorldWritable file checks in lint. Change-Id: Ia2922e4bfe9faf70b46b239726a6c65aa9abd3dc
* Added detection for the creation of world-readable files to lintSebastian Porst2012-03-152-3/+25
| | | | Change-Id: I521d53cc23a35c11db3ccff949916c77f3f6f9bd
* Added detection of android.webkit.WebSettings.setJavaScriptEnabled to the ↵Sebastian Porst2012-03-142-1/+79
| | | | | | lint tool. Change-Id: I8be9fadfe2de26ac6f4a3bd299054a9678697f27
* Fix issue 26663: Avoid rewriting memory mapped files on WindowsTor Norbye2012-03-091-1/+5
| | | | Change-Id: Ie19113652a70b55ea2db545eacd0de8c7be798c9
* Make GridLayout support work with the support libraryTor Norbye2012-03-081-1/+1
| | | | | | | Also fix the paste operation to target the parent if the paste target does not accept children. Change-Id: Id084db376e5ff9b4a374e6d2145bc890a925a078
* Fix the duplicate id detectorTor Norbye2012-03-071-243/+473
| | | | | | | | | | | | | | The duplicate id detector now handles locations properly (so you get line numbers), it handles suppressing errors via annotations, and it's better about avoiding false positives because it handles configuration variations independently. It also attempts to filter out obvious cases that aren't problems such as portrait versus landscape layouts. Related issues: http://code.google.com/p/android/issues/detail?id=22885 http://code.google.com/p/android/issues/detail?id=26454 Change-Id: Id178d08818b6cce1ebbeff6ca10e95e2906175a5
* Misc Lint FixesTor Norbye2012-03-065-15/+88
| | | | | | | | | | | | | | | | | | | | | | | | | This changeset contains fixes for several unrelated reported lint bugs: 26505: Default disabled rules that are explicitly enabled do not activate 26467: Lint says ByteBuffer.array is API 9+ but it's really API 1+ 26501: Warning "This tag and its children can be replaced by one <TextView/> and a compound drawable" is not always correct (Partially fixed) It also fixes the following bugs: - The quickfix for the typography detector did not work for the fraction warning (replacing 1/2 with the half unicode symbol etc) - A couple of XML detectors did not check for SuppressLint on the associated root node - Add a --exitcode flag, and only set the exit code to non-zero if that flag is specified. Also fix the code such that non-fatal errors also contribute to the exit code. - Make the HTML reporter classes public to help Maven integration. Change-Id: I60f5fdcb2a465d51fa58bb918a195b373096d54b
* Merge "Remove R.attr resources from UnusedResource detector (26174)"Xavier Ducrohet2012-03-011-3/+4
|\
| * Remove R.attr resources from UnusedResource detector (26174)Tor Norbye2012-03-011-3/+4
| | | | | | | | Change-Id: I46abcb93537b3d288234729dd01005c41394d227
* | Update lint custom view rule to reflect new res-auto namespaceTor Norbye2012-03-011-6/+9
|/ | | | Change-Id: If74938a7e607ef6e1ffbc00cb0e5d191a672b0c5
* Fix outerclass handling for the @TargetApi annotationTor Norbye2012-03-011-2/+49
| | | | | | | | | | | | | | This changeset adds outerclass handling for the @TargetApi annotation, such that the API checker takes outerclasses (and outermethods, in the case of anonymous inner classes) into account when computing the effective minimum SDK For a method. This also fixes the handling of nested anonymous innerclasses for the @SuppressLint annotation. http://code.google.com/p/android/issues/detail?id=26262 Change-Id: Iafb0fd88cc41042ea1727c3882e3ddd1ebfc1f09
* Add lint check for calling native wrapper class constructorsTor Norbye2012-02-272-4/+42
| | | | Change-Id: I59c2a64e4453c4d05bebaba1cfa4fcb31b9592e2
* Fix SuppressLint annotations in outer classesTor Norbye2012-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset makes @SuppressLint work for classfile based detectors when the error is found in an inner class and the SuppressLint annotations is on an outer class. Innerclasses are actually separate classes from their outer classes, so they are processed separately (each .class file is read and analyzed independently). This changeset processes the class files in alphabetical* order such that it can maintain a stack of outerclasses when processing a class. The suppress lint check can then visit the outer class' annotations to see if the error should be suppressed. (*: The order isn't exactly alphabetical: We want Foo$Bar.class to come after Foo.class) This changeset also tweaks the Add Annotation quickfix such that it only offers per-method or per-class annotations, since class files do not maintain annotation info for other granularities (such as on variable declarations, so you cannot suppress classfile based issues with annotations there.) We could make a lint check which ensures that you don't try to put these annotations there :-) (This is related to issue http://b.android.com/25948) Change-Id: Ia9dbc39b1adc73a1b60e375edbf9b5618c7d2353
* Lint bug fixesTor Norbye2012-02-241-97/+60
| | | | | | | | | | | | | | | | | This changeset fixes a couple of Lint bugs: (1) Handle BOMs (byte order marks) in Java files. We already handle this for XML files (where it's common) but these can be present in other file types as well, such as Java. See http://code.google.com/p/android/issues/detail?id=25952 (2) Fix a bug (false positive) in the FloatMath detector; the visitor approach can get confused; do simple ASM node iteration instead (which is how all the other detectors work; this detector was written before we had the ASM DOM model) Change-Id: I65b4e6cd8d8e6c7e591433d8eb5aedf273e2caad
* Fix typoTor Norbye2012-02-231-1/+1
| | | | Change-Id: I16fadfbf801bcb60e0d7edda6af163bf158a4c21
* Merge "Lint API check should use main project's SDK version"Tor Norbye2012-02-231-1/+1
|\
| * Lint API check should use main project's SDK versionTor Norbye2012-02-231-1/+1
| | | | | | | | | | | | | | | | When the Lint API check is analyzing code in a library project, it should use the min sdk version from the main project (unless you are linting just a library project without including a main project). Change-Id: I6d09f2d3e406213014df55832e781813c96aedfd
* | Handle nulls from Element.getAttribute (fix for issue 25668)Tor Norbye2012-02-231-0/+4
|/ | | | | | | | | | | | | | | | | | Element.getAttribute isn't supposed to return null, but in Eclipse it sometimes does. It was common in 3.5.2, which we've dropped support for, but issue 25668 shows that it can happen in Eclipse 3.7.1 too though it's rare. This changeset attempts to address the issue in two ways: (1) Spotfix the specific NPE (2) Hold the readlock on the XML document while the detectors are using the DOM nodes (this is in case the nulls are related to this, which is not certain given that the issue is rare and not reproducible) Change-Id: I14727531ea9e08abf45d70013248e702cf5a15eb
* Wrong category metadata for the color detectorTor Norbye2012-02-221-1/+1
| | | | Change-Id: Id62e675e467a4c9754515640194c836ab4cb9a83
* Add lint check for "old" proguard configurations with generic Android configTor Norbye2012-02-222-11/+95
| | | | Change-Id: I79cbdf874cffe78eb62f9af2e22e6cc780853e6a
* Merge "Split ProGuard file into two halves"Tor Norbye2012-02-221-3/+3
|\
| * Split ProGuard file into two halvesTor Norbye2012-02-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset splits the proguard.cfg into two halves: (1) All the general Android settings go into $ANDROID_SDK/proguard/proguard-android.txt. This defines shrinking rules like keep custom views, etc. The crucial point is that this information is maintained and updated by Tools updates, so whenever new APIs are added to Android, or whenever bugs are found in the configuration such as flags needed to work with Dalvik, we can make the updates - we don't have old snapshots living on in projects. (2) Any project specific settings go to proguard-project.txt in the project. (3) The proguard.config property in project.properties now refers to a *path* of configuration files, which are all passed to ProGuard in the given order. The code which processes this setting will substitute android.sdk.home and user.home variables, so the path does not have to be hardcoded to point to the project-android.txt file. The default project templates have been updated to include a commented out configuration setting up proguard as described above. The default proguard file name was changed from proguard.cfg to proguard-project.txt such that it can be directly opened in Eclipse and to make it clear it's an editable text file. Lint was updated to find the Proguard file via the proguard.config property as well as via the old and new default names for projects not enabled with ProGuard. A subsequent CL will add a lint check which identifies projects containing the old setup (full local configuration) and offer to replace it with the new setup. Change-Id: I44b4c97a160114c2382f02f843c95486a0dc9d6b
* | Add lint rule to catch incorrect setColor callsTor Norbye2012-02-214-7/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android has various setColor methods (such as setTextColor) which take an integer, where it expects RGB values in the bytes. Since this is an integer, and since color resources are integers, sometimes code incorrectly passes the color resource id rather than a resolved color to the setter: paint.setColor(R.color.red) Obviously, the color should be "resolved" first via getResource().getColor(). This changeset adds a lint detector which catches these kinds of bugs. Change-Id: I2970e5220d24ad3b844a9f19fbe99b932d9f7fb4
* | Merge "Suppress support and location tracking for translation detector"Tor Norbye2012-02-211-63/+149
|\ \
| * | Suppress support and location tracking for translation detectorTor Norbye2012-02-211-63/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds support for suppressing lint errors on translations. For a missing translation, place the suppress attribute on the default language key. For strings defined in other languages but not the default locale, place the attribute on the extra translation. This required adding better location tracking (which is also beneficial in that the translation warnings will show up as editor underlines in Eclipse etc). Instead of having errors generated for each locale ("the following strings are missing from locale X") it now generates a unique error for each string, listing which locales it's missing from. This also solves a different issue where the list of missing strings was truncated when large; there's no more truncation now. Change-Id: If63e92a6a750a5314af2f11441347cf9fc0b0a15
* | | Merge "Make API detector in XML files consider folder version"Tor Norbye2012-02-212-20/+4
|\ \ \ | |/ / |/| |
| * | Make API detector in XML files consider folder versionTor Norbye2012-02-212-20/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Take the folder version into account when checking the API level in XML files. For example, even if minSdkVersion=5, it's okay to have a <GridLayout> element in a layout if that layout is in a layout-v14 (or higher) folder. Change-Id: Idbd3647c1145e4b3d03f90626339ef7e6b10c827
* | | Merge "Lint rule to catch edit-usage of TextViews (should be EditText)"Tor Norbye2012-02-213-1/+284
|\ \ \
| * | | Lint rule to catch edit-usage of TextViews (should be EditText)Tor Norbye2012-02-213-1/+284
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TextView provides a number of attributes related to text editing. However, these are generally intended for the EditText subclass of EditText. This lint check looks for <TextView> elements in layouts where one or more of the edit-related attributes (such as inputType) are defined. It also updates the deprecation detector to check various deprecated attributes (it only checked for deprecated elements before this.) Change-Id: I1b94902d906cd0bee6a6564368125a68b3c9bb2a
* | | Use lint error mechanism for config issues like no classes foundTor Norbye2012-02-211-5/+13
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If Lint cannot find the .class files for a project, it cannot run any of the class-file based checks (such as the NewApi check). This changeset adds a new category and issue id, "Lint Error", for these types of issues. In HTML reports, these errors are listed at the top. The issue explanation states that these errors don't represent bugs in the user's code, but that lint was not able to check certain things for the reasons given. In the case of no .class files found, it asks whether the project needs to be built first. It also uses these lint errors to emit errors in processing lint.xml configuration files. (Note that if you don't want to see these types of errors, you can suppress it via --disable LintError.) Change-Id: Ifc2f55566f3a0cd20189d43e4205201bc21ee280
* | Merge "Lint rule checking that activities and services are registered"Tor Norbye2012-02-212-1/+248
|\ \ | |/ |/|
| * Lint rule checking that activities and services are registeredTor Norbye2012-02-162-1/+248
| | | | | | | | | | | | | | | | | | | | | | This changeset adds a lint rule checking that any named, non-abstract classes which extend Activity, Service or ContentProvider have a corresponding registration in the manifest file. It also ensures that the registration is under the right kind of tag (<activity>, <service>, <provider> or <receiver>). Change-Id: Ifbb587ae7b3eb6529d5099b33245d0478d48c41f
* | Add @android resource version checking to the lint API detectorTor Norbye2012-02-161-25/+102
|/ | | | | | | | This changeset makes the API lint detector look at XML attribute values and XML value text nodes and check any references to @android resources to ensure that they are available in all supported versions. Change-Id: Iab0d23423c30381e06b32f54aa902a31cc1f9a1c
* Add suppress-scope handling for more XML detectorsTor Norbye2012-02-168-69/+218
| | | | | | | | | | | | | | | | This changeset adds is-suppressed checking to most of the remaining XML detectors. These are detectors which do post processing on data in order to compute the warnings, at which point they no longer have access to the original DOM node context. This changeset adds various checks to handle this, such as storing the DOM node in the location handle client data and checking explicitly before using the handles. It adds various unit tests for the suppress scenarios too. There are now two remaining detectors which don't properly handle suppression: the TranslateDetector, and the DuplicateIdDetector (in cross layout scenarios). These will be addressed in a separate CL. Change-Id: I53e792dd2f2802c7dce16beb73127f20d9b2dba8
* Build fix: fix import packageTor Norbye2012-02-161-1/+1
| | | | Change-Id: Id8f467c5a088101e6b50c33fa0703520e31bdede
* Add onClick check for lintTor Norbye2012-02-163-26/+249
| | | | | | | | | | | | | This lint check makes sure that if a layout references android:onClick="foo" then one of the Java classes provide a public void foo(View) method. It also looks for simple typos, and warns if the access modifiers are not right. (It also moves some ASM-related utility code out of specific detectors and into the ClassContext class) Change-Id: Ifb0820221175a0760b83992f54e99f761b4d7097
* Fix HTML export category handlingTor Norbye2012-02-143-2/+5
| | | | Change-Id: Ia8f0c1aebb4e797352a0513b8113b5d6b75ef0dc
* Merge "Add lint check for custom attributes in library projects"Tor Norbye2012-02-145-99/+227
|\
| * Add lint check for custom attributes in library projectsTor Norbye2012-02-145-99/+227
| | | | | | | | | | | | | | | | Also adds a lint check for unused namespace declarations, and migrates the TypoDetector code into this new namespace detector. Change-Id: I5ec2214ea4c59e14194f8eaecef422ea19baa35e
* | Fix JavaPerformanceDetector to only report enabled issuesTor Norbye2012-02-141-8/+17
|/ | | | Change-Id: I6a68b28b610ebdfc31b779b7b66e49a70a5e1a01