Push mapping from file extension to GID.
An upcoming sdcardfs change will offer to automatically change the
GID of files on external storage based on the extension, but we need
to tell the kernel the mapping that we'd like to see.
Test: build, boots
Bug: 34733702
Change-Id: I15d4db5423d18c4da17e198c0e45a8adb381fed2
diff --git a/cmds/installd/matchgen.py b/cmds/installd/matchgen.py
index b37352b..131487d 100644
--- a/cmds/installd/matchgen.py
+++ b/cmds/installd/matchgen.py
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import collections
+import collections, sys
TYPES = {
"AID_MEDIA_AUDIO": ["aac","aac","amr","awb","snd","flac","flac","mp3","mpga","mpega","mp2","m4a","aif","aiff","aifc","gsm","mka","m3u","wma","wax","ra","rm","ram","ra","pls","sd2","wav","ogg","oga"],
@@ -22,6 +22,19 @@
"AID_MEDIA_IMAGE": ["bmp","gif","jpg","jpeg","jpe","pcx","png","svg","svgz","tiff","tif","wbmp","webp","dng","cr2","ras","art","jng","nef","nrw","orf","rw2","pef","psd","pnm","pbm","pgm","ppm","srw","arw","rgb","xbm","xpm","xwd"]
}
+if "--rc" in sys.argv:
+ print "on early-boot"
+ print " mkdir /config/sdcardfs/extensions/1055"
+ print " mkdir /config/sdcardfs/extensions/1056"
+ print " mkdir /config/sdcardfs/extensions/1057"
+ for gid, exts in TYPES.iteritems():
+ if gid is "AID_MEDIA_AUDIO": gid = "1055"
+ if gid is "AID_MEDIA_VIDEO": gid = "1056"
+ if gid is "AID_MEDIA_IMAGE": gid = "1057"
+ for ext in exts:
+ print " mkdir /config/sdcardfs/extensions/%s/%s" % (gid, ext)
+ exit()
+
print """/*
* Copyright (C) 2017 The Android Open Source Project
*