private void updateGovernorFeatures() { IGovernorModel governorModel = getGovernorModel(); GovernorConfig governorConfig = GovernorConfigHelper.getGovernorConfig(governorModel.getGov()); int up = governorModel.getGovernorThresholdUp(); int down = governorModel.getGovernorThresholdDown(); boolean hasThreshholdUp = governorConfig.hasThreshholdUpFeature(); boolean hasThreshholdDown = governorConfig.hasThreshholdDownFeature(); if (hasThreshholdUp) { llGovernorThresholds.setVisibility(View.VISIBLE); } else { llGovernorThresholds.setVisibility(View.GONE); } if (hasThreshholdUp) { labelGovThreshUp.setVisibility(View.VISIBLE); etGovTreshUp.setVisibility(View.VISIBLE); if (up < 2) { up = Integer.parseInt(origThreshUp); } if (up < 2) { up = 90; } etGovTreshUp.setText(up + ""); } else { governorModel.setGovernorThresholdUp(0); labelGovThreshUp.setVisibility(View.INVISIBLE); etGovTreshUp.setVisibility(View.INVISIBLE); etGovTreshUp.setText("-1"); } if (hasThreshholdDown) { labelGovThreshDown.setVisibility(View.VISIBLE); etGovTreshDown.setVisibility(View.VISIBLE); if (down < 1) { down = Integer.parseInt(origThreshDown); } if (down >= up || down < 1) { if (up > 30) { down = up - 10; } else { down = up - 1; } } etGovTreshDown.setText(down + ""); } else { governorModel.setGovernorThresholdDown(0); labelGovThreshDown.setVisibility(View.INVISIBLE); etGovTreshDown.setVisibility(View.INVISIBLE); etGovTreshDown.setText("-1"); } if (governorConfig.hasPowersaveBias()) { llPowersaveBias.setVisibility(View.VISIBLE); } else { llPowersaveBias.setVisibility(View.GONE); } }
public GovernorFragment( GovernorFragmentCallback callback, IGovernorModel governor, boolean disableScript) { super(callback, governor); this.origThreshUp = governor.getGovernorThresholdUp() + ""; this.origThreshDown = governor.getGovernorThresholdDown() + ""; this.disableScript = disableScript; this.cpuHandler = CpuHandler.getInstance(); this.availCpuGovs = cpuHandler.getAvailCpuGov(); }