Merge changes Id2749d70,Ie705f064

* changes:
  Add a DirEntryInfo interface that is a subset of os.FileInfo
  Move android/soong/fs to android/soong/finder/fs
diff --git a/finder/Android.bp b/finder/Android.bp
index b5c0e13..47b47c9 100644
--- a/finder/Android.bp
+++ b/finder/Android.bp
@@ -30,7 +30,7 @@
         "finder_test.go",
     ],
     deps: [
-      "soong-fs",
+      "soong-finder-fs",
     ],
 }
 
diff --git a/finder/cmd/finder.go b/finder/cmd/finder.go
index 70c1dc4..ab9108f 100644
--- a/finder/cmd/finder.go
+++ b/finder/cmd/finder.go
@@ -28,7 +28,7 @@
 	"time"
 
 	"android/soong/finder"
-	"android/soong/fs"
+	"android/soong/finder/fs"
 )
 
 var (
diff --git a/finder/finder.go b/finder/finder.go
index 2dd8e0b..89be0f5 100644
--- a/finder/finder.go
+++ b/finder/finder.go
@@ -30,7 +30,7 @@
 	"sync/atomic"
 	"time"
 
-	"android/soong/fs"
+	"android/soong/finder/fs"
 )
 
 // This file provides a Finder struct that can quickly search for files satisfying
@@ -1384,7 +1384,7 @@
 		f.onFsError(path, err)
 		// if listing the contents of the directory fails (presumably due to
 		// permission denied), then treat the directory as empty
-		children = []os.FileInfo{}
+		children = nil
 	}
 
 	var subdirs []string
diff --git a/finder/finder_test.go b/finder/finder_test.go
index 1522c68..29711fc 100644
--- a/finder/finder_test.go
+++ b/finder/finder_test.go
@@ -21,12 +21,12 @@
 	"os"
 	"path/filepath"
 	"reflect"
+	"runtime/debug"
 	"sort"
 	"testing"
 	"time"
 
-	"android/soong/fs"
-	"runtime/debug"
+	"android/soong/finder/fs"
 )
 
 // some utils for tests to use
diff --git a/fs/Android.bp b/finder/fs/Android.bp
similarity index 92%
rename from fs/Android.bp
rename to finder/fs/Android.bp
index f4706ca..fe0a0d3 100644
--- a/fs/Android.bp
+++ b/finder/fs/Android.bp
@@ -17,8 +17,8 @@
 //
 
 bootstrap_go_package {
-    name: "soong-fs",
-    pkgPath: "android/soong/fs",
+    name: "soong-finder-fs",
+    pkgPath: "android/soong/finder/fs",
     srcs: [
         "fs.go",
     ],
diff --git a/fs/fs.go b/finder/fs/fs.go
similarity index 95%
rename from fs/fs.go
rename to finder/fs/fs.go
index eff8ad0..3de5486 100644
--- a/fs/fs.go
+++ b/finder/fs/fs.go
@@ -51,7 +51,7 @@
 	// getting information about files
 	Open(name string) (file io.ReadCloser, err error)
 	Lstat(path string) (stats os.FileInfo, err error)
-	ReadDir(path string) (contents []os.FileInfo, err error)
+	ReadDir(path string) (contents []DirEntryInfo, err error)
 
 	InodeNumber(info os.FileInfo) (number uint64, err error)
 	DeviceNumber(info os.FileInfo) (number uint64, err error)
@@ -67,18 +67,39 @@
 	ViewId() (id string) // Some unique id of the user accessing the filesystem
 }
 
+// DentryInfo is a subset of the functionality available through os.FileInfo that might be able
+// to be gleaned through only a syscall.Getdents without requiring a syscall.Lstat of every file.
+type DirEntryInfo interface {
+	Name() string
+	Mode() os.FileMode // the file type encoded as an os.FileMode
+	IsDir() bool
+}
+
+var _ DirEntryInfo = os.FileInfo(nil)
+
 // osFs implements FileSystem using the local disk.
 type osFs struct{}
 
+var _ FileSystem = (*osFs)(nil)
+
 func (osFs) Open(name string) (io.ReadCloser, error) { return os.Open(name) }
 
 func (osFs) Lstat(path string) (stats os.FileInfo, err error) {
 	return os.Lstat(path)
 }
 
-func (osFs) ReadDir(path string) (contents []os.FileInfo, err error) {
-	return ioutil.ReadDir(path)
+func (osFs) ReadDir(path string) (contents []DirEntryInfo, err error) {
+	entries, err := ioutil.ReadDir(path)
+	if err != nil {
+		return nil, err
+	}
+	for _, entry := range entries {
+		contents = append(contents, entry)
+	}
+
+	return contents, nil
 }
+
 func (osFs) Rename(oldPath string, newPath string) error {
 	return os.Rename(oldPath, newPath)
 }
@@ -154,6 +175,8 @@
 	aggregatesLock sync.Mutex
 }
 
+var _ FileSystem = (*MockFs)(nil)
+
 type mockInode struct {
 	modTime     time.Time
 	permTime    time.Time
@@ -475,7 +498,7 @@
 		fmt.Errorf("%v is not a mockFileInfo", info)
 }
 
-func (m *MockFs) ReadDir(path string) (contents []os.FileInfo, err error) {
+func (m *MockFs) ReadDir(path string) (contents []DirEntryInfo, err error) {
 	// update aggregates
 	m.aggregatesLock.Lock()
 	m.ReadDirCalls = append(m.ReadDirCalls, path)
@@ -486,7 +509,7 @@
 	if err != nil {
 		return nil, err
 	}
-	results := []os.FileInfo{}
+	results := []DirEntryInfo{}
 	dir, err := m.getDir(path, false)
 	if err != nil {
 		return nil, err
diff --git a/fs/fs_darwin.go b/finder/fs/fs_darwin.go
similarity index 100%
rename from fs/fs_darwin.go
rename to finder/fs/fs_darwin.go
diff --git a/fs/fs_linux.go b/finder/fs/fs_linux.go
similarity index 100%
rename from fs/fs_linux.go
rename to finder/fs/fs_linux.go
diff --git a/ui/build/finder.go b/ui/build/finder.go
index a0f5d08..3bd6d87 100644
--- a/ui/build/finder.go
+++ b/ui/build/finder.go
@@ -16,7 +16,7 @@
 
 import (
 	"android/soong/finder"
-	"android/soong/fs"
+	"android/soong/finder/fs"
 	"android/soong/ui/logger"
 	"bytes"
 	"io/ioutil"