History log of /sdk/lint/libs/lint_checks/src/com/android/tools/lint/checks/TranslationDetector.java
Revision Date Author Comments
6837aad30d6c51783ca1dc784ca6bdcc8a3d9f2d 18-Sep-2012 Siva Velusamy <vsiva@google.com> Rename ide_common to sdk_common

Change-Id: I1b39ee439a532f3f6758be35b569948e2e906665
12d4581faa6438941e65a9dc83213be34c6ca970 13-Sep-2012 Tor Norbye <tnorbye@google.com> Constants refactoring.

This changeset moves most constants into the SdkConstants
class, and gets rid of AndroidConstants and LintConstants.
It also migrates all non-ADT specific constants from
AdtConstants into SdkConstants. It furthermore moves various
other constants (such as those in XmlUtils and ValuesDescriptors)
into the constants class. It also fixes the modifier order
to be the canonical modifier order (JLS 8.x).

Finally, it removes redundancy and combines various constant
aliases such that we don't have both NAME_ATTR and ATTR_NAME
pointing to "name", etc.

Change-Id: Ifd1755016f62ce2dd80e5c76130d6de4b0e32161
04e0362252295b3e94ca72350f2d3bf08962b2d7 04-Sep-2012 Tor Norbye <tnorbye@google.com> 36942: tools:ignore="DuplicateActivity" just doesn't

Change-Id: Iffd270a227a8a76636cbfa5d19c6e0330a8391fb
ec9484e931d521ccb97da090a0a91986a6b9a5eb 28-Aug-2012 Tor Norbye <tnorbye@google.com> Minor tweaks and typos

Change-Id: I46630c51a4f055222fb614d73419cb28272b87de
addbd7110d87e9f48d854e5ba6a729359110ada8 22-Aug-2012 Tor Norbye <tnorbye@google.com> Use simple markup for bold and monospace in lint issues

The explanation text for issues can now contain some simple
markup such as * around sentences for bold and ` for monospace.
In the HTML report this is converted to HTML markup using <b>
and <code> spans, as well as <a> for http:// links.

Change-Id: I875a55a0ab9a61c2e8bb493ad94d5e4d51dd1072
9a666a7cf24a78455482b79b4fbe4c1eba0481ce 04-Aug-2012 Tor Norbye <tnorbye@google.com> 35875: Lint too strict about translating strings by default.

This changeset updates the issue explanation for the translation
detector to explain the translatable=false and donottranslate.xml
mechanisms to handle non-translatable strings.

It adds a quickfix for missing translation items to set the
translatable attribute to false.

It also makes lint warn where you're using translatable=false
on strings in a locale-folder, as well as when you're translating
a string defined as translatable=false in the base folder.

And finally it also bumps up the severity of the extra translations
issue as justified in issue 35875.

Change-Id: I7539464b234b0a4b444bf9f188ce5b819f962430
e452eef06c22959dfb25fe7b61d38bb509786028 24-Jul-2012 Tor Norbye <tnorbye@google.com> Improve handling of library projects in lint

This changeset improves the way lint handles library projects.

Until now, running lint on project "master" would also look up any
library projects referenced by the master project, and analyze the
library projects as well. This is necessary in order to correctly
compute unused resources for example, since it's possible for a
resource to be defined in one project and referenced in another.

However, while this behavior is desirable for users who partition
their code up into library projects, it has some serious problems for
users who are using a third party library project:

- Their lint output can be swamped with errors from the library which
they have no control over.

- If for example the library provides translations into 60 languages,
lint will use these 60 languages as the set of languages targeted by
the application, and complain about all strings in the master
project which are not translated into all the languages.

This changeset makes a key change to how library projects are
handled:

(1) If you run lint on all projects (including the library projects),
then there is no change from before.

(2) If you run lint and specify just a project, then lint will
continue to analyze the project as well as all its libraries,
but will only report problems on the user-specified project.

The way this is done is by a new "report errors" attribute stored with
each project. All projects that are explicitly referenced on the
command line (or selected in the Eclipse UI), and all projects that
are found recursively if you specify a top level directory, all these
projects have their "report errors" flag set. Any remaining projects,
which would be those found through library project references, these
have their report errors flag cleared. And whenever lint is processing
errors, it will filter out errors for projects that are not reporting
errors.

This addresses issue
http://code.google.com/p/android/issues/detail?id=33847
as well as a number of other requests (in StackOverflow and elsewhere)
around the ability to filter errors in library projects.

Change-Id: I9d084f598c678ecf79cfe70d8ea7a84844333acc
db39de536209298ed0c09a0e5aaf69c9df5715d3 24-Jul-2012 Tor Norbye <tnorbye@google.com> Tweaks to the lint CLI offsets

Change-Id: I20592372d41235b36227a0d36014d77c23c7fc58
7e4b8e9d595e45baa9d87cdb8282f02759e73abc 30-May-2012 Tor Norbye <tnorbye@google.com> Fix nullness annotations

Eclipse 4.2 includes analysis support for @Nullable and @NonNull
annotations. However, it requires these annotations to be *repeated*
on every single method implementing or overriding a superclass or
interface method (!).

This changeset basically applies the quickfixes to inline these
annotations. It also changes the retention of our nullness
annotations from source to class, since without this Eclipse believes
that a @NonNull annotation downstream is a redefinition of a @Nullable
annotation.

Finally, the null analysis revealed a dozen or so places where the
nullness annotation was either wrong, or some null checking on
parameters or return values needed to be done.

Change-Id: I43b4e56e2d025a8a4c92a8873f55c13cdbc4c1cb
8eec9333ea57cfed1f90524ea480c52e128bd09e 23-Apr-2012 Tor Norbye <tnorbye@google.com> Fix 29263: ExtraTranslation incorrectly flags string-arrays

Fixes http://code.google.com/p/android/issues/detail?id=29263

Change-Id: Id4e247ce751bca9ff54311126d64e1fbd0bfb312
0439ffbb1e53702ea8c3bbba299f2d0323c1c5a8 18-Feb-2012 Tor Norbye <tnorbye@google.com> Add lint rule to catch incorrect setColor calls

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
70b12c9566e097e88e241c389b19c2b1b5a29577 22-Feb-2012 Tor Norbye <tnorbye@google.com> Suppress support and location tracking for translation detector

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
5da3610b249d74267a67a6b48acdf4cc95475bc0 13-Feb-2012 Tor Norbye <tnorbye@google.com> Add Fatal severity

This changeset adds a new severity, "Fatal", and shifts the abort-on-
export feature from using the Error severity to the Fatal severity.

This gives the user (and lint check developers) a bit more control
over which errors should fail a build. You can now leave some issues
as "error", but not have it block export. This can be useful for
checks which are extremely slow, or for checks that generally
represent errors but where the rule cannot know for sure (such as
attempts to figure out reflection calls in Java).

Change-Id: Ie44d5efcb605091ba8c1c67aa720edbbde416ca5
69067f399231dc28f4ff0aa02b60153ffd2d5831 06-Feb-2012 Tor Norbye <tnorbye@google.com> Add support for suppressing lint via XML attributes

This changeset adds support for suppressing in XML files:

(1) Lint will ignore errors found in attributes and elements if the
element (or any surrounding parent elements) specifies a
tools:ignore="id-list" attribute where the id-list matches the id
of the reported issue (or "all"). The "tools" prefix can be any
prefix bound to the namespace "http://schemas.android.com/tools"

(2) There's a new quickfix shown for XML lint warnings which offers to
add a lint suppress attribute for a given lint warning (setting
the id to the id of the warning, and adding the tools namespace
binding if necessary).

(3) The XML formatter now handles namespaces a bit better: after the
preferred attributes (id, name, style, layout params, etc) have
been handled, attributes are sorted by namespace prefix before
they are sorted by local name -- which effectively will sort any
new tools:ignore attributes to the end.

Change-Id: Id7474cde5665d9bd29bdd4e0d0cc89ed4d422aea
9e0b2fa6c26613b66fc9198314c71ee87e0cccb3 03-Feb-2012 Tor Norbye <tnorbye@google.com> Add lint abbreviation flag

Add a new flag, --showall, to turn off the abbreviation handling which
truncates long lists (such as all missing translation keys, or
additional resource locations).

In HTML reports, always include full location lists, but by default
hide them via a JavaScript reveal button. Also style buttons a bit
more holo-like.

Change-Id: I6e4ac7f910d1161981c48c7c4c766f03e650fdf6
37d5a9bbdc2895921cd0f636777efe2d3bad4e5b 09-Dec-2011 Tor Norbye <tnorbye@google.com> Add lint checks: String format, Casts, Security, Imports, /sdcard

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
b45957a134d6fd6184348387fd0f0b14ffa7021c 09-Dec-2011 Tor Norbye <tnorbye@google.com> A few misc lint fixes

Change-Id: Idc81f7a2d033675a03209eeabda0216babc35ebe
3db9393ba06bbf70fa7b4a6db1ef60396979a1d4 06-Dec-2011 Tor Norbye <tnorbye@google.com> Add the Guava library to the tools

This changeset adds the Guava library to ADT and lint. (It is also a
prerequisite for the Lombok AST library which is added by a later CL.)

This changeset also uses the library in a few simple ways: It replaces
some custom I/O and collections code with calls into the equivalent
Guava methods, and it also adds the @Beta annotation on the various
"API" classes which are not yet stable.

Change-Id: I2f50febfa075c32818404e888578a2e1e447d408
3ce45b249f898697ae82e8c6dd045966227f3438 02-Dec-2011 Tor Norbye <tnorbye@google.com> Lint infrastructure improvements

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
879ee99e2fe077263982260348ade2fde9b8a0b2 29-Nov-2011 Tor Norbye <tnorbye@google.com> Fix string arrays incorrectly flagged as not localized

If you define the children of your <string-array> using @string
resource references, then you don't need to redefine your
<string-array> in all the other locales. This changeset fixes the lint
translation check such that it only looks for translations for string
arrays that have one or more elements that are not a string reference.

Change-Id: I8daf0b36edad43635f47062b3fdf57b2617233ce
af2ebe8bd69afb551b4182e401a0863a7f1ee0ef 09-Nov-2011 Tor Norbye <tnorbye@google.com> Fix bugs in unused resource detector

First, look at the text node children of <style> tags to pick up
references to resources, such as @dimen/foo or ?attr/bar.

Second, look at the XML files for declarations of resources; these
provide the actual location of the unused resource (which is stored in
a map for the error reporter), as well as makes the lint work on
source trees that do not have a built gen/ folder.

Third, make the detector use the project-provided source paths rather
than being hardcoded to src/ and gen/.

Fourth, ignore R.style unused warnings since these can be false
positives and will require some more analysis.

Move some constants from checks into the LintConstants class.

Change-Id: Iee062fd7f6452d90716004ef0beb1f869fb57df4
229581314076be1b6f82fe1efed2bd00da340899 07-Nov-2011 Tor Norbye <tnorbye@google.com> Lint Architecture Changes: Configurations, Categories, etc.

This changeset makes various architectural changes to lint:

(1) Add configurations, which are basically user preferences for lint
in a given project, such as providing a custom severity for an
issue, or disabling a specific warning in a specific file.

In Eclipse, there is a project configuration (stored in lint.xml
in each project), as well as a global configuration (stored using
Eclipse preference data). Project configurations inherit from the
global configuration.

The options dialog now shows up both as a project property page
(showing the issue state for the project configuration), as well
as a normal preference page (showing the global or "fallback"
configuraiton). I also changed the Options UI for issues from a
Table to a TreeViewer to add in category nodes, and changed the
checkbox UI to have a custom severity toggle instead.

The lint quickfixes also now have 3 suppression options:
* Ignore in this file
* Ignore in this project
* Disable check

(2) Change detectors to be registered by class and instantiated for
each lint run rather than having a fixed list of detectors get
reused over and over. Turns out that since some detectors store
state, this prevented lints from running concurrently since the
two runs could stomp each other's state.

To do this effectively I've also switched from a DetectorRegistry
to an IssueRegistry, which contains the global list of available
issues and each issue can point to the class detecting the issue
(and these are created on the fly based on parameters like scope.)

(3) Explicit Categories. Categories used to just be a string property
on issues; now it's an explicit class with both a name and an
explanation, with parents to allow nesting (such that for example
the Usability category has an Icons sub category), and finally the
category class provides sorting. Categories also show up in the
HTML Report now as separate sections.

(4) Other API changes:

* I changed the package containing APIs for lint clients to an
explicit "client" package
* Moved the LintConstants class up from lint-checks to lint-api
and added a LintUtils class which contains many generic methods
that were spread around in specific detectors.
* The detectors are now talking to a wrapper client rather than
directly to lint clients, such that the wrapper client can
filter out results on disabled checks etc, which means that
tools can assume they always get correct reports and don't have
to worry about improperly written detectors.
* I renamed ToolContext to LintClient.
* I got rid of the "isEnabled" state, which was a bit redundant
with the severity since severity has a Severity.IGNORE value.
* I added a LintListener interface, which notifies about progress
(and the CLI tool will print "."'s for each processed file
unless suppressed with -q).
* A new dispose method on the parser interface to for example
allow IDEs to lock/unlock read models on underlying data.

(5) I added a toolbar action for running Lint on the currently
selected project. I also added an --xml export option intended
for use with CI plugins.

Change-Id: Icadd9b2d14d075234d97b31398806111af747b7b
27ed098e750ee9463dfa7a36cef68d219de9eb50 31-Oct-2011 Tor Norbye <tnorbye@google.com> Lint infrastructure fixes

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
de18b5a12cb5c3baed6f41c235fac9129533cb8f 31-Oct-2011 Tor Norbye <tnorbye@google.com> Suppress unused resource ids by default and ignore donottranslate

(1) For the unused resource detector, separate out unused ids from
other types of resources. Lots of projects have unused id's, and
these are mostly harmless and often serve a useful documentation
purpose in the layout. Therefore, unused id's get their own
separate issue, and this issue is off by default.

(2) There seems to be a convention in many Android projects that files
named "donottranslate.xml" are ignored for translation
purposes. The translation detector now ignores these files as
well.

Change-Id: Id3de99e8286b5a5c39b141af9c233f1515b493fb
53f27f8adbe5a657e766d81af1d584c2490730b7 26-Oct-2011 Tor Norbye <tnorbye@google.com> Two new lint warnings: array-size check, and manifest order

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
8853b3b92496c5734bbcb75499030bb51a060097 23-Oct-2011 Tor Norbye <tnorbye@google.com> Lint: Unused resource detector, and framework improvements

This changeset contains a number of changes to the lint support:

(1) Preparation to support Java (.java source and .class binary
checks). The lint-api and lint-checks libraries do not yet
contain any APIs for visiting Java ASTs or visiting bytecodes, but
there is preliminary support such as interfaces Java and Class
detectors can implement, and they are provided with the source
paths and output paths.

(2) Various other framework API changes such as making ToolContext an
abstract class (to easy future API additions), moving file reading
to the tool context, making the Xml/Java/Class detectors marker
interfaces instead of abstract classes such that a detector can
have more than one behavior. And the error reporter now passes a
data field along with each issue containing data intended for use
by tools to for example make a quickfix able to identify target
data without having to parse the error message or infer it from
the error range.

(3) A new "unused resource" detector which identifies unused resources
(strings, ids, layouts, etc) in a project. The default lint-checks
implementation performs only simple string analysis, but in the
Eclipse plugin this is replaced by a specialized detector which
uses the Eclipse Java model to do more accurate AST-based
analysis. This is a technique lint should support anyway (the
ability of a tool to provide optimized versions of the builtin
checks) but longer term once we get actual Java AST support into
the API this might move.

Various misc smaller fixes I ran into along the way and changes to the
test infrastructure.

Change-Id: Ic5aab0180b53de70f1fd36540c854abb8210e751
b4622eb274f472919a7d7ae0bab045e4b9e4325f 21-Oct-2011 Tor Norbye <tnorbye@google.com> Lint improvements

First, in the translation detector, split out the report into two
separate issues:
- Failing to provide a translation for a string defined by the default
locale (Error)
- Unused translations (strings found in languages but no longer in the
default locale) (Warning)
Also add region handling such that a region can define just a subset
of the available strings and fall back to the overall language for
strings it does not define.

Second, the Quickfix in Eclipse for the px to dp conversion now shows
a dedicated dialog which has a combobox for the available densities
rather than asking the user to type in the density number in a text
field.

Third, the CLI driver (the "lint" command line tool) has a bunch of
new flags for controlling the report format as well as for dumping
out information about available issues:

Usage: lint [flags] <project directories>

Flags:
--suppress <id-list>: Suppress a list of issue id's.
--enable <id-list>: Only check the specific list of issues
--fullpath : Use full paths in the error output
--lines : Include the lines with errors in the output

--list: List the available issue id's and exit.
--show: List available issues along with full explanations
--show <ids>: Show full explanations for the given list of issue id's
Id lists should be comma separated with no spaces.

Here's an example of what an issue explanation looks like:

% lint --show DuplicateIds
DuplicateIds
------------
Summary: Checks for duplicate ids within a single layout or within an
include hierarchy

Priority: 7 / 10
Severity: Warning
Category: Layout

It's okay for two independent layouts to use the same ids. However,
within a single layout (including the case where two separate layouts
are fused together with an include tag) the ids should be unique such
that theActivity#findViewById() method can work predictably.

---

The layout editor now runs lint on every edit operation instead of
on every save.

And finally the scope has been moved from Detectors to Issues such
that when looking at issue markers we can clear those associated with
the scope the analysis is run under. We also run the detectors when
any of the associated issues is eligible.

Change-Id: I3f068de4edeb3ed166eeb7ab7f2cff84d7ae5cbd
8027fad9680e1622d7c70be330422d6b11fc6c88 18-Oct-2011 Tor Norbye <tnorbye@google.com> More lint checks: translation, i18n, proguard, gridlayout, "px"

This changeset adds more lint checks:

(1) Translation. It looks at all the string values in the application,
and if there are discrepancies (where a translatable string is not
defined in all provided languages and regions) then these are
listed.

(2) Internationalization. It looks for text: and contentDescription:
attributes and ensures that these refer to @string resources, not
hardcoded string values. This lint warning also has an associated
quickfix when shown in Eclipse which invokes the Extract String
refactoring wizard on the right selection context.

(3) Proguard. It looks for the old (broken) patterns we had in older
proguard.cfg files (-keepclasseswithmembernames instead of
-keepclasseswithmembers which implies shrinking.)

(4) GridLayout. It looks at the layout constraints provided on views
in a GridLayout and ensures that they fall within the overall
dimensions of the grid.

(5) "px" usage. It looks for dimensions using "px" as a unit and
recommends switching to dp instead. This lint warning also has a
quickfix in Eclipse which pops up a dialog asking for the screen
density and then converts the px value to the right dp value and
changes the unit.

(6) TextFields. It looks at EditTexts and makes sure they either set
inputType, hint or inputMethod. There's a quickfix in Eclipse for
setting the inputType, which adds the property and automatically
invokes content assist for showing the possible values.

This changeset also adds some quick fixes for a few existing lint
warnings:

(7) Accessibility: Insert a content description attribute, front the
editor and select the placeholder value.

(8) Useless leaf layout: Remove the leaf layout

(9) Useless middle layout: Invoke the Remove Container visual
refactoring

10) Inefficient Linear Layout Weights: Change the attribute to 0dp

Plus unit tests.

Change-Id: Iebd7b23224a898bd1851abd578460019aee44df5