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

Commit 3a580aae authored by Roman Birg's avatar Roman Birg
Browse files

SystemUI: fix performance profile not showing up



Change-Id: Id8980c0808bd40ff432117ee47dab3f81a164887
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent a2940869
Loading
Loading
Loading
Loading
+11 −4
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import android.graphics.drawable.AnimatedVectorDrawable;
import android.os.Handler;
import android.os.Handler;
import android.os.PowerManager;
import android.os.PowerManager;
import android.provider.Settings;
import android.provider.Settings;
import android.util.Log;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.QSTile;


@@ -40,6 +39,15 @@ public class PerfProfileTile extends QSTile<PerfProfileTile.ProfileState> {


    private PerformanceProfileObserver mObserver;
    private PerformanceProfileObserver mObserver;


    private Runnable mStartTileAnimation = new Runnable() {
        @Override
        public void run() {
            if (getState().icon instanceof AnimatedVectorDrawable) {
                ((AnimatedVectorDrawable) getState().icon).start();
            }
        }
    };

    public PerfProfileTile(Host host) {
    public PerfProfileTile(Host host) {
        super(host);
        super(host);
        mObserver = new PerformanceProfileObserver(mHandler);
        mObserver = new PerformanceProfileObserver(mHandler);
@@ -75,9 +83,7 @@ public class PerfProfileTile extends QSTile<PerfProfileTile.ProfileState> {
        state.profile = arg == null ? getCurrentProfileIndex() : (Integer) arg;
        state.profile = arg == null ? getCurrentProfileIndex() : (Integer) arg;
        state.label = mEntries[state.profile];
        state.label = mEntries[state.profile];
        state.icon = mContext.getDrawable(mEntryIconRes[state.profile]);
        state.icon = mContext.getDrawable(mEntryIconRes[state.profile]);
        if (state.icon instanceof AnimatedVectorDrawable) {
        mUiHandler.post(mStartTileAnimation);
            ((AnimatedVectorDrawable) getState().icon).start();
        }
    }
    }


    @Override
    @Override
@@ -88,6 +94,7 @@ public class PerfProfileTile extends QSTile<PerfProfileTile.ProfileState> {
            mObserver.startObserving();
            mObserver.startObserving();
        } else {
        } else {
            mObserver.endObserving();
            mObserver.endObserving();
            mUiHandler.removeCallbacks(mStartTileAnimation);
        }
        }
    }
    }