当前位置: 首页>>代码示例>>Java>>正文


Java SysUtils.isLowEndDevice方法代码示例

本文整理汇总了Java中org.chromium.base.SysUtils.isLowEndDevice方法的典型用法代码示例。如果您正苦于以下问题:Java SysUtils.isLowEndDevice方法的具体用法?Java SysUtils.isLowEndDevice怎么用?Java SysUtils.isLowEndDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.base.SysUtils的用法示例。


在下文中一共展示了SysUtils.isLowEndDevice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: detectEnabled

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
private static boolean detectEnabled() {
    if (SysUtils.isLowEndDevice()) {
        return false;
    }

    // Allow this user-flippable flag to disable the feature.
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_CONTEXTUAL_SEARCH)) {
        return false;
    }

    // Allow this user-flippable flag to enable the feature.
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_CONTEXTUAL_SEARCH)) {
        return true;
    }

    // Allow disabling the feature remotely.
    if (getBooleanParam(DISABLED_PARAM)) {
        return false;
    }

    return true;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:ContextualSearchFieldTrial.java

示例2: shouldDisableHardwareAcceleration

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
private boolean shouldDisableHardwareAcceleration() {
    // Low end devices should disable hardware acceleration for memory gains.
    if (SysUtils.isLowEndDevice()) return true;

    // Turning off hardware acceleration reduces crash rates. See http://crbug.com/651918
    // GT-S7580 on JDQ39 accounts for 42% of crashes in libPowerStretch.so on dev and beta.
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1
            && Build.MODEL.equals("GT-S7580")) {
        return true;
    }
    // SM-N9005 on JSS15J accounts for 44% of crashes in libPowerStretch.so on stable channel.
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR2
            && Build.MODEL.equals("SM-N9005")) {
        return true;
    }
    return false;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:18,代码来源:ChromeActivity.java

示例3: startModerateBindingManagementIfNeeded

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
private static void startModerateBindingManagementIfNeeded(Context context) {
    // Ensures that a low memory device isn't included in the field trial experimental.
    if (SysUtils.isLowEndDevice()) return;

    String enabledValue = getModerateBindingConfigValue(MODERATE_BINDING_ENABLED_PARAM);
    if (!Boolean.parseBoolean(enabledValue)) return;

    String lowReduceRatioValue =
            getModerateBindingConfigValue(MODERATE_BINDING_LOW_REDUCE_RATIO_PARAM);
    String highReduceRatioValue =
            getModerateBindingConfigValue(MODERATE_BINDING_HIGH_REDUCE_RATIO_PARAM);
    float lowReduceRatio =
            parseFloat(lowReduceRatioValue, DEFAULT_MODERATE_BINDING_REDUCE_RATIO);
    float highReduceRatio =
            parseFloat(highReduceRatioValue, DEFAULT_MODERATE_BINDING_REDUCE_RATIO * 2);
    highReduceRatio = Math.max(0, Math.min(1, highReduceRatio));
    lowReduceRatio = Math.max(0, Math.min(highReduceRatio, lowReduceRatio));
    ChildProcessLauncher.startModerateBindingManagement(
            context, lowReduceRatio, highReduceRatio);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:21,代码来源:DeferredStartupHandler.java

示例4: enableHardwareAcceleration

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
private void enableHardwareAcceleration() {
    // HW acceleration is disabled in the manifest. Enable it only on high-end devices.
    if (!SysUtils.isLowEndDevice()) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);

        // When HW acceleration is enabled manually for an activity, child windows (e.g.
        // dialogs) don't inherit HW acceleration state. However, when HW acceleration is
        // enabled in the manifest, child windows do inherit HW acceleration state. That
        // looks like a bug, so I filed b/23036374
        //
        // In the meanwhile the workaround is to call
        //   window.setWindowManager(..., hardwareAccelerated=true)
        // to let the window know that it's HW accelerated. However, since there is no way
        // to know 'appToken' argument until window's view is attached to the window (!!),
        // we have to do the workaround in onAttachedToWindow()
        mSetWindowHWA = true;
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:19,代码来源:ChromeActivity.java

示例5: startBackgroundRequestsImpl

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
/**
 * Triggers processing of background offlining requests.  This is called when
 * system conditions are appropriate for background offlining, typically from the
 * GcmTaskService onRunTask() method.  In response, we will start the
 * task processing by passing the call along to the C++ RequestCoordinator.
 * Also starts UMA collection.
 *
 * @returns Whether processing will be carried out and completion will be indicated through a
 *     callback.
 */
static boolean startBackgroundRequestsImpl(BackgroundSchedulerProcessor bridge, Context context,
        Bundle taskExtras, Callback<Boolean> callback) {
    TriggerConditions triggerConditions =
            TaskExtrasPacker.unpackTriggerConditionsFromBundle(taskExtras);
    DeviceConditions currentConditions = DeviceConditions.getCurrentConditions(context);
    if (!currentConditions.isPowerConnected()
            && currentConditions.getBatteryPercentage()
                    < triggerConditions.getMinimumBatteryPercentage()) {
        Log.d(TAG, "Battery percentage is lower than minimum to start processing");
        return false;
    }

    if (SysUtils.isLowEndDevice() && ApplicationStatus.hasVisibleActivities()) {
        Log.d(TAG, "Application visible on low-end device so deferring background processing");
        return false;
    }

    // Gather UMA data to measure how often the user's machine is amenable to background
    // loading when we wake to do a task.
    long taskScheduledTimeMillis = TaskExtrasPacker.unpackTimeFromBundle(taskExtras);
    OfflinePageUtils.recordWakeupUMA(context, taskScheduledTimeMillis);

    return bridge.startScheduledProcessing(currentConditions, callback);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:35,代码来源:BackgroundOfflinerTask.java

示例6: Toast

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
private Toast(Context context, android.widget.Toast toast) {
    mToast = toast;

    if (SysUtils.isLowEndDevice() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // Don't HW accelerate Toasts. Unfortunately the only way to do that is to make
        // toast.getView().getContext().getApplicationInfo() return lies to prevent
        // WindowManagerGlobal.addView() from adding LayoutParams.FLAG_HARDWARE_ACCELERATED.
        mSWLayout = new FrameLayout(new ContextWrapper(context) {
            @Override
            public ApplicationInfo getApplicationInfo() {
                ApplicationInfo info = new ApplicationInfo(super.getApplicationInfo());
                // On Lollipop the condition we need to fail is
                // "targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP"
                // (and for Chrome targetSdkVersion is always the latest)
                info.targetSdkVersion = Build.VERSION_CODES.KITKAT;

                // On M+ the condition we need to fail is
                // "flags & ApplicationInfo.FLAG_HARDWARE_ACCELERATED"
                info.flags &= ~ApplicationInfo.FLAG_HARDWARE_ACCELERATED;
                return info;
            }
        });

        setView(toast.getView());
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:27,代码来源:Toast.java

示例7: isEnabled

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
/**
 * @return Whether Reader mode and its new UI are enabled.
 * @param context A context
 */
public static boolean isEnabled(Context context) {
    if (context == null) return false;

    boolean enabled = CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_DOM_DISTILLER)
            && !CommandLine.getInstance().hasSwitch(
                    ChromeSwitches.DISABLE_READER_MODE_BOTTOM_BAR)
            && !DeviceFormFactor.isTablet(context)
            && DomDistillerTabUtils.isDistillerHeuristicsEnabled()
            && !SysUtils.isLowEndDevice();
    return enabled;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:ReaderModeManager.java

示例8: DeviceClassManager

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
/**
 * The {@link DeviceClassManager} constructor should be self contained and
 * rely on system information and command line flags.
 */
private DeviceClassManager() {
    // Device based configurations.
    if (SysUtils.isLowEndDevice()) {
        mEnableSnapshots = false;
        mEnableLayerDecorationCache = true;
        mEnableAccessibilityLayout = true;
        mEnableAnimations = false;
        mEnablePrerendering = false;
        mEnableToolbarSwipe = false;
        mDisableDomainReliability = true;
    } else {
        mEnableSnapshots = true;
        mEnableLayerDecorationCache = true;
        mEnableAccessibilityLayout = false;
        mEnableAnimations = true;
        mEnablePrerendering = true;
        mEnableToolbarSwipe = true;
        mDisableDomainReliability = false;
    }

    if (DeviceFormFactor.isTablet(ContextUtils.getApplicationContext())) {
        mEnableAccessibilityLayout = false;
    }

    // Flag based configurations.
    CommandLine commandLine = CommandLine.getInstance();
    mEnableAccessibilityLayout |= commandLine
            .hasSwitch(ChromeSwitches.ENABLE_ACCESSIBILITY_TAB_SWITCHER);
    mEnableFullscreen =
            !commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN);

    // Related features.
    if (mEnableAccessibilityLayout) {
        mEnableAnimations = false;
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:41,代码来源:DeviceClassManager.java

示例9: startBackgroundRequests

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
/**
 * Triggers processing of background offlining requests.  This is called when
 * system conditions are appropriate for background offlining, typically from the
 * GcmTaskService onRunTask() method.  In response, we will start the
 * task processing by passing the call along to the C++ RequestCoordinator.
 * Also starts UMA collection.
 *
 * @returns true for success
 */
public boolean startBackgroundRequests(Context context, Bundle bundle,
                                       ChromeBackgroundServiceWaiter waiter) {
    // Set up backup scheduled task in case processing is killed before RequestCoordinator
    // has a chance to reschedule base on remaining work.
    TriggerConditions previousTriggerConditions =
            TaskExtrasPacker.unpackTriggerConditionsFromBundle(bundle);
    BackgroundScheduler.backupSchedule(context, previousTriggerConditions, DEFER_START_SECONDS);

    DeviceConditions currentConditions = OfflinePageUtils.getDeviceConditions(context);
    if (!currentConditions.isPowerConnected()
            && currentConditions.getBatteryPercentage()
                    < previousTriggerConditions.getMinimumBatteryPercentage()) {
        Log.d(TAG, "Battery percentage is lower than minimum to start processing");
        return false;
    }

    if (SysUtils.isLowEndDevice() && ApplicationStatus.hasVisibleActivities()) {
        Log.d(TAG, "Application visible on low-end device so deferring background processing");
        return false;
    }

    // Now initiate processing.
    processBackgroundRequests(bundle, currentConditions, waiter);

    // Gather UMA data to measure how often the user's machine is amenable to background
    // loading when we wake to do a task.
    long taskScheduledTimeMillis = TaskExtrasPacker.unpackTimeFromBundle(bundle);
    OfflinePageUtils.recordWakeupUMA(context, taskScheduledTimeMillis);

    return true;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:41,代码来源:BackgroundOfflinerTask.java

示例10: startModerateBindingManagementIfNeeded

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
private void startModerateBindingManagementIfNeeded() {
    // Moderate binding doesn't apply to low end devices.
    if (SysUtils.isLowEndDevice()) return;

    boolean moderateBindingTillBackgrounded =
            FieldTrialList.findFullName("ModerateBindingOnBackgroundTabCreation")
                    .equals("Enabled");
    ChildProcessLauncher.startModerateBindingManagement(
            mAppContext, moderateBindingTillBackgrounded);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:11,代码来源:DeferredStartupHandler.java

示例11: startObservingMediaSinks

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
/**
 * Starts background monitoring for available media sinks compatible with the given
 * |sourceUrn| if the device is in a state that allows it.
 * @param sourceId a URL to use for filtering of the available media sinks
 * @return whether the monitoring started (ie. was allowed).
 */
@CalledByNative
public boolean startObservingMediaSinks(String sourceId) {
    if (SysUtils.isLowEndDevice()) return false;

    for (MediaRouteProvider provider : mRouteProviders) {
        provider.startObservingMediaSinks(sourceId);
    }

    return true;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:17,代码来源:ChromeMediaRouter.java

示例12: detectEnabled

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
private static boolean detectEnabled() {
    if (SysUtils.isLowEndDevice()) {
        return false;
    }

    // This is used for instrumentation tests (i.e. it is not a user-flippable flag). We cannot
    // use Variations params because in the test harness, the initialization comes before any
    // native methods are available. And the ContextualSearchManager is initialized very early
    // in the Chrome initialization.
    if (CommandLine.getInstance().hasSwitch(
                ChromeSwitches.ENABLE_CONTEXTUAL_SEARCH_FOR_TESTING)) {
        return true;
    }

    // Allow this user-flippable flag to disable the feature.
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_CONTEXTUAL_SEARCH)) {
        return false;
    }

    // Allow this user-flippable flag to override disabling due to language.
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_CONTEXTUAL_SEARCH)) {
        return true;
    }

    String languageCode = Locale.getDefault().getLanguage();
    if (!isLanguageSupported(languageCode)) return false;

    if (ChromeVersionInfo.isLocalBuild()) return true;

    return getBooleanParam(ENABLED_PARAM);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:32,代码来源:ContextualSearchFieldTrial.java

示例13: setTabSwitcherMode

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
@Override
protected void setTabSwitcherMode(
        boolean inTabSwitcherMode, boolean showToolbar, boolean delayAnimation) {
    if (mInTabSwitcherMode == inTabSwitcherMode) return;

    finishAnimations();

    mDelayingTabSwitcherAnimation = delayAnimation;

    if (inTabSwitcherMode) {
        if (mUrlFocusLayoutAnimator != null && mUrlFocusLayoutAnimator.isRunning()) {
            mUrlFocusLayoutAnimator.end();
            mUrlFocusLayoutAnimator = null;
            // After finishing the animation, force a re-layout of the location bar,
            // so that the final translation position is correct (since onMeasure updates
            // won't happen in tab switcher mode). crbug.com/518795.
            layoutLocationBar(getMeasuredWidth());
            updateUrlExpansionAnimation();
        }
        mNewTabButton.setEnabled(true);
        updateViewsForTabSwitcherMode(true);
        mTabSwitcherModeAnimation = createEnterTabSwitcherModeAnimation();
    } else {
        if (!mDelayingTabSwitcherAnimation) {
            mTabSwitcherModeAnimation = createExitTabSwitcherAnimation(showToolbar);
        }
        mUIAnimatingTabSwitcherTransition = true;
    }

    mAnimateNormalToolbar = showToolbar;
    mInTabSwitcherMode = inTabSwitcherMode;
    if (mTabSwitcherModeAnimation != null) mTabSwitcherModeAnimation.start();

    if (SysUtils.isLowEndDevice()) finishAnimations();

    postInvalidateOnAnimation();
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:38,代码来源:ToolbarPhone.java

示例14: isEnabled

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
/**
 * @return Whether Reader mode and its new UI are enabled.
 * @param context A context
 */
public static boolean isEnabled(Context context) {
    if (context == null) return false;

    boolean enabled = CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_DOM_DISTILLER)
            && !CommandLine.getInstance().hasSwitch(
                       ChromeSwitches.DISABLE_READER_MODE_BOTTOM_BAR)
            && !DeviceFormFactor.isTablet()
            && DomDistillerTabUtils.isDistillerHeuristicsEnabled()
            && !SysUtils.isLowEndDevice();
    return enabled;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:16,代码来源:ReaderModeManager.java

示例15: preInflationStartupDone

import org.chromium.base.SysUtils; //导入方法依赖的package包/类
/**
 * This is needed for device class manager which depends on commandline args that are
 * initialized in preInflationStartup()
 */
private void preInflationStartupDone() {
    // Domain reliability uses significant enough memory that we should disable it on low memory
    // devices for now.
    // TODO(zbowling): remove this after domain reliability is refactored. (crbug.com/495342)
    if (SysUtils.isLowEndDevice()) {
        CommandLine.getInstance().appendSwitch(ChromeSwitches.DISABLE_DOMAIN_RELIABILITY);
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:13,代码来源:ChromeBrowserInitializer.java


注:本文中的org.chromium.base.SysUtils.isLowEndDevice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。