From 0c6c0aed3529369d9009655dcb9f69e345b0858b Mon Sep 17 00:00:00 2001 From: Steven Schoen Date: Tue, 25 Oct 2016 09:38:03 -0400 Subject: [PATCH] Fix for Nougat remounting (SELinux-related) --- Emoji Switcher/build.gradle | 4 ++-- .../stevenschoen/emojiswitcher/EmojiSwitcherUtils.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Emoji Switcher/build.gradle b/Emoji Switcher/build.gradle index e3a28a0..73fc481 100644 --- a/Emoji Switcher/build.gradle +++ b/Emoji Switcher/build.gradle @@ -8,8 +8,8 @@ android { applicationId 'com.stevenschoen.emojiswitcher' minSdkVersion 19 targetSdkVersion 25 - versionCode 20 - versionName "2.1.1" + versionCode 21 + versionName "2.1.2" } compileOptions { diff --git a/Emoji Switcher/src/main/java/com/stevenschoen/emojiswitcher/EmojiSwitcherUtils.java b/Emoji Switcher/src/main/java/com/stevenschoen/emojiswitcher/EmojiSwitcherUtils.java index 4542d06..bde6375 100644 --- a/Emoji Switcher/src/main/java/com/stevenschoen/emojiswitcher/EmojiSwitcherUtils.java +++ b/Emoji Switcher/src/main/java/com/stevenschoen/emojiswitcher/EmojiSwitcherUtils.java @@ -306,9 +306,13 @@ public static String filePath(Context context, EmojiSetListing listing) { } public static void applyPermissions(String permissions, String path) throws TimeoutException, RootDeniedException, IOException { - RootTools.remount(path, "RW"); Shell shell = RootTools.getShell(true); - shell.add(new Command(0, "chmod " + permissions + " " + path)); + if (shell.isSELinuxEnforcing()) { + shell.add(new Command(0, "mount -o rw,remount /system")); + } else { + RootTools.remount(path, "RW"); + } + shell.add(new Command(1, "chmod " + permissions + " " + path)); shell.close(); }