This source file includes following definitions.
- isTablet
- addDeviceSpecificUserAgentSwitch
package org.chromium.content.browser;
import android.content.Context;
import org.chromium.base.CommandLine;
import org.chromium.content.common.ContentSwitches;
public class DeviceUtils {
private static final int MINIMUM_TABLET_WIDTH_DP = 600;
private static Boolean sIsTablet = null;
public static boolean isTablet(Context context) {
if (sIsTablet == null) {
int minimumScreenWidthDp = context.getResources().getConfiguration().
smallestScreenWidthDp;
sIsTablet = minimumScreenWidthDp >= MINIMUM_TABLET_WIDTH_DP;
}
return sIsTablet;
}
public static void addDeviceSpecificUserAgentSwitch(Context context) {
if (isTablet(context)) {
CommandLine.getInstance().appendSwitch(ContentSwitches.TABLET_UI);
} else {
CommandLine.getInstance().appendSwitch(ContentSwitches.USE_MOBILE_UA);
}
}
}