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

Commit 0f8186a6 authored by Vadivel Thekkamalai's avatar Vadivel Thekkamalai Committed by Linux Build Service Account
Browse files

Bluetooth: Add support to Receive/Send OPP file with size greater than an int can hold

Change-Id: I5d70718be14c3bbbdccaf52971ce03c0879a6a71
CRs-fixed: 366818, 468659

Conflicts:
	src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
	src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java
	src/com/android/bluetooth/opp/BluetoothOppReceiveFileInfo.java
	src/com/android/bluetooth/opp/BluetoothOppShareInfo.java
parent 86bb6c3c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -125,16 +125,16 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
        private static final int sSleepTime = 500;
        private Uri contentUri;
        private Context mContext1;
        private int position;
        private long position;

        public ContentResolverUpdateThread(Context context, Uri cntUri, int pos) {
        public ContentResolverUpdateThread(Context context, Uri cntUri, long pos) {
            super("BtOpp ContentResolverUpdateThread");
            mContext1 = context;
            contentUri = cntUri;
            position = pos;
        }

        public void updateProgress (int pos) {
        public void updateProgress (long pos) {
            position = pos;
        }

@@ -434,7 +434,7 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                }

                if (!error) {
                    int position = 0;
                    long position = 0;
                    int readLength = 0;
                    boolean okToProceed = false;
                    long timestamp = 0;
+5 −5
Original line number Diff line number Diff line
@@ -173,16 +173,16 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen
        private static final int sSleepTime = 500;
        private Uri contentUri;
        private Context mContext1;
        private int position;
        private long position;

        public ContentResolverUpdateThread(Context context, Uri cntUri, int pos) {
        public ContentResolverUpdateThread(Context context, Uri cntUri, long pos) {
            super("BtOpp Server ContentResolverUpdateThread");
            mContext1 = context;
            contentUri = cntUri;
            position = pos;
        }

        public void updateProgress (int pos) {
        public void updateProgress (long pos) {
            position = pos;
        }

@@ -317,7 +317,7 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen
        ContentValues values = new ContentValues();

        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.DESTINATION, destination);
@@ -502,7 +502,7 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen
            mContext.getContentResolver().update(contentUri, updateValues, null, null);
        }

        int position = 0;
        long position = 0;
        if (!error) {
            bos = new BufferedOutputStream(fileInfo.mOutputStream, 0x10000);
        }
+9 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2008-2009, Motorola, Inc.
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 *
 * All rights reserved.
 *
@@ -228,6 +229,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
    public Uri insert(Uri uri, ContentValues values) {
        SQLiteDatabase db = mOpenHelper.getWritableDatabase();
@@ -245,7 +253,7 @@ public final class BluetoothOppProvider extends ContentProvider {
        copyString(BluetoothShare.DESTINATION, 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) {
            filteredValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_VISIBLE);
+2 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
@@ -100,7 +99,7 @@ public class BluetoothOppReceiveFileInfo {
            try {
                if (metadataCursor.moveToFirst()) {
                    hint = metadataCursor.getString(0);
                    length = metadataCursor.getInt(1);
                    length = metadataCursor.getLong(1);
                    mimeType = metadataCursor.getString(2);
                }
            } finally {
+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2008-2009, Motorola, Inc.
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 *
 * All rights reserved.
 *
@@ -122,7 +123,7 @@ public class BluetoothOppSendFileInfo {
                try {
                    if (metadataCursor.moveToFirst()) {
                        fileName = metadataCursor.getString(0);
                        length = metadataCursor.getInt(1);
                        length = metadataCursor.getLong(1);
                        if (D) Log.d(TAG, "fileName = " + fileName + " length = " + length);
                    }
                } finally {
Loading