Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 089262dc authored by Suchi Amalapurapu's avatar Suchi Amalapurapu
Browse files

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
parent e182a92a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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)) {
+4 −0
Original line number Diff line number Diff line
@@ -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");
+3 −3
Original line number Diff line number Diff line
@@ -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;
                }
+3 −1
Original line number Diff line number Diff line
@@ -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>
+24 −4
Original line number Diff line number Diff line
@@ -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;

@@ -651,6 +651,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!

        if (upgradeVersion != currentVersion) {
@@ -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);

Loading