Merge changes from topic "ccassidy-sbil" into tm-qpr-dev
* changes: [Status Bar Refactor] Improvements to StatusBarIconList: [Status Bar Refactor] Move StatusBarIconListTest to the same directory as StatusBarIconList.
This commit is contained in:
committed by
Android (Google) Code Review
commit
758b4a3eb9
@@ -68,6 +68,7 @@ import com.android.systemui.statusbar.phone.ManagedProfileController;
|
|||||||
import com.android.systemui.statusbar.phone.ManagedProfileControllerImpl;
|
import com.android.systemui.statusbar.phone.ManagedProfileControllerImpl;
|
||||||
import com.android.systemui.statusbar.phone.StatusBarIconController;
|
import com.android.systemui.statusbar.phone.StatusBarIconController;
|
||||||
import com.android.systemui.statusbar.phone.StatusBarIconControllerImpl;
|
import com.android.systemui.statusbar.phone.StatusBarIconControllerImpl;
|
||||||
|
import com.android.systemui.statusbar.phone.StatusBarIconList;
|
||||||
import com.android.systemui.statusbar.phone.StatusBarRemoteInputCallback;
|
import com.android.systemui.statusbar.phone.StatusBarRemoteInputCallback;
|
||||||
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
|
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
|
||||||
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallFlags;
|
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallFlags;
|
||||||
@@ -252,6 +253,16 @@ public interface CentralSurfacesDependenciesModule {
|
|||||||
StatusBarIconController provideStatusBarIconController(
|
StatusBarIconController provideStatusBarIconController(
|
||||||
StatusBarIconControllerImpl controllerImpl);
|
StatusBarIconControllerImpl controllerImpl);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
@Provides
|
||||||
|
@SysUISingleton
|
||||||
|
static StatusBarIconList provideStatusBarIconList(Context context) {
|
||||||
|
return new StatusBarIconList(
|
||||||
|
context.getResources().getStringArray(
|
||||||
|
com.android.internal.R.array.config_statusBarIcons));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.phone;
|
package com.android.systemui.statusbar.phone;
|
||||||
|
|
||||||
|
import static com.android.systemui.statusbar.phone.StatusBarIconList.Slot;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
@@ -56,11 +58,12 @@ import javax.inject.Inject;
|
|||||||
* registered with it.
|
* registered with it.
|
||||||
*/
|
*/
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
public class StatusBarIconControllerImpl extends StatusBarIconList implements Tunable,
|
public class StatusBarIconControllerImpl implements Tunable,
|
||||||
ConfigurationListener, Dumpable, CommandQueue.Callbacks, StatusBarIconController, DemoMode {
|
ConfigurationListener, Dumpable, CommandQueue.Callbacks, StatusBarIconController, DemoMode {
|
||||||
|
|
||||||
private static final String TAG = "StatusBarIconController";
|
private static final String TAG = "StatusBarIconController";
|
||||||
|
|
||||||
|
private final StatusBarIconList mStatusBarIconList;
|
||||||
private final ArrayList<IconManager> mIconGroups = new ArrayList<>();
|
private final ArrayList<IconManager> mIconGroups = new ArrayList<>();
|
||||||
private final ArraySet<String> mIconHideList = new ArraySet<>();
|
private final ArraySet<String> mIconHideList = new ArraySet<>();
|
||||||
|
|
||||||
@@ -74,15 +77,12 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
DemoModeController demoModeController,
|
DemoModeController demoModeController,
|
||||||
ConfigurationController configurationController,
|
ConfigurationController configurationController,
|
||||||
TunerService tunerService,
|
TunerService tunerService,
|
||||||
DumpManager dumpManager) {
|
DumpManager dumpManager,
|
||||||
super(context.getResources().getStringArray(
|
StatusBarIconList statusBarIconList) {
|
||||||
com.android.internal.R.array.config_statusBarIcons));
|
mStatusBarIconList = statusBarIconList;
|
||||||
configurationController.addCallback(this);
|
|
||||||
|
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
loadDimens();
|
configurationController.addCallback(this);
|
||||||
|
|
||||||
commandQueue.addCallback(this);
|
commandQueue.addCallback(this);
|
||||||
tunerService.addTunable(this, ICON_HIDE_LIST);
|
tunerService.addTunable(this, ICON_HIDE_LIST);
|
||||||
demoModeController.addCallback(this);
|
demoModeController.addCallback(this);
|
||||||
@@ -101,15 +101,14 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
|
|
||||||
group.setController(this);
|
group.setController(this);
|
||||||
mIconGroups.add(group);
|
mIconGroups.add(group);
|
||||||
List<Slot> allSlots = getSlots();
|
List<Slot> allSlots = mStatusBarIconList.getSlots();
|
||||||
for (int i = 0; i < allSlots.size(); i++) {
|
for (int i = 0; i < allSlots.size(); i++) {
|
||||||
Slot slot = allSlots.get(i);
|
Slot slot = allSlots.get(i);
|
||||||
List<StatusBarIconHolder> holders = slot.getHolderListInViewOrder();
|
List<StatusBarIconHolder> holders = slot.getHolderListInViewOrder();
|
||||||
boolean hidden = mIconHideList.contains(slot.getName());
|
boolean hidden = mIconHideList.contains(slot.getName());
|
||||||
|
|
||||||
for (StatusBarIconHolder holder : holders) {
|
for (StatusBarIconHolder holder : holders) {
|
||||||
int tag = holder.getTag();
|
int viewIndex = mStatusBarIconList.getViewIndex(slot.getName(), holder.getTag());
|
||||||
int viewIndex = getViewIndex(getSlotIndex(slot.getName()), holder.getTag());
|
|
||||||
group.onIconAdded(viewIndex, slot.getName(), hidden, holder);
|
group.onIconAdded(viewIndex, slot.getName(), hidden, holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,7 +143,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
}
|
}
|
||||||
mIconHideList.clear();
|
mIconHideList.clear();
|
||||||
mIconHideList.addAll(StatusBarIconController.getIconHideList(mContext, newValue));
|
mIconHideList.addAll(StatusBarIconController.getIconHideList(mContext, newValue));
|
||||||
ArrayList<Slot> currentSlots = getSlots();
|
List<Slot> currentSlots = mStatusBarIconList.getSlots();
|
||||||
ArrayMap<Slot, List<StatusBarIconHolder>> slotsToReAdd = new ArrayMap<>();
|
ArrayMap<Slot, List<StatusBarIconHolder>> slotsToReAdd = new ArrayMap<>();
|
||||||
|
|
||||||
// This is a little hacky... Peel off all of the holders on all of the slots
|
// This is a little hacky... Peel off all of the holders on all of the slots
|
||||||
@@ -163,17 +162,13 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
List<StatusBarIconHolder> iconsForSlot = slotsToReAdd.get(item);
|
List<StatusBarIconHolder> iconsForSlot = slotsToReAdd.get(item);
|
||||||
if (iconsForSlot == null) continue;
|
if (iconsForSlot == null) continue;
|
||||||
for (StatusBarIconHolder holder : iconsForSlot) {
|
for (StatusBarIconHolder holder : iconsForSlot) {
|
||||||
setIcon(getSlotIndex(item.getName()), holder);
|
setIcon(item.getName(), holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadDimens() {
|
private void addSystemIcon(String slot, StatusBarIconHolder holder) {
|
||||||
}
|
int viewIndex = mStatusBarIconList.getViewIndex(slot, holder.getTag());
|
||||||
|
|
||||||
private void addSystemIcon(int index, StatusBarIconHolder holder) {
|
|
||||||
String slot = getSlotName(index);
|
|
||||||
int viewIndex = getViewIndex(index, holder.getTag());
|
|
||||||
boolean hidden = mIconHideList.contains(slot);
|
boolean hidden = mIconHideList.contains(slot);
|
||||||
|
|
||||||
mIconGroups.forEach(l -> l.onIconAdded(viewIndex, slot, hidden, holder));
|
mIconGroups.forEach(l -> l.onIconAdded(viewIndex, slot, hidden, holder));
|
||||||
@@ -182,18 +177,17 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
/** */
|
/** */
|
||||||
@Override
|
@Override
|
||||||
public void setIcon(String slot, int resourceId, CharSequence contentDescription) {
|
public void setIcon(String slot, int resourceId, CharSequence contentDescription) {
|
||||||
int index = getSlotIndex(slot);
|
StatusBarIconHolder holder = mStatusBarIconList.getIconHolder(slot, 0);
|
||||||
StatusBarIconHolder holder = getIcon(index, 0);
|
|
||||||
if (holder == null) {
|
if (holder == null) {
|
||||||
StatusBarIcon icon = new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(),
|
StatusBarIcon icon = new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(),
|
||||||
Icon.createWithResource(
|
Icon.createWithResource(
|
||||||
mContext, resourceId), 0, 0, contentDescription);
|
mContext, resourceId), 0, 0, contentDescription);
|
||||||
holder = StatusBarIconHolder.fromIcon(icon);
|
holder = StatusBarIconHolder.fromIcon(icon);
|
||||||
setIcon(index, holder);
|
setIcon(slot, holder);
|
||||||
} else {
|
} else {
|
||||||
holder.getIcon().icon = Icon.createWithResource(mContext, resourceId);
|
holder.getIcon().icon = Icon.createWithResource(mContext, resourceId);
|
||||||
holder.getIcon().contentDescription = contentDescription;
|
holder.getIcon().contentDescription = contentDescription;
|
||||||
handleSet(index, holder);
|
handleSet(slot, holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,21 +197,18 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setSignalIcon(String slot, WifiIconState state) {
|
public void setSignalIcon(String slot, WifiIconState state) {
|
||||||
|
|
||||||
int index = getSlotIndex(slot);
|
|
||||||
|
|
||||||
if (state == null) {
|
if (state == null) {
|
||||||
removeIcon(index, 0);
|
removeIcon(slot, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBarIconHolder holder = getIcon(index, 0);
|
StatusBarIconHolder holder = mStatusBarIconList.getIconHolder(slot, 0);
|
||||||
if (holder == null) {
|
if (holder == null) {
|
||||||
holder = StatusBarIconHolder.fromWifiIconState(state);
|
holder = StatusBarIconHolder.fromWifiIconState(state);
|
||||||
setIcon(index, holder);
|
setIcon(slot, holder);
|
||||||
} else {
|
} else {
|
||||||
holder.setWifiState(state);
|
holder.setWifiState(state);
|
||||||
handleSet(index, holder);
|
handleSet(slot, holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,8 +220,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setMobileIcons(String slot, List<MobileIconState> iconStates) {
|
public void setMobileIcons(String slot, List<MobileIconState> iconStates) {
|
||||||
Slot mobileSlot = getSlot(slot);
|
Slot mobileSlot = mStatusBarIconList.getSlot(slot);
|
||||||
int slotIndex = getSlotIndex(slot);
|
|
||||||
|
|
||||||
// Reverse the sort order to show icons with left to right([Slot1][Slot2]..).
|
// Reverse the sort order to show icons with left to right([Slot1][Slot2]..).
|
||||||
// StatusBarIconList has UI design that first items go to the right of second items.
|
// StatusBarIconList has UI design that first items go to the right of second items.
|
||||||
@@ -241,10 +231,10 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
StatusBarIconHolder holder = mobileSlot.getHolderForTag(state.subId);
|
StatusBarIconHolder holder = mobileSlot.getHolderForTag(state.subId);
|
||||||
if (holder == null) {
|
if (holder == null) {
|
||||||
holder = StatusBarIconHolder.fromMobileIconState(state);
|
holder = StatusBarIconHolder.fromMobileIconState(state);
|
||||||
setIcon(slotIndex, holder);
|
setIcon(slot, holder);
|
||||||
} else {
|
} else {
|
||||||
holder.setMobileState(state);
|
holder.setMobileState(state);
|
||||||
handleSet(slotIndex, holder);
|
handleSet(slot, holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,21 +246,19 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setCallStrengthIcons(String slot, List<CallIndicatorIconState> states) {
|
public void setCallStrengthIcons(String slot, List<CallIndicatorIconState> states) {
|
||||||
Slot callStrengthSlot = getSlot(slot);
|
Slot callStrengthSlot = mStatusBarIconList.getSlot(slot);
|
||||||
int callStrengthSlotIndex = getSlotIndex(slot);
|
|
||||||
Collections.reverse(states);
|
Collections.reverse(states);
|
||||||
for (CallIndicatorIconState state : states) {
|
for (CallIndicatorIconState state : states) {
|
||||||
if (!state.isNoCalling) {
|
if (!state.isNoCalling) {
|
||||||
StatusBarIconHolder holder = callStrengthSlot.getHolderForTag(state.subId);
|
StatusBarIconHolder holder = callStrengthSlot.getHolderForTag(state.subId);
|
||||||
if (holder == null) {
|
if (holder == null) {
|
||||||
holder = StatusBarIconHolder.fromCallIndicatorState(mContext, state);
|
holder = StatusBarIconHolder.fromCallIndicatorState(mContext, state);
|
||||||
setIcon(callStrengthSlotIndex, holder);
|
|
||||||
} else {
|
} else {
|
||||||
holder.setIcon(new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(),
|
holder.setIcon(new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(),
|
||||||
Icon.createWithResource(mContext, state.callStrengthResId), 0, 0,
|
Icon.createWithResource(mContext, state.callStrengthResId), 0, 0,
|
||||||
state.callStrengthDescription));
|
state.callStrengthDescription));
|
||||||
setIcon(callStrengthSlotIndex, holder);
|
|
||||||
}
|
}
|
||||||
|
setIcon(slot, holder);
|
||||||
}
|
}
|
||||||
setIconVisibility(slot, !state.isNoCalling, state.subId);
|
setIconVisibility(slot, !state.isNoCalling, state.subId);
|
||||||
}
|
}
|
||||||
@@ -283,21 +271,19 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setNoCallingIcons(String slot, List<CallIndicatorIconState> states) {
|
public void setNoCallingIcons(String slot, List<CallIndicatorIconState> states) {
|
||||||
Slot noCallingSlot = getSlot(slot);
|
Slot noCallingSlot = mStatusBarIconList.getSlot(slot);
|
||||||
int noCallingSlotIndex = getSlotIndex(slot);
|
|
||||||
Collections.reverse(states);
|
Collections.reverse(states);
|
||||||
for (CallIndicatorIconState state : states) {
|
for (CallIndicatorIconState state : states) {
|
||||||
if (state.isNoCalling) {
|
if (state.isNoCalling) {
|
||||||
StatusBarIconHolder holder = noCallingSlot.getHolderForTag(state.subId);
|
StatusBarIconHolder holder = noCallingSlot.getHolderForTag(state.subId);
|
||||||
if (holder == null) {
|
if (holder == null) {
|
||||||
holder = StatusBarIconHolder.fromCallIndicatorState(mContext, state);
|
holder = StatusBarIconHolder.fromCallIndicatorState(mContext, state);
|
||||||
setIcon(noCallingSlotIndex, holder);
|
|
||||||
} else {
|
} else {
|
||||||
holder.setIcon(new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(),
|
holder.setIcon(new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(),
|
||||||
Icon.createWithResource(mContext, state.noCallingResId), 0, 0,
|
Icon.createWithResource(mContext, state.noCallingResId), 0, 0,
|
||||||
state.noCallingDescription));
|
state.noCallingDescription));
|
||||||
setIcon(noCallingSlotIndex, holder);
|
|
||||||
}
|
}
|
||||||
|
setIcon(slot, holder);
|
||||||
}
|
}
|
||||||
setIconVisibility(slot, state.isNoCalling, state.subId);
|
setIconVisibility(slot, state.isNoCalling, state.subId);
|
||||||
}
|
}
|
||||||
@@ -305,42 +291,31 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExternalIcon(String slot) {
|
public void setExternalIcon(String slot) {
|
||||||
int viewIndex = getViewIndex(getSlotIndex(slot), 0);
|
int viewIndex = mStatusBarIconList.getViewIndex(slot, 0);
|
||||||
int height = mContext.getResources().getDimensionPixelSize(
|
int height = mContext.getResources().getDimensionPixelSize(
|
||||||
R.dimen.status_bar_icon_drawing_size);
|
R.dimen.status_bar_icon_drawing_size);
|
||||||
mIconGroups.forEach(l -> l.onIconExternal(viewIndex, height));
|
mIconGroups.forEach(l -> l.onIconExternal(viewIndex, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: remove this (used in command queue and for 3rd party tiles?)
|
//TODO: remove this (used in command queue and for 3rd party tiles?)
|
||||||
@Override
|
|
||||||
public void setIcon(String slot, StatusBarIcon icon) {
|
public void setIcon(String slot, StatusBarIcon icon) {
|
||||||
setIcon(getSlotIndex(slot), icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For backwards compatibility, in the event that someone gives us a slot and a status bar icon
|
|
||||||
*/
|
|
||||||
private void setIcon(int index, StatusBarIcon icon) {
|
|
||||||
String slot = getSlotName(index);
|
|
||||||
if (icon == null) {
|
if (icon == null) {
|
||||||
removeAllIconsForSlot(slot);
|
removeAllIconsForSlot(slot);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBarIconHolder holder = StatusBarIconHolder.fromIcon(icon);
|
StatusBarIconHolder holder = StatusBarIconHolder.fromIcon(icon);
|
||||||
setIcon(index, holder);
|
setIcon(slot, holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
private void setIcon(String slot, @NonNull StatusBarIconHolder holder) {
|
||||||
@Override
|
boolean isNew = mStatusBarIconList.getIconHolder(slot, holder.getTag()) == null;
|
||||||
public void setIcon(int index, @NonNull StatusBarIconHolder holder) {
|
mStatusBarIconList.setIcon(slot, holder);
|
||||||
boolean isNew = getIcon(index, holder.getTag()) == null;
|
|
||||||
super.setIcon(index, holder);
|
|
||||||
|
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
addSystemIcon(index, holder);
|
addSystemIcon(slot, holder);
|
||||||
} else {
|
} else {
|
||||||
handleSet(index, holder);
|
handleSet(slot, holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,34 +326,33 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
|
|
||||||
/** */
|
/** */
|
||||||
public void setIconVisibility(String slot, boolean visibility, int tag) {
|
public void setIconVisibility(String slot, boolean visibility, int tag) {
|
||||||
int index = getSlotIndex(slot);
|
StatusBarIconHolder holder = mStatusBarIconList.getIconHolder(slot, tag);
|
||||||
StatusBarIconHolder holder = getIcon(index, tag);
|
|
||||||
if (holder == null || holder.isVisible() == visibility) {
|
if (holder == null || holder.isVisible() == visibility) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.setVisible(visibility);
|
holder.setVisible(visibility);
|
||||||
handleSet(index, holder);
|
handleSet(slot, holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@Override
|
@Override
|
||||||
public void setIconAccessibilityLiveRegion(String slotName, int accessibilityLiveRegion) {
|
public void setIconAccessibilityLiveRegion(String slotName, int accessibilityLiveRegion) {
|
||||||
Slot slot = getSlot(slotName);
|
Slot slot = mStatusBarIconList.getSlot(slotName);
|
||||||
if (!slot.hasIconsInSlot()) {
|
if (!slot.hasIconsInSlot()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int slotIndex = getSlotIndex(slotName);
|
|
||||||
List<StatusBarIconHolder> iconsToUpdate = slot.getHolderListInViewOrder();
|
List<StatusBarIconHolder> iconsToUpdate = slot.getHolderListInViewOrder();
|
||||||
for (StatusBarIconHolder holder : iconsToUpdate) {
|
for (StatusBarIconHolder holder : iconsToUpdate) {
|
||||||
int viewIndex = getViewIndex(slotIndex, holder.getTag());
|
int viewIndex = mStatusBarIconList.getViewIndex(slotName, holder.getTag());
|
||||||
mIconGroups.forEach(l -> l.mGroup.getChildAt(viewIndex)
|
mIconGroups.forEach(l -> l.mGroup.getChildAt(viewIndex)
|
||||||
.setAccessibilityLiveRegion(accessibilityLiveRegion));
|
.setAccessibilityLiveRegion(accessibilityLiveRegion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
|
@Override
|
||||||
public void removeIcon(String slot) {
|
public void removeIcon(String slot) {
|
||||||
removeAllIconsForSlot(slot);
|
removeAllIconsForSlot(slot);
|
||||||
}
|
}
|
||||||
@@ -386,39 +360,34 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
/** */
|
/** */
|
||||||
@Override
|
@Override
|
||||||
public void removeIcon(String slot, int tag) {
|
public void removeIcon(String slot, int tag) {
|
||||||
removeIcon(getSlotIndex(slot), tag);
|
if (mStatusBarIconList.getIconHolder(slot, tag) == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int viewIndex = mStatusBarIconList.getViewIndex(slot, tag);
|
||||||
|
mStatusBarIconList.removeIcon(slot, tag);
|
||||||
|
mIconGroups.forEach(l -> l.onRemoveIcon(viewIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@Override
|
@Override
|
||||||
public void removeAllIconsForSlot(String slotName) {
|
public void removeAllIconsForSlot(String slotName) {
|
||||||
Slot slot = getSlot(slotName);
|
Slot slot = mStatusBarIconList.getSlot(slotName);
|
||||||
if (!slot.hasIconsInSlot()) {
|
if (!slot.hasIconsInSlot()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int slotIndex = getSlotIndex(slotName);
|
|
||||||
List<StatusBarIconHolder> iconsToRemove = slot.getHolderListInViewOrder();
|
List<StatusBarIconHolder> iconsToRemove = slot.getHolderListInViewOrder();
|
||||||
for (StatusBarIconHolder holder : iconsToRemove) {
|
for (StatusBarIconHolder holder : iconsToRemove) {
|
||||||
int viewIndex = getViewIndex(slotIndex, holder.getTag());
|
int viewIndex = mStatusBarIconList.getViewIndex(slotName, holder.getTag());
|
||||||
slot.removeForTag(holder.getTag());
|
slot.removeForTag(holder.getTag());
|
||||||
mIconGroups.forEach(l -> l.onRemoveIcon(viewIndex));
|
mIconGroups.forEach(l -> l.onRemoveIcon(viewIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
|
||||||
@Override
|
|
||||||
public void removeIcon(int index, int tag) {
|
|
||||||
if (getIcon(index, tag) == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
super.removeIcon(index, tag);
|
|
||||||
int viewIndex = getViewIndex(index, 0);
|
|
||||||
mIconGroups.forEach(l -> l.onRemoveIcon(viewIndex));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleSet(int index, StatusBarIconHolder holder) {
|
|
||||||
int viewIndex = getViewIndex(index, holder.getTag());
|
private void handleSet(String slotName, StatusBarIconHolder holder) {
|
||||||
|
int viewIndex = mStatusBarIconList.getViewIndex(slotName, holder.getTag());
|
||||||
mIconGroups.forEach(l -> l.onSetIconHolder(viewIndex, holder));
|
mIconGroups.forEach(l -> l.onSetIconHolder(viewIndex, holder));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,7 +407,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.dump(pw);
|
mStatusBarIconList.dump(pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@@ -482,7 +451,6 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
|||||||
/** */
|
/** */
|
||||||
@Override
|
@Override
|
||||||
public void onDensityOrFontScaleChanged() {
|
public void onDensityOrFontScaleChanged() {
|
||||||
loadDimens();
|
|
||||||
refreshIconGroups();
|
refreshIconGroups();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,13 @@ import com.android.internal.annotations.VisibleForTesting;
|
|||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/** A class holding the list of all the system icons that could be shown in the status bar. */
|
||||||
public class StatusBarIconList {
|
public class StatusBarIconList {
|
||||||
private ArrayList<Slot> mSlots = new ArrayList<>();
|
private final ArrayList<Slot> mSlots = new ArrayList<>();
|
||||||
|
private final List<Slot> mViewOnlySlots = Collections.unmodifiableList(mSlots);
|
||||||
|
|
||||||
public StatusBarIconList(String[] slots) {
|
public StatusBarIconList(String[] slots) {
|
||||||
final int N = slots.length;
|
final int N = slots.length;
|
||||||
@@ -37,48 +40,57 @@ public class StatusBarIconList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSlotIndex(String slot) {
|
/** Returns the list of current slots. */
|
||||||
final int N = mSlots.size();
|
public List<Slot> getSlots() {
|
||||||
for (int i=0; i<N; i++) {
|
return mViewOnlySlots;
|
||||||
Slot item = mSlots.get(i);
|
|
||||||
if (item.getName().equals(slot)) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Auto insert new items at the beginning.
|
|
||||||
mSlots.add(0, new Slot(slot, null));
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ArrayList<Slot> getSlots() {
|
/**
|
||||||
return new ArrayList<>(mSlots);
|
* Gets the slot with the given {@code name}, or creates a new slot if we don't already have a
|
||||||
|
* slot by that name.
|
||||||
|
*
|
||||||
|
* If a new slot is created, that slot will be inserted at the front of the list.
|
||||||
|
*
|
||||||
|
* TODO(b/237533036): Rename this to getOrCreateSlot to make it more clear that it could create
|
||||||
|
* a new slot. Other methods in this class will also create a new slot if we don't have one,
|
||||||
|
* should those be re-named too?
|
||||||
|
*/
|
||||||
|
public Slot getSlot(String name) {
|
||||||
|
return mSlots.get(findOrInsertSlot(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Slot getSlot(String name) {
|
/**
|
||||||
return mSlots.get(getSlotIndex(name));
|
* Sets the icon in {@code holder} to be associated with the slot with the given
|
||||||
|
* {@code slotName}.
|
||||||
|
*/
|
||||||
|
public void setIcon(String slotName, @NonNull StatusBarIconHolder holder) {
|
||||||
|
mSlots.get(findOrInsertSlot(slotName)).addHolder(holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int size() {
|
/**
|
||||||
return mSlots.size();
|
* Removes the icon holder that we had associated with {@code slotName}'s slot at the given
|
||||||
|
* {@code tag}.
|
||||||
|
*/
|
||||||
|
public void removeIcon(String slotName, int tag) {
|
||||||
|
mSlots.get(findOrInsertSlot(slotName)).removeForTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIcon(int index, @NonNull StatusBarIconHolder holder) {
|
/**
|
||||||
mSlots.get(index).addHolder(holder);
|
* Returns the icon holder currently associated with {@code slotName}'s slot at the given
|
||||||
|
* {@code tag}, or null if we don't have one.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public StatusBarIconHolder getIconHolder(String slotName, int tag) {
|
||||||
|
return mSlots.get(findOrInsertSlot(slotName)).getHolderForTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeIcon(int index, int tag) {
|
/**
|
||||||
mSlots.get(index).removeForTag(tag);
|
* Returns the index of the icon in {@code slotName}'s slot at the given {@code tag}.
|
||||||
}
|
*
|
||||||
|
* Note that a single slot can have multiple icons, and this function takes that into account.
|
||||||
public String getSlotName(int index) {
|
*/
|
||||||
return mSlots.get(index).getName();
|
public int getViewIndex(String slotName, int tag) {
|
||||||
}
|
int slotIndex = findOrInsertSlot(slotName);
|
||||||
|
|
||||||
public StatusBarIconHolder getIcon(int index, int tag) {
|
|
||||||
return mSlots.get(index).getHolderForTag(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getViewIndex(int slotIndex, int tag) {
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < slotIndex; i++) {
|
for (int i = 0; i < slotIndex; i++) {
|
||||||
Slot item = mSlots.get(i);
|
Slot item = mSlots.get(i);
|
||||||
@@ -100,6 +112,25 @@ public class StatusBarIconList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int findOrInsertSlot(String slot) {
|
||||||
|
final int N = mSlots.size();
|
||||||
|
for (int i = 0; i < N; i++) {
|
||||||
|
Slot item = mSlots.get(i);
|
||||||
|
if (item.getName().equals(slot)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Auto insert new items at the beginning.
|
||||||
|
mSlots.add(0, new Slot(slot, null));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representing one slot in the status bar system icons view.
|
||||||
|
*
|
||||||
|
* Note that one slot can have multiple icons associated with it.
|
||||||
|
*/
|
||||||
public static class Slot {
|
public static class Slot {
|
||||||
private final String mName;
|
private final String mName;
|
||||||
private StatusBarIconHolder mHolder;
|
private StatusBarIconHolder mHolder;
|
||||||
|
|||||||
@@ -1,4 +1,20 @@
|
|||||||
package com.android.systemui.statusbar;
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.systemui.statusbar.phone;
|
||||||
|
|
||||||
import static com.android.systemui.statusbar.phone.StatusBarIconController.TAG_PRIMARY;
|
import static com.android.systemui.statusbar.phone.StatusBarIconController.TAG_PRIMARY;
|
||||||
|
|
||||||
@@ -9,13 +25,10 @@ import static junit.framework.Assert.assertTrue;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import androidx.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.statusbar.phone.StatusBarIconHolder;
|
|
||||||
import com.android.systemui.statusbar.phone.StatusBarIconList;
|
|
||||||
import com.android.systemui.statusbar.phone.StatusBarIconList.Slot;
|
import com.android.systemui.statusbar.phone.StatusBarIconList.Slot;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -33,28 +46,39 @@ public class StatusBarIconListTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetExistingSlot() {
|
public void testGetExistingSlot() {
|
||||||
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
||||||
assertEquals(1, statusBarIconList.getSlotIndex("bbb"));
|
|
||||||
assertEquals(2, statusBarIconList.getSlotIndex("ccc"));
|
List<Slot> slots = statusBarIconList.getSlots();
|
||||||
|
assertEquals(3, slots.size());
|
||||||
|
assertEquals("aaa", slots.get(0).getName());
|
||||||
|
assertEquals("bbb", slots.get(1).getName());
|
||||||
|
assertEquals("ccc", slots.get(2).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNonexistingSlot() {
|
public void testGetNonexistingSlot() {
|
||||||
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
||||||
assertEquals(0, statusBarIconList.getSlotIndex("aaa"));
|
|
||||||
assertEquals(3, statusBarIconList.size());
|
statusBarIconList.getSlot("zzz");
|
||||||
assertEquals(0, statusBarIconList.getSlotIndex("zzz")); // new content added in front
|
|
||||||
assertEquals(1, statusBarIconList.getSlotIndex("aaa")); // slid back
|
List<Slot> slots = statusBarIconList.getSlots();
|
||||||
assertEquals(4, statusBarIconList.size());
|
assertEquals(4, slots.size());
|
||||||
|
// new content added in front, so zzz should be first and aaa should slide back to second
|
||||||
|
assertEquals("zzz", slots.get(0).getName());
|
||||||
|
assertEquals("aaa", slots.get(1).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddSlotSlidesIcons() {
|
public void testAddSlotSlidesIcons() {
|
||||||
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
||||||
StatusBarIconHolder sbHolder = mock(StatusBarIconHolder.class);
|
StatusBarIconHolder sbHolder = mock(StatusBarIconHolder.class);
|
||||||
statusBarIconList.setIcon(0, sbHolder);
|
statusBarIconList.setIcon("aaa", sbHolder);
|
||||||
statusBarIconList.getSlotIndex("zzz"); // new content added in front
|
|
||||||
assertNull(statusBarIconList.getIcon(0, TAG_PRIMARY));
|
statusBarIconList.getSlot("zzz");
|
||||||
assertEquals(sbHolder, statusBarIconList.getIcon(1, TAG_PRIMARY));
|
|
||||||
|
List<Slot> slots = statusBarIconList.getSlots();
|
||||||
|
// new content added in front, so the holder we set on "aaa" should show up at index 1
|
||||||
|
assertNull(slots.get(0).getHolderForTag(TAG_PRIMARY));
|
||||||
|
assertEquals(sbHolder, slots.get(1).getHolderForTag(TAG_PRIMARY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -62,11 +86,13 @@ public class StatusBarIconListTest extends SysuiTestCase {
|
|||||||
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
||||||
StatusBarIconHolder sbHolderA = mock(StatusBarIconHolder.class);
|
StatusBarIconHolder sbHolderA = mock(StatusBarIconHolder.class);
|
||||||
StatusBarIconHolder sbHolderB = mock(StatusBarIconHolder.class);
|
StatusBarIconHolder sbHolderB = mock(StatusBarIconHolder.class);
|
||||||
statusBarIconList.setIcon(0, sbHolderA);
|
|
||||||
statusBarIconList.setIcon(1, sbHolderB);
|
statusBarIconList.setIcon("aaa", sbHolderA);
|
||||||
assertEquals(sbHolderA, statusBarIconList.getIcon(0, TAG_PRIMARY));
|
statusBarIconList.setIcon("bbb", sbHolderB);
|
||||||
assertEquals(sbHolderB, statusBarIconList.getIcon(1, TAG_PRIMARY));
|
|
||||||
assertNull(statusBarIconList.getIcon(2, TAG_PRIMARY)); // icon not set
|
assertEquals(sbHolderA, statusBarIconList.getIconHolder("aaa", TAG_PRIMARY));
|
||||||
|
assertEquals(sbHolderB, statusBarIconList.getIconHolder("bbb", TAG_PRIMARY));
|
||||||
|
assertNull(statusBarIconList.getIconHolder("ccc", TAG_PRIMARY)); // icon not set
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -74,24 +100,31 @@ public class StatusBarIconListTest extends SysuiTestCase {
|
|||||||
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
||||||
StatusBarIconHolder sbHolderA = mock(StatusBarIconHolder.class);
|
StatusBarIconHolder sbHolderA = mock(StatusBarIconHolder.class);
|
||||||
StatusBarIconHolder sbHolderB = mock(StatusBarIconHolder.class);
|
StatusBarIconHolder sbHolderB = mock(StatusBarIconHolder.class);
|
||||||
statusBarIconList.setIcon(0, sbHolderA);
|
|
||||||
statusBarIconList.setIcon(1, sbHolderB);
|
statusBarIconList.setIcon("aaa", sbHolderA);
|
||||||
statusBarIconList.removeIcon(0, TAG_PRIMARY);
|
statusBarIconList.setIcon("bbb", sbHolderB);
|
||||||
assertNull(statusBarIconList.getIcon(0, TAG_PRIMARY)); // icon not set
|
|
||||||
|
statusBarIconList.removeIcon("aaa", TAG_PRIMARY);
|
||||||
|
|
||||||
|
assertNull(statusBarIconList.getIconHolder("aaa", TAG_PRIMARY)); // icon not set
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetViewIndex_NoMultiples() {
|
public void testGetViewIndex_NoMultiples() {
|
||||||
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
||||||
StatusBarIconHolder sbHolder = mock(StatusBarIconHolder.class);
|
StatusBarIconHolder sbHolder = mock(StatusBarIconHolder.class);
|
||||||
statusBarIconList.setIcon(2, sbHolder);
|
|
||||||
// Icon for item 2 is 0th child view.
|
statusBarIconList.setIcon("ccc", sbHolder);
|
||||||
assertEquals(0, statusBarIconList.getViewIndex(2, TAG_PRIMARY));
|
|
||||||
statusBarIconList.setIcon(0, sbHolder);
|
// Since only "ccc" has a holder set, it should be first
|
||||||
// Icon for item 0 is 0th child view,
|
assertEquals(0, statusBarIconList.getViewIndex("ccc", TAG_PRIMARY));
|
||||||
assertEquals(0, statusBarIconList.getViewIndex(0, TAG_PRIMARY));
|
|
||||||
// and item 2 is now 1st child view.
|
// Now, also set a holder for "aaa"
|
||||||
assertEquals(1, statusBarIconList.getViewIndex(2, TAG_PRIMARY));
|
statusBarIconList.setIcon("aaa", sbHolder);
|
||||||
|
|
||||||
|
// Then "aaa" gets the first view index and "ccc" gets the second
|
||||||
|
assertEquals(0, statusBarIconList.getViewIndex("aaa", TAG_PRIMARY));
|
||||||
|
assertEquals(1, statusBarIconList.getViewIndex("ccc", TAG_PRIMARY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -99,7 +132,7 @@ public class StatusBarIconListTest extends SysuiTestCase {
|
|||||||
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
StatusBarIconList statusBarIconList = new StatusBarIconList(STATUS_BAR_SLOTS);
|
||||||
StatusBarIconHolder sbHolder = mock(StatusBarIconHolder.class);
|
StatusBarIconHolder sbHolder = mock(StatusBarIconHolder.class);
|
||||||
|
|
||||||
statusBarIconList.setIcon(2, sbHolder); // item 2, one icon 0th child
|
statusBarIconList.setIcon("ccc", sbHolder);
|
||||||
|
|
||||||
// All of these can be added to the same slot
|
// All of these can be added to the same slot
|
||||||
// no tag bc it defaults to 0
|
// no tag bc it defaults to 0
|
||||||
@@ -111,23 +144,23 @@ public class StatusBarIconListTest extends SysuiTestCase {
|
|||||||
int sb4Tag = 2;
|
int sb4Tag = 2;
|
||||||
when(sbHolder4.getTag()).thenReturn(sb4Tag);
|
when(sbHolder4.getTag()).thenReturn(sb4Tag);
|
||||||
|
|
||||||
// Put a holder at slot 1, verify that it is first
|
// Put a holder for "bbb", verify that it is first
|
||||||
statusBarIconList.setIcon(1, sbHolder2);
|
statusBarIconList.setIcon("bbb", sbHolder2);
|
||||||
assertEquals(0, statusBarIconList.getViewIndex(1, TAG_PRIMARY));
|
assertEquals(0, statusBarIconList.getViewIndex("bbb", TAG_PRIMARY));
|
||||||
|
|
||||||
// Put another holder at slot 1, verify it's index 0 and the rest come after
|
// Put another holder for "bbb" at slot 1, verify its index 0 and the rest come after
|
||||||
statusBarIconList.setIcon(1, sbHolder3);
|
statusBarIconList.setIcon("bbb", sbHolder3);
|
||||||
assertEquals(0, statusBarIconList.getViewIndex(1, sb3Tag));
|
assertEquals(0, statusBarIconList.getViewIndex("bbb", sb3Tag));
|
||||||
assertEquals(1, statusBarIconList.getViewIndex(1, TAG_PRIMARY));
|
assertEquals(1, statusBarIconList.getViewIndex("bbb", TAG_PRIMARY));
|
||||||
// First icon should be at the end
|
// "ccc" should appear at the end
|
||||||
assertEquals(2, statusBarIconList.getViewIndex(2, TAG_PRIMARY));
|
assertEquals(2, statusBarIconList.getViewIndex("ccc", TAG_PRIMARY));
|
||||||
|
|
||||||
// Put another one in there just for good measure
|
// Put another one in "bbb" just for good measure
|
||||||
statusBarIconList.setIcon(1, sbHolder4);
|
statusBarIconList.setIcon("bbb", sbHolder4);
|
||||||
assertEquals(0, statusBarIconList.getViewIndex(1, sb4Tag));
|
assertEquals(0, statusBarIconList.getViewIndex("bbb", sb4Tag));
|
||||||
assertEquals(1, statusBarIconList.getViewIndex(1, sb3Tag));
|
assertEquals(1, statusBarIconList.getViewIndex("bbb", sb3Tag));
|
||||||
assertEquals(2, statusBarIconList.getViewIndex(1, TAG_PRIMARY));
|
assertEquals(2, statusBarIconList.getViewIndex("bbb", TAG_PRIMARY));
|
||||||
assertEquals(3, statusBarIconList.getViewIndex(2, TAG_PRIMARY));
|
assertEquals(3, statusBarIconList.getViewIndex("ccc", TAG_PRIMARY));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reference in New Issue
Block a user