I think this is cleaner:

```java
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
  return getErrorResult("Unable to open notifications on device below API level 18");
}

if (!command.isElementCommand()) {
  return getErrorResult("Unable to open notifications on an element.");
}

// only makes sense on a device
if (UiDevice.getInstance().openNotification()) {
  return getSuccessResult(true);
} else {
  return getErrorResult("Device failed to open notifications.");
}
```