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

Commit ea21248c authored by zfu's avatar zfu Committed by Gerrit - the friendly Code Review server
Browse files

Add perflock for NotificationBar drag animation

There has some heavy load in DrawThread when drag down or drag up
notification bar. Call schedule boost and boostup CPU frequency

Change-Id: Ibf7124b1a0a863914e640bff7751e20228fc70fd
parent 3a1b6141
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -2309,6 +2309,10 @@
    <integer name="ascrollboost_timeout">0</integer>
    <integer name="ascrollboost_timeout">0</integer>
    <integer-array name="ascrollboost_param_value"/>
    <integer-array name="ascrollboost_param_value"/>


    <!-- cpu boost for PanelView fling -->
    <bool name="config_enableCpuBoostForPanelViewFling">false</bool>
    <integer-array name="panelview_flingboost_param_value" />

   <!-- Configuration to play sms ringtone during MO/MT call -->
   <!-- Configuration to play sms ringtone during MO/MT call -->
   <bool name="config_sms_ringtone_incall">false</bool>
   <bool name="config_sms_ringtone_incall">false</bool>
    <!-- IpReachability monitor enable/Disable -->
    <!-- IpReachability monitor enable/Disable -->
+4 −0
Original line number Original line Diff line number Diff line
@@ -2364,6 +2364,10 @@
  <java-symbol type="integer" name="ascrollboost_timeout" />
  <java-symbol type="integer" name="ascrollboost_timeout" />
  <java-symbol type="array" name="ascrollboost_param_value" />
  <java-symbol type="array" name="ascrollboost_param_value" />


  <!-- cpu boost for PanelView fling -->
  <java-symbol type="bool" name="config_enableCpuBoostForPanelViewFling" />
  <java-symbol type="array" name="panelview_flingboost_param_value" />

  <!-- for wifi auto connection -->
  <!-- for wifi auto connection -->
  <java-symbol type="bool" name="wifi_autocon" />
  <java-symbol type="bool" name="wifi_autocon" />
  <!-- Configuration to play sms ringtone during MO/MT call -->
  <!-- Configuration to play sms ringtone during MO/MT call -->
+22 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.systemui.doze.DozeLog;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import android.util.BoostFramework;


import java.io.FileDescriptor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.PrintWriter;
@@ -85,6 +86,11 @@ public abstract class PanelView extends FrameLayout {
    private ObjectAnimator mPeekAnimator;
    private ObjectAnimator mPeekAnimator;
    private VelocityTrackerInterface mVelocityTracker;
    private VelocityTrackerInterface mVelocityTracker;
    private FlingAnimationUtils mFlingAnimationUtils;
    private FlingAnimationUtils mFlingAnimationUtils;
    /**
     * For PanelView fling perflock call
     */
    private BoostFramework mPerf = null;
    private int mBoostParamVal[];


    /**
    /**
     * Whether an instant expand request is currently pending and we are just waiting for layout.
     * Whether an instant expand request is currently pending and we are just waiting for layout.
@@ -190,6 +196,13 @@ public abstract class PanelView extends FrameLayout {
        mLinearOutSlowInInterpolator =
        mLinearOutSlowInInterpolator =
                AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in);
                AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in);
        mBounceInterpolator = new BounceInterpolator();
        mBounceInterpolator = new BounceInterpolator();
        boolean lIsPerfBoostEnabled = context.getResources().getBoolean(
                com.android.internal.R.bool.config_enableCpuBoostForPanelViewFling);
        if (lIsPerfBoostEnabled) {
            mBoostParamVal = context.getResources().getIntArray(
                    com.android.internal.R.array.panelview_flingboost_param_value);
            mPerf = new BoostFramework();
        }
    }
    }


    protected void loadDimens() {
    protected void loadDimens() {
@@ -659,16 +672,25 @@ public abstract class PanelView extends FrameLayout {
                                / collapseSpeedUpFactor));
                                / collapseSpeedUpFactor));
            }
            }
        }
        }
        if (mPerf != null) {
            mPerf.perfLockAcquire(0, mBoostParamVal);
        }
        animator.addListener(new AnimatorListenerAdapter() {
        animator.addListener(new AnimatorListenerAdapter() {
            private boolean mCancelled;
            private boolean mCancelled;


            @Override
            @Override
            public void onAnimationCancel(Animator animation) {
            public void onAnimationCancel(Animator animation) {
                if (mPerf != null) {
                    mPerf.perfLockRelease();
                }
                mCancelled = true;
                mCancelled = true;
            }
            }


            @Override
            @Override
            public void onAnimationEnd(Animator animation) {
            public void onAnimationEnd(Animator animation) {
                if (mPerf != null) {
                    mPerf.perfLockRelease();
                }
                if (clearAllExpandHack && !mCancelled) {
                if (clearAllExpandHack && !mCancelled) {
                    setExpandedHeightInternal(getMaxPanelHeight());
                    setExpandedHeightInternal(getMaxPanelHeight());
                }
                }