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
This commit is contained in:
@@ -404,6 +404,15 @@ int get_size(const char *pkgname, const char *apkpath,
|
||||
}
|
||||
}
|
||||
|
||||
/* count the source apk as code -- but only if it's not
|
||||
* installed on the sdcard
|
||||
*/
|
||||
if (strncmp(apkpath, SDCARD_DIR_PREFIX, 7) != 0) {
|
||||
if (stat(apkpath, &s) == 0) {
|
||||
codesize += stat_size(&s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* count the cached dexfile as code */
|
||||
if (!create_cache_path(path, apkpath)) {
|
||||
|
||||
@@ -40,6 +40,10 @@ public class PackageHelper {
|
||||
public static final int RECOMMEND_FAILED_ALREADY_EXISTS = -4;
|
||||
private static final boolean localLOGV = true;
|
||||
private static final String TAG = "PackageHelper";
|
||||
// App installation location settings values
|
||||
public static final int APP_INSTALL_AUTO = 0;
|
||||
public static final int APP_INSTALL_INTERNAL = 1;
|
||||
public static final int APP_INSTALL_EXTERNAL = 2;
|
||||
|
||||
public static IMountService getMountService() {
|
||||
IBinder service = ServiceManager.getService("mount");
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,10 @@
|
||||
<bool name="def_mount_ums_autostart">false</bool>
|
||||
<bool name="def_mount_ums_prompt">true</bool>
|
||||
<bool name="def_mount_ums_notify_enabled">true</bool>
|
||||
<!-- Enable User preference for setting install location -->
|
||||
<bool name="set_install_location">true</bool>
|
||||
<!-- Default install location if user preference for setting install location is turned on. -->
|
||||
<integer name="def_install_location">2</integer>
|
||||
|
||||
<!-- user interface sound effects -->
|
||||
<integer name="def_power_sounds_enabled">1</integer>
|
||||
@@ -72,5 +75,4 @@
|
||||
|
||||
<!-- Default for Settings.System.VIBRATE_IN_SILENT -->
|
||||
<bool name="def_vibrate_in_silent">true</bool>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.unit_tests;
|
||||
|
||||
import com.android.internal.content.PackageHelper;
|
||||
|
||||
import android.os.storage.IMountService.Stub;
|
||||
|
||||
import android.net.Uri;
|
||||
@@ -73,9 +75,9 @@ public class PackageManagerTests extends AndroidTestCase {
|
||||
public final long MAX_WAIT_TIME=120*1000;
|
||||
public final long WAIT_TIME_INCR=20*1000;
|
||||
private static final String SECURE_CONTAINERS_PREFIX = "/mnt/asec";
|
||||
private static final int APP_INSTALL_AUTO = 0;
|
||||
private static final int APP_INSTALL_DEVICE = 1;
|
||||
private static final int APP_INSTALL_SDCARD = 2;
|
||||
private static final int APP_INSTALL_AUTO = PackageHelper.APP_INSTALL_AUTO;
|
||||
private static final int APP_INSTALL_DEVICE = PackageHelper.APP_INSTALL_INTERNAL;
|
||||
private static final int APP_INSTALL_SDCARD = PackageHelper.APP_INSTALL_EXTERNAL;
|
||||
|
||||
void failStr(String errMsg) {
|
||||
Log.w(TAG, "errMsg="+errMsg);
|
||||
|
||||
Reference in New Issue
Block a user