OmniGears: expanded desktop: use OVERRIDE_POLICY_CONTROL to toggle enable
that way we dont loose app specific settings every time
we switch between global enable and app specific
Change-Id: I48e0c77c45054d6377b4d4a2b5a10ce00c8a6a63
diff --git a/src/org/omnirom/omnigears/interfacesettings/ExpandedDesktop.java b/src/org/omnirom/omnigears/interfacesettings/ExpandedDesktop.java
index ada5ff2..94063de 100644
--- a/src/org/omnirom/omnigears/interfacesettings/ExpandedDesktop.java
+++ b/src/org/omnirom/omnigears/interfacesettings/ExpandedDesktop.java
@@ -91,6 +91,11 @@
private MenuItem mMenuItem;
private int getExpandedDesktopState(ContentResolver cr) {
+ boolean enableForAll = Settings.Global.getInt(getContentResolver(),
+ Settings.Global.OVERRIDE_POLICY_CONTROL, 0) == 1;
+ if (enableForAll) {
+ return STATE_ENABLE_FOR_ALL;
+ }
String value = Settings.Global.getString(cr, Settings.Global.POLICY_CONTROL);
if ("immersive.full=*".equals(value)) {
return STATE_ENABLE_FOR_ALL;
@@ -167,16 +172,20 @@
private void enableForAll() {
mExpandedDesktopState = STATE_ENABLE_FOR_ALL;
- writeValue("immersive.full=*");
- mAllPackagesAdapter.notifyDataSetInvalidated();
+ //writeValue("immersive.full=*");
+ Settings.Global.putInt(getContentResolver(),
+ Settings.Global.OVERRIDE_POLICY_CONTROL, 1);
+ mAllPackagesAdapter.notifyDataSetChanged();
hideListView();
}
private void userConfigurableSettings() {
mExpandedDesktopState = STATE_USER_CONFIGURABLE;
- writeValue("");
+ //writeValue("");
+ Settings.Global.putInt(getContentResolver(),
+ Settings.Global.OVERRIDE_POLICY_CONTROL, 0);
WindowManagerPolicyControl.reloadFromSetting(getActivity());
- mAllPackagesAdapter.notifyDataSetInvalidated();
+ mAllPackagesAdapter.notifyDataSetChanged();
showListView();
}
@@ -190,9 +199,9 @@
mEmptyView.setVisibility(View.GONE);
}
- private void writeValue(String value) {
+ /*private void writeValue(String value) {
Settings.Global.putString(getContentResolver(), Settings.Global.POLICY_CONTROL, value);
- }
+ }*/
private static int getStateForPackage(String packageName) {
int state = STATE_DISABLED;