1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Merge pull request #9619 from Redirion/avoidreflectionifpossible

Check availability of Samsung DeX only on Samsung devices
This commit is contained in:
Stypox 2023-01-12 12:06:19 +01:00 committed by GitHub
commit a15a5adacc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,7 @@
package org.schabi.newpipe.util; package org.schabi.newpipe.util;
import static android.content.Context.INPUT_SERVICE;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.UiModeManager; import android.app.UiModeManager;
import android.content.Context; import android.content.Context;
@ -27,11 +29,10 @@ import org.schabi.newpipe.R;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import static android.content.Context.INPUT_SERVICE;
public final class DeviceUtils { public final class DeviceUtils {
private static final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv"; private static final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv";
private static final boolean SAMSUNG = Build.MANUFACTURER.equals("samsung");
private static Boolean isTV = null; private static Boolean isTV = null;
private static Boolean isFireTV = null; private static Boolean isFireTV = null;
@ -120,6 +121,10 @@ public final class DeviceUtils {
return true; return true;
} }
if (!SAMSUNG) {
return false;
// DeX is Samsung-specific, skip the checks below on non-Samsung devices
}
// DeX check for standalone and multi-window mode, from: // DeX check for standalone and multi-window mode, from:
// https://developer.samsung.com/samsung-dex/modify-optimizing.html // https://developer.samsung.com/samsung-dex/modify-optimizing.html
try { try {