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

Commit 6c574452 authored by Hyundo Moon's avatar Hyundo Moon Committed by Gerrit Code Review
Browse files

Merge "Metrics: Log error metrics for OPP" into main

parents 8eb7d6b9 14291e82
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -35,6 +35,8 @@ package com.android.bluetooth.opp;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;


import android.bluetooth.AlertActivity;
import android.bluetooth.AlertActivity;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothProtoEnums;
import android.content.BroadcastReceiver;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.ContentValues;
import android.content.Context;
import android.content.Context;
@@ -53,12 +55,13 @@ import android.widget.TextView;
import android.widget.Toast;
import android.widget.Toast;


import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.R;
import com.android.bluetooth.R;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;


/**
/** This class is designed to ask user to confirm if accept incoming file; */
 * This class is designed to ask user to confirm if accept incoming file;
// Next tag value for ContentProfileErrorReportUtils.report(): 1
 */
public class BluetoothOppIncomingFileConfirmActivity extends AlertActivity {
public class BluetoothOppIncomingFileConfirmActivity extends AlertActivity {
    private static final String TAG = "BluetoothIncomingFileConfirmActivity";
    private static final String TAG = "BluetoothIncomingFileConfirmActivity";
    private static final boolean D = Constants.DEBUG;
    private static final boolean D = Constants.DEBUG;
@@ -99,6 +102,11 @@ public class BluetoothOppIncomingFileConfirmActivity extends AlertActivity {
            if (V) {
            if (V) {
                Log.e(TAG, "Error: Can not get data from db");
                Log.e(TAG, "Error: Can not get data from db");
            }
            }
            ContentProfileErrorReportUtils.report(
                    BluetoothProfile.OPP,
                    BluetoothProtoEnums.BLUETOOTH_OPP_INCOMING_FILE_CONFIRM_ACTIVITY,
                    BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__LOG_ERROR,
                    0);
            finish();
            finish();
            return;
            return;
        }
        }
+90 −20
Original line number Original line Diff line number Diff line
@@ -36,6 +36,8 @@ import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTE


import android.app.Activity;
import android.app.Activity;
import android.bluetooth.BluetoothDevicePicker;
import android.bluetooth.BluetoothDevicePicker;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothProtoEnums;
import android.content.ContentResolver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
@@ -47,8 +49,10 @@ import android.util.Patterns;
import android.widget.Toast;
import android.widget.Toast;


import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.R;
import com.android.bluetooth.R;
import com.android.bluetooth.Utils;
import com.android.bluetooth.Utils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;


import java.io.File;
import java.io.File;
@@ -61,10 +65,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.Pattern;


/**
/**
 * This class is designed to act as the entry point of handling the share intent
 * This class is designed to act as the entry point of handling the share intent via BT from other
 * via BT from other APPs. and also make "Bluetooth" available in sharing method
 * APPs. and also make "Bluetooth" available in sharing method selection dialog.
 * selection dialog.
 */
 */
// Next tag value for ContentProfileErrorReportUtils.report(): 11
public class BluetoothOppLauncherActivity extends Activity {
public class BluetoothOppLauncherActivity extends Activity {
    private static final String TAG = "BluetoothOppLauncherActivity";
    private static final String TAG = "BluetoothOppLauncherActivity";
    private static final boolean D = Constants.DEBUG;
    private static final boolean D = Constants.DEBUG;
@@ -83,6 +87,11 @@ public class BluetoothOppLauncherActivity extends Activity {
        String action = intent.getAction();
        String action = intent.getAction();
        if (action == null) {
        if (action == null) {
            Log.w(TAG, " Received " + intent + " with null action");
            Log.w(TAG, " Received " + intent + " with null action");
            ContentProfileErrorReportUtils.report(
                    BluetoothProfile.OPP,
                    BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                    BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__LOG_WARN,
                    0);
            finish();
            finish();
            return;
            return;
        }
        }
@@ -150,11 +159,23 @@ public class BluetoothOppLauncherActivity extends Activity {
                        return;
                        return;
                    } else {
                    } else {
                        Log.w(TAG, "Error trying to do set text...File not created!");
                        Log.w(TAG, "Error trying to do set text...File not created!");
                        ContentProfileErrorReportUtils.report(
                                BluetoothProfile.OPP,
                                BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                                BluetoothStatsLog
                                        .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__LOG_WARN,
                                1);
                        finish();
                        finish();
                        return;
                        return;
                    }
                    }
                } else {
                } else {
                    Log.e(TAG, "type is null; or sending file URI is null");
                    Log.e(TAG, "type is null; or sending file URI is null");
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__LOG_ERROR,
                            2);
                    finish();
                    finish();
                    return;
                    return;
                }
                }
@@ -166,18 +187,31 @@ public class BluetoothOppLauncherActivity extends Activity {
                        Log.v(TAG, "Get ACTION_SHARE_MULTIPLE intent: uris " + uris + "\n Type= "
                        Log.v(TAG, "Get ACTION_SHARE_MULTIPLE intent: uris " + uris + "\n Type= "
                                + mimeType);
                                + mimeType);
                    }
                    }
                    Thread t = new Thread(new Runnable() {
                    Thread t =
                            new Thread(
                                    new Runnable() {
                                        @Override
                                        @Override
                                        public void run() {
                                        public void run() {
                                            try {
                                            try {
                                BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this)
                                                BluetoothOppManager.getInstance(
                                        .saveSendingFileInfo(mimeType, uris, false /* isHandover */,
                                                                BluetoothOppLauncherActivity.this)
                                                        .saveSendingFileInfo(
                                                                mimeType,
                                                                uris,
                                                                false /* isHandover */,
                                                                true /* fromExternal */);
                                                                true /* fromExternal */);
                                                // Done getting file info..Launch device picker
                                                // Done getting file info..Launch device picker
                                                // and finish this activity
                                                // and finish this activity
                                                launchDevicePicker();
                                                launchDevicePicker();
                                                finish();
                                                finish();
                                            } catch (IllegalArgumentException exception) {
                                            } catch (IllegalArgumentException exception) {
                                                ContentProfileErrorReportUtils.report(
                                                        BluetoothProfile.OPP,
                                                        BluetoothProtoEnums
                                                                .BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                                                        BluetoothStatsLog
                                                                .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                                                        3);
                                                showToast(exception.getMessage());
                                                showToast(exception.getMessage());
                                                finish();
                                                finish();
                                            }
                                            }
@@ -187,6 +221,12 @@ public class BluetoothOppLauncherActivity extends Activity {
                    return;
                    return;
                } else {
                } else {
                    Log.e(TAG, "type is null; or sending files URIs are null");
                    Log.e(TAG, "type is null; or sending files URIs are null");
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__LOG_ERROR,
                            4);
                    finish();
                    finish();
                    return;
                    return;
                }
                }
@@ -203,6 +243,11 @@ public class BluetoothOppLauncherActivity extends Activity {
            finish();
            finish();
        } else {
        } else {
            Log.w(TAG, "Unsupported action: " + action);
            Log.w(TAG, "Unsupported action: " + action);
            ContentProfileErrorReportUtils.report(
                    BluetoothProfile.OPP,
                    BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                    BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__LOG_WARN,
                    5);
            // To prevent activity to finish immediately in testing mode
            // To prevent activity to finish immediately in testing mode
            if (!Utils.isInstrumentationTestMode()) {
            if (!Utils.isInstrumentationTestMode()) {
                finish();
                finish();
@@ -355,11 +400,26 @@ public class BluetoothOppLauncherActivity extends Activity {
                }
                }
            }
            }
        } catch (FileNotFoundException e) {
        } catch (FileNotFoundException e) {
            ContentProfileErrorReportUtils.report(
                    BluetoothProfile.OPP,
                    BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                    BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                    6);
            Log.e(TAG, "FileNotFoundException: " + e.toString());
            Log.e(TAG, "FileNotFoundException: " + e.toString());
            e.printStackTrace();
            e.printStackTrace();
        } catch (IOException e) {
        } catch (IOException e) {
            ContentProfileErrorReportUtils.report(
                    BluetoothProfile.OPP,
                    BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                    BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                    7);
            Log.e(TAG, "IOException: " + e.toString());
            Log.e(TAG, "IOException: " + e.toString());
        } catch (Exception e) {
        } catch (Exception e) {
            ContentProfileErrorReportUtils.report(
                    BluetoothProfile.OPP,
                    BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                    BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                    8);
            Log.e(TAG, "Exception: " + e.toString());
            Log.e(TAG, "Exception: " + e.toString());
        } finally {
        } finally {
            try {
            try {
@@ -367,6 +427,11 @@ public class BluetoothOppLauncherActivity extends Activity {
                    outStream.close();
                    outStream.close();
                }
                }
            } catch (IOException e) {
            } catch (IOException e) {
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        9);
                e.printStackTrace();
                e.printStackTrace();
            }
            }
        }
        }
@@ -422,6 +487,11 @@ public class BluetoothOppLauncherActivity extends Activity {
            launchDevicePicker();
            launchDevicePicker();
            finish();
            finish();
        } catch (IllegalArgumentException exception) {
        } catch (IllegalArgumentException exception) {
            ContentProfileErrorReportUtils.report(
                    BluetoothProfile.OPP,
                    BluetoothProtoEnums.BLUETOOTH_OPP_LAUNCHER_ACTIVITY,
                    BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                    10);
            showToast(exception.getMessage());
            showToast(exception.getMessage());
            finish();
            finish();
        }
        }
+18 −3
Original line number Original line Diff line number Diff line
@@ -34,6 +34,8 @@ package com.android.bluetooth.opp;


import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothProtoEnums;
import android.content.ContentResolver;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.ContentValues;
import android.content.Context;
import android.content.Context;
@@ -47,7 +49,9 @@ import android.util.Log;
import android.util.Pair;
import android.util.Pair;


import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.R;
import com.android.bluetooth.R;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;


import java.util.ArrayList;
import java.util.ArrayList;
@@ -55,10 +59,11 @@ import java.util.Iterator;
import java.util.List;
import java.util.List;


/**
/**
 * This class provides a simplified interface on top of other Bluetooth service
 * This class provides a simplified interface on top of other Bluetooth service layer components;
 * layer components; Also it handles some Opp application level variables. It's
 * Also it handles some Opp application level variables. It's a singleton got from
 * a singleton got from BluetoothOppManager.getInstance(context);
 * BluetoothOppManager.getInstance(context);
 */
 */
// Next tag value for ContentProfileErrorReportUtils.report(): 2
public class BluetoothOppManager {
public class BluetoothOppManager {
    private static final String TAG = "BluetoothOppManager";
    private static final String TAG = "BluetoothOppManager";
    private static final boolean V = Constants.VERBOSE;
    private static final boolean V = Constants.VERBOSE;
@@ -384,6 +389,11 @@ public class BluetoothOppManager {
        synchronized (BluetoothOppManager.this) {
        synchronized (BluetoothOppManager.this) {
            if (mInsertShareThreadNum > ALLOWED_INSERT_SHARE_THREAD_NUMBER) {
            if (mInsertShareThreadNum > ALLOWED_INSERT_SHARE_THREAD_NUMBER) {
                Log.e(TAG, "Too many shares user triggered concurrently!");
                Log.e(TAG, "Too many shares user triggered concurrently!");
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_MANAGER,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__LOG_ERROR,
                        0);


                // Notice user
                // Notice user
                Intent in = new Intent(mContext, BluetoothOppBtErrorActivity.class);
                Intent in = new Intent(mContext, BluetoothOppBtErrorActivity.class);
@@ -454,6 +464,11 @@ public class BluetoothOppManager {
            Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
            Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
            if (mRemoteDevice == null) {
            if (mRemoteDevice == null) {
                Log.e(TAG, "Target bt device is null!");
                Log.e(TAG, "Target bt device is null!");
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_MANAGER,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__LOG_ERROR,
                        1);
                return;
                return;
            }
            }
            if (mIsMultiple) {
            if (mIsMultiple) {
+101 −4
Original line number Original line Diff line number Diff line
@@ -32,6 +32,8 @@


package com.android.bluetooth.opp;
package com.android.bluetooth.opp;


import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothProtoEnums;
import android.content.ContentValues;
import android.content.ContentValues;
import android.content.Context;
import android.content.Context;
import android.net.Uri;
import android.net.Uri;
@@ -45,7 +47,9 @@ import android.util.Log;


import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.btservice.MetricsLogger;
import com.android.bluetooth.btservice.MetricsLogger;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
import com.android.obex.ClientOperation;
import com.android.obex.ClientOperation;
import com.android.obex.ClientSession;
import com.android.obex.ClientSession;
import com.android.obex.HeaderSet;
import com.android.obex.HeaderSet;
@@ -59,9 +63,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStream;


/**
/** This class runs as an OBEX client */
 * This class runs as an OBEX client
// Next tag value for ContentProfileErrorReportUtils.report(): 17
 */
public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
public class BluetoothOppObexClientSession implements BluetoothOppObexSession {


    private static final String TAG = "BtOppObexClient";
    private static final String TAG = "BtOppObexClient";
@@ -188,6 +191,11 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
            try {
            try {
                Thread.sleep(100);
                Thread.sleep(100);
            } catch (InterruptedException e1) {
            } catch (InterruptedException e1) {
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        0);
                if (V) {
                if (V) {
                    Log.v(TAG, "Client thread was interrupted (1), exiting");
                    Log.v(TAG, "Client thread was interrupted (1), exiting");
                }
                }
@@ -209,7 +217,12 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                        }
                        }
                        Thread.sleep(SLEEP_TIME);
                        Thread.sleep(SLEEP_TIME);
                    } catch (InterruptedException e) {
                    } catch (InterruptedException e) {

                        ContentProfileErrorReportUtils.report(
                                BluetoothProfile.OPP,
                                BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                                BluetoothStatsLog
                                        .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                                1);
                    }
                    }
                }
                }
            }
            }
@@ -242,6 +255,11 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                    Log.d(TAG, "OBEX session disconnected");
                    Log.d(TAG, "OBEX session disconnected");
                }
                }
            } catch (IOException e) {
            } catch (IOException e) {
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        2);
                Log.w(TAG, "OBEX session disconnect error" + e);
                Log.w(TAG, "OBEX session disconnect error" + e);
            }
            }
            try {
            try {
@@ -255,12 +273,23 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                    }
                    }
                }
                }
            } catch (IOException e) {
            } catch (IOException e) {
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        3);
                Log.w(TAG, "OBEX session close error" + e);
                Log.w(TAG, "OBEX session close error" + e);
            }
            }
            if (mTransport1 != null) {
            if (mTransport1 != null) {
                try {
                try {
                    mTransport1.close();
                    mTransport1.close();
                } catch (IOException e) {
                } catch (IOException e) {
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                            4);
                    Log.e(TAG, "mTransport.close error");
                    Log.e(TAG, "mTransport.close error");
                }
                }


@@ -275,6 +304,11 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                mCs = new ClientSession(mTransport1);
                mCs = new ClientSession(mTransport1);
                mConnected = true;
                mConnected = true;
            } catch (IOException e1) {
            } catch (IOException e1) {
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        5);
                Log.e(TAG, "OBEX session create error");
                Log.e(TAG, "OBEX session create error");
            }
            }
            if (mConnected) {
            if (mConnected) {
@@ -291,6 +325,12 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                    }
                    }
                    mConnected = true;
                    mConnected = true;
                } catch (IOException e) {
                } catch (IOException e) {
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                            6);
                    Log.e(TAG, "OBEX session connect error");
                    Log.e(TAG, "OBEX session connect error");
                }
                }
            }
            }
@@ -308,6 +348,12 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                try {
                try {
                    Thread.sleep(50);
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                } catch (InterruptedException e) {
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                            7);
                    status = BluetoothShare.STATUS_CANCELED;
                    status = BluetoothShare.STATUS_CANCELED;
                }
                }
            }
            }
@@ -407,12 +453,24 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                    }
                    }
                    putOperation = (ClientOperation) mCs.put(request);
                    putOperation = (ClientOperation) mCs.put(request);
                } catch (IllegalArgumentException e) {
                } catch (IllegalArgumentException e) {
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                            8);
                    status = BluetoothShare.STATUS_OBEX_DATA_ERROR;
                    status = BluetoothShare.STATUS_OBEX_DATA_ERROR;
                    Constants.updateShareStatus(mContext1, mInfo.mId, status);
                    Constants.updateShareStatus(mContext1, mInfo.mId, status);


                    Log.e(TAG, "Error setting header items for request: " + e);
                    Log.e(TAG, "Error setting header items for request: " + e);
                    error = true;
                    error = true;
                } catch (IOException e) {
                } catch (IOException e) {
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                            9);
                    status = BluetoothShare.STATUS_OBEX_DATA_ERROR;
                    status = BluetoothShare.STATUS_OBEX_DATA_ERROR;
                    Constants.updateShareStatus(mContext1, mInfo.mId, status);
                    Constants.updateShareStatus(mContext1, mInfo.mId, status);


@@ -431,6 +489,12 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                        outputStream = putOperation.openOutputStream();
                        outputStream = putOperation.openOutputStream();
                        inputStream = putOperation.openInputStream();
                        inputStream = putOperation.openInputStream();
                    } catch (IOException e) {
                    } catch (IOException e) {
                        ContentProfileErrorReportUtils.report(
                                BluetoothProfile.OPP,
                                BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                                BluetoothStatsLog
                                        .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                                10);
                        status = BluetoothShare.STATUS_OBEX_DATA_ERROR;
                        status = BluetoothShare.STATUS_OBEX_DATA_ERROR;
                        Constants.updateShareStatus(mContext1, mInfo.mId, status);
                        Constants.updateShareStatus(mContext1, mInfo.mId, status);
                        Log.e(TAG, "Error when openOutputStream");
                        Log.e(TAG, "Error when openOutputStream");
@@ -566,10 +630,25 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                    }
                    }
                }
                }
            } catch (IOException e) {
            } catch (IOException e) {
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        11);
                handleSendException(e.toString());
                handleSendException(e.toString());
            } catch (NullPointerException e) {
            } catch (NullPointerException e) {
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        12);
                handleSendException(e.toString());
                handleSendException(e.toString());
            } catch (IndexOutOfBoundsException e) {
            } catch (IndexOutOfBoundsException e) {
                ContentProfileErrorReportUtils.report(
                        BluetoothProfile.OPP,
                        BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        13);
                handleSendException(e.toString());
                handleSendException(e.toString());
            } finally {
            } finally {
                try {
                try {
@@ -577,6 +656,12 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                        outputStream.close();
                        outputStream.close();
                    }
                    }
                } catch (IOException e) {
                } catch (IOException e) {
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                            14);
                    Log.e(TAG, "Error when closing output stream after send");
                    Log.e(TAG, "Error when closing output stream after send");
                }
                }


@@ -615,6 +700,12 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                        putOperation.close();
                        putOperation.close();
                    }
                    }
                } catch (IOException e) {
                } catch (IOException e) {
                    ContentProfileErrorReportUtils.report(
                            BluetoothProfile.OPP,
                            BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                            BluetoothStatsLog
                                    .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                            15);
                    Log.e(TAG, "Error when closing stream after send");
                    Log.e(TAG, "Error when closing stream after send");


                    // Socket has been closed due to the response timeout in the framework,
                    // Socket has been closed due to the response timeout in the framework,
@@ -649,6 +740,12 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                    try {
                    try {
                        mTransport1.close();
                        mTransport1.close();
                    } catch (IOException e) {
                    } catch (IOException e) {
                        ContentProfileErrorReportUtils.report(
                                BluetoothProfile.OPP,
                                BluetoothProtoEnums.BLUETOOTH_OPP_OBEX_CLIENT_SESSION,
                                BluetoothStatsLog
                                        .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                                16);
                        Log.e(TAG, "mTransport.close error");
                        Log.e(TAG, "mTransport.close error");
                    }
                    }
                    Message msg = Message.obtain(mCallbackHandler);
                    Message msg = Message.obtain(mCallbackHandler);
+82 −3

File changed.

Preview size limit exceeded, changes collapsed.

Loading