summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/cyanogenmod
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2016-03-09 11:49:57 -0800
committerDanesh M <daneshm90@gmail.com>2016-03-14 13:37:13 -0700
commit9c35338443d9d9d84bbfe4c899d82d2da1f85b60 (patch)
treecc8debc41a1f437cccbdb53e4efc139e9e272bb6 /src/com/android/settings/cyanogenmod
parentd8c29b8f2327a2df83e606e286d053cfce28ba16 (diff)
downloadpackages_apps_Settings-9c35338443d9d9d84bbfe4c899d82d2da1f85b60.zip
packages_apps_Settings-9c35338443d9d9d84bbfe4c899d82d2da1f85b60.tar.gz
packages_apps_Settings-9c35338443d9d9d84bbfe4c899d82d2da1f85b60.tar.bz2
Settings : Add multiuser support for CMHardware
- Show button for other users - Use services instead of CMHardware for vibrator and touch sensitivity - Do a one time restore of tunable settings CYNGNOS-1166 Change-Id: I0de8eef6bf73c344ee5789e9650dd96b25b1a6bc
Diffstat (limited to 'src/com/android/settings/cyanogenmod')
-rw-r--r--src/com/android/settings/cyanogenmod/BootReceiver.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/com/android/settings/cyanogenmod/BootReceiver.java b/src/com/android/settings/cyanogenmod/BootReceiver.java
index 14e004d..19c2794 100644
--- a/src/com/android/settings/cyanogenmod/BootReceiver.java
+++ b/src/com/android/settings/cyanogenmod/BootReceiver.java
@@ -19,6 +19,9 @@ package com.android.settings.cyanogenmod;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+
import com.android.settings.ButtonSettings;
import com.android.settings.R;
import com.android.settings.Utils;
@@ -32,14 +35,19 @@ import com.android.settings.DevelopmentSettings;
public class BootReceiver extends BroadcastReceiver {
private static final String TAG = "BootReceiver";
+ private static final String ONE_TIME_TUNABLE_RESTORE = "hardware_tunable_restored";
@Override
public void onReceive(Context ctx, Intent intent) {
- /* Restore the hardware tunable values */
- ButtonSettings.restoreKeyDisabler(ctx);
- DisplayGamma.restore(ctx);
- VibratorIntensity.restore(ctx);
- InputMethodAndLanguageSettings.restore(ctx);
+ if (!hasRestoredTunable(ctx)) {
+ /* Restore the hardware tunable values */
+ ButtonSettings.restoreKeyDisabler(ctx);
+ DisplayGamma.restore(ctx);
+ VibratorIntensity.restore(ctx);
+ InputMethodAndLanguageSettings.restore(ctx);
+ setRestoredTunable(ctx);
+ }
+
LocationSettings.restore(ctx);
// Extract the contributors database
@@ -47,4 +55,14 @@ public class BootReceiver extends BroadcastReceiver {
DevelopmentSettings.initializeUpdateRecoveryOption();
}
+
+ private boolean hasRestoredTunable(Context context) {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ return preferences.getBoolean(ONE_TIME_TUNABLE_RESTORE, false);
+ }
+
+ private void setRestoredTunable(Context context) {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ preferences.edit().putBoolean(ONE_TIME_TUNABLE_RESTORE, true).apply();
+ }
}