Bug 1510971 - simplify redundant if statements r=geckoview-reviewers,owlish

Differential Revision: https://phabricator.services.mozilla.com/D185880
This commit is contained in:
Logan Rosen 2023-10-23 09:10:35 +00:00
parent fef29849ec
commit 0f5ba7b380
5 changed files with 8 additions and 32 deletions

View File

@ -186,11 +186,7 @@ final class JellyBeanAsyncCodec implements AsyncCodec {
return false;
}
if (mInputEnded && (what == MSG_POLL_INPUT_BUFFERS)) {
return false;
}
return true;
return !(mInputEnded && (what == MSG_POLL_INPUT_BUFFERS));
}
protected boolean handleMessageLocked(final Message msg) {

View File

@ -179,11 +179,7 @@ public final class RemoteManager implements IBinder.DeathRecipient {
private synchronized void handleRemoteDeath() {
mConnection.waitDisconnect();
if (init() && recoverRemoteCodec()) {
notifyError(false);
} else {
notifyError(true);
}
notifyError(!(init() && recoverRemoteCodec()));
}
private synchronized void notifyError(final boolean fatal) {

View File

@ -390,12 +390,8 @@ public final class HardwareCodecCapabilityUtils {
return true;
}
if (Build.VERSION.SDK_INT >= 29
return Build.VERSION.SDK_INT >= 29
&& ((profile == MediaCodecInfo.CodecProfileLevel.VP9Profile2HDR10Plus)
|| (profile == MediaCodecInfo.CodecProfileLevel.VP9Profile3HDR10Plus))) {
return true;
}
return false;
|| (profile == MediaCodecInfo.CodecProfileLevel.VP9Profile3HDR10Plus));
}
}

View File

@ -1174,10 +1174,7 @@ import org.mozilla.geckoview.SessionTextInput.EditableListener.IMEState;
}
// BaseKeyListener returns false even if it handled these keys for us,
// so we skip the key listener entirely and handle these ourselves
if (keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_FORWARD_DEL) {
return true;
}
return false;
return keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_FORWARD_DEL;
}
private static KeyEvent translateSonyXperiaGamepadKeys(final int keyCode, final KeyEvent event) {

View File

@ -2710,18 +2710,12 @@ public class GeckoSession {
return false;
}
if (mIndex >= mState.getHistoryEntries().length) {
return false;
}
return true;
return mIndex < mState.getHistoryEntries().length;
}
@Override /* ListIterator */
public boolean hasPrevious() {
if (mIndex <= 0) {
return false;
}
return true;
return mIndex > 0;
}
@Override /* ListIterator */
@ -6231,10 +6225,7 @@ public class GeckoSession {
*/
@UiThread
public @NonNull PromptResponse confirm(@NonNull final AllowOrDeny response) {
boolean res = false;
if (AllowOrDeny.ALLOW == response) {
res = true;
}
final boolean res = AllowOrDeny.ALLOW == response;
ensureResult().putBoolean("response", res);
return super.confirm();
}