Installd: restorecon mislabeled gsf
This is a temporary fix while we determine a better long term fix.
This will recursively fix up the selinux context of
/data/user/0/com.google.android.gsf.
Bug: 188141923
Bug: 190567190
Test: 1. adb root
2. adb shell cp /system/build.prop /user/data/0/com.google.android.gsf
3. adb reboot
4. adb root; adb shell ls -laZ /user/data/0/com.google.android.gsf
5. verify that installd has fixed up incorrect labels.
Change-Id: Ieadd64b61162f2fa802add2a8e54d2072ad2fd48
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 818804a..0595322 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -342,7 +342,8 @@
// If the initial top-level restorecon above changed the label, then go
// back and restorecon everything recursively
- if (strcmp(before, after)) {
+ // TODO(b/190567190, b/188141923) Remove recursive fixup of com.google.android.gsf.
+ if (strcmp(before, after) || (path.find("com.google.android.gsf") != std::string::npos)) {
if (existing) {
LOG(DEBUG) << "Detected label change from " << before << " to " << after << " at "
<< path << "; running recursive restorecon";