aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/dictionary.txt
Commit message (Collapse)AuthorAgeFilesLines
* Reuse device display code from sdk-commonTor Norbye2013-03-221-0/+1
| | | | Change-Id: I49b5cd8352587a723d91d660a3f782322aa33033
* Merge "ddms sysinfo: Add support for gfxinfo"Siva Velusamy2012-12-061-0/+1
|\
| * ddms sysinfo: Add support for gfxinfoSiva Velusamy2012-12-061-0/+1
| | | | | | | | Change-Id: I8fdb798a0c5374a4be2825cb4be5f4f58437253e
* | Fix Rename Application Package such that it doesn't touch bin/Tor Norbye2012-12-051-0/+1
|/ | | | | | | | | | | | | | | Fix the rename application package refactoring such that it only modifies AndroidManifest.xml, not for example a copy in bin/. Also added a diagnostic information message to the plain Java package refactoring, shown when refactoring the application package, explaining that the refactoring will not actually change the manifest package, and explaining how to invoke the dedicated refactoring to change it. Also add unit tests for this refactoring. Change-Id: I13054e033b9ee44210ca341f00c633d73a4418b4
* Multi-configuration editing bug fixesTor Norbye2012-10-221-0/+1
| | | | | | | | | | | | | | | | This changeset fixes a number of bugs with multi configuration editing; especially around configuration switching and inheritance, as well as some memory improvements. It also synchronizes values between layout variations. If you for example have layout-land/foo.xml and layout-port/foo.xml and you change the Theme to Theme.Holo or the device to Galaxy Nexus, the configurations for both files will be updated (whether or not the files are open), and provided of course the layout folder doesn't contradict it; layout-xlarge/foo.xml would be unaffected by the above edit since Galaxy Nexus doesn't match the layout-xlarge folder. Change-Id: I5c01555aad8339f68788d8aed1f707d30993ae1b
* Lint detector for missing menu titlesTor Norbye2012-10-151-0/+1
| | | | | | | As requested in 38022: Lint should warn when menus don't have a title Change-Id: I34688d7733d98ba9fa8cc10202a5470040962117
* Multi-Configuration Layout EditingTor Norbye2012-10-031-0/+1
| | | | | | | | This changeset adds support for previewing other configurations (as well as including contexts) for a layout, with live updates. Change-Id: Iff3523d6f5749b3287716e563330fb18c8576611
* Support separate layout editors for a single layout resourceTor Norbye2012-09-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset changes the "reuse" behavior of the layout editor to no longer reuse the same layout editor when you are switching between alternate layout files for the same layout resource, such as layout/foo.xml and layout-land/foo.xml. This lets you more quickly switch back and forth and inspect differences between the layouts, etc. There is also an option in the Android > Editors panel to turn on single editor sharing again. The biggest part of the changeset, by far, is a cleanup of the ConfigurationComposite class and associated code. This was necessary not just to support the above feature (where we need to "back out" UI changes when you've made a configuration edit which results in a different file getting opened), but it's also an important preparation for multi configuration editing, where we need to be able to switch configuration settings in and out of a single configuration editor, etc. The configuration data itself is now in a separate Configuration class; the UI is in ConfigurationChooser, and the configuration matching code is in ConfigurationMatcher. There's also a new Locale class to track language/region pairs instead of using 2-element ResourceQualifier arrays. The various menu listeners are also in separate UI classes now. While there are new classes, most of the configuration matching algorithm is unchanged, just moved to a new class and the UI syncing and configuration data lookup replaced. Bitmasks are used to handle configuration changes, such that updating multiple related attributes (e.g. a rendering target change also causes a theme change if say Holo isn't available) can now be processed just once with a single change call. (Various other cleanup too.) Change-Id: I04ac969f46824321be3db0c487ef077c03cc6012
* Add lint rule which warns about View.setTag(int, Object)Tor Norbye2012-08-271-0/+1
| | | | | | | | | | | This changeset adds a lint rule which looks for potential leaks when using View#setTag(int, Object) where the Object is likely to contain a strong reference to the context, such as views and view holders. http://code.google.com/p/android/issues/detail?id=26984 Change-Id: Ib606485d2b875d2129c339b9b89be0e444629408
* Issue 34322: Fix handling of import statementsTor Norbye2012-08-271-0/+1
| | | | | | | | Fix the commit prefs lint check such that it correctly identifies scenarios where the innerclass "Editor" is referenced without its qualifying top level class, SharedPreferences. Change-Id: I3a22738508b66ce0b3e836feff91f816b2c368e8
* Asset studio fixesTor Norbye2012-08-061-0/+1
| | | | | | | | | | | | When generating actionbar icons from clipart, do not strip surrounding space, and do not add extra padding. The clipart images already contain baked in padding suitable for action bar icons. This CL also makes sure the UI disables the corresponding options in this mode. It also renames and moves to the bottom the legacy menu and tab icon generators, and fixes a file resource leak in the image loading code. Change-Id: I8a0dd61c97862206cdc71dc591a207a0b6a050f8
* Add support for additional languages in the typo detectorTor Norbye2012-08-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This checkin adds typo databases for six additional languages, as well as several fixes to the infrastructure. First, it now supports "globbing", since for example the German typo database contains glob patterns of the form "asymetrisch*->asymmetrisch*". Second, it supports multiword typos (such as "all zu->allzu") which caused some complications (since this means that the typo detector can match beyond the word boundary it was passed in). Third, it adds a bunch of validation code to the type dictionaries, which uncovered a bunch of inconsistencies (duplicate entries, using "-" instead of "->" for some separators, etc). There's now a unit test which produces a cleaned up version of each dictionary file, as well as tests to ensure that the ASCII and the UTF-8 comparison methods are in sync (and this uncovered some bugs which were fixed.) Finally, it fixes the HTML reporter such that it properly handles UTF-8. Change-Id: Ie32cbbe489687a7b50184696a027f87c2e21c409
* Allow custom source and class foldersTor Norbye2012-08-021-0/+1
| | | | | | | | | | | | Maven places the source files and class files in different locations than our default Eclipse and ant build systems. This changeset adds --sources and --classes arguments to the lint CLI to allow a build script to point to these custom locations. It also also looks in Maven's default location if it doesn't find the normal bin/classes/ folder such that out of the box it might just work even in Maven projects. Change-Id: Ia91b05f0fc9d2c7e504c962d2e794c768085754c
* Add basic flow analysis support to lintTor Norbye2012-07-231-0/+1
| | | | | | | | | | | This changeset adds in the ASM analysis library (an optional part of the ASM package lint is already using to process bytecode). It also adds some basic flow analysis to the SecureRandom detector to detect whether a given dispatch to a field of type java.util.Random is actually pointing to a java.security.SecureRandom, in which case it flags calls on it to setSeed() where the argument is a fixed integer. Change-Id: If85ab9f8db0e801a01f1a3ea845865b4f98e259c
* Add lint checks for wakelock and secure random problemsTor Norbye2012-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | This changeset adds new two lint bytecode-based detectors. The WakelockDetector looks for problems with wakelocks: - Calling release() in onDestroy() rather than in onPause() - Calling acquire() but never calling release() anywhere in the app. The SecureRandomDetector looks for problems with the SecureRandom random number generator: - Calling setSeed() with a fixed number, such as a string literal, or something equivalent (such as a static field reference of this or some other class) - Calling setSeed() and passing in System.nanoTime or currentTimeMillis since these are considered predictable seeds. These are both using the new fast-dispatch mechanism for bytecode detectors in lint. In both cases, there are more complex control flow we should be checking using flow analysis; that's for an upcoming CL where we add ASM's analysis library. Change-Id: Iec2a95b042b8a3e4e976923cc62e9dccf2dfeca5
* Handle window events across multiple workbench eventsTor Norbye2012-07-201-0/+1
| | | | | | | | | | | | | | | | ADT uses a "window coordinator" which listens for various window related events (such as part activation, editors getting maximized etc) to implement its various layout editor handling (to dock property sheets within the layout editor unless it's shown in the surrounding frame), to activate/deactivate editors for keybinding handling, etc. This did not take into account the possibility of multiple workbench windows getting opened. This CL adds proper support for this. The window coordinator is no longer a singleton; there is one instance per workbench window, and AdtStartup listens for workbench events and creates or disposes these on demand. Change-Id: I298d9d82c7aefd684bcb1ace3bee0267e1f94a60
* Only report field getter issues when targeting pre-Froyo targetsTor Norbye2012-07-161-0/+1
| | | | Change-Id: Ibc8756c2580a9e263b63b3507224acdf09f264ed
* Workaround for Eclipse 4.x focus issueTor Norbye2012-06-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | In Eclipse 4, the system calls setFocus on the outline view *after* a mouse click inside the outline has been processed. This ends up calling setFocus on the treeviewer. If you clicked in the property sheet to for example start editing a text property, this means the focus loss will cause the property editor to abort editing again. The net result is that you always need to click twice to start editing properties if the Outline view does not already contain focus. This changeset adds a workaround for this. It has two parts. First, simply make the OutlinePage's setFocus() method do nothing if it's called during a mouse click in the property sheet (which we can track with a mouse listener). The second part is trickier. The outline view itself (which is provided by Eclipse and we have no hooks into it) will be called first, and it calls setFocus() on its first child, which is a composite, so it ends up searching down for the first focusable component. The workaround is to add our own widget as the first child, and make it declare that it's focusable but make the setFocus call a no-op. Second, make the widget invisible since we don't want anything but the tree viewer in the outline. Change-Id: Ib89943c410bce599723f59a4f202f339adab6327
* Merge "Code completion in custom views now picks up newly added attrs"Tor Norbye2012-05-291-0/+1
|\
| * Code completion in custom views now picks up newly added attrsTor Norbye2012-05-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ADT encounters a custom view, it creates a view descriptor for that custom view, and in ADT 20 it also finds the associated styles and records these as attributes, which means code completion and the property sheet will show these properties. However, once the descriptor has been lazily created, it never changes. If you go and edit the styles.xml file specifying the attributes for your custom view, you need to restart the IDE before code completion will pick up these changes. This changeset makes this behavior more dynamic: It will now pick up edits to the files specifying styles for a custom view. Change-Id: I365119e18c74378a0a039c1e7a22641c94acf002
* | Support selector syntax for thumbnails in templatesTor Norbye2012-05-251-0/+1
|/ | | | | | | | | | | | | | This changes the thumbnail handling from templates from ad-hoc attributes to a more selector-centric system. The template can specify one or more thumbnails along with parameter values associated with those thumbnails. When the user edits an attribute, the wizard reevaluates the thumbnail and picks the best match (meaning one of the thumbnails that matches all the parameter values, and among those the one that matches the most.) (This changeset also moves the metadata code into a new class.) Change-Id: Ic75d58573df5b2ea200c6b2861bbf36ce17ea1c3
* New Template Wizard supportTor Norbye2012-05-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds several new templates, to create a new project, a new activity, a new custom view, etc. More importantly, it contains support for these wizards (and the corresponding code generation) to be driven by templates. A wizard contains metadata which provides a name, description and icon for the template, as well as a list of parameters, along with type and constraint metadata for those parameters. When a wizard is created for this template, it automatically adds UI elements to input the parameters and to validate the input. Parameters can also specify their default values as templated expressions using the other variables on the page, so in the New Blank Activity wizard for example, editing the activity name automatically updates the suggested layout name, by repeatedly evaluating a template expression to compute a layout name from an activity name. There's a recipe file for each template which states what actions to take to create the template. In addition to obviously copying resources (such as icons and jar files) and instantiating templates (to rewrite text using variables and FreeMarker logic), it can also merge XML contents (to for example insert activity registration metadata into the manifest file, or add string definitions to the strings.xml file), and it can cause files to be opened when the template is created. Tne new wizards also use JFace's decorator support to provide help and to mark text fields that contain errors, when one or more of the page fields do not validate, as well as to show tip text along the bottom of the page. One example of this is that it explains what a "package name" is when the package field has focus. This changeset also contains a "Template Development Wizard" which lets you point to a local directory containing a template definition, and run a test wizard from there. This is useful for developing, debugging and testing templates. Change-Id: I08e7d2464a1ef00d09517f0154c42681249a7ff6
* New Configuration ChooserTor Norbye2012-05-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset replaces the configuration chooser with a new UI. First, the two lines of comboboxes have been replaced by a toolbar, which will wrap to two lines if it cannot fit on a single line. However, it tries hard to avoid this scenario by using icons and brief labels. For example, the rendering target is displayed as an Android icon along with just "4.0" instead of "Android 4.0". Similarly, the "Other" locale is just shown as a globe icon, and for example in the Device list "4.65in 720p (Galaxy Nexus)" is display as just "Galaxy Nexus". Second, the "current configuration" label is now a dropdown instead. The text of the label displays the current configuration as before (though using the brief name, e.g. "layout-land" instead of "Landscape Configuration". In addition, it's a dropdown, and opening the menu will display all other available configurations for this file. Thus, if you have a special landscape version and a special tablet version of a particular layout, the menu will contain default, landscape and tablet (where the menu items display the full configuration names such as "Landscape Orientation"). In addition, the configuration menu also contains "Create New...", which is the new location for the Create button which used to be in the toolbar itself. Third, there is a new "Activity" dropdown. This displays the current activity associated with this layout, next to an Eclipse "class" icon. It is initially populated with our best guess of what the activity is. The chosen activity determines which theme is initially assigned to a layout (for example when there is a Manifest registration of a theme to an activity). In the future we will use this facility to drive other features as well, such as preview rendering the action bar (where we need to know the associated activity) or assisting with creating click handlers. The Activity dropdown menu also contains a "Open <Activity class>..." action for jumping to the associated Java code. The chosen activity is persisted as an XML attribute in the layout so it should be preserved across IDE sessions and shared among developers. Fourth, all the dropdown menus are now native SWT menus rather than dropdown menus, which means we can use icons, proper separators, and nesting. The locale menu now shows flag icons next to each region (and when a locale is chosen the corresponding icon is shown in the configuration toolbar). In the Theme menu we no longer need to use "-------" ASCII separators, we can use proper native menu separators instead. And the Theme menu is now nested; rather than a really long list of options, the menu is grouped into related sections: * Currently selected theme * Project Themes > * Manifest Themes > * Holo Themes > * Holo.Light Themes > * DeviceDefault Themes > ... * All > * Open "<current theme>" Declaration... Fifth, the device configuration combobox has been replaced by three inline icon radiobuttons, showing portrait, landscape and (if enabled) square. This makes it easy to switch orientation through a single click. Sixth, the UI mode (Normal/Car/Dock) and Night mode (Day/Night) are no longer directly shown in the configuration chooser since they are not used frequently enough to warrant persistent space in the always visible toolbar. Instead, there is an "Edit Configuration" icon on the left you can click which brings up a full editor dialog where all the previous combo boxes appear, along with the generic configuration qualifier selection dialog. Here you can make more specific edits to the current configuration state. There are various fixes as well. For example the whole toolbar is hidden during platform data loading and made visible at the end. When creating a new configuration file, that new configuration file is opened after creation. We now track whether the current theme (stored in the IDE persistent property) is a project theme or a framework theme. Change-Id: Ic8d9817c7bc4dbcae4535b6b9222393fb49cfde9
* Improved layout window managementTor Norbye2012-04-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset improves the way the layout editor handles windows. In particular, it attempts to make the property sheet and the outline more visible. Specifically: * It adds the WindowBuilder docking support, which offers several new features: (1) You can collapse and expand the palette and structure views. If you hover over a collapsed palette (for example) it temporarily opens, and when you drag from it over to the canvas it collapses again. (2) The initial size is pixel based rather than percentage based, so the default palette size is more reasonable on large displays (it used to always take 20%, which was fine on a small screen but a waste on larger screens). (3) You can drag & drop to reconfigure the layout a bit. (This is fairly limited though; in particular, you cannot drag these views out of the editor area and mix them with Eclipse views.) * When the property sheet view is not shown anywhere else, it is shown as part of the outline instead (sharing the vertical space). This works better for the new property sheet implementation since it works better as a vertical window than a horizontal window. * When the outline is not shown anywhere else, it is shown in a new composite window *inside* the editor area. This mode is also entered when you temporarily maximize the layout editor window. * The layout canvas is auto-fit-zoomed when you enter and exit maximized mode, as well as when you open or close docked windows within the editor. The goal is for these changes to offer a good layout editing experience with the outline views and property sheets *without* using a new perspective for layout editing. Note that this is not identical to what WindowBuilder does; they always embed both the palette and the structure views within the editor area, which means the structure view is typically redundant with the outline view on the right unless you maximize the view. With the approach above hopefully we'll avoid that case and you'll always see the views without redundancy (and therefore with more available space for the layouts). Change-Id: I0d338b2781b9732e992f088fcc4e1ba46ff0954f
* Add support for the WindowBuilder Property SheetTor Norbye2012-04-051-0/+5
| | | | | | This reverts commit 27dac06bfc4297dc9a018edc534f44ecf96cd724. Change-Id: I6708bd4091f0cb677484669479357d479b9db5fa
* Revert "Add support for the WindowBuilder Property Sheet"Tor Norbye2012-04-031-5/+0
| | | | This reverts commit a7621238bf0202419677380ee3a268142358df83.
* Add support for the WindowBuilder Property SheetTor Norbye2012-04-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The WindowBuilder propertysheet has been extracted and added as a library in external/eclipse-windowbuilder/. This changeset removes the old propertysheet code (which used the builtin Eclipse property sheet page), and replaces it with the WindowBuilder one, along with new code to aggregate the properties into some categories, as well as tagging some of the properties as advanced. (This was computed by running the same analysis scripts used to produce the most-frequent attributes (sdk/attribute_stats) and instead computing which attributes are used very infrequently or not at all in some representative sample code.) The WindowBuilder propertysheet gives us the following new features: - Highlighting (bold) of important attributes - Masking (and when included, shown in gray italic) of advanced attributes - "Complex" attributes with nesting, used to for example aggregate all the layout parameters into a single node, and the margin layout attributes within those - Tooltips over the attribute names, not values, so they never obscure content In addition, this changeset adds custom implementations of properties, property editors and property dialogs for the core Android property types (XML strings, flags and booleans), which adds the following new features: - Preview rendering of color and image resources inline - Display of -default- attributes (those not specified in XML) using the layoutlib facility getDefaultProperties() to render the implied attributes. For example, if you look at a Button, it will show you that the implied value of "Text Color Link" is "@android:color/holo_blue_light" even though it is not set. NOTE: This only happens for attributes that were actually queried by the widget during rendering. Attributes that are not used by the widget have no (displayed) value. Thus, EditText-specific attributes in a TextView are not shown when a non-EditText TextView is selected. - Evaluation of the attributes. In the above example, in addition to showing @android:color/holo_blue_light, it will chase down the value of this to for example render a blue square next to the value. For drawables it will render a thumbnail, and for String resources it will display the actual value in parentheses. - Field completion in text fields, completing all resource strings (@string, @android:string, etc), as well as flag values. Enum values are chosen in a dropdown. - Checkbox support for boolean values, allowing you to click through the three values true, false and null. - Our custom version of the Property Sheet Page allows you to expand/collapse all properties, and it also has an option letting you switch between Alphabetical Sort (where all attributes are in a flat table, sorted alphabetically by property value), or hierarchical sorted "by category". Currently the categories are simply the defining views, plus 2 more (layout parameters and deprecated attributes). When we get more metadata, it would be nice to switch these to more logical categories, such as "text", "scrolling", "focus", etc. (There is some preliminary support for this in the code, but since the defining-view categories seem to work better those are used instead right now.) Change-Id: Ie4959a3a2c36c083dcc1ba19a70f24b33739fe2f
* Speed up loadPublicResources()Tor Norbye2012-03-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FrameworkResources method which loads in the public resources takes about ~500ms of the target loading time. This changeset optimizes this down to < 50ms using the following three optimizations: 1) Precompute a map from names to ResourceItems before processing the public names. Before this, it would search sequentially through the name list, which when done n times meant O(n^2); we can construct the map in O(n) and then perform n lookups in O(1) => O(n). Also, be smart about which maps we precompute names for: the ResourceType.PUBLIC and ResourceType.DECLARE_STYLEABLE types have about 2,000 items, none of which are public, so skip precomputing maps for these two. (However, keep the linear search around such that if any are exported in the future the code will work correctly. Similarly, we know "roughly" the size of the final public maps, so initialize them in the right size range such that they don't have to do any internal resize+copy operations as we insert into them. 2) In android-15 there are 1500 new <java-symbol> elements in the public xml file, which were being processed, doubling the number of exported symbols. Limit the processing to only the <public> tags. 3) Switch from DOM parsing to pull parsing. This helps since more than half the file consists of <java-symbol> elements, and we can ignore whitespace and id attributes etc, so there is much less object creation involved. Change-Id: I4761e1182b9bc0c50fe94aea7dcd9690754c7908
* Handle the android support gridlayout library automaticallyTor Norbye2012-03-081-0/+1
| | | | | | | | | | | | | | | | | | | | | This changeset adds support for the android support library's GridLayout library project. When you create a new layout with the GridLayout, or when you drop a GridLayout, the IDE checks whether you need the compatibility version of GridLayout (e.g. min sdk < 14), and if so, offers to install it. This will then first run the SDK manager to install the android support package into extras, and then it creates a local library project in the Eclipse workspace, and updates the library dependency to reference it. Finally, it rewrites tags such that the layout will use the compatibility package for the <GridLayout> and <Space> tags. This is done in the node handler, so client rule code will automatically get the right compatibility tag; they don't need to handle it there. Change-Id: I6da926eee7ffa956832ddd311d4180e8ff38ae07
* Make the lint string-format check ignore date stringsTor Norbye2012-02-071-0/+1
| | | | | | | | | | | | | | | | The string format lint check might be processing strings not intended for String.format (but intended for example for android.text.format.Time#format), in which case it will be wrong about whether two conversions are incompatible. (This does not fix all scenarios; if a date string looks like a String.format in the sense that all of its formatting characters are defined by String.format then the string will assume to be intended for String.format.) This changeset attempts to recognize this, and also make the "is incompatible" check a bit more nuanced: it will now consider "d" compatible with "x" for example. Change-Id: I63ce082f40169e4033809d25cae3cf116c9e2044
* Lint HTML improvementsTor Norbye2012-02-011-0/+1
| | | | | | | | | | | This changeset makes various improvements to the Lint error report: the styles are now in a separate stylesheet, and the default style is Holo-like. Paths are handled better when linting multiple projects such that the report title includes the root-relative project path, and all filenames are then relative to the project root. The table of contents is now a table, and includes error and warning icons. Change-Id: I4e49f7b226bfa4d7b46e3a29e006fe78a504e9ef
* Add @SuppressLint support for Java parse tree detectorsTor Norbye2012-01-311-0/+1
| | | | | | | This changeset adds support for suppressing lint warnings by annotatating variable declarations, fields, methods and classes. Change-Id: If274d65bccdc5c7d6426566c635245d6b3aae147
* Write lint overview report for multi-reportTor Norbye2012-01-311-0/+1
| | | | | | | | | | | If lint writes out multiple HTML reports (e.g. when specifying a directory to the --html flag), and there are more projects than just one, write an overview doc which contains a table of all the projects and the corresponding error and warning counts in decreasing order, with links to the individual reports. Also ensure that there are no case-insensitive filename clashes. Change-Id: I4dcda14a625863e71022734088a027fc8ac357d0
* Add lint checks: String format, Casts, Security, Imports, /sdcardTor Norbye2012-01-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds several new Java parsetree-based lint detectors: (1) String format checker. This checks several issues related to formatting strings (%1$s), such as - Is the string format valid? - Is the string format consistent between different translations, e.g. if argument #1 is of type "s" in locale A, is it also of type "s" in locale B? - Is the string format being called from Java with arguments of the right type? - Are strings which are not supposed to be formatted (e.g. ends with a %) passed to String.format? (2) View Cast checker. Looks at the views associated with specific id's in layouts, and makes sure that any casts to views returned by findViewById in Java is cast-compatible with the type in the layout. For example, if you have a layout containing a <Button id="foo">, then a cast to an EditText of findViewById(R.id.foo) would be invalid. (3) A security check which flags file creation calls that pass a context of world-writeable. (4) An "import android.R" checker. This looks for "import android.R" in .java files and warns that this is potentially confusing. (5) A hardcoded "/sdcard" string checker which looks for this prefix in string literals and when found warns that the method Environment.getExternalStorageDirectory().getPath() should be used instead. Change-Id: I14a4656f0ff6a58f25cde1b4bb23f6c47c47fdba
* Lint View ImprovementsTor Norbye2012-01-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset makes a bunch of changes to the Lint Window in Eclipse: * First, it changes the view from a flat table into a hierarchical tree. For any given type of error, there is one top level tree node, and its children are the remaining occurrences of the same error. This makes it much easier to quickly skim through the different issues without having to scroll; if you see an error you want to fix, you can expand the node to jump to all the various occurrences. The top level labels also include a count in the form of "(2 items)" after the error message so you can get a sense of how many warnings were found for each type. * Second, it adds a bunch of new actions to the Lint View toolbar: expand, collapse, configure (more on that later), settings, and ignore file and ignore project (ignore global was already there). It also updates the icons for some of the existing actions; the lint toolbar action and window should look a bit better now. * Third, it adds more columns (such as priority and category) to the lint view, and makes the set of visible columns configurable. You can click on the Configure toolbar action to bring up a dialog to show which columns are included, and this selection is persisted across IDE sessions (and it also persists the column sizes). Furthermore, instead of separate file, path and line number columns, there is now a new "Location" column, which is shown by default instead of the separate file, path and line number columns. This column displays combined info for all three: the file name, the line number, the parent folder and the project name. This includes all the relevant information in a more compact format such that there is more room for the error message. * Fourth, the table now supports sorting: you can click on any column header, and the table will be sorted using that column as a key. (This is not alphabetical but a logical sort defined for each column; for line number and priority it's obviously numerical, but for the default column it continues to be a combination of severity, priority, issue type etc.) Change-Id: I42695988780b493ad90aff5aeb5895e0fd8d3998
* Lint Library SupportTor Norbye2012-01-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | This changeset adds support for library projects to lint. Lint now checks all the library projects for errors as well, and projects that depend on global analysis (such as the unused resource detector) will properly handle resource declarations and references across projects. This changeset also cleans up the multi-project handling for the Lint window in Eclipse. The "Run Lint" toolbar action, in addition to operating on multiple selection, now has a dropdown menu for choosing which projects to check (and there are also actions for checking all projects, the current file, and clearing markers). Running lint on a project will also automatically include dependent library projects. Finally, some misc UI improvements: The Lint preference dialog includes buttons for quickly enabling and disabling all the checks; the Lint View includes a Project column which is shown when more than one project is checked, and the file and linenumber columns are now blank when the location does not correspond to a specific file. Change-Id: I733f5258102dfb0aebbc2b75cb02b9ba6ef974e8
* Extract positional XML parser into common and fix encoding issuesTor Norbye2012-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The XML DOM parser used by the lint CLI driver (which tracks positions) is needed outside of lint, so pull it out of the lint/cli project, and refactor it such that it does not directly reference the lint Position APIs (but can utilize them when subclassed in lint). In addition, handle non-UTF-8 file encodings. XML files can be encoded in other character sets, and can specify this via the encoding attribute in the XML prologue. Until now, the CLI lint runner would just read the XML file contents in using the default encoding and parse this. Now there's a new utility method which takes a byte[] and infers the desired encoding and uses that to convert the byte[] into a string using the correct encoding. (We can't just pass an InputStream and let the SAX parser handle this on its own because the XML parser needs to access the character stream in order to assign correct node offsets.) This code now also handles the byte order mark more cleanly. There are some new unit tests too to check the new encoding, BOM and offset handling. Change-Id: Ib0badbbe72172e3408c6d5af2413be51280a7724
* Add Java Classfile supportTor Norbye2011-12-051-0/+1
| | | | Change-Id: Ifcc1d88dabb07dc05b2e5c934743ad52f9b6dc1d
* Lint infrastructure improvementsTor Norbye2011-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset fixes a bunch of issues in the infrastructure: (1) It cleans up the Context class quite a bit. It had some hardcoded XML stuff in it, which is now in a separate XmlContext class (and there will be a JavaContext class in the Java support CL). It also hides a bunch of public fields, cleans up some unused stuff, and introduces a couple of wrapper methods to make detector code cleaner; in particular, rather than calling context.client.report(context, ... you can now just call context.report(... and similarly there are wrappers for logging and checking for disabled issues. (2) The IParser interface is renamed to IDomParser since in the next CL there will also be an IJavaParser. Some other related cleanup. (3) There is now a "Location.Handle" interface. This allows detectors to create light-weight location holders, and later on call handle.resolve() to create a full-fledged Location. This is useful when detectors don't yet know whether they'll need a location for a node, but want to store it for later in case they do. As an example, the unused resource detector creates location handles for declaration and only resolves full locations for those that are found to be unused. Locations can now carry custom messages. For example, for a duplicate id error, the secondary location now contains a "original declaration here" message. And the CLI and HTML reports now include alternate locations in the output. Some other location cleanup too; using factory methods to make the code cleaner, some default implementations that can be shared, etc. (4) There's a new SDK info class intended to provide SDK information from a tool client (such as resource resolution). It currently just contains parent-view information, used for the ObsoleteLayoutParams detector and an upcoming CL for a ViewTypeDetector. (5) The Detector class now provides dummy implementations for the inner-interfaces, so we no longer need the adapter classes. This makes it easy to implement the XmlScanner or JavaScanner interfaces without needing to also stub out a bunch of methods. Change-Id: I4b3aaabe51febb25b000f9086703653bea6cf7c9
* Merge "Typography lint checker"Tor Norbye2011-11-231-0/+1
|\
| * Typography lint checkerTor Norbye2011-11-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds a new typography detector. This looks at the strings defined by the application and makes various suggestions to make the text look better typographically, such as - suggesting directional single and double quotes instead of straight single or or double quotes - suggesting typographical apostrophes instead of straight ones - suggesting n-dashes instead of hyphens in number ranges - suggesting m-dashes instead of --'s - suggesting fractional characters instead of strings like 1/2 - suggesting the ellipsis character instead of "..." - suggesting the copyright symbol instead of (c) There is also an Eclipse quick fix for these issues. Change-Id: If3912f9d34841faf069174f291911f73e6b78c28
* | Automatically fix up editor bindings on project load (once)Tor Norbye2011-11-231-0/+1
|/ | | | | | | | | | | | | | | | This changeset adds a follow-up fix for 21124. The fix for that issue fixes the problem where newly discovered files aren't assigned an editor binding. However, it does not *retroactively* fix up editor bindings for files that it didn't correctly initialize. This changeset fixes that. It adds a project open hook which scans through the resource folders and reassigns the editor type of any .xml files based on the resource type. This hook is only run once - it uses a project persistent property to ensure that it only performs this check once (or whenever we rev the version number associated with the scan.) Change-Id: Id843a8a174c84e3794e88a1c108b67d4000a3e69
* Add support for NTLM proxy authentication.Siva Velusamy2011-11-121-0/+1
| | | | Change-Id: Ia8375444bf99b33396616a57e781adb22d82175d
* Add duplicate icon detectorTor Norbye2011-11-081-0/+1
| | | | | | | | | | | | | | | | | This changeset adds a detector which finds two types of icon duplication: - Unrelated drawable resources which have the exact same bitmap. This could mean that the wrong icon was checked in, or that you could potentially consolidate to using a single resource. - Resources which have the same bitmap for multiple different configurations, such as the same icon in both -mdpi and in -hdpi. Unlike the various dip size checking methods, this also works for nine patch files. Change-Id: Ibe2d0900cecb66c2589400f24c2af9a76ad8dabe
* New lint icon detectorTor Norbye2011-11-071-0/+10
| | | | | | | | | | | | | | | | | | | | This changeset adds a new image detector which looks for various issues related to icons: (1) Are there bitmap icons in the densityless res/drawable/ folder? (2) Do the icons appear in all the density folders (except, optionally, ldpi) (3) Are the launcher/notification/etc icons of the expected size? (For example a launcher icon should be 48x48 in mdpi). This issue is disabled by default. (4) Do the various bitmaps roughly have the same density-adjusted sizes across all the densities for the same configuration parameters? This will catch cases where assets are placed in the wrong place. (5) It warns about using .gif files since that format is supported but discouraged. Change-Id: Ibe0f97cba7cada5ac0deee244310a38dbc721873
* Lint infrastructure fixesTor Norbye2011-11-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset makes a number of infrastructure fixes to lint. It also has some user visible aspects: (1) The "run lint on export" option, which aborts Export APK if fatal errors are found, now only checks for fatal issues, which should be significantly faster (since it skips expensive detectors like the unused resource detector). (2) The command line lint tool lets you specify not just issue ids, but categories to enable or disable as well. In addition to the --enable and --disable flags to add or remove checks, there is also a --check flag which runs the exact specified checks. Thus you can for example run "lint --check Security" to run the security related lint checks. When using --show to display the available id's, they are organized and described under category labels. I also cleaned up the categories a bit; "Layout" isn't a category anymore, and instead the layoutopt options are placed in other categories like "Performance" or "Usability". (3) From the command line you can now also specify multiple projects or even search a directory for projects contained recursively within it. This required a bunch of infrastructure changes to handle partitioning up the arguments into related projects (since checks have before-project and after-project hooks that need to run properly). (4) On the infrastructure side the "scope" concept was changed to become a scope set, and a detector can declare that an issue requires analysis of any of {manifest, resource file, java source file, resource folder, ...} etc. When lint runs it determines which detectors are applicable (for example, for a single-file lint run it will ignore detectors which require a wider scope). And when applicable, a detector will be called for all the various scopes it requires. Therefore, the unused resource detector, which used to have to manually scan the manifest file on its own, now automatically gets called as part of the manifest file parse, the resource file parses, and the java file scan. Single-file linting is still only supported for XML files. Change-Id: I49a5e2b27f8f6da22904085089aa0c4d2eee67f6
* Two new lint warnings: array-size check, and manifest orderTor Norbye2011-10-261-1/+2
| | | | | | | | | | | | | | | | | | | | | This changeset adds two warnings: (1) A new lint warning which checks the sizes (number of items) in arrays of the same name across the various resource files and warns if the number of items differ. (2) A new "manifest order" detector which looks for element ordering problems in manifest files, such as placing <uses-sdk> after the <application> element. It also cleans up the way XML detectors were handled such that a detector can be an XML detector without being a resource detector (such as the manifest detector for example). Finally it also moves classpath initialization into the tool context where it belongs. Change-Id: I02fee56bfdbe1064874acf70f18db79897d8a908
* Static analyzerTor Norbye2011-10-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds a static analyzer, "lint", which looks for various potential bugs in Android projects. It has 3 parts: (1) A library which performs the actual static checks. This library is standalone: it does not depend on Eclipse. (Technically the library has two halves: an API half, for use by third party developers to write additional detectors, and an actual implementation of a bunch of built-in checks.) (2) A command line driver, "lint", which runs the static checks and emits any warnings to standard out. This can be thought of as a replacement for the layoutopt tool. (3) Eclipse integration. Lint errors are added to the Problems view as well as shown as editor annotations. There's an options panel for controlling which detectors are enabled. There's also a quickfix for disabling errors directly within the editor and a marker resolution for disabling them via the Problems view. The static checks are run on an XML file right after it has been saved. (This is optional via a toggle on the same preference page as the detector list.) The static checks are also run when you export an APK, and if any fatal errors are found the export is abandoned. (This is also optional via an option). Finally you can run a full lint through the Android Tools menu, and there's also an action to clear all the lint markers there. There's also a new indicator on the layout editor which shows whether there are lint errors on the associated file, and when clicked brings up a dialog listing the specific errors. This changeset also includes a number of checks: * An accessibility detector which warns about images missing contentDescriptions * A drawable selector detector which warns about state lists where not all states are reachable (e.g. it is not the case that only the last item in the list omits a state qualifier) * A detector finding duplicate ids, not just in the current layout but across included layouts (transitively) as well * All the layoutopt ones ported to Java + DOM * Unit tests for the above. The focus here is on getting the infrastructure in place, and it currently focuses on XML resource files and analyzing them efficiently. See the comment in XmlVisitor for details on that. Change-Id: Ic5f5f37d92bfb96ff901b959aaac24db33552ff7
* More GridLayout FixesTor Norbye2011-10-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset fixes various issues in the GridLayout support: (1) Add custom Paste support for GridLayout. The default copy/paste handler just treats a paste as a drag into (0,0) followed by a drop. That doesn't work well for GridLayout since it ends up writing the dragged elements into row/column 0,0. This changeset adds a custom override of the paste handler such that it adds the pasted elements into successive table cells instead. It still needs to adjust the column spans to avoid changing the current table structure; that will be done in a followup CL. (2) Clean up the Layout Actions Bar a bit for GridLayout. Separate out the "Show Structure" and "Grid Mode" actions, and make grid-operations (Add/Remove Row/Column) only show up in Grid Mode, and similarly only show Snap to Grid in Free Mode. (3) The hidden <Space> widgets should also be hidden when selected via Select All. Also fix a remaining issue with the action enablement of Select All. (4) Fix a bug where the preview bounding rectangle was drawn at the wrong place when showing a center-horizontal proposal. (5) Remove an assertion encountered during GridLayout conversion which is not always true. Change-Id: I8c4c0cac5052e59c5943e535b2f790f420303f9d
* Refactoring quick fix adjustments to caret and selection handlingTor Norbye2011-09-301-0/+1
| | | | | | | | | | | | | | | | This changeset changes the logic in the refactoring quickfix (which adds the Android refactorings based on the current caret position, lexical context and selection). It now allows some of the refactorings to be run when there is a selection (this fixes "20393: Extract string functionality in Android XML files"), and it makes other refactorings work when there is no selection (it implicitly selects the surrounding element). It also ensures that the Extract Style refactoring won't be listed at the top if the attribute under the cursor is not a stylable attribute, and it makes some other adjustments to the proposal order. Change-Id: I0714bb652032aa19e6c2502dc1af7bb5e4adf308