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

Commit eb6a003b authored by Hemant Gupta's avatar Hemant Gupta Committed by Myles Watson
Browse files

Bluetooth: Prevent BT crash using adb commands

Use case:
1) Start OppLauncher activity or PbapActivity
   using adb shell command

Failure:
"Unfortunately, Bluetooth share has stopped" error comes.

Root cause:
Observed NPE because no action was supplied during opening
activity.

Fix:
Add NULL check before process action value to prevent force
close in profile.

Fixes: 119540033
Test: Performed sanity with above mentioned use case.
Change-Id: Ic9cc8079fd2c1c8b82c5b5062f253828483ed7e9
parent 1bc9b8ba
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -75,6 +75,11 @@ public class BluetoothOppLauncherActivity extends Activity {


        Intent intent = getIntent();
        Intent intent = getIntent();
        String action = intent.getAction();
        String action = intent.getAction();
        if (action == null) {
            Log.w(TAG, " Received " + intent + " with null action");
            finish();
            return;
        }


        if (action.equals(Intent.ACTION_SEND) || action.equals(Intent.ACTION_SEND_MULTIPLE)) {
        if (action.equals(Intent.ACTION_SEND) || action.equals(Intent.ACTION_SEND_MULTIPLE)) {
            //Check if Bluetooth is available in the beginning instead of at the end
            //Check if Bluetooth is available in the beginning instead of at the end
+1 −1
Original line number Original line Diff line number Diff line
@@ -109,7 +109,7 @@ public class BluetoothPbapActivity extends AlertActivity
        Intent i = getIntent();
        Intent i = getIntent();
        String action = i.getAction();
        String action = i.getAction();
        mDevice = i.getParcelableExtra(BluetoothPbapService.EXTRA_DEVICE);
        mDevice = i.getParcelableExtra(BluetoothPbapService.EXTRA_DEVICE);
        if (action.equals(BluetoothPbapService.AUTH_CHALL_ACTION)) {
        if (action != null && action.equals(BluetoothPbapService.AUTH_CHALL_ACTION)) {
            showPbapDialog(DIALOG_YES_NO_AUTH);
            showPbapDialog(DIALOG_YES_NO_AUTH);
            mCurrentDialog = DIALOG_YES_NO_AUTH;
            mCurrentDialog = DIALOG_YES_NO_AUTH;
        } else {
        } else {