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

Commit e8fcbe03 authored by Hemant Gupta's avatar Hemant Gupta
Browse files

OPP: Add local support for file transfer error text.

Usecase:
1) Set Language on DUT to Turkish.
2) Transfer a file > 4GB and observe

Expectation:
Error message if any should be shown in system laguage set on DUT.

Observation:
Error message is displayed in English instead of Turkish

Fix:
Show file limit message through localized version of getString()
instead of as hardcoded item from code.

Test: Checked that error mesage is not displayed in english if DUT
system language is different from english.

Bug: 38186567
Change-Id: I62c1f24696389fe844623573b877b1fd78210f8b
parent 38df49c7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -247,4 +247,5 @@
    <string name="bluetooth_connected">Bluetooth audio connected</string>
    <string name="bluetooth_disconnected">Bluetooth audio disconnected"</string>
    <string name="a2dp_sink_mbs_label">Bluetooth Audio</string>
    <string name="bluetooth_opp_file_limit_exceeded">Files bigger than 4GB cannot be transferred</string>
</resources>
+5 −3
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ import android.provider.OpenableColumns;
import android.util.EventLog;
import android.util.Log;

import com.android.bluetooth.R;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -224,9 +226,9 @@ public class BluetoothOppSendFileInfo {
            Log.e(TAG, "Could not determine size of file");
            return SEND_FILE_INFO_ERROR;
        } else if (length > 0xffffffffL) {
            String msg = "Files bigger than 4GB can't be transferred";
            Log.e(TAG, msg);
            throw new IllegalArgumentException(msg);
            Log.e(TAG, "File of size: " + length + " bytes can't be transferred");
            throw new IllegalArgumentException(context
                .getString(R.string.bluetooth_opp_file_limit_exceeded));
        }

        return new BluetoothOppSendFileInfo(fileName, contentType, length, is, 0);