cmsdk: insert dnd & edit tiles for 12.1 -> 13.0 upgrade
Ref: CYNGNOS-1924 Change-Id: I6d221e143dc91ec3dbc1c9a1877754f2b98b732e Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
parent
ccce292498
commit
60a4ebcb43
@ -45,9 +45,13 @@ import android.text.TextUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
|
||||||
|
import org.cyanogenmod.internal.util.QSConstants;
|
||||||
|
import org.cyanogenmod.internal.util.QSUtils;
|
||||||
|
|
||||||
import cyanogenmod.providers.CMSettings;
|
import cyanogenmod.providers.CMSettings;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -204,6 +208,41 @@ public class CMSettingsProvider extends ContentProvider {
|
|||||||
else if (tableName.equals(CMDatabaseHelper.CMTableNames.TABLE_SECURE)) {
|
else if (tableName.equals(CMDatabaseHelper.CMTableNames.TABLE_SECURE)) {
|
||||||
settingsValue = Settings.Secure.getStringForUser(contentResolver, settingsKey,
|
settingsValue = Settings.Secure.getStringForUser(contentResolver, settingsKey,
|
||||||
userId);
|
userId);
|
||||||
|
|
||||||
|
// insert dnd, edit tiles for upgrade from 12.1 -> 13.0
|
||||||
|
if (CMSettings.Secure.QS_TILES.equals(settingsKey) && (settingsValue != null
|
||||||
|
&& (!settingsValue.contains(QSConstants.TILE_DND)
|
||||||
|
|| !settingsValue.contains(QSConstants.TILE_EDIT)))) {
|
||||||
|
if (LOCAL_LOGV) {
|
||||||
|
Log.d(TAG, "Need to insert DND or Edit tile for upgrade, currentValue: "
|
||||||
|
+ settingsValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<String> tiles = Settings.Secure.getDelimitedStringAsList(
|
||||||
|
contentResolver, settingsKey, ",");
|
||||||
|
|
||||||
|
if (!tiles.contains(QSConstants.TILE_DND)) {
|
||||||
|
tiles.add(QSConstants.TILE_DND);
|
||||||
|
}
|
||||||
|
if (!tiles.contains(QSConstants.TILE_EDIT)) {
|
||||||
|
// we need to insert edit tile to the last tile on the first page!
|
||||||
|
// ensure edit tile is present
|
||||||
|
|
||||||
|
// use value in old database
|
||||||
|
boolean nineTilesPerPage = Settings.Secure.getInt(contentResolver,
|
||||||
|
CMSettings.Secure.QS_USE_MAIN_TILES, 0) == 1;
|
||||||
|
|
||||||
|
final int TILES_PER_PAGE = nineTilesPerPage ? 9 : 8;
|
||||||
|
|
||||||
|
if (tiles.size() > TILES_PER_PAGE) {
|
||||||
|
tiles.add((TILES_PER_PAGE - 1), QSConstants.TILE_EDIT);
|
||||||
|
} else {
|
||||||
|
tiles.add(QSConstants.TILE_EDIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsValue = TextUtils.join(",", tiles);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (tableName.equals(CMDatabaseHelper.CMTableNames.TABLE_GLOBAL)) {
|
else if (tableName.equals(CMDatabaseHelper.CMTableNames.TABLE_GLOBAL)) {
|
||||||
settingsValue = Settings.Global.getStringForUser(contentResolver, settingsKey,
|
settingsValue = Settings.Global.getStringForUser(contentResolver, settingsKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user