From 2be0eef4dda0548de9ce68c50f1edd7ff0457dff Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Wed, 18 Nov 2015 16:06:36 -0800 Subject: [PATCH] CMSettingsProvider: Change migration pref. The previous migration step should've never happened, change the default shared pref to a different location to force trigger a migration on devices where the previous iteration of settings migration already happened. Change-Id: I6b466d37910c31dbf58d37fd631807d7dd2dbae3 --- .../cmsettings/CMSettingsProvider.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java index cdd4291..4da7d6c 100644 --- a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java +++ b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java @@ -18,6 +18,7 @@ package org.cyanogenmod.cmsettings; import android.app.ActivityManager; import android.content.BroadcastReceiver; +import android.content.ComponentName; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentValues; @@ -54,12 +55,12 @@ import java.util.Set; * The CMSettingsProvider serves as a {@link ContentProvider} for CM specific settings */ public class CMSettingsProvider extends ContentProvider { - private static final String TAG = "CMSettingsProvider"; + static final String TAG = "CMSettingsProvider"; private static final boolean LOCAL_LOGV = false; private static final boolean USER_CHECK_THROWS = true; - private static final String PREF_HAS_MIGRATED_CM_SETTINGS = "has_migrated_cm_settings"; + static final String PREF_HAS_MIGRATED_CM_SETTINGS = "has_migrated_cm13_settings"; private static final Bundle NULL_SETTING = Bundle.forPair("value", null); @@ -249,7 +250,7 @@ public class CMSettingsProvider extends ContentProvider { @Override public Bundle call(String method, String request, Bundle args) { - if (LOCAL_LOGV) Log.d(TAG, "Call method: " + method); + if (LOCAL_LOGV) Log.d(TAG, "Call method: " + method + " " + request); int callingUserId = UserHandle.getCallingUserId(); if (args != null) { @@ -262,6 +263,19 @@ public class CMSettingsProvider extends ContentProvider { } } + boolean hasMigratedCMSettings = mSharedPrefs.getBoolean(PREF_HAS_MIGRATED_CM_SETTINGS, + false); + if (!hasMigratedCMSettings) { + if (LOCAL_LOGV) { + Log.d(TAG, "Reenabling component preboot receiver"); + } + getContext().getPackageManager().setComponentEnabledSetting( + new ComponentName("org.cyanogenmod.cmsettings", + "org.cyanogenmod.cmsettings.PreBootReceiver"), + PackageManager.COMPONENT_ENABLED_STATE_ENABLED, + PackageManager.DONT_KILL_APP); + } + // Migrate methods if (CMSettings.CALL_METHOD_MIGRATE_SETTINGS.equals(method)) { migrateCMSettingsForExistingUsersIfNeeded();