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

Commit bb16e15d authored by jhtop.kim's avatar jhtop.kim Committed by Jake Hamby
Browse files

Bluetooth : fix for crashing alertDialogbox



- changes for crashing of alertDialogbox while displaying message
- in showError function, this fix code shoud be added in case of showing error pop up

Bug: 5068089
Change-Id: I40e8a699461832b7bd47080b40f467572632d412
Signed-off-by: default avatarjhtop.kim <jhtop.kim@samsung.com>
parent b5573884
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -79,6 +79,10 @@ public final class LocalBluetoothManager {
        return mContext;
    }

    public Context getForegroundActivity() {
        return mForegroundActivity;
    }

    boolean isForegroundActivity() {
        return mForegroundActivity != null;
    }
+7 −1
Original line number Diff line number Diff line
@@ -89,11 +89,17 @@ final class Utils {

    static void showError(Context context, String name, int messageResId) {
        String message = context.getString(messageResId, name);
        new AlertDialog.Builder(context)
        LocalBluetoothManager manager = LocalBluetoothManager.getInstance(context);
        Context activity = manager.getForegroundActivity();
        if(manager.isForegroundActivity()) {
            new AlertDialog.Builder(activity)
                .setIcon(android.R.drawable.ic_dialog_alert)
                .setTitle(R.string.bluetooth_error_title)
                .setMessage(message)
                .setPositiveButton(android.R.string.ok, null)
                .show();
        } else {
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
        }
    }
}