Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4915)

Unified Diff: chrome/browser/chromeos/arc/arc_util.cc

Issue 2788383003: ChromeOS: Disable ARC when incompatible filesystem is detected. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_util.cc
diff --git a/chrome/browser/chromeos/arc/arc_util.cc b/chrome/browser/chromeos/arc/arc_util.cc
index 3c40a7c2f950b82644f66845c0aada8f88eee9d2..8fdf110879347180b95d34cbf3e60ee5c3901318 100644
--- a/chrome/browser/chromeos/arc/arc_util.cc
+++ b/chrome/browser/chromeos/arc/arc_util.cc
@@ -4,7 +4,13 @@
#include "chrome/browser/chromeos/arc/arc_util.h"
+#include <linux/magic.h>
+#include <sys/statfs.h>
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/logging.h"
+#include "base/strings/string_split.h"
#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/login/user_flow.h"
#include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
@@ -92,6 +98,12 @@ bool IsArcAllowedForProfile(const Profile* profile) {
return false;
}
+ if (!profile->GetPrefs()->GetBoolean(
+ prefs::kArcCompatibleFilesystemChosen)) {
+ VLOG(1) << "Users who postponed to migrate to dircrypto are not supported.";
+ return false;
+ }
+
return true;
}
@@ -141,4 +153,28 @@ bool AreArcAllOptInPreferencesManagedForProfile(const Profile* profile) {
prefs::kArcLocationServiceEnabled);
}
+bool IsArcCompatibleFilesystem(const base::FilePath& path) {
+ // If it can be verified it is not on ecryptfs, then it is ok.
+ struct statfs statfs_buf;
+ if (statfs(path.value().c_str(), &statfs_buf) < 0)
+ return false;
+ if (statfs_buf.f_type != ECRYPTFS_SUPER_MAGIC)
+ return true;
+
+ // Otherwise, it is ok if and only if we are running Android M.
+ std::string lsb_release;
+ if (!base::ReadFileToString(
xiyuan 2017/04/03 16:20:49 Think lsb release info is loaded and parsed early
kinaba 2017/04/04 04:13:56 Thanks! That's very nice to know. Replaced the who
+ base::FilePath(FILE_PATH_LITERAL("/etc/lsb-release")),
+ &lsb_release)) {
+ return false;
+ }
+ base::StringPairs pairs;
+ base::SplitStringIntoKeyValuePairs(lsb_release, '=', '\n', &pairs);
+ for (const auto& pair : pairs) {
+ if (pair.first == "CHROMEOS_ARC_ANDROID_SDK_VERSION")
+ return pair.second == "23";
+ }
+ return false;
+}
+
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698