Type pkgs w/ unsupported types in Java now work

Previously, if a package (typically a types-only package) declares types
which are not supported in Java, the type can't be compiled in Java.
However, this unnecessarily restricts some otherwise useful HALs from
being used in Java.

Note that all interfaces in a package must be Java compatible in order
for the package to be compiled in Java (this doesn't support compiling a
subset of the interfaces in Java). This is because in HIDL, the build
system must know exactly which files are outputed, and interfaces always
come with their own files. It would be much more work to handle this
other case, and there isn't a usecase for it now.

Note also that isJavaCompatible interfaces will always compile after
this CL since in order to be compiled in Java, they must only reference
java compatible types. This logic shouldn't rely on assumptions made at
the scope level, so it's safe to remove the scope logic (and if there is
a bug, the worst that will happen is a failed javac compile, which while
potentially confusing, the underlying cause can be fixed in hidl-gen).

Bug: 143566068
Test: cd $ANDROID_BUILD_TOP/hardware/interfaces && update-makefiles.sh
   && mma

Change-Id: I4c81ec269a766be9b1e1ef1fbbb3b1e55bcbce46
diff --git a/Scope.cpp b/Scope.cpp
index adc8f30..588ba95 100644
--- a/Scope.cpp
+++ b/Scope.cpp
@@ -227,10 +227,14 @@
 
 bool Scope::deepIsJavaCompatible(std::unordered_set<const Type*>* visited) const {
     for (const Type* type : mTypes) {
-        if (!type->isJavaCompatible(visited)) {
+        // Java compatibility focuses on types that are actually used by interfaces.
+        // Declarations of java-incompatible types are simply omitted from
+        // corresponding Java libraries.
+        if (type->isInterface() && !type->isJavaCompatible(visited)) {
             return false;
         }
     }
+
     return Type::deepIsJavaCompatible(visited);
 }