SystemUI: adjust CPUInfoService top margin
Change-Id: I5fc3267e155c32a8b646139c69333d402854bbc1
diff --git a/packages/SystemUI/src/com/android/systemui/omni/CPUInfoService.java b/packages/SystemUI/src/com/android/systemui/omni/CPUInfoService.java
index 03ff42b..93b1eeb 100644
--- a/packages/SystemUI/src/com/android/systemui/omni/CPUInfoService.java
+++ b/packages/SystemUI/src/com/android/systemui/omni/CPUInfoService.java
@@ -82,6 +82,7 @@
private float mAscent;
private int mFH;
private int mMaxWidth;
+ private int mExtraPaddingTop;
private int mNeededWidth;
private int mNeededHeight;
@@ -130,6 +131,7 @@
setBackgroundColor(Color.argb(0x60, 0, 0, 0));
final int textSize = mTextHeight;
+ mExtraPaddingTop = c.getResources().getDimensionPixelSize(R.dimen.status_bar_height);
Typeface typeface = Typeface.create("monospace", Typeface.NORMAL);
@@ -200,10 +202,10 @@
final int RIGHT = getWidth()-1;
int x = RIGHT - mPaddingRight;
- int top = mPaddingTop + 2;
- int bottom = mPaddingTop + mFH - 2;
+ int top = mExtraPaddingTop + mPaddingTop + 2;
+ int bottom = mExtraPaddingTop + mPaddingTop + mFH - 2;
- int y = mPaddingTop - (int)mAscent;
+ int y = mExtraPaddingTop + mPaddingTop - (int)mAscent;
if(!mCpuTemp.equals("0")) {
canvas.drawText("Temp: " + getCpuTemp(mCpuTemp) + "°C",
@@ -232,7 +234,7 @@
final int NW = mNumCpus;
int neededWidth = mPaddingLeft + mPaddingRight + mMaxWidth;
- int neededHeight = mPaddingTop + mPaddingBottom + (mFH*((mCpuTempAvail?1:0)+NW));
+ int neededHeight = mExtraPaddingTop + mPaddingTop + mPaddingBottom + (mFH*((mCpuTempAvail?1:0)+NW));
if (neededWidth != mNeededWidth || neededHeight != mNeededHeight) {
mNeededWidth = neededWidth;
mNeededHeight = neededHeight;
@@ -323,7 +325,9 @@
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.RIGHT | Gravity.TOP;
params.setTitle("CPU Info");
-
+ // we force a unified top margin in mExtraPaddingTop under status bar
+ params.layoutInDisplayCutoutMode =
+ WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
startThread();
mDreamManager = IDreamManager.Stub.asInterface(