水滴屏、刘海屏项目,状态栏图标显示区域空间不够,为解决此问题,可去掉状态栏volte图标,保留下拉状态栏volte图标,以增加状态栏显示区域:
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
old mode 100755
new mode 100644
index 383d53a…f86f790
— a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
@@ -197,7 +197,7 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
}
}
/* @} */
-
if (mState.mMobileVolteId > 0) {
-
if (mState.mMobileVolteId > 0 && mShowVolte) { mMobileVolte.setImageResource(mState.mMobileVolteId); mMobileVolte.setVisibility(View.VISIBLE); }else {
@@ -265,7 +265,7 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
/* @} /
}
/ @} */
-
if (state.mMobileVolteId > 0) {
-
if (state.mMobileVolteId > 0 && mShowVolte) { Log.d(TAG, "mMobileVolteId = " + state.mMobileVolteId + " mSubId = " + state.subId); mMobileVolte.setImageResource(state.mMobileVolteId); mMobileVolte.setVisibility(View.VISIBLE);
@@ -394,4 +394,14 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
return mobileDataInOutId;
}
/* @} */
+
- private boolean mShowVolte = true;
- public void updateVolte(boolean show){
-
Log.i(TAG,"updateVolte mShowVolte-->"+mShowVolte+";show-->"+show);
-
if(mShowVolte != show){
-
mShowVolte = show;
-
updateState(mState);
-
requestLayout();
-
}
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
index d061649…56eb542 100644
— a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone;
import static com.android.systemui.statusbar.StatusBarIconView.STATE_DOT;
import static com.android.systemui.statusbar.StatusBarIconView.STATE_HIDDEN;
import static com.android.systemui.statusbar.StatusBarIconView.STATE_ICON;
+import com.android.systemui.statusbar.StatusBarMobileView;
import android.annotation.Nullable;
import android.content.Context;
@@ -277,6 +278,15 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
StatusIconDisplayable iconView = (StatusIconDisplayable) child;
StatusIconState childState = getViewStateFromChild(child);
-
if(iconView instanceof StatusBarMobileView){
-
StatusBarMobileView mobileView = (StatusBarMobileView)iconView;
-
if(translationX < 360){ //此值一般设置为机器分辨率的一半
-
mobileView.updateVolte(false);
-
} else {
-
mobileView.updateVolte(true);
-
}
-
}