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

Commit aba39f23 authored by Pradeep Panigrahi's avatar Pradeep Panigrahi Committed by Android Git Automerger
Browse files

am 1de18457: am a4f678e5: Use long as file size instead of int while using OPP.

* commit '1de18457':
  Use long as file size instead of int while using OPP.
parents 5b2ea364 1de18457
Loading
Loading
Loading
Loading
+14 −6
Original line number Original line Diff line number Diff line
@@ -111,9 +111,9 @@ class BluetoothOppNotification {


        int direction; // to indicate sending or receiving
        int direction; // to indicate sending or receiving


        int totalCurrent = 0; // current transfer bytes
        long totalCurrent = 0; // current transfer bytes


        int totalTotal = 0; // total bytes for current transfer
        long totalTotal = 0; // total bytes for current transfer


        long timeStamp = 0; // Database time stamp. Used for sorting ongoing transfers.
        long timeStamp = 0; // Database time stamp. Used for sorting ongoing transfers.


@@ -241,8 +241,8 @@ class BluetoothOppNotification {
            long timeStamp = cursor.getLong(timestampIndex);
            long timeStamp = cursor.getLong(timestampIndex);
            int dir = cursor.getInt(directionIndex);
            int dir = cursor.getInt(directionIndex);
            int id = cursor.getInt(idIndex);
            int id = cursor.getInt(idIndex);
            int total = cursor.getInt(totalBytesIndex);
            long total = cursor.getLong(totalBytesIndex);
            int current = cursor.getInt(currentBytesIndex);
            long current = cursor.getLong(currentBytesIndex);
            int confirmation = cursor.getInt(confirmIndex);
            int confirmation = cursor.getInt(confirmIndex);


            String destination = cursor.getString(destinationIndex);
            String destination = cursor.getString(destinationIndex);
@@ -319,7 +319,15 @@ class BluetoothOppNotification {
            b.setContentTitle(item.description);
            b.setContentTitle(item.description);
            b.setContentInfo(
            b.setContentInfo(
                BluetoothOppUtility.formatProgressText(item.totalTotal, item.totalCurrent));
                BluetoothOppUtility.formatProgressText(item.totalTotal, item.totalCurrent));
            b.setProgress(item.totalTotal, item.totalCurrent, item.totalTotal == -1);
            if (item.totalTotal != 0) {
                if (V) Log.v(TAG, "mCurrentBytes: " + item.totalCurrent +
                    " mTotalBytes: " + item.totalTotal + " (" +
                    (int)((item.totalCurrent * 100) / item.totalTotal) + " %)");
                b.setProgress(100, (int)((item.totalCurrent * 100) / item.totalTotal),
                    item.totalTotal == -1);
            } else {
                b.setProgress(100, 100, item.totalTotal == -1);
            }
            b.setWhen(item.timeStamp);
            b.setWhen(item.timeStamp);
            if (item.direction == BluetoothShare.DIRECTION_OUTBOUND) {
            if (item.direction == BluetoothShare.DIRECTION_OUTBOUND) {
                b.setSmallIcon(android.R.drawable.stat_sys_upload);
                b.setSmallIcon(android.R.drawable.stat_sys_upload);
+3 −1
Original line number Original line Diff line number Diff line
@@ -268,7 +268,9 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen
        ContentValues values = new ContentValues();
        ContentValues values = new ContentValues();


        values.put(BluetoothShare.FILENAME_HINT, name);
        values.put(BluetoothShare.FILENAME_HINT, name);
        values.put(BluetoothShare.TOTAL_BYTES, length.intValue());

        values.put(BluetoothShare.TOTAL_BYTES, length);

        values.put(BluetoothShare.MIMETYPE, mimeType);
        values.put(BluetoothShare.MIMETYPE, mimeType);


        values.put(BluetoothShare.DESTINATION, destination);
        values.put(BluetoothShare.DESTINATION, destination);
+8 −2
Original line number Original line Diff line number Diff line
@@ -215,6 +215,13 @@ public final class BluetoothOppProvider extends ContentProvider {
        }
        }
    }
    }


    private static final void copyLong(String key, ContentValues from, ContentValues to) {
        Long i = from.getAsLong(key);
        if (i != null) {
            to.put(key, i);
        }
    }

    @Override
    @Override
    public Uri insert(Uri uri, ContentValues values) {
    public Uri insert(Uri uri, ContentValues values) {
        SQLiteDatabase db = mOpenHelper.getWritableDatabase();
        SQLiteDatabase db = mOpenHelper.getWritableDatabase();
@@ -232,8 +239,7 @@ public final class BluetoothOppProvider extends ContentProvider {
        copyString(BluetoothShare.DESTINATION, values, filteredValues);
        copyString(BluetoothShare.DESTINATION, values, filteredValues);


        copyInteger(BluetoothShare.VISIBILITY, values, filteredValues);
        copyInteger(BluetoothShare.VISIBILITY, values, filteredValues);
        copyInteger(BluetoothShare.TOTAL_BYTES, values, filteredValues);
        copyLong(BluetoothShare.TOTAL_BYTES, values, filteredValues);

        if (values.getAsInteger(BluetoothShare.VISIBILITY) == null) {
        if (values.getAsInteger(BluetoothShare.VISIBILITY) == null) {
            filteredValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_VISIBLE);
            filteredValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_VISIBLE);
        }
        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -100,7 +100,7 @@ public class BluetoothOppReceiveFileInfo {
            try {
            try {
                if (metadataCursor.moveToFirst()) {
                if (metadataCursor.moveToFirst()) {
                    hint = metadataCursor.getString(0);
                    hint = metadataCursor.getString(0);
                    length = metadataCursor.getInt(1);
                    length = metadataCursor.getLong(1);
                    mimeType = metadataCursor.getString(2);
                    mimeType = metadataCursor.getString(2);
                }
                }
            } finally {
            } finally {
+1 −1
Original line number Original line Diff line number Diff line
@@ -122,7 +122,7 @@ public class BluetoothOppSendFileInfo {
                try {
                try {
                    if (metadataCursor.moveToFirst()) {
                    if (metadataCursor.moveToFirst()) {
                        fileName = metadataCursor.getString(0);
                        fileName = metadataCursor.getString(0);
                        length = metadataCursor.getInt(1);
                        length = metadataCursor.getLong(1);
                        if (D) Log.d(TAG, "fileName = " + fileName + " length = " + length);
                        if (D) Log.d(TAG, "fileName = " + fileName + " length = " + length);
                    }
                    }
                } finally {
                } finally {
Loading