diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index dc5c36b4f7d..f9355fb46aa 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1756,6 +1756,8 @@
android:value="com.android.settings.slim.DisplayRotation" />
+
+
diff --git a/res/drawable-xhdpi/bloqueo.png b/res/drawable-xhdpi/bloqueo.png
new file mode 100644
index 00000000000..0e05a2748f0
Binary files /dev/null and b/res/drawable-xhdpi/bloqueo.png differ
diff --git a/res/drawable-xhdpi/cortina.png b/res/drawable-xhdpi/cortina.png
new file mode 100644
index 00000000000..8e07d43f1a9
Binary files /dev/null and b/res/drawable-xhdpi/cortina.png differ
diff --git a/res/drawable-xhdpi/horassilencio.png b/res/drawable-xhdpi/horassilencio.png
new file mode 100644
index 00000000000..7df59d3be84
Binary files /dev/null and b/res/drawable-xhdpi/horassilencio.png differ
diff --git a/res/drawable-xhdpi/ic_settings_halo.png b/res/drawable-xhdpi/ic_settings_halo.png
new file mode 100644
index 00000000000..05535431b08
Binary files /dev/null and b/res/drawable-xhdpi/ic_settings_halo.png differ
diff --git a/res/drawable-xhdpi/multi.png b/res/drawable-xhdpi/multi.png
new file mode 100644
index 00000000000..51d2ce631b1
Binary files /dev/null and b/res/drawable-xhdpi/multi.png differ
diff --git a/res/drawable-xhdpi/navbar.png b/res/drawable-xhdpi/navbar.png
new file mode 100644
index 00000000000..6b5384de06d
Binary files /dev/null and b/res/drawable-xhdpi/navbar.png differ
diff --git a/res/drawable-xhdpi/power.png b/res/drawable-xhdpi/power.png
new file mode 100644
index 00000000000..60d55fc3c23
Binary files /dev/null and b/res/drawable-xhdpi/power.png differ
diff --git a/res/drawable-xhdpi/status.png b/res/drawable-xhdpi/status.png
new file mode 100644
index 00000000000..3f0652360b7
Binary files /dev/null and b/res/drawable-xhdpi/status.png differ
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml
index 40efe184dfe..1f17b5d3ea6 100644
--- a/res/layout/installed_app_details.xml
+++ b/res/layout/installed_app_details.xml
@@ -62,6 +62,13 @@
android:layout_marginTop="4dip"
android:text="@string/app_notifications_switch_label" />
+
+
+
2
+
+ - @string/halo_state_black
+ - @string/halo_state_white
+
+
+
+ - 1
+ - 0
+
+
+
+ - @string/halo_size_miniscule
+ - @string/halo_size_small
+ - @string/halo_size_default
+ - @string/halo_size_large
+ - @string/halo_size_gigantic
+ - @string/halo_size_monster
+
+
+ - 0.6
+ - 0.8
+ - 1.0
+ - 1.2
+ - 1.4
+ - 1.6
+
+
+
+ - @string/halo_notification_count_none
+ - @string/halo_notification_count_total
+ - @string/halo_notification_count_individual
+ - @string/halo_notification_count_both
+
+
+
+ - 1
+ - 2
+ - 3
+ - 4
+
+
+
+ - @string/halo_msgbox_animation_none
+ - @string/halo_msgbox_animation_flip
+
+
+
+ - 1
+ - 2
+
+
diff --git a/res/values/slim_strings.xml b/res/values/slim_strings.xml
index 7e1ed513a65..c434e7d3e8e 100644
--- a/res/values/slim_strings.xml
+++ b/res/values/slim_strings.xml
@@ -823,4 +823,61 @@ two in order to insert additional control points. \'Remove\' deletes the selecte
Left
Right
+
+ revolution build date
+ 2012-01-01-0000
+
+
+ Halo
+ Halo Behavior
+ Hide Halo after activity
+ Halo will appear for incoming tasks and scroll out of sight after a while
+ Reverse Halo
+ Applies for task switching and moving gestures
+ Halo policy
+ Enables black/white listing notifications
+ Black list
+ White list
+ Pause active app
+ When opening an app with Halo the underlying app will get paused
+ Ninja mode
+ Halo will disappear completely when empty
+ Enable message pop-up
+ Show message box for incoming notifications
+ Ping on unlock
+ Halo will ping when device is unlocked if new notifications were received
+
+ Halo size
+ Defines how big Halo is going to be
+ Miniscule
+ Small
+ Normal (default)
+ Large
+ Gigantic
+ Monster
+
+ Notification count
+ Display notification counts on Halo
+ None
+ Total
+ Per app
+ Both
+
+ Message box animation
+ Halo message box animation for incoming notifications
+ None
+ Flip
+
+
+ Blacklist from HALO
+ Whitelist from HALO
+
+
+ Quick Access ribbon
+ Quick Setting tiles
+ Misc
+ Show in drawer
+ Linked layout
+ Use the same tiles and layout as the Quick Settings panel
+
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
index 5e6f67a6465..c860ab95000 100644
--- a/res/xml/device_info_settings.xml
+++ b/res/xml/device_info_settings.xml
@@ -137,6 +137,12 @@
android:title="@string/build_number"
android:summary="@string/device_info_default"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/xml/quick_settings.xml b/res/xml/quick_settings.xml
new file mode 100644
index 00000000000..6057c31f2f8
--- /dev/null
+++ b/res/xml/quick_settings.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/xml/settings_headers.xml b/res/xml/settings_headers.xml
index 0f5fd699b56..e5a7527c4f0 100644
--- a/res/xml/settings_headers.xml
+++ b/res/xml/settings_headers.xml
@@ -86,6 +86,13 @@
android:targetClass="com.slim.center.SlimCenter" />
+
+
+
diff --git a/res/xml/slim_interface_settings.xml b/res/xml/slim_interface_settings.xml
index 8c1c497ff45..105aca5050c 100644
--- a/res/xml/slim_interface_settings.xml
+++ b/res/xml/slim_interface_settings.xml
@@ -34,4 +34,8 @@
android:fragment="com.android.settings.slim.StatusBar"
android:title="@string/status_bar_title" />
+
+
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 3d0d3533af5..b2980eaacce 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -64,6 +64,7 @@ public class DeviceInfoSettings extends RestrictedSettingsFragment {
private static final String KEY_EQUIPMENT_ID = "fcc_equipment_id";
private static final String PROPERTY_EQUIPMENT_ID = "ro.ril.fccid";
private static final String KEY_SLIM_VERSION = "slim_version";
+ private static final String KEY_MOD_BUILD_DATE = "build_date";
static final int TAPS_TO_BE_A_DEVELOPER = 7;
@@ -95,6 +96,7 @@ public void onCreate(Bundle icicle) {
findPreference(KEY_BUILD_NUMBER).setEnabled(true);
findPreference(KEY_KERNEL_VERSION).setSummary(getFormattedKernelVersion());
setValueSummary(KEY_SLIM_VERSION, "ro.slim.version");
+ setValueSummary(KEY_MOD_BUILD_DATE, "ro.build.date");
if (!SELinux.isSELinuxEnabled()) {
String status = getResources().getString(R.string.selinux_status_disabled);
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index face65931d5..4e7942bd2f8 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -110,11 +110,13 @@ public class InstalledAppDetails extends Fragment
private AppWidgetManager mAppWidgetManager;
private DevicePolicyManager mDpm;
private ISms mSmsManager;
+ private INotificationManager mNotificationManager;
private ApplicationsState mState;
private ApplicationsState.Session mSession;
private ApplicationsState.AppEntry mAppEntry;
private boolean mInitialized;
private boolean mShowUninstalled;
+ private boolean mHaloPolicyIsBlack = true;
private PackageInfo mPackageInfo;
private CanBeOnSdCardChecker mCanBeOnSdCardChecker;
private View mRootView;
@@ -142,8 +144,7 @@ public class InstalledAppDetails extends Fragment
private Button mForceStopButton;
private Button mClearDataButton;
private Button mMoveAppButton;
- private CompoundButton mNotificationSwitch;
- private Button mAppOpsButton;
+ private CompoundButton mNotificationSwitch, mHaloState;
private PackageMoveObserver mPackageMoveObserver;
private AppOpsManager mAppOps;
@@ -383,16 +384,18 @@ private void initUninstallButtons() {
}
private void initNotificationButton() {
- INotificationManager nm = INotificationManager.Stub.asInterface(
- ServiceManager.getService(Context.NOTIFICATION_SERVICE));
boolean enabled = true; // default on
+ boolean allowedForHalo = true; // default on
try {
- enabled = nm.areNotificationsEnabledForPackage(mAppEntry.info.packageName,
+ enabled = mNotificationManager.areNotificationsEnabledForPackage(mAppEntry.info.packageName,
mAppEntry.info.uid);
+ allowedForHalo = mNotificationManager.isPackageAllowedForHalo(mAppEntry.info.packageName);
} catch (android.os.RemoteException ex) {
// this does not bode well
}
mNotificationSwitch.setChecked(enabled);
+ mHaloState.setChecked((mHaloPolicyIsBlack ? !allowedForHalo : allowedForHalo));
+ mHaloState.setOnCheckedChangeListener(this);
if (isThisASystemPackage()) {
mNotificationSwitch.setEnabled(false);
} else {
@@ -428,9 +431,17 @@ public void onCreate(Bundle icicle) {
mAppWidgetManager = AppWidgetManager.getInstance(getActivity());
mDpm = (DevicePolicyManager)getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
mSmsManager = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+ mNotificationManager = INotificationManager.Stub.asInterface(
+ ServiceManager.getService(Context.NOTIFICATION_SERVICE));
mCanBeOnSdCardChecker = new CanBeOnSdCardChecker();
+ try {
+ mHaloPolicyIsBlack = mNotificationManager.isHaloPolicyBlack();
+ } catch (android.os.RemoteException ex) {
+ // System dead
+ }
+
// Need to make sure we have loaded applications at this point.
mSession.resume();
@@ -491,8 +502,8 @@ public View onCreateView(
mNotificationSwitch = (CompoundButton) view.findViewById(R.id.notification_switch);
- mAppOps = (AppOpsManager) getActivity().getSystemService(Context.APP_OPS_SERVICE);
- mAppOpsButton = (Button) view.findViewById(R.id.app_ops_button);
+ mHaloState = (CompoundButton) view.findViewById(R.id.halo_state);
+ mHaloState.setText((mHaloPolicyIsBlack ? R.string.app_halo_label_black : R.string.app_halo_label_white));
return view;
}
@@ -1318,17 +1329,22 @@ protected Object doInBackground(Object... params) {
}
private void setNotificationsEnabled(boolean enabled) {
- String packageName = mAppEntry.info.packageName;
- INotificationManager nm = INotificationManager.Stub.asInterface(
- ServiceManager.getService(Context.NOTIFICATION_SERVICE));
try {
final boolean enable = mNotificationSwitch.isChecked();
- nm.setNotificationsEnabledForPackage(packageName, mAppEntry.info.uid, enabled);
+ mNotificationManager.setNotificationsEnabledForPackage(mAppEntry.info.packageName, mAppEntry.info.uid, enabled);
} catch (android.os.RemoteException ex) {
mNotificationSwitch.setChecked(!enabled); // revert
}
}
+ private void setHaloState(boolean state) {
+ try {
+ mNotificationManager.setHaloStatus(mAppEntry.info.packageName, state);
+ } catch (android.os.RemoteException ex) {
+ mHaloState.setChecked(!state); // revert
+ }
+ }
+
private int getPremiumSmsPermission(String packageName) {
try {
if (mSmsManager != null) {
@@ -1432,6 +1448,8 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
} else {
setNotificationsEnabled(true);
}
+ } else if (buttonView == mHaloState) {
+ setHaloState(isChecked);
}
}
}
diff --git a/src/com/android/settings/slim/Halo.java b/src/com/android/settings/slim/Halo.java
new file mode 100644
index 00000000000..6b4099740a5
--- /dev/null
+++ b/src/com/android/settings/slim/Halo.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2012 ParanoidAndroid Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.omnikang;
+
+import android.app.ActivityManager;
+import android.app.INotificationManager;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+import android.provider.Settings;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+
+public class Halo extends SettingsPreferenceFragment
+ implements Preference.OnPreferenceChangeListener {
+
+ private static final String KEY_HALO_STATE = "halo_state";
+ private static final String KEY_HALO_HIDE = "halo_hide";
+ private static final String KEY_HALO_REVERSED = "halo_reversed";
+ private static final String KEY_HALO_SIZE = "halo_size";
+ private static final String KEY_HALO_PAUSE = "halo_pause";
+ private static final String KEY_HALO_NINJA = "halo_ninja";
+ private static final String KEY_HALO_MSGBOX = "halo_msgbox";
+ private static final String KEY_HALO_MSGBOX_ANIMATION = "halo_msgbox_animation";
+ private static final String KEY_HALO_NOTIFY_COUNT = "halo_notify_count";
+ private static final String KEY_HALO_UNLOCK_PING = "halo_unlock_ping";
+
+ private ListPreference mHaloState;
+ private ListPreference mHaloSize;
+ private CheckBoxPreference mHaloHide;
+ private CheckBoxPreference mHaloReversed;
+ private CheckBoxPreference mHaloPause;
+ private ListPreference mHaloNotifyCount;
+ private ListPreference mHaloMsgAnimate;
+ private CheckBoxPreference mHaloNinja;
+ private CheckBoxPreference mHaloMsgBox;
+ private CheckBoxPreference mHaloUnlockPing;
+
+ private Context mContext;
+ private INotificationManager mNotificationManager;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.halo_settings);
+ PreferenceScreen prefSet = getPreferenceScreen();
+ mContext = getActivity();
+
+ mNotificationManager = INotificationManager.Stub.asInterface(
+ ServiceManager.getService(Context.NOTIFICATION_SERVICE));
+
+ mHaloState = (ListPreference) prefSet.findPreference(KEY_HALO_STATE);
+ mHaloState.setValue(String.valueOf((isHaloPolicyBlack() ? "1" : "0")));
+ mHaloState.setOnPreferenceChangeListener(this);
+
+ mHaloHide = (CheckBoxPreference) prefSet.findPreference(KEY_HALO_HIDE);
+ mHaloHide.setChecked(Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HALO_HIDE, 0) == 1);
+
+ mHaloReversed = (CheckBoxPreference) prefSet.findPreference(KEY_HALO_REVERSED);
+ mHaloReversed.setChecked(Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HALO_REVERSED, 1) == 1);
+
+ int isLowRAM = (!ActivityManager.isLowRamDeviceStatic()) ? 0 : 1;
+ mHaloPause = (CheckBoxPreference) prefSet.findPreference(KEY_HALO_PAUSE);
+ mHaloPause.setChecked(Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HALO_PAUSE, isLowRAM) == 1);
+
+ mHaloSize = (ListPreference) prefSet.findPreference(KEY_HALO_SIZE);
+ try {
+ float haloSize = Settings.System.getFloat(mContext.getContentResolver(),
+ Settings.System.HALO_SIZE, 1.0f);
+ mHaloSize.setValue(String.valueOf(haloSize));
+ } catch(Exception ex) {
+ // So what
+ }
+ mHaloSize.setOnPreferenceChangeListener(this);
+
+ mHaloNinja = (CheckBoxPreference) prefSet.findPreference(KEY_HALO_NINJA);
+ mHaloNinja.setChecked(Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HALO_NINJA, 0) == 1);
+
+ mHaloMsgBox = (CheckBoxPreference) prefSet.findPreference(KEY_HALO_MSGBOX);
+ mHaloMsgBox.setChecked(Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HALO_MSGBOX, 1) == 1);
+
+ mHaloUnlockPing = (CheckBoxPreference) prefSet.findPreference(KEY_HALO_UNLOCK_PING);
+ mHaloUnlockPing.setChecked(Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HALO_UNLOCK_PING, 0) == 1);
+
+ mHaloNotifyCount = (ListPreference) prefSet.findPreference(KEY_HALO_NOTIFY_COUNT);
+ try {
+ int haloCounter = Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HALO_NOTIFY_COUNT, 4);
+ mHaloNotifyCount.setValue(String.valueOf(haloCounter));
+ } catch(Exception ex) {
+ // fail...
+ }
+ mHaloNotifyCount.setOnPreferenceChangeListener(this);
+
+ mHaloMsgAnimate = (ListPreference) prefSet.findPreference(KEY_HALO_MSGBOX_ANIMATION);
+ try {
+ int haloMsgAnimation = Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HALO_MSGBOX_ANIMATION, 2);
+ mHaloMsgAnimate.setValue(String.valueOf(haloMsgAnimation));
+ } catch(Exception ex) {
+ // fail...
+ }
+ mHaloMsgAnimate.setOnPreferenceChangeListener(this);
+ }
+
+ private boolean isHaloPolicyBlack() {
+ try {
+ return mNotificationManager.isHaloPolicyBlack();
+ } catch (android.os.RemoteException ex) {
+ // System dead
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ if (preference == mHaloHide) {
+ Settings.System.putInt(mContext.getContentResolver(),
+ Settings.System.HALO_HIDE, mHaloHide.isChecked()
+ ? 1 : 0);
+ } else if (preference == mHaloReversed) {
+ Settings.System.putInt(mContext.getContentResolver(),
+ Settings.System.HALO_REVERSED, mHaloReversed.isChecked()
+ ? 1 : 0);
+ } else if (preference == mHaloPause) {
+ Settings.System.putInt(mContext.getContentResolver(),
+ Settings.System.HALO_PAUSE, mHaloPause.isChecked()
+ ? 1 : 0);
+ } else if (preference == mHaloNinja) {
+ Settings.System.putInt(mContext.getContentResolver(),
+ Settings.System.HALO_NINJA, mHaloNinja.isChecked()
+ ? 1 : 0);
+ } else if (preference == mHaloMsgBox) {
+ Settings.System.putInt(mContext.getContentResolver(),
+ Settings.System.HALO_MSGBOX, mHaloMsgBox.isChecked()
+ ? 1 : 0);
+ } else if (preference == mHaloUnlockPing) {
+ Settings.System.putInt(mContext.getContentResolver(),
+ Settings.System.HALO_UNLOCK_PING, mHaloUnlockPing.isChecked()
+ ? 1 : 0);
+ }
+ return super.onPreferenceTreeClick(preferenceScreen, preference);
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (preference == mHaloSize) {
+ float haloSize = Float.valueOf((String) newValue);
+ Settings.System.putFloat(getActivity().getContentResolver(),
+ Settings.System.HALO_SIZE, haloSize);
+ return true;
+ } else if (preference == mHaloState) {
+ boolean state = Integer.valueOf((String) newValue) == 1;
+ try {
+ mNotificationManager.setHaloPolicyBlack(state);
+ } catch (android.os.RemoteException ex) {
+ // System dead
+ }
+ return true;
+ } else if (preference == mHaloMsgAnimate) {
+ int haloMsgAnimation = Integer.valueOf((String) newValue);
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.HALO_MSGBOX_ANIMATION, haloMsgAnimation);
+ return true;
+ } else if (preference == mHaloNotifyCount) {
+ int haloNotifyCount = Integer.valueOf((String) newValue);
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.HALO_NOTIFY_COUNT, haloNotifyCount);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/com/android/settings/slim/LockscreenStyle.java b/src/com/android/settings/slim/LockscreenStyle.java
index e96a1ade016..eb8c8260c29 100644
--- a/src/com/android/settings/slim/LockscreenStyle.java
+++ b/src/com/android/settings/slim/LockscreenStyle.java
@@ -44,6 +44,7 @@
import android.view.MenuItem;
import android.widget.Toast;
+import com.android.internal.util.slim.DeviceUtils;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.R;
import com.android.settings.Utils;
@@ -150,6 +151,7 @@ private PreferenceScreen createCustomView() {
R.string.lockscreen_dots_color_summary), dotsColor);
mDotsColor.setNewPreviewColor(dotsColor);
+ // No lock-slider is available
boolean dotsDisabled = new LockPatternUtils(getActivity()).isSecure()
&& Settings.Secure.getInt(getContentResolver(),
Settings.Secure.LOCK_BEFORE_UNLOCK, 0) == 0;
@@ -158,6 +160,10 @@ private PreferenceScreen createCustomView() {
mDotsColor.setEnabled(!dotsDisabled);
mLockIcon.setEnabled(!dotsDisabled);
mColorizeCustom.setEnabled(!dotsDisabled && imageExists);
+ // Tablets don't have the extended-widget lock icon
+ if (DeviceUtils.isTablet(getActivity())) {
+ mLockColor.setEnabled(!dotsDisabled);
+ }
updateLockSummary();
diff --git a/src/com/android/settings/slim/QuickSettings.java b/src/com/android/settings/slim/QuickSettings.java
new file mode 100644
index 00000000000..8f041add00f
--- /dev/null
+++ b/src/com/android/settings/slim/QuickSettings.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2013 The Dirty Unicorns Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.slim;
+
+import android.app.ActivityManager;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.provider.Settings;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+import android.preference.PreferenceCategory;
+import android.provider.Settings.SettingNotFoundException;
+import android.util.Log;
+import android.view.WindowManagerGlobal;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.util.Helpers;
+
+public class QuickSettings extends SettingsPreferenceFragment implements
+ Preference.OnPreferenceChangeListener {
+ private static final String TAG = "QuickSettings";
+
+ private static final String QS_QUICK_ACCESS = "qs_quick_access";
+ private static final String QS_QUICK_ACCESS_LINKED = "qs_quick_access_linked";
+
+ private CheckBoxPreference mQSQuickAccess;
+ private CheckBoxPreference mQSQuickAccess_linked;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.quick_settings);
+ PreferenceScreen prefSet = getPreferenceScreen();
+
+ ContentResolver resolver = getActivity().getContentResolver();
+
+ mQSQuickAccess = (CheckBoxPreference) prefSet.findPreference(QS_QUICK_ACCESS);
+ mQSQuickAccess.setChecked((Settings.System.getInt(resolver,
+ Settings.System.QS_QUICK_ACCESS, 0) == 1));
+
+ mQSQuickAccess_linked = (CheckBoxPreference) prefSet.findPreference(QS_QUICK_ACCESS_LINKED);
+ mQSQuickAccess_linked.setChecked((Settings.System.getInt(resolver,
+ Settings.System.QS_QUICK_ACCESS_LINKED, 0) == 1));
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ ContentResolver resolver = getActivity().getContentResolver();
+
+ return false;
+ }
+
+ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ ContentResolver resolver = getActivity().getContentResolver();
+ boolean value;
+
+ if (preference == mQSQuickAccess) {
+ value = mQSQuickAccess.isChecked();
+ Settings.System.putInt(resolver,
+ Settings.System.QS_QUICK_ACCESS, value ? 1 : 0);
+ Helpers.restartSystemUI();
+ } else if (preference == mQSQuickAccess_linked) {
+ value = mQSQuickAccess_linked.isChecked();
+ Settings.System.putInt(resolver,
+ Settings.System.QS_QUICK_ACCESS_LINKED, value ? 1 : 0);
+ Helpers.restartSystemUI();
+ } else {
+ // If we didn't handle it, let preferences handle it.
+ return super.onPreferenceTreeClick(preferenceScreen, preference);
+ }
+ return true;
+ }
+}