Skip to content

Commit 5e2ef7f

Browse files
han-szAudricV
authored andcommitted
Address review comments
1 parent cfda073 commit 5e2ef7f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ public static boolean isTv(final Context context) {
8989
}
9090

9191
public static boolean isDesktopMode(final Context context) {
92-
final boolean isDesktopMode = ContextCompat.getSystemService(context, UiModeManager.class)
93-
.getCurrentModeType() == Configuration.UI_MODE_TYPE_DESK;
94-
92+
if (ContextCompat.getSystemService(context, UiModeManager.class)
93+
.getCurrentModeType() == Configuration.UI_MODE_TYPE_DESK) {
94+
return true;
95+
}
9596
// DeX check for standalone and multi-window mode
96-
boolean isDeXMode = false;
9797
try {
9898
final Configuration config = context.getResources().getConfiguration();
9999
final Class<?> configClass = config.getClass();
@@ -102,7 +102,7 @@ public static boolean isDesktopMode(final Context context) {
102102
final int currentMode =
103103
configClass.getField("semDesktopModeEnabled").getInt(config);
104104
if (semDesktopModeEnabledConst == currentMode) {
105-
isDeXMode = true;
105+
return true;
106106
}
107107
} catch (final NoSuchFieldException | IllegalAccessException e) {
108108
// empty
@@ -122,14 +122,14 @@ public static boolean isDesktopMode(final Context context) {
122122
final int enabled = (int) getEnabledMethod.invoke(desktopModeState);
123123
if (enabled == desktopModeStateClass
124124
.getDeclaredField("ENABLED").getInt(desktopModeStateClass)) {
125-
isDeXMode = true;
125+
return true;
126126
}
127127
} catch (NoSuchFieldException | NoSuchMethodException
128128
| IllegalAccessException | InvocationTargetException e) {
129129
// Device does not support DeX 3.0
130130
}
131131
}
132-
return isDesktopMode || isDeXMode;
132+
return false;
133133
}
134134

135135
public static boolean isTablet(@NonNull final Context context) {

0 commit comments

Comments
 (0)