diff options
author | d34d <clark@cyngn.com> | 2015-11-17 10:13:10 -0800 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2015-11-17 18:26:17 -0800 |
commit | 177218b9818f1d9b4bc2f350fa4a65778f4f91f9 (patch) | |
tree | e38a5a53815af6e876d49ff2b5da12f941e2b387 /cmds/settings/src/com/android/commands | |
parent | c4caff693f86b88ac7d2ea254e3ad4ddc04e89cf (diff) | |
download | frameworks_base-177218b9818f1d9b4bc2f350fa4a65778f4f91f9.zip frameworks_base-177218b9818f1d9b4bc2f350fa4a65778f4f91f9.tar.gz frameworks_base-177218b9818f1d9b4bc2f350fa4a65778f4f91f9.tar.bz2 |
settings: Implicitly use CMSettings for legacy settings
Change-Id: Ibb04c5612ae010b0d19d6e58b994940f1349e384
Diffstat (limited to 'cmds/settings/src/com/android/commands')
-rw-r--r-- | cmds/settings/src/com/android/commands/settings/SettingsCmd.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cmds/settings/src/com/android/commands/settings/SettingsCmd.java b/cmds/settings/src/com/android/commands/settings/SettingsCmd.java index b6cdbeb..64610fe 100644 --- a/cmds/settings/src/com/android/commands/settings/SettingsCmd.java +++ b/cmds/settings/src/com/android/commands/settings/SettingsCmd.java @@ -29,6 +29,7 @@ import android.os.Process; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; +import android.text.TextUtils; import cyanogenmod.providers.CMSettings; import java.util.ArrayList; @@ -140,6 +141,13 @@ public final class SettingsCmd { mUser = UserHandle.USER_OWNER; } + // Implicitly use CMSettings provider if the setting is a legacy setting + if (!mUseCMSettingsProvider && isLegacySetting(mTable, mKey)) { + System.err.println("'" + mKey + "' has moved to CMSettings. Use --cm to avoid " + + "this warning in the future."); + mUseCMSettingsProvider = true; + } + try { IActivityManager activityManager = ActivityManagerNative.getDefault(); IContentProvider provider = null; @@ -329,6 +337,19 @@ public final class SettingsCmd { System.err.println("If '--cm' is given, the operations are performed on the CMSettings provider."); } + private static boolean isLegacySetting(String table, String key) { + if (!TextUtils.isEmpty(key)) { + if ("system".equals(table)) { + return CMSettings.System.isLegacySetting(key); + } else if ("secure".equals(table)) { + return CMSettings.Secure.isLegacySetting(key); + } else if ("global".equals(table)) { + return CMSettings.Global.isLegacySetting(key); + } + } + return false; + } + public static String resolveCallingPackage() { switch (android.os.Process.myUid()) { case Process.ROOT_UID: { |