Replace fix permissions with fix contexts for emulated storage
Fix permissions rarely fixed anything on more recent versions of
Android and usually made things worse. Instead we will replace it
with a more dumbed down option that should fix contexts on
/data/media with a few improvements to ensure that contexts get
fixed for multiple users and on adopted storage.
Change-Id: If5523781936a0b04196e2ad871cae767ebae2583
diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml
index 3bbb8be..7ce8d65 100755
--- a/gui/theme/common/landscape.xml
+++ b/gui/theme/common/landscape.xml
@@ -3094,9 +3094,10 @@
</button>
<button style="main_button">
+ <condition var1="tw_has_data_media" var2="1"/>
<placement x="%center_x%" y="%row2_y%"/>
- <text>{@fix_perm_btn=Fix Permissions}</text>
- <action function="page">fixperms</action>
+ <text>{@fix_context_btn=Fix Contexts}</text>
+ <action function="page">fixcontexts</action>
</button>
<button style="main_button">
@@ -4467,7 +4468,7 @@
</action>
</page>
- <page name="fixperms">
+ <page name="fixcontexts">
<template name="page"/>
<text style="text_l">
@@ -4477,37 +4478,31 @@
<text style="text_m">
<placement x="%col1_x_header%" y="%row4_header_y%"/>
- <text>{@fix_perms_hdr=Fix Permissions}</text>
+ <text>{@fix_contexts_hdr=Fix Contexts}</text>
</text>
<text style="text_m_accent">
<placement x="%center_x%" y="%row2_y%" placement="5"/>
- <text>{@fix_perms_note=Note: Fixing permissions is rarely needed.}</text>
+ <text>{@fix_contexts_note1=Note: Fixing contexts is rarely needed.}</text>
</text>
- <checkbox>
- <placement x="%col2_x_left%" y="%row4_y%"/>
- <text>{@fix_perms_selinux_chk=Also fix SELinux Contexts}</text>
- <data variable="tw_fixperms_restorecon"/>
- </checkbox>
-
<text style="text_m_fail">
<placement x="%center_x%" y="%row6_y%" placement="5"/>
- <text>{@fix_perms_sel_note1=Fixing SELinux Contexts may cause}</text>
+ <text>{@fix_contexts_note2=Fixing SELinux Contexts may cause}</text>
</text>
<text style="text_m_fail">
<placement x="%center_x%" y="%row7_y%" placement="5"/>
- <text>{@fix_perms_sel_note2=your device to not boot properly.}</text>
+ <text>{@fix_contexts_note3=your device to not boot properly.}</text>
</text>
<slider style="slider_centered">
- <text>{@swipe_to_fix_perms=Swipe to Fix Permissions}</text>
+ <text>{@swipe_to_fix_contexts=Swipe to Fix Contexts}</text>
<actions>
<action function="set">tw_back=advanced</action>
- <action function="set">tw_action=fixpermissions</action>
- <action function="set">tw_action_text1={@fixing_perms=Fixing Permissions...}</action>
- <action function="set">tw_complete_text1={@fix_perms_complete=Fix Permissions Complete}</action>
+ <action function="set">tw_action=fixcontexts</action>
+ <action function="set">tw_action_text1={@fixing_contexts=Fixing Contexts...}</action>
+ <action function="set">tw_complete_text1={@fix_contexts_complete=Fix Contexts Complete}</action>
<action function="set">tw_slider_text={@swipe_to_confirm=Swipe to Confirm}</action>
<action function="set">tw_show_reboot=1</action>
<action function="page">action_page</action>
diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml
index 8c04af3..1bb9b68 100755
--- a/gui/theme/common/languages/en.xml
+++ b/gui/theme/common/languages/en.xml
@@ -365,8 +365,7 @@
<string name="copy_log_confirm">Copy Log to SD Card?</string>
<string name="copying_log">Copying Log to SD Card...</string>
<string name="copy_log_complete">Log Copy Complete</string>
- <string name="fix_perm_btn">Fix Permissions</string>
- <string name="fix_perm_s_btn">Fix Perms</string>
+ <string name="fix_context_btn">Fix Contexts</string>
<string name="part_sd_btn">Partition SD Card</string>
<string name="part_sd_s_btn">SD Card</string>
<string name="file_manager_btn">File Manager</string>
@@ -453,15 +452,14 @@
<string name="sideload_confirm">ADB Sideload</string>
<string name="sideload_usage">Usage: adb sideload filename.zip</string>
<string name="sideload_complete">ADB Sideload Complete</string>
- <string name="fix_perms_hdr">Fix Permissions</string>
- <string name="fix_perms_note">Note: Fixing permissions is rarely needed.</string>
- <string name="fix_perms_selinux_chk">Also fix SELinux Contexts</string>
- <string name="fix_perms_sel_note1">Fixing SELinux Contexts may cause</string>
- <string name="fix_perms_sel_note2">your device to not boot properly.</string>
- <string name="swipe_to_fix_perms">Swipe to Fix Permissions</string>
- <string name="swipe_fix_perms"> Fix Perms</string>
- <string name="fixing_perms">Fixing Permissions...</string>
- <string name="fix_perms_complete">Fix Permissions Complete</string>
+ <string name="fix_contexts_hdr">Fix Contexts</string>
+ <string name="fix_contexts_note1">Note: Fixing contexts is rarely needed.</string>
+ <string name="fix_contexts_note2">Fixing SELinux Contexts may cause</string>
+ <string name="fix_contexts_note3">your device to not boot properly.</string>
+ <string name="swipe_to_fix_contexts">Swipe to Fix Contexts</string>
+ <string name="swipe_fix_contexts"> Fix Contexts</string>
+ <string name="fixing_contexts">Fixing Contexts...</string>
+ <string name="fix_contexts_complete">Fix Contexts Complete</string>
<string name="reboot_hdr">Reboot</string>
<string name="su_hdr">SuperSU Check</string>
<string name="su_note1">Your device does not appear to be rooted.</string>
diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml
index f253b22..8e1a0d2 100755
--- a/gui/theme/common/portrait.xml
+++ b/gui/theme/common/portrait.xml
@@ -3168,9 +3168,10 @@
</button>
<button style="main_button">
+ <condition var1="tw_has_data_media" var2="1"/>
<placement x="%center_x%" y="%row2a_y%"/>
- <text>{@fix_perm_btn=Fix Permissions}</text>
- <action function="page">fixperms</action>
+ <text>{@fix_context_btn=Fix Contexts}</text>
+ <action function="page">fixcontexts</action>
</button>
<button style="main_button">
@@ -4363,7 +4364,7 @@
</action>
</page>
- <page name="fixperms">
+ <page name="fixcontexts">
<template name="page"/>
<text style="text_l">
@@ -4373,37 +4374,31 @@
<text style="text_m">
<placement x="%col1_x_header%" y="%row4_header_y%"/>
- <text>{@fix_perms_hdr=Fix Permissions}</text>
+ <text>{@fix_contexts_hdr=Fix Contexts}</text>
</text>
<text style="text_m_accent">
<placement x="%center_x%" y="%row2_y%" placement="5"/>
- <text>{@fix_perms_note=Note: Fixing permissions is rarely needed.}</text>
+ <text>{@fix_contexts_note1=Note: Fixing contexts is rarely needed.}</text>
</text>
- <checkbox>
- <placement x="%indent%" y="%row4_y%"/>
- <text>{@fix_perms_selinux_chk=Also fix SELinux Contexts}</text>
- <data variable="tw_fixperms_restorecon"/>
- </checkbox>
-
<text style="text_m_fail">
<placement x="%center_x%" y="%row6_y%" placement="5"/>
- <text>{@fix_perms_sel_note1=Fixing SELinux Contexts may cause}</text>
+ <text>{@fix_contexts_note2=Fixing SELinux Contexts may cause}</text>
</text>
<text style="text_m_fail">
<placement x="%center_x%" y="%row7_y%" placement="5"/>
- <text>{@fix_perms_sel_note2=your device to not boot properly.}</text>
+ <text>{@fix_contexts_note3=your device to not boot properly.}</text>
</text>
<slider>
- <text>{@swipe_to_fix_perms=Swipe to Fix Permissions}</text>
+ <text>{@swipe_to_fix_contexts=Swipe to Fix Contexts}</text>
<actions>
<action function="set">tw_back=advanced</action>
- <action function="set">tw_action=fixpermissions</action>
- <action function="set">tw_action_text1={@fixing_perms=Fixing Permissions...}</action>
- <action function="set">tw_complete_text1={@fix_perms_complete=Fix Permissions Complete}</action>
+ <action function="set">tw_action=fixcontexts</action>
+ <action function="set">tw_action_text1={@fixing_contexts=Fixing Contexts...}</action>
+ <action function="set">tw_complete_text1={@fix_contexts_complete=Fix Contexts Complete}</action>
<action function="set">tw_slider_text={@swipe_to_confirm=Swipe to Confirm}</action>
<action function="set">tw_show_reboot=1</action>
<action function="page">action_page</action>
diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml
index 22cc02b..e840687 100755
--- a/gui/theme/common/watch.xml
+++ b/gui/theme/common/watch.xml
@@ -3887,9 +3887,10 @@
</button>
<button style="main_button">
+ <condition var1="tw_has_data_media" var2="1"/>
<placement x="%col1_x_right%" y="%row1_y%"/>
- <text>{@fix_perm_s_btn=Fix Perms}</text>
- <action function="page">fixperms</action>
+ <text>{@fix_context_btn=Fix Contexts}</text>
+ <action function="page">fixcontexts</action>
</button>
<button style="main_button">
@@ -5158,44 +5159,38 @@
</action>
</page>
- <page name="fixperms">
+ <page name="fixcontexts">
<template name="page"/>
<template name="statusbar"/>
<text style="text_m">
<placement x="%col1_x_left%" y="%row1_header_y%"/>
- <text>{@advanced_hdr=Advanced} > {@fix_perms_hdr=Fix Permissions}</text>
+ <text>{@advanced_hdr=Advanced} > {@fix_contexts_hdr=Fix Contexts}</text>
</text>
<text style="text_m_accent">
<placement x="%center_x%" y="%row2_y%" placement="5"/>
- <text>{@fix_perms_note=Note: Fixing permissions is rarely needed.}</text>
+ <text>{@fix_contexts_note1=Note: Fixing contexts is rarely needed.}</text>
</text>
- <checkbox>
- <placement x="%indent%" y="%row4_y%"/>
- <text>{@fix_perms_selinux_chk=Also fix SELinux Contexts}</text>
- <data variable="tw_fixperms_restorecon"/>
- </checkbox>
-
<text style="text_m_fail">
<placement x="%center_x%" y="%row6a_y%" placement="5"/>
- <text>{@fix_perms_sel_note1=Fixing SELinux Contexts may cause}</text>
+ <text>{@fix_contexts_note2=Fixing SELinux Contexts may cause}</text>
</text>
<text style="text_m_fail">
<placement x="%center_x%" y="%row7a_y%" placement="5"/>
- <text>{@fix_perms_sel_note2=your device to not boot properly.}</text>
+ <text>{@fix_contexts_note3=your device to not boot properly.}</text>
</text>
<slider>
- <text>{@swipe_fix_perms= Fix Perms}</text>
+ <text>{@swipe_fix_contexts= Fix Contexts}</text>
<actions>
<action function="set">tw_back=advanced</action>
- <action function="set">tw_action=fixpermissions</action>
- <action function="set">tw_action_text1={@fixing_perms=Fixing Permissions...}</action>
- <action function="set">tw_complete_text1={@fix_perms_complete=Fix Permissions Complete}</action>
+ <action function="set">tw_action=fixcontexts</action>
+ <action function="set">tw_action_text1={@fixing_contexts=Fixing Contexts...}</action>
+ <action function="set">tw_complete_text1={@fix_contexts_complete=Fix Contexts Complete}</action>
<action function="set">tw_slider_text={@swipe_confirm= Confirm}</action>
<action function="set">tw_show_reboot=1</action>
<action function="page">action_page</action>