Install the best split apk for device if split info is available

Gradle model 0.13 introduces the concepts of split apks where an
apk is specific only to a particular combination of density or abi.
This CL adapts Studio to first look at whether the current gradle
model supports splits, and if so, use that information to identify
the best apk to install.

In a future CL will introduce a bigger reorganization to only build
the specific split apks that are necessary.

Change-Id: I051a6bf6c69108e885943b1e605c5b686c677cfa
(cherry picked from commit d3f1aa3c3604f23427ba59f6d38d81779a4514de)
Merge "Install the best split apk for device if split info is available" into ub-tools-idea133-release
Adds support for reproxing methods that throw exceptions

If the model is out of that but the IDE handles it by catching the
exception that calling a method that doesn't exist in the actual model,
reproxied objects need to behave in the same way.

This change also improves nested proxy objects testing.

Change-Id: I8ba8d1b74d532ff53eb1eca6f69ba56f3a77addd
(cherry picked from commit e25f85a25d35dcd595098325bbbbf4b3db27b0ed)
Merge "Adds support for reproxing methods that throw exceptions" into ub-tools-idea133-release
Fixes type of exception thrown from cached model.

Even though an exception was being thrown from the "reproxied" model, it was not
of the correct type.

Change-Id: I0059801f252714ec6a78b059d5eaf5f2ed8cc639
(cherry picked from commit 933ea2570f18fb905c7cb5c1f682a4a6b7f50f8b)
Merge "Fixes type of exception thrown from cached model." into ub-tools-idea133-release
Merge remote-tracking branch 'aosp/upstream-133' into merge-upstream

Conflicts:
	adt-branding/src/idea/AndroidStudioApplicationInfo.xml
	android/src/com/android/tools/idea/ddms/DevicePanel.java
	android/src/com/android/tools/idea/navigator/AndroidProjectViewPane.java
	android/src/com/android/tools/idea/navigator/nodes/AndroidManifestFileNode.java
	android/src/com/android/tools/idea/navigator/nodes/AndroidModuleNode.java
	android/src/com/android/tools/idea/navigator/nodes/AndroidPsiDirectoryNode.java
	android/src/com/android/tools/idea/navigator/nodes/AndroidResFileNode.java
	android/src/com/android/tools/idea/navigator/nodes/AndroidSourceTypeNode.java
	android/src/com/android/tools/idea/navigator/nodes/AndroidTestsNode.java
	android/src/com/android/tools/idea/wizard/ConfigureFormFactorStep.java
	android/src/com/android/tools/idea/wizard/WizardConstants.java
	android/testSrc/com/android/tools/idea/navigator/AndroidProjectViewTest.java

Change-Id: I78805bc5aaaa2d37a555fad71a0e606f5b148514
(cherry picked from commit 71c61eb7524fb1386b1577befdc9297b2d672c8d)
Merge "Merge remote-tracking branch 'aosp/upstream-133' into merge-upstream" into ub-tools-idea133-release
DevicePanel: Guard against NPE

See b/17521382

Change-Id: I98edc3dfcb7dbc09dcb7fe20a05adafaa7788936
(cherry picked from commit b35a72ae796be8631630df945a582dff95daa2ab)
Merge "DevicePanel: Guard against NPE" into ub-tools-idea133-release
Updated embedded Android Gradle plug-in 0.13.0 (take 2.)

Change-Id: I43a1dd0f36f231aedbae06064a1cf467f5399039
(cherry picked from commit ddd9d68b76020fa2fa425c2aa22da39f3fcc320a)
Merge "Updated embedded Android Gradle plug-in 0.13.0 (take 2.)" into ub-tools-idea133-release
Now we stop processing project files as soon as we find the Gradle model version.

The IDE used to collect all the build.gradle files in the project and then
iterate through them to find the Gradle model version. This completely
wasteful, especially for big projects.

In this CL we go through the project files and stop when the Gradle model
version is found.

Change-Id: Ie2a8da54a3c072d29926cbd02a07ffc9e3f09e3c
(cherry picked from commit 9b134049a23c2c9464a4d23e02d0597e75e76f67)
Merge "Now we stop processing project files as soon as we find the Gradle model version." into ub-tools-idea133-release
Improved the way we find version of Android plug-in in build files.

In this CL:
- Replaced regular expression with GroovyLexer to make parsing
  of build files more reliable
- If the found version is '+' or uses '+' for the major or minor
  portions, the IDE will look in the local Gradle cache for the
  latest version of the plug-in
- Lookup of GradleCoordinates was moved from
  AndroidLintInspectionToolProvider to GradleUtil.

Change-Id: Id2cbdc1a5d5f1364e6b1701f12ca827228744b60
(cherry picked from commit f78ef89d1202f5f9684be41c9d4ece93eac00f9d)
Merge "Improved the way we find version of Android plug-in in build files." into ub-tools-idea133-release
Fixed usage of SdkConstants#GRADLE_LATEST_VERSION.

Quick fixes used this constant without performing any checks
when supporting plug-in 0.12 only. Now that we support both
0.12 and 0.13 the latest supported version of Gradle depends
on the plug-in version (1.12 for 0.12 and 2.1 for 0.13).

This CL performs those checks before using
SdkConstants#GRADLE_LATEST_VERSION when appropriate.

Change-Id: Id100117f7eb71afe25a28100c9879eb21ca38fc0
(cherry picked from commit ccacb0992c6d43b74dd29acd7e080781d64b082a)
Merge "Fixed usage of SdkConstants#GRADLE_LATEST_VERSION." into ub-tools-idea133-release