Merge "Hide privacy icons from QS header"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7a9c11c08c
@@ -81,6 +81,7 @@ import com.android.systemui.statusbar.policy.DateView;
|
||||
import com.android.systemui.statusbar.policy.NextAlarmController;
|
||||
import com.android.systemui.statusbar.policy.ZenModeController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
@@ -200,6 +201,8 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
mSystemIconsView = findViewById(R.id.quick_status_bar_system_icons);
|
||||
mQuickQsStatusIcons = findViewById(R.id.quick_qs_status_icons);
|
||||
StatusIconContainer iconContainer = findViewById(R.id.statusIcons);
|
||||
// Ignore privacy icons because they show in the space above QQS
|
||||
iconContainer.addIgnoredSlots(getIgnoredIconSlots());
|
||||
iconContainer.setShouldRestrictIcons(false);
|
||||
mIconManager = new TintedIconManager(iconContainer);
|
||||
|
||||
@@ -241,6 +244,18 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
updateShowPercent();
|
||||
}
|
||||
|
||||
private List<String> getIgnoredIconSlots() {
|
||||
ArrayList<String> ignored = new ArrayList<>();
|
||||
ignored.add(mContext.getResources().getString(
|
||||
com.android.internal.R.string.status_bar_camera));
|
||||
ignored.add(mContext.getResources().getString(
|
||||
com.android.internal.R.string.status_bar_microphone));
|
||||
ignored.add(mContext.getResources().getString(
|
||||
com.android.internal.R.string.status_bar_location));
|
||||
|
||||
return ignored;
|
||||
}
|
||||
|
||||
private void updateStatusText() {
|
||||
boolean changed = updateRingerStatus() || updateAlarmStatus();
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.android.systemui.statusbar.notification.stack.AnimationProperties;
|
||||
import com.android.systemui.statusbar.notification.stack.ViewState;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A container for Status bar system icons. Limits the number of system icons and handles overflow
|
||||
@@ -67,6 +68,8 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
|
||||
private ArrayList<StatusIconState> mLayoutStates = new ArrayList<>();
|
||||
// So we can count and measure properly
|
||||
private ArrayList<View> mMeasureViews = new ArrayList<>();
|
||||
// Any ignored icon will never be added as a child
|
||||
private ArrayList<String> mIgnoredSlots = new ArrayList<>();
|
||||
|
||||
public StatusIconContainer(Context context) {
|
||||
this(context, null);
|
||||
@@ -146,7 +149,8 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
|
||||
// Collect all of the views which want to be laid out
|
||||
for (int i = 0; i < count; i++) {
|
||||
StatusIconDisplayable icon = (StatusIconDisplayable) getChildAt(i);
|
||||
if (icon.isIconVisible() && !icon.isIconBlocked()) {
|
||||
if (icon.isIconVisible() && !icon.isIconBlocked()
|
||||
&& !mIgnoredSlots.contains(icon.getSlot())) {
|
||||
mMeasureViews.add((View) icon);
|
||||
}
|
||||
}
|
||||
@@ -204,6 +208,47 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
|
||||
child.setTag(R.id.status_bar_view_state_tag, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a name of an icon slot to be ignored. It will not show up nor be measured
|
||||
* @param slotName name of the icon as it exists in
|
||||
* frameworks/base/core/res/res/values/config.xml
|
||||
*/
|
||||
public void addIgnoredSlot(String slotName) {
|
||||
addIgnoredSlotInternal(slotName);
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a list of slots to be ignored
|
||||
* @param slots names of the icons to ignore
|
||||
*/
|
||||
public void addIgnoredSlots(List<String> slots) {
|
||||
for (String slot : slots) {
|
||||
addIgnoredSlotInternal(slot);
|
||||
}
|
||||
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
private void addIgnoredSlotInternal(String slotName) {
|
||||
if (!mIgnoredSlots.contains(slotName)) {
|
||||
mIgnoredSlots.add(slotName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a slot from the list of ignored icon slots. It will then be shown when set to visible
|
||||
* by the {@link StatusBarIconController}.
|
||||
* @param slotName name of the icon slot to remove from the ignored list
|
||||
*/
|
||||
public void removeIgnoredSlot(String slotName) {
|
||||
if (mIgnoredSlots.contains(slotName)) {
|
||||
mIgnoredSlots.remove(slotName);
|
||||
}
|
||||
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout is happening from end -> start
|
||||
*/
|
||||
@@ -223,7 +268,8 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
|
||||
StatusIconDisplayable iconView = (StatusIconDisplayable) child;
|
||||
StatusIconState childState = getViewStateFromChild(child);
|
||||
|
||||
if (!iconView.isIconVisible() || iconView.isIconBlocked()) {
|
||||
if (!iconView.isIconVisible() || iconView.isIconBlocked()
|
||||
|| mIgnoredSlots.contains(iconView.getSlot())) {
|
||||
childState.visibleState = STATE_HIDDEN;
|
||||
if (DEBUG) Log.d(TAG, "skipping child (" + iconView.getSlot() + ") not visible");
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user