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

Commit a313bfae authored by Varun Garg's avatar Varun Garg Committed by Gerrit - the friendly Code Review server
Browse files

BoostFramework: Adding config for disable packing params & scroll fix

Adding config variable for disable packing, this will provide the
flexibility to enable and disable packing on different targets.
Fixing bug in launch boost while calling back to back perflock
acquire using same Boostframework object.
Fixed bug in scroll duration during scroll perflocks.

Change-Id: Id42a6e350dfd852a43ec35ec3afef9b298707057
parent 09ecabc3
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -609,6 +609,7 @@ public class OverScroller {
        private boolean mIsPerfLockAcquired = false;
        private boolean mIsPerfBoostEnabled = false;
        private int fBoostTimeOut = 0;
        private int flingBoostTimeOut = 0;
        private int fBoostParamVal[];

        static {
@@ -664,6 +665,10 @@ public class OverScroller {
            fBoostParamVal = context.getResources().getIntArray(
                        com.android.internal.R.array.flingboost_param_value);
            }

            if (mPerf == null && mIsPerfBoostEnabled) {
                mPerf = new BoostFramework();
            }
        }

        void updateScroll(float q) {
@@ -786,16 +791,17 @@ public class OverScroller {
            if (velocity != 0) {
                mDuration = mSplineDuration = getSplineFlingDuration(velocity);
                totalDistance = getSplineFlingDistance(velocity);
                if (mPerf == null && mIsPerfBoostEnabled) {
                    mPerf = new BoostFramework();
                }

                if (mPerf != null) {
                    mIsPerfLockAcquired = true;
                    if (0 == fBoostTimeOut) {
                        fBoostTimeOut = mDuration;
                        //config value is not defined
                        flingBoostTimeOut = mDuration;
                    } else {
                        //config value is present
                        flingBoostTimeOut = fBoostTimeOut;
                    }
                    mPerf.perfLockAcquire(fBoostTimeOut, fBoostParamVal);
                    mPerf.perfLockAcquire(flingBoostTimeOut, fBoostParamVal);
                }
            }

+7 −2
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ public class Scroller {
    private BoostFramework mPerf = null;
    boolean bIsPerfBoostEnabled = false;
    private int sBoostTimeOut = 0;
    private int scrollBoostTimeOut = 0;
    private int sBoostParamVal[];

    // A context-specific coefficient adjusted to physical values.
@@ -422,9 +423,13 @@ public class Scroller {

        if ((mPerf != null) && (duration != 0)) {
            if (0 == sBoostTimeOut) {
                sBoostTimeOut = mDuration;
                //config value is not defined
                scrollBoostTimeOut = mDuration;
            } else {
                //config value is present
                scrollBoostTimeOut = sBoostTimeOut;
            }
            mPerf.perfLockAcquire(sBoostTimeOut, sBoostParamVal);
            mPerf.perfLockAcquire(scrollBoostTimeOut, sBoostParamVal);
        }
    }

+5 −2
Original line number Diff line number Diff line
@@ -2278,11 +2278,14 @@

    <!-- Whether cpu boost is enabled for AppLaunch -->
    <bool name="config_enableCpuBoostForAppLaunch">false</bool>
    <integer name="disablepacking_timeout_param">0</integer>
    <integer-array name="launchboost_packing_param_value"/>
    <integer name="launchboost_timeout_param">0</integer>
    <integer-array name="launchboost_param_value"/>

    <!-- Whether disablepacking is enabled or not -->
    <bool name="config_disablePacking">false</bool>
    <integer name="disablepacking_timeout_param">0</integer>
    <integer-array name="launchboost_packing_param_value"/>

    <!-- Whether cpu boost is enabled for animation. -->
    <bool name="config_enablePerfBoostForAnimation">false</bool>
    <integer name="animationboost_timeout_param">0</integer>
+5 −2
Original line number Diff line number Diff line
@@ -2330,11 +2330,14 @@

  <!-- cpu boost for AppLaunch -->
  <java-symbol type="bool" name="config_enableCpuBoostForAppLaunch" />
  <java-symbol type="integer" name="disablepacking_timeout_param" />
  <java-symbol type="array" name="launchboost_packing_param_value"/>
  <java-symbol type="integer" name="launchboost_timeout_param" />
  <java-symbol type="array" name="launchboost_param_value" />

  <!-- cpu boost for AppLaunch -->
  <java-symbol type="bool" name="config_disablePacking" />
  <java-symbol type="integer" name="disablepacking_timeout_param" />
  <java-symbol type="array" name="launchboost_packing_param_value" />

  <!-- cpu boost for Animationboost -->
  <java-symbol type="bool" name="config_enablePerfBoostForAnimation" />
  <java-symbol type="integer" name="animationboost_timeout_param" />
+22 −8
Original line number Diff line number Diff line
@@ -161,9 +161,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
    static final int RESUME_TOP_ACTIVITY_MSG = FIRST_SUPERVISOR_STACK_MSG + 2;
    static final int SLEEP_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 3;
    static final int LAUNCH_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 4;
    public BoostFramework mPerf = null;
    public BoostFramework mPerf_iop = null;
    public BoostFramework mPerfBoost = null;
    public BoostFramework mPerfPack = null;
    public boolean mIsPerfBoostEnabled = false;
    public boolean mIsperfDisablepackingEnable = false;
    public int lBoostTimeOut = 0;
    public int lDisPackTimeOut = 0;
    public int lBoostCpuParamVal[];
@@ -352,13 +354,19 @@ public final class ActivityStackSupervisor implements DisplayListener {
        /* Is perf lock for cpu-boost enabled during App 1st launch */
        mIsPerfBoostEnabled = mService.mContext.getResources().getBoolean(
                   com.android.internal.R.bool.config_enableCpuBoostForAppLaunch);
        mIsperfDisablepackingEnable = mService.mContext.getResources().getBoolean(
                   com.android.internal.R.bool.config_disablePacking);

        if(mIsPerfBoostEnabled) {
           lBoostTimeOut = mService.mContext.getResources().getInteger(
                   com.android.internal.R.integer.launchboost_timeout_param);
           lDisPackTimeOut = mService.mContext.getResources().getInteger(
                   com.android.internal.R.integer.disablepacking_timeout_param);
           lBoostCpuParamVal = mService.mContext.getResources().getIntArray(
                           com.android.internal.R.array.launchboost_param_value);
        }

        if(mIsperfDisablepackingEnable) {
           lDisPackTimeOut = mService.mContext.getResources().getInteger(
                   com.android.internal.R.integer.disablepacking_timeout_param);
           lBoostPackParamVal = mService.mContext.getResources().getIntArray(
                        com.android.internal.R.array.launchboost_packing_param_value);
       }
@@ -3063,12 +3071,18 @@ public final class ActivityStackSupervisor implements DisplayListener {

    void acquireAppLaunchPerfLock() {
       /* Acquire perf lock during new app launch */
       if (mIsPerfBoostEnabled == true && mPerf == null) {
           mPerf = new BoostFramework();
       if (mIsperfDisablepackingEnable == true && mPerfPack == null) {
           mPerfPack = new BoostFramework();
       }
       if (mPerfPack != null) {
           mPerfPack.perfLockAcquire(lDisPackTimeOut, lBoostPackParamVal);
       }

       if (mIsPerfBoostEnabled == true && mPerfBoost == null) {
           mPerfBoost = new BoostFramework();
       }
       if (mPerf != null) {
             mPerf.perfLockAcquire(lDisPackTimeOut, lBoostPackParamVal);
             mPerf.perfLockAcquire(lBoostTimeOut, lBoostCpuParamVal);
       if (mPerfBoost != null) {
           mPerfBoost.perfLockAcquire(lBoostTimeOut, lBoostCpuParamVal);
       }
    }