From 39f48c03d70d7df08520e9a042160accfdb6e2e6 Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Fri, 21 Jun 2013 08:34:07 +0200 Subject: Make system UI settings work for multi-user (2/2) Change-Id: I88ab9fa0cb7791c5f9d859ab6531346f2aa55193 --- .../settings/cyanogenmod/SystemSettings.java | 29 ++++++++-------------- 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/com/android/settings/cyanogenmod/SystemSettings.java b/src/com/android/settings/cyanogenmod/SystemSettings.java index 0b0d29c..7be4e03 100644 --- a/src/com/android/settings/cyanogenmod/SystemSettings.java +++ b/src/com/android/settings/cyanogenmod/SystemSettings.java @@ -26,6 +26,7 @@ import android.os.UserHandle; import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; +import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; import android.provider.Settings; import android.util.Log; @@ -74,6 +75,9 @@ public class SystemSettings extends SettingsPreferenceFragment implements boolean removeKeys = false; boolean removeNavbar = false; + PreferenceCategory navbarCategory = + (PreferenceCategory) findPreference(KEY_NAVIGATION_BAR_CATEGORY); + IWindowManager windowManager = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); try { @@ -86,6 +90,13 @@ public class SystemSettings extends SettingsPreferenceFragment implements // Do nothing } + if (removeKeys) { + prefScreen.removePreference(findPreference(KEY_HARDWARE_KEYS)); + } + if (removeNavbar) { + prefScreen.removePreference(navbarCategory); + } + // Determine which user is logged in mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER; if (mIsPrimary) { @@ -99,27 +110,9 @@ public class SystemSettings extends SettingsPreferenceFragment implements mBatteryPulse = null; } } - - // Act on the above - if (removeKeys) { - prefScreen.removePreference(findPreference(KEY_HARDWARE_KEYS)); - } - if (removeNavbar) { - prefScreen.removePreference(findPreference(KEY_NAVIGATION_BAR)); - prefScreen.removePreference(findPreference(KEY_NAVIGATION_RING)); - prefScreen.removePreference(findPreference(KEY_NAVIGATION_BAR_CATEGORY)); - } } else { // Secondary user is logged in, remove all primary user specific preferences prefScreen.removePreference(findPreference(KEY_BATTERY_LIGHT)); - prefScreen.removePreference(findPreference(KEY_HARDWARE_KEYS)); - prefScreen.removePreference(findPreference(KEY_NAVIGATION_BAR)); - prefScreen.removePreference(findPreference(KEY_NAVIGATION_RING)); - prefScreen.removePreference(findPreference(KEY_NAVIGATION_BAR_CATEGORY)); - prefScreen.removePreference(findPreference(KEY_STATUS_BAR)); - prefScreen.removePreference(findPreference(KEY_QUICK_SETTINGS)); - prefScreen.removePreference(findPreference(KEY_POWER_MENU)); - prefScreen.removePreference(findPreference(KEY_NOTIFICATION_DRAWER)); } // Preferences that applies to all users -- cgit v1.1