Loading core/java/android/content/Intent.java +10 −5 Original line number Original line Diff line number Diff line Loading @@ -3464,10 +3464,12 @@ public class Intent implements Parcelable, Cloneable { /** /** * Broadcast action: report that a settings element is being restored from backup. The intent * Broadcast action: report that a settings element is being restored from backup. The intent * contains three extras: EXTRA_SETTING_NAME is a string naming the restored setting, * contains four extras: EXTRA_SETTING_NAME is a string naming the restored setting, * EXTRA_SETTING_NEW_VALUE is the value being restored, and EXTRA_SETTING_PREVIOUS_VALUE * EXTRA_SETTING_NEW_VALUE is the value being restored, EXTRA_SETTING_PREVIOUS_VALUE * is the value of that settings entry prior to the restore operation. All of these values are * is the value of that settings entry prior to the restore operation, and * represented as strings. * EXTRA_SETTING_RESTORED_FROM_SDK_INT is the version of the SDK that the setting has been * restored from (corresponds to {@link android.os.Build.VERSION#SDK_INT}). The first three * values are represented as strings, the fourth one as int. * * * <p>This broadcast is sent only for settings provider entries known to require special handling * <p>This broadcast is sent only for settings provider entries known to require special handling * around restore time. These entries are found in the BROADCAST_ON_RESTORE table within * around restore time. These entries are found in the BROADCAST_ON_RESTORE table within Loading @@ -3476,6 +3478,7 @@ public class Intent implements Parcelable, Cloneable { * @see #EXTRA_SETTING_NAME * @see #EXTRA_SETTING_NAME * @see #EXTRA_SETTING_PREVIOUS_VALUE * @see #EXTRA_SETTING_PREVIOUS_VALUE * @see #EXTRA_SETTING_NEW_VALUE * @see #EXTRA_SETTING_NEW_VALUE * @see #EXTRA_SETTING_RESTORED_FROM_SDK_INT * {@hide} * {@hide} */ */ public static final String ACTION_SETTING_RESTORED = "android.os.action.SETTING_RESTORED"; public static final String ACTION_SETTING_RESTORED = "android.os.action.SETTING_RESTORED"; Loading @@ -3486,6 +3489,8 @@ public class Intent implements Parcelable, Cloneable { public static final String EXTRA_SETTING_PREVIOUS_VALUE = "previous_value"; public static final String EXTRA_SETTING_PREVIOUS_VALUE = "previous_value"; /** {@hide} */ /** {@hide} */ public static final String EXTRA_SETTING_NEW_VALUE = "new_value"; public static final String EXTRA_SETTING_NEW_VALUE = "new_value"; /** {@hide} */ public static final String EXTRA_SETTING_RESTORED_FROM_SDK_INT = "restored_from_sdk_int"; /** /** * Activity Action: Process a piece of text. * Activity Action: Process a piece of text. Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -151,6 +151,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { private WifiManager mWifiManager; private WifiManager mWifiManager; // Version of the SDK that com.android.providers.settings package has been restored from. // Populated in onRestore(). private int mRestoredFromSdkInt; @Override @Override public void onCreate() { public void onCreate() { if (DEBUG_BACKUP) Log.d(TAG, "onCreate() invoked"); if (DEBUG_BACKUP) Log.d(TAG, "onCreate() invoked"); Loading Loading @@ -205,6 +209,9 @@ public class SettingsBackupAgent extends BackupAgentHelper { public void onRestore(BackupDataInput data, int appVersionCode, public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException { ParcelFileDescriptor newState) throws IOException { // versionCode of com.android.providers.settings corresponds to SDK_INT mRestoredFromSdkInt = appVersionCode; HashSet<String> movedToGlobal = new HashSet<String>(); HashSet<String> movedToGlobal = new HashSet<String>(); Settings.System.getMovedToGlobalSettings(movedToGlobal); Settings.System.getMovedToGlobalSettings(movedToGlobal); Settings.Secure.getMovedToGlobalSettings(movedToGlobal); Settings.Secure.getMovedToGlobalSettings(movedToGlobal); Loading Loading @@ -656,7 +663,8 @@ public class SettingsBackupAgent extends BackupAgentHelper { final Uri destination = (movedToGlobal != null && movedToGlobal.contains(key)) final Uri destination = (movedToGlobal != null && movedToGlobal.contains(key)) ? Settings.Global.CONTENT_URI ? Settings.Global.CONTENT_URI : contentUri; : contentUri; settingsHelper.restoreValue(this, cr, contentValues, destination, key, value); settingsHelper.restoreValue(this, cr, contentValues, destination, key, value, mRestoredFromSdkInt); if (DEBUG) { if (DEBUG) { Log.d(TAG, "Restored setting: " + destination + " : " + key + "=" + value); Log.d(TAG, "Restored setting: " + destination + " : " + key + "=" + value); Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -122,7 +122,7 @@ public class SettingsHelper { * and in some cases the property value needs to be modified before setting. * and in some cases the property value needs to be modified before setting. */ */ public void restoreValue(Context context, ContentResolver cr, ContentValues contentValues, public void restoreValue(Context context, ContentResolver cr, ContentValues contentValues, Uri destination, String name, String value) { Uri destination, String name, String value, int restoredFromSdkInt) { // Will we need a post-restore broadcast for this element? // Will we need a post-restore broadcast for this element? String oldValue = null; String oldValue = null; boolean sendBroadcast = false; boolean sendBroadcast = false; Loading Loading @@ -179,7 +179,8 @@ public class SettingsHelper { .setPackage("android").addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY) .setPackage("android").addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY) .putExtra(Intent.EXTRA_SETTING_NAME, name) .putExtra(Intent.EXTRA_SETTING_NAME, name) .putExtra(Intent.EXTRA_SETTING_NEW_VALUE, value) .putExtra(Intent.EXTRA_SETTING_NEW_VALUE, value) .putExtra(Intent.EXTRA_SETTING_PREVIOUS_VALUE, oldValue); .putExtra(Intent.EXTRA_SETTING_PREVIOUS_VALUE, oldValue) .putExtra(Intent.EXTRA_SETTING_RESTORED_FROM_SDK_INT, restoredFromSdkInt); context.sendBroadcastAsUser(intent, UserHandle.SYSTEM, null); context.sendBroadcastAsUser(intent, UserHandle.SYSTEM, null); } } } } Loading services/core/java/com/android/server/notification/NotificationManagerService.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -814,6 +814,8 @@ public class NotificationManagerService extends SystemService { try { try { String element = intent.getStringExtra(Intent.EXTRA_SETTING_NAME); String element = intent.getStringExtra(Intent.EXTRA_SETTING_NAME); String newValue = intent.getStringExtra(Intent.EXTRA_SETTING_NEW_VALUE); String newValue = intent.getStringExtra(Intent.EXTRA_SETTING_NEW_VALUE); int restoredFromSdkInt = intent.getIntExtra( Intent.EXTRA_SETTING_RESTORED_FROM_SDK_INT, 0); mListeners.onSettingRestored(element, newValue, getSendingUserId()); mListeners.onSettingRestored(element, newValue, getSendingUserId()); mConditionProviders.onSettingRestored(element, newValue, getSendingUserId()); mConditionProviders.onSettingRestored(element, newValue, getSendingUserId()); } catch (Exception e) { } catch (Exception e) { Loading Loading
core/java/android/content/Intent.java +10 −5 Original line number Original line Diff line number Diff line Loading @@ -3464,10 +3464,12 @@ public class Intent implements Parcelable, Cloneable { /** /** * Broadcast action: report that a settings element is being restored from backup. The intent * Broadcast action: report that a settings element is being restored from backup. The intent * contains three extras: EXTRA_SETTING_NAME is a string naming the restored setting, * contains four extras: EXTRA_SETTING_NAME is a string naming the restored setting, * EXTRA_SETTING_NEW_VALUE is the value being restored, and EXTRA_SETTING_PREVIOUS_VALUE * EXTRA_SETTING_NEW_VALUE is the value being restored, EXTRA_SETTING_PREVIOUS_VALUE * is the value of that settings entry prior to the restore operation. All of these values are * is the value of that settings entry prior to the restore operation, and * represented as strings. * EXTRA_SETTING_RESTORED_FROM_SDK_INT is the version of the SDK that the setting has been * restored from (corresponds to {@link android.os.Build.VERSION#SDK_INT}). The first three * values are represented as strings, the fourth one as int. * * * <p>This broadcast is sent only for settings provider entries known to require special handling * <p>This broadcast is sent only for settings provider entries known to require special handling * around restore time. These entries are found in the BROADCAST_ON_RESTORE table within * around restore time. These entries are found in the BROADCAST_ON_RESTORE table within Loading @@ -3476,6 +3478,7 @@ public class Intent implements Parcelable, Cloneable { * @see #EXTRA_SETTING_NAME * @see #EXTRA_SETTING_NAME * @see #EXTRA_SETTING_PREVIOUS_VALUE * @see #EXTRA_SETTING_PREVIOUS_VALUE * @see #EXTRA_SETTING_NEW_VALUE * @see #EXTRA_SETTING_NEW_VALUE * @see #EXTRA_SETTING_RESTORED_FROM_SDK_INT * {@hide} * {@hide} */ */ public static final String ACTION_SETTING_RESTORED = "android.os.action.SETTING_RESTORED"; public static final String ACTION_SETTING_RESTORED = "android.os.action.SETTING_RESTORED"; Loading @@ -3486,6 +3489,8 @@ public class Intent implements Parcelable, Cloneable { public static final String EXTRA_SETTING_PREVIOUS_VALUE = "previous_value"; public static final String EXTRA_SETTING_PREVIOUS_VALUE = "previous_value"; /** {@hide} */ /** {@hide} */ public static final String EXTRA_SETTING_NEW_VALUE = "new_value"; public static final String EXTRA_SETTING_NEW_VALUE = "new_value"; /** {@hide} */ public static final String EXTRA_SETTING_RESTORED_FROM_SDK_INT = "restored_from_sdk_int"; /** /** * Activity Action: Process a piece of text. * Activity Action: Process a piece of text. Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -151,6 +151,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { private WifiManager mWifiManager; private WifiManager mWifiManager; // Version of the SDK that com.android.providers.settings package has been restored from. // Populated in onRestore(). private int mRestoredFromSdkInt; @Override @Override public void onCreate() { public void onCreate() { if (DEBUG_BACKUP) Log.d(TAG, "onCreate() invoked"); if (DEBUG_BACKUP) Log.d(TAG, "onCreate() invoked"); Loading Loading @@ -205,6 +209,9 @@ public class SettingsBackupAgent extends BackupAgentHelper { public void onRestore(BackupDataInput data, int appVersionCode, public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException { ParcelFileDescriptor newState) throws IOException { // versionCode of com.android.providers.settings corresponds to SDK_INT mRestoredFromSdkInt = appVersionCode; HashSet<String> movedToGlobal = new HashSet<String>(); HashSet<String> movedToGlobal = new HashSet<String>(); Settings.System.getMovedToGlobalSettings(movedToGlobal); Settings.System.getMovedToGlobalSettings(movedToGlobal); Settings.Secure.getMovedToGlobalSettings(movedToGlobal); Settings.Secure.getMovedToGlobalSettings(movedToGlobal); Loading Loading @@ -656,7 +663,8 @@ public class SettingsBackupAgent extends BackupAgentHelper { final Uri destination = (movedToGlobal != null && movedToGlobal.contains(key)) final Uri destination = (movedToGlobal != null && movedToGlobal.contains(key)) ? Settings.Global.CONTENT_URI ? Settings.Global.CONTENT_URI : contentUri; : contentUri; settingsHelper.restoreValue(this, cr, contentValues, destination, key, value); settingsHelper.restoreValue(this, cr, contentValues, destination, key, value, mRestoredFromSdkInt); if (DEBUG) { if (DEBUG) { Log.d(TAG, "Restored setting: " + destination + " : " + key + "=" + value); Log.d(TAG, "Restored setting: " + destination + " : " + key + "=" + value); Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -122,7 +122,7 @@ public class SettingsHelper { * and in some cases the property value needs to be modified before setting. * and in some cases the property value needs to be modified before setting. */ */ public void restoreValue(Context context, ContentResolver cr, ContentValues contentValues, public void restoreValue(Context context, ContentResolver cr, ContentValues contentValues, Uri destination, String name, String value) { Uri destination, String name, String value, int restoredFromSdkInt) { // Will we need a post-restore broadcast for this element? // Will we need a post-restore broadcast for this element? String oldValue = null; String oldValue = null; boolean sendBroadcast = false; boolean sendBroadcast = false; Loading Loading @@ -179,7 +179,8 @@ public class SettingsHelper { .setPackage("android").addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY) .setPackage("android").addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY) .putExtra(Intent.EXTRA_SETTING_NAME, name) .putExtra(Intent.EXTRA_SETTING_NAME, name) .putExtra(Intent.EXTRA_SETTING_NEW_VALUE, value) .putExtra(Intent.EXTRA_SETTING_NEW_VALUE, value) .putExtra(Intent.EXTRA_SETTING_PREVIOUS_VALUE, oldValue); .putExtra(Intent.EXTRA_SETTING_PREVIOUS_VALUE, oldValue) .putExtra(Intent.EXTRA_SETTING_RESTORED_FROM_SDK_INT, restoredFromSdkInt); context.sendBroadcastAsUser(intent, UserHandle.SYSTEM, null); context.sendBroadcastAsUser(intent, UserHandle.SYSTEM, null); } } } } Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -814,6 +814,8 @@ public class NotificationManagerService extends SystemService { try { try { String element = intent.getStringExtra(Intent.EXTRA_SETTING_NAME); String element = intent.getStringExtra(Intent.EXTRA_SETTING_NAME); String newValue = intent.getStringExtra(Intent.EXTRA_SETTING_NEW_VALUE); String newValue = intent.getStringExtra(Intent.EXTRA_SETTING_NEW_VALUE); int restoredFromSdkInt = intent.getIntExtra( Intent.EXTRA_SETTING_RESTORED_FROM_SDK_INT, 0); mListeners.onSettingRestored(element, newValue, getSendingUserId()); mListeners.onSettingRestored(element, newValue, getSendingUserId()); mConditionProviders.onSettingRestored(element, newValue, getSendingUserId()); mConditionProviders.onSettingRestored(element, newValue, getSendingUserId()); } catch (Exception e) { } catch (Exception e) { Loading