Turn GlobFiles into a Glob for files, use it

GlobFiles had allowed results to be anywhere in the source tree,
restrict it to results within the current module directory.

Then use it for ExpandSources and other places where we only want files.
This fixes using '*' in cc_test's `data` property, which can only
support files.

The only thing this changes today is that java_resource_dirs and
java_resources no longer pass directories to soong_zip's -f argument.
core-libart previously added some icu directories, now it only passes
files.

Bug: 71906438
Test: only expected changes in out/soong/build.ninja
Test: add data: ["**/*"] to a cc_test, build successfully
Change-Id: Iff1bd8c005a48e431c740706d7e23f4f957d8b1d
diff --git a/java/app.go b/java/app.go
index 34f05b7..ac88df7 100644
--- a/java/app.go
+++ b/java/app.go
@@ -342,17 +342,7 @@
 }
 
 func resourceGlob(ctx android.ModuleContext, dir android.Path) android.Paths {
-	var ret android.Paths
-	files := ctx.Glob(filepath.Join(dir.String(), "**/*"), aaptIgnoreFilenames)
-	for _, f := range files {
-		if isDir, err := ctx.Fs().IsDir(f.String()); err != nil {
-			ctx.ModuleErrorf("error in IsDir(%s): %s", f.String(), err.Error())
-			return nil
-		} else if !isDir {
-			ret = append(ret, f)
-		}
-	}
-	return ret
+	return ctx.GlobFiles(filepath.Join(dir.String(), "**/*"), aaptIgnoreFilenames)
 }
 
 type overlayGlobResult struct {
@@ -440,10 +430,7 @@
 		}
 		var paths android.Paths
 		for _, f := range files {
-			if isDir, err := ctx.Fs().IsDir(f); err != nil {
-				ctx.Errorf("error in IsDir(%s): %s", f, err.Error())
-				return
-			} else if !isDir {
+			if !strings.HasSuffix(f, "/") {
 				paths = append(paths, android.PathForSource(ctx, f))
 			}
 		}