From 089262dc022d87e31eefc536025be6c015c7ebde Mon Sep 17 00:00:00 2001 From: Suchi Amalapurapu Date: Wed, 10 Mar 2010 14:19:21 -0800 Subject: Dont include code size for apps on sdcard. Use constants defined in PackageHelper for user preferences to install auto, internal, external. Set default install location to external. Update settings db version number Change-Id: Ib5110c9377990e20a48cee923e55898dfddfd1e6 --- .../defcontainer/DefaultContainerService.java | 6 ++--- packages/SettingsProvider/res/values/defaults.xml | 4 +++- .../android/providers/settings/DatabaseHelper.java | 28 ++++++++++++++++++---- 3 files changed, 30 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java index 4635f48..7714911 100644 --- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java +++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java @@ -349,11 +349,11 @@ public class DefaultContainerService extends IntentService { int installPreference = Settings.System.getInt(getApplicationContext() .getContentResolver(), Settings.System.DEFAULT_INSTALL_LOCATION, - PackageInfo.INSTALL_LOCATION_AUTO); - if (installPreference == 1) { + PackageHelper.APP_INSTALL_AUTO); + if (installPreference == PackageHelper.APP_INSTALL_INTERNAL) { installOnlyInternal = true; auto = false; - } else if (installPreference == 2) { + } else if (installPreference == PackageHelper.APP_INSTALL_EXTERNAL) { installOnlyOnSd = true; auto = false; } diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 64bb0ef..34302c4 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -56,7 +56,10 @@ false true true + true + + 2 1 @@ -72,5 +75,4 @@ true - diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index edf3923..ba66dc5 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -61,7 +61,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion' // is properly propagated through your change. Not doing so will result in a loss of user // settings. - private static final int DATABASE_VERSION = 53; + private static final int DATABASE_VERSION = 54; private Context mContext; @@ -650,6 +650,25 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 53; } + + if (upgradeVersion == 53) { + /* + * New settings for set install location UI. + */ + db.beginTransaction(); + try { + SQLiteStatement stmt = db.compileStatement("INSERT INTO system(name,value)" + + " VALUES(?,?);"); + loadIntegerSetting(stmt, Settings.System.DEFAULT_INSTALL_LOCATION, + R.integer.def_install_location); + stmt.close(); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + + upgradeVersion = 54; + } // *** Remember to update DATABASE_VERSION above! @@ -943,9 +962,10 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.System.NOTIFICATION_LIGHT_PULSE, R.bool.def_notification_pulse); - loadBooleanSetting(stmt, Settings.System.SET_INSTALL_LOCATION, R.bool.set_install_location); - loadSetting(stmt, Settings.System.DEFAULT_INSTALL_LOCATION, - PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY); + loadBooleanSetting(stmt, Settings.System.SET_INSTALL_LOCATION, + R.bool.set_install_location); + loadIntegerSetting(stmt, Settings.System.DEFAULT_INSTALL_LOCATION, + R.integer.def_install_location); loadUISoundEffectsSettings(stmt); -- cgit v1.1