Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb8a826a authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "CpuGovernorService for all, optional iobusy server thread" into ics

parents 75ec6d46 02cead23
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -51,10 +51,14 @@ import android.util.Log;
class CpuGovernorService {
    private final String TAG = "CpuGovernorService";
    private Context mContext;

    private final boolean DBG = false;
    private final boolean mUseIOBusyFeature = true;

    private SamplingRateChangeProcessor mSamplingRateChangeProcessor =
        new SamplingRateChangeProcessor();
    private IOBusyVoteProcessor mIOBusyVoteChangeProcessor =
        new IOBusyVoteProcessor();

    private IOBusyVoteProcessor mIOBusyVoteChangeProcessor = null;

    public CpuGovernorService(Context context) {
        mContext = context;
@@ -62,10 +66,16 @@ class CpuGovernorService {

        intentFilter.addAction(Intent.ACTION_SCREEN_ON);
        intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
        new Thread(mSamplingRateChangeProcessor).start();

        if (mUseIOBusyFeature) {
            // IOBusy feature requires kernel >= 2.6.35
            intentFilter.addAction(IOBusyVoteProcessor.ACTION_IOBUSY_VOTE);
            intentFilter.addAction(IOBusyVoteProcessor.ACTION_IOBUSY_UNVOTE);
        new Thread(mSamplingRateChangeProcessor).start();

            mIOBusyVoteChangeProcessor = new IOBusyVoteProcessor();
            new Thread(mIOBusyVoteChangeProcessor).start();
        }
        mContext.registerReceiver(mReceiver, intentFilter);
    }

@@ -74,7 +84,7 @@ class CpuGovernorService {
        public void onReceive(Context context, Intent intent) {
            boolean changeAdded = false;

            Log.i(TAG, "intent action: " + intent.getAction());
            if (DBG) Log.d(TAG, "intent action: " + intent.getAction());

            if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
                if (SystemProperties.getInt("dev.pm.dyn_samplingrate", 0) != 0) {
+5 −5
Original line number Diff line number Diff line
@@ -270,13 +270,13 @@ class ServerThread extends Thread {
            if (SystemProperties.QCOM_HARDWARE) {
                Slog.i(TAG, "DynamicMemoryManager Service");
                dmm = new DynamicMemoryManagerService(context);
            }

            cpuGovernorManager = new CpuGovernorService(context);

            if (cpuGovernorManager == null) {
                Slog.e(TAG, "CpuGovernorService failed to start");
            }
            }

        } catch (RuntimeException e) {
            Slog.e("System", "******************************************");
            Slog.e("System", "************ Failure starting core service", e);