@@ -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