diff options
author | d34d <clark@cyngn.com> | 2015-11-10 10:47:58 -0800 |
---|---|---|
committer | Clark Scheff <clark@cyngn.com> | 2015-11-12 10:06:12 -0800 |
commit | aa782a28f1a75c3d9bdfdc23b5aa29f039fe085b (patch) | |
tree | 10b375898a3ea87b09fb3af86c8394d5bc9a4170 /services | |
parent | a3f946d143b969cf7d385a6c2a1704d4d77dc04c (diff) | |
download | frameworks_base-aa782a28f1a75c3d9bdfdc23b5aa29f039fe085b.zip frameworks_base-aa782a28f1a75c3d9bdfdc23b5aa29f039fe085b.tar.gz frameworks_base-aa782a28f1a75c3d9bdfdc23b5aa29f039fe085b.tar.bz2 |
fw: Move Secure settings to CMSettings
This moves all Settings.Secure.* settings that, were added to
CyanogenMod, to CMSettings.
* KEYBOARD_BRIGHTNESS
* BUTTON_BRIGHTNESS
* BUTTON_BACKLIGHT_TIMEOUT
* DEV_FORCE_SHOW_NAVBAR
* ADB_NOTIFY
* ADB_PORT
* DEVICE_HOSTNAME
* KILL_APP_LONGPRESS_BACK
* PROTECTED_COMPONENTS
* LIVE_DISPLAY_COLOR_MATRIX
* ADVANCED_REBOOT
* POWER_MENU_ACTIONS
* DEFAULT_THEME_COMPONENTS
* THEME_PREV_BOOT_API_LEVEL
Change-Id: I49e9160177ffc727b20008817ac2b5ce5e89ead5
Diffstat (limited to 'services')
13 files changed, 64 insertions, 53 deletions
diff --git a/services/Android.mk b/services/Android.mk index ecbddaa..b15f575 100644 --- a/services/Android.mk +++ b/services/Android.mk @@ -35,6 +35,8 @@ services := \ # The convention is to name each service module 'services.$(module_name)' LOCAL_STATIC_JAVA_LIBRARIES := $(addprefix services.,$(services)) +LOCAL_JAVA_LIBRARIES += org.cyanogenmod.platform.internal + include $(BUILD_JAVA_LIBRARY) # native library diff --git a/services/accessibility/Android.mk b/services/accessibility/Android.mk index d98fc28..39355a7 100644 --- a/services/accessibility/Android.mk +++ b/services/accessibility/Android.mk @@ -7,4 +7,6 @@ LOCAL_MODULE := services.accessibility LOCAL_SRC_FILES += \ $(call all-java-files-under,java) +LOCAL_JAVA_LIBRARIES += org.cyanogenmod.platform.internal + include $(BUILD_STATIC_JAVA_LIBRARY) diff --git a/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java b/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java index ab8eacf..1b4182d 100644 --- a/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java +++ b/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java @@ -26,6 +26,7 @@ import android.os.ServiceManager; import android.provider.Settings; import android.util.Slog; import android.view.accessibility.AccessibilityManager; +import cyanogenmod.providers.CMSettings; /** * Utility methods for performing accessibility display adjustments. @@ -76,8 +77,8 @@ public class DisplayAdjustmentUtils { return true; } - if (Settings.Secure.getStringForUser(cr, - Settings.Secure.LIVE_DISPLAY_COLOR_MATRIX, userId) != null) { + if (CMSettings.Secure.getStringForUser(cr, + CMSettings.Secure.LIVE_DISPLAY_COLOR_MATRIX, userId) != null) { return true; } @@ -96,8 +97,8 @@ public class DisplayAdjustmentUtils { colorMatrix = multiply(colorMatrix, INVERSION_MATRIX_VALUE_ONLY); } - String adj = Settings.Secure.getStringForUser(cr, - Settings.Secure.LIVE_DISPLAY_COLOR_MATRIX, userId); + String adj = CMSettings.Secure.getStringForUser(cr, + CMSettings.Secure.LIVE_DISPLAY_COLOR_MATRIX, userId); if (adj != null) { String[] tmp = adj.split(" "); if (tmp.length == 16) { diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index aae73fe..e46aff2 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -133,6 +133,7 @@ import com.android.server.net.LockdownVpnTracker; import com.google.android.collect.Lists; import com.google.android.collect.Sets; +import cyanogenmod.providers.CMSettings; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -642,8 +643,8 @@ public class ConnectivityService extends IConnectivityManager.Stub mTrackerHandler = new NetworkStateTrackerHandler(mHandlerThread.getLooper()); // setup our unique device name - String hostname = Settings.Secure.getString(context.getContentResolver(), - Settings.Secure.DEVICE_HOSTNAME); + String hostname = CMSettings.Secure.getString(context.getContentResolver(), + CMSettings.Secure.DEVICE_HOSTNAME); if (TextUtils.isEmpty(hostname) && TextUtils.isEmpty(SystemProperties.get("net.hostname"))) { String id = Settings.Secure.getString(context.getContentResolver(), diff --git a/services/core/java/com/android/server/ThemeService.java b/services/core/java/com/android/server/ThemeService.java index 2553961..d3547b5 100644 --- a/services/core/java/com/android/server/ThemeService.java +++ b/services/core/java/com/android/server/ThemeService.java @@ -66,6 +66,7 @@ import android.util.Log; import com.android.internal.R; import com.android.internal.util.cm.ImageUtils; +import cyanogenmod.providers.CMSettings; import java.io.BufferedInputStream; import java.io.File; @@ -345,9 +346,9 @@ public class ThemeService extends IThemeService.Stub { final ContentResolver resolver = mContext.getContentResolver(); int recordedApiLevel = android.os.Build.VERSION.SDK_INT; try { - recordedApiLevel = Settings.Secure.getInt(resolver, - Settings.Secure.THEME_PREV_BOOT_API_LEVEL); - } catch (SettingNotFoundException e) { + recordedApiLevel = CMSettings.Secure.getInt(resolver, + CMSettings.Secure.THEME_PREV_BOOT_API_LEVEL); + } catch (CMSettings.CMSettingNotFoundException e) { recordedApiLevel = -1; Log.d(TAG, "Previous api level not found. First time booting?"); } @@ -359,8 +360,8 @@ public class ThemeService extends IThemeService.Stub { private void updateThemeApi() { final ContentResolver resolver = mContext.getContentResolver(); - boolean success = Settings.Secure.putInt(resolver, - Settings.Secure.THEME_PREV_BOOT_API_LEVEL, android.os.Build.VERSION.SDK_INT); + boolean success = CMSettings.Secure.putInt(resolver, + CMSettings.Secure.THEME_PREV_BOOT_API_LEVEL, android.os.Build.VERSION.SDK_INT); if (!success) { Log.e(TAG, "Unable to store latest API level to secure settings"); } @@ -450,8 +451,8 @@ public class ThemeService extends IThemeService.Stub { final String defaultThemePkg = Settings.Secure.getString(resolver, Settings.Secure.DEFAULT_THEME_PACKAGE); if (!TextUtils.isEmpty(defaultThemePkg)) { - String defaultThemeComponents = Settings.Secure.getString(resolver, - Settings.Secure.DEFAULT_THEME_COMPONENTS); + String defaultThemeComponents = CMSettings.Secure.getString(resolver, + CMSettings.Secure.DEFAULT_THEME_COMPONENTS); List<String> components; if (TextUtils.isEmpty(defaultThemeComponents)) { components = ThemeUtils.getAllComponents(); diff --git a/services/core/java/com/android/server/display/LiveDisplayController.java b/services/core/java/com/android/server/display/LiveDisplayController.java index 4679a5b..be26c57 100644 --- a/services/core/java/com/android/server/display/LiveDisplayController.java +++ b/services/core/java/com/android/server/display/LiveDisplayController.java @@ -309,8 +309,8 @@ public class LiveDisplayController { if (mHardware.isSupported(CMHardwareManager.FEATURE_DISPLAY_COLOR_CALIBRATION)) { // Clear this out in case of an upgrade - Settings.Secure.putStringForUser(mContext.getContentResolver(), - Settings.Secure.LIVE_DISPLAY_COLOR_MATRIX, + CMSettings.Secure.putStringForUser(mContext.getContentResolver(), + CMSettings.Secure.LIVE_DISPLAY_COLOR_MATRIX, null, UserHandle.USER_CURRENT); @@ -334,8 +334,8 @@ public class LiveDisplayController { // For GPU color transform, go thru DisplayAdjustmentUtils in // order to coexist with accessibility settings - Settings.Secure.putStringForUser(mContext.getContentResolver(), - Settings.Secure.LIVE_DISPLAY_COLOR_MATRIX, + CMSettings.Secure.putStringForUser(mContext.getContentResolver(), + CMSettings.Secure.LIVE_DISPLAY_COLOR_MATRIX, colorMatrixStr, UserHandle.USER_CURRENT); diff --git a/services/core/java/com/android/server/policy/GlobalActions.java b/services/core/java/com/android/server/policy/GlobalActions.java index 9caa4c1..8c42917 100644 --- a/services/core/java/com/android/server/policy/GlobalActions.java +++ b/services/core/java/com/android/server/policy/GlobalActions.java @@ -84,6 +84,7 @@ import android.widget.ImageView; import android.widget.ImageView.ScaleType; import android.widget.ListView; import android.widget.TextView; +import cyanogenmod.providers.CMSettings; import java.util.ArrayList; import java.util.List; @@ -1211,8 +1212,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac protected void updatePowerMenuActions() { ContentResolver resolver = mContext.getContentResolver(); - mActions = Settings.Secure.getStringForUser(resolver, - Settings.Secure.POWER_MENU_ACTIONS, UserHandle.USER_CURRENT); + mActions = CMSettings.Secure.getStringForUser(resolver, + CMSettings.Secure.POWER_MENU_ACTIONS, UserHandle.USER_CURRENT); } private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() { diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index cb51c31..592a016 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -881,13 +881,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { Settings.Global.POLICY_CONTROL), false, this, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.System.getUriFor( - Settings.System.DEV_FORCE_SHOW_NAVBAR), false, this, - UserHandle.USER_ALL); - resolver.registerContentObserver(Settings.System.getUriFor( Settings.System.ACCELEROMETER_ROTATION_ANGLES), false, this, UserHandle.USER_ALL); - resolver.registerContentObserver(Settings.Secure.getUriFor( - Settings.Secure.DEV_FORCE_SHOW_NAVBAR), false, this, + resolver.registerContentObserver(CMSettings.Secure.getUriFor( + CMSettings.Secure.DEV_FORCE_SHOW_NAVBAR), false, this, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.System.getUriFor( Settings.System.VOLBTN_MUSIC_CONTROLS), false, this, @@ -2189,8 +2186,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { updateEdgeGestureListenerState(); } - boolean devForceNavbar = Settings.Secure.getIntForUser(resolver, - Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0, UserHandle.USER_CURRENT) == 1; + boolean devForceNavbar = CMSettings.Secure.getIntForUser(resolver, + CMSettings.Secure.DEV_FORCE_SHOW_NAVBAR, 0, UserHandle.USER_CURRENT) == 1; if (devForceNavbar != mDevForceNavbar) { mDevForceNavbar = devForceNavbar; } @@ -3478,8 +3475,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { } return -1; } else if (keyCode == KeyEvent.KEYCODE_BACK) { - if (Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.KILL_APP_LONGPRESS_BACK, 0) == 1) { + if (CMSettings.Secure.getInt(mContext.getContentResolver(), + CMSettings.Secure.KILL_APP_LONGPRESS_BACK, 0) == 1) { if (down && repeatCount == 0) { mHandler.postDelayed(mBackLongPress, mBackKillTimeout); } diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index 5e0c4c3..a8fbf6e 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -675,14 +675,14 @@ public final class PowerManagerService extends SystemService resolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.DOUBLE_TAP_TO_WAKE), false, mSettingsObserver, UserHandle.USER_ALL); - resolver.registerContentObserver(Settings.Secure.getUriFor( - Settings.Secure.BUTTON_BRIGHTNESS), + resolver.registerContentObserver(CMSettings.Secure.getUriFor( + CMSettings.Secure.BUTTON_BRIGHTNESS), false, mSettingsObserver, UserHandle.USER_ALL); - resolver.registerContentObserver(Settings.Secure.getUriFor( - Settings.Secure.KEYBOARD_BRIGHTNESS), + resolver.registerContentObserver(CMSettings.Secure.getUriFor( + CMSettings.Secure.KEYBOARD_BRIGHTNESS), false, mSettingsObserver, UserHandle.USER_ALL); - resolver.registerContentObserver(Settings.Secure.getUriFor( - Settings.Secure.BUTTON_BACKLIGHT_TIMEOUT), + resolver.registerContentObserver(CMSettings.Secure.getUriFor( + CMSettings.Secure.BUTTON_BACKLIGHT_TIMEOUT), false, mSettingsObserver, UserHandle.USER_ALL); resolver.registerContentObserver(CMSettings.System.getUriFor( CMSettings.System.PROXIMITY_ON_WAKE), @@ -824,15 +824,15 @@ public final class PowerManagerService extends SystemService updateLowPowerModeLocked(); } - mButtonTimeout = Settings.Secure.getIntForUser(resolver, - Settings.Secure.BUTTON_BACKLIGHT_TIMEOUT, + mButtonTimeout = CMSettings.Secure.getIntForUser(resolver, + CMSettings.Secure.BUTTON_BACKLIGHT_TIMEOUT, DEFAULT_BUTTON_ON_DURATION, UserHandle.USER_CURRENT); - mButtonBrightness = Settings.Secure.getIntForUser(resolver, - Settings.Secure.BUTTON_BRIGHTNESS, mButtonBrightnessSettingDefault, + mButtonBrightness = CMSettings.Secure.getIntForUser(resolver, + CMSettings.Secure.BUTTON_BRIGHTNESS, mButtonBrightnessSettingDefault, UserHandle.USER_CURRENT); - mKeyboardBrightness = Settings.Secure.getIntForUser(resolver, - Settings.Secure.KEYBOARD_BRIGHTNESS, mKeyboardBrightnessSettingDefault, + mKeyboardBrightness = CMSettings.Secure.getIntForUser(resolver, + CMSettings.Secure.KEYBOARD_BRIGHTNESS, mKeyboardBrightnessSettingDefault, UserHandle.USER_CURRENT); mDirty |= DIRTY_SETTINGS; diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index d358d8c..9b8ea14 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -65,6 +65,8 @@ import android.util.Log; import android.view.IWindowManager; import android.view.WindowManager; import java.lang.reflect.Method; + +import cyanogenmod.providers.CMSettings; import dalvik.system.PathClassLoader; import java.io.BufferedReader; @@ -170,8 +172,8 @@ public final class ShutdownThread extends Thread { private static boolean isAdvancedRebootPossible(final Context context) { KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); boolean keyguardLocked = km.inKeyguardRestrictedInputMode() && km.isKeyguardSecure(); - boolean advancedRebootEnabled = Settings.Secure.getInt(context.getContentResolver(), - Settings.Secure.ADVANCED_REBOOT, 0) == 1; + boolean advancedRebootEnabled = CMSettings.Secure.getInt(context.getContentResolver(), + CMSettings.Secure.ADVANCED_REBOOT, 0) == 1; boolean isPrimaryUser = UserHandle.getCallingUserId() == UserHandle.USER_OWNER; return advancedRebootEnabled && !keyguardLocked && isPrimaryUser; @@ -190,8 +192,8 @@ public final class ShutdownThread extends Thread { boolean showRebootOption = false; String[] actionsArray; - String actions = Settings.Secure.getStringForUser(context.getContentResolver(), - Settings.Secure.POWER_MENU_ACTIONS, UserHandle.USER_CURRENT); + String actions = CMSettings.Secure.getStringForUser(context.getContentResolver(), + CMSettings.Secure.POWER_MENU_ACTIONS, UserHandle.USER_CURRENT); if (actions == null) { actionsArray = context.getResources().getStringArray( com.android.internal.R.array.config_globalActionsList); diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 8cfbac6..90a4dc1 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -102,6 +102,7 @@ import com.android.server.wallpaper.WallpaperManagerService; import com.android.server.webkit.WebViewUpdateService; import com.android.server.wm.WindowManagerService; +import cyanogenmod.providers.CMSettings; import dalvik.system.VMRuntime; import java.io.File; @@ -189,8 +190,8 @@ public final class SystemServer { } @Override public void onChange(boolean selfChange) { - int adbPort = Settings.Secure.getInt(mContentResolver, - Settings.Secure.ADB_PORT, 0); + int adbPort = CMSettings.Secure.getInt(mContentResolver, + CMSettings.Secure.ADB_PORT, 0); // setting this will control whether ADB runs on TCP/IP or USB SystemProperties.set("service.adb.tcp.port", Integer.toString(adbPort)); } @@ -1048,12 +1049,12 @@ public final class SystemServer { } // make sure the ADB_ENABLED setting value matches the secure property value - Settings.Secure.putInt(mContentResolver, Settings.Secure.ADB_PORT, + CMSettings.Secure.putInt(mContentResolver, CMSettings.Secure.ADB_PORT, Integer.parseInt(SystemProperties.get("service.adb.tcp.port", "-1"))); // register observer to listen for settings changes mContentResolver.registerContentObserver( - Settings.Secure.getUriFor(Settings.Secure.ADB_PORT), + CMSettings.Secure.getUriFor(CMSettings.Secure.ADB_PORT), false, new AdbPortObserver()); // Before things start rolling, be sure we have decided whether diff --git a/services/usb/Android.mk b/services/usb/Android.mk index feabf0a..2a9c382 100644 --- a/services/usb/Android.mk +++ b/services/usb/Android.mk @@ -9,4 +9,6 @@ LOCAL_SRC_FILES += \ LOCAL_JAVA_LIBRARIES := services.core +LOCAL_JAVA_LIBRARIES += org.cyanogenmod.platform.internal + include $(BUILD_STATIC_JAVA_LIBRARY) diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 29a1809..a79c8ea 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -51,6 +51,7 @@ import android.util.Slog; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.IndentingPrintWriter; import com.android.server.FgThread; +import cyanogenmod.providers.CMSettings; import java.io.File; import java.io.FileNotFoundException; @@ -356,10 +357,10 @@ public class UsbDeviceManager { }; mContentResolver.registerContentObserver( - Settings.Secure.getUriFor(Settings.Secure.ADB_PORT), + CMSettings.Secure.getUriFor(CMSettings.Secure.ADB_PORT), false, adbNotificationObserver); mContentResolver.registerContentObserver( - Settings.Secure.getUriFor(Settings.Secure.ADB_NOTIFY), + CMSettings.Secure.getUriFor(CMSettings.Secure.ADB_NOTIFY), false, adbNotificationObserver); // Watch for USB configuration changes @@ -809,10 +810,10 @@ public class UsbDeviceManager { final int id; boolean usbAdbActive = mAdbEnabled && mConnected; boolean netAdbActive = mAdbEnabled && - Settings.Secure.getInt(mContentResolver, Settings.Secure.ADB_PORT, -1) > 0; + CMSettings.Secure.getInt(mContentResolver, CMSettings.Secure.ADB_PORT, -1) > 0; boolean hideNotification = "0".equals(SystemProperties.get("persist.adb.notify")) - || Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ADB_NOTIFY, 1) == 0; + || CMSettings.Secure.getInt(mContext.getContentResolver(), + CMSettings.Secure.ADB_NOTIFY, 1) == 0; if (hideNotification) { id = 0; |