am 514ad663: Set the visibility of the icons.
This commit is contained in:
@@ -26,6 +26,7 @@ public class StatusBarIcon implements Parcelable {
|
||||
public String iconPackage;
|
||||
public int iconId;
|
||||
public int iconLevel;
|
||||
public boolean visible = true;
|
||||
|
||||
private StatusBarIcon() {
|
||||
}
|
||||
@@ -36,8 +37,15 @@ public class StatusBarIcon implements Parcelable {
|
||||
this.iconLevel = iconLevel;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "StatusBarIcon(pkg=" + this.iconPackage + " id=0x" + Integer.toHexString(this.iconId)
|
||||
+ " level=" + this.iconLevel + " visible=" + visible + ")";
|
||||
}
|
||||
|
||||
public StatusBarIcon clone() {
|
||||
return new StatusBarIcon(this.iconPackage, this.iconId, this.iconLevel);
|
||||
StatusBarIcon that = new StatusBarIcon(this.iconPackage, this.iconId, this.iconLevel);
|
||||
that.visible = this.visible;
|
||||
return that;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,12 +59,14 @@ public class StatusBarIcon implements Parcelable {
|
||||
this.iconPackage = in.readString();
|
||||
this.iconId = in.readInt();
|
||||
this.iconLevel = in.readInt();
|
||||
this.visible = in.readInt() != 0;
|
||||
}
|
||||
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeString(this.iconPackage);
|
||||
out.writeInt(this.iconId);
|
||||
out.writeInt(this.iconLevel);
|
||||
out.writeInt(this.visible ? 1 : 0);
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
|
||||
@@ -155,13 +155,7 @@ public class StatusBarIconList implements Parcelable {
|
||||
final int N = mSlots.length;
|
||||
pw.println("Icon list:");
|
||||
for (int i=0; i<N; i++) {
|
||||
final StatusBarIcon icon = mIcons[i];
|
||||
if (icon == null) {
|
||||
pw.printf(" %2d: (%s) null\n", i, mSlots[i]);
|
||||
} else {
|
||||
pw.printf(" %2d: (%s) pkg=%s id=0x%08x level=%d\n", i, mSlots[i], icon.iconPackage,
|
||||
icon.iconId, icon.iconLevel);
|
||||
}
|
||||
pw.printf(" %2d: (%s) %s\n", i, mSlots[i], mIcons[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,14 @@ package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.statusbar.IStatusBar;
|
||||
import com.android.internal.statusbar.StatusBarIcon;
|
||||
import com.android.internal.statusbar.StatusBarIconList;
|
||||
|
||||
class CommandQueue extends IStatusBar.Stub {
|
||||
private static final String TAG = "StatusBar.CommandQueue";
|
||||
|
||||
private static final int MSG_MASK = 0xffff0000;
|
||||
private static final int INDEX_MASK = 0x0000ffff;
|
||||
|
||||
@@ -359,16 +359,6 @@ public class PhoneStatusBarService extends StatusBarService {
|
||||
}
|
||||
}
|
||||
|
||||
/* private */ void performSetIconVisibility(IBinder key, boolean visible) {
|
||||
synchronized (mIconMap) {
|
||||
if (SPEW) {
|
||||
Slog.d(TAG, "performSetIconVisibility key=" + key + " visible=" + visible);
|
||||
}
|
||||
StatusBarIconData icon = mIconMap.get(key);
|
||||
icon.view.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
StatusBarNotification getNotification(IBinder key) {
|
||||
synchronized (mNotificationData) {
|
||||
return mNotificationData.get(key);
|
||||
|
||||
@@ -54,12 +54,17 @@ public class StatusBarIconView extends AnimatedImageView {
|
||||
&& mIcon.iconId == icon.iconId;
|
||||
final boolean levelEquals = iconEquals
|
||||
&& mIcon.iconLevel == icon.iconLevel;
|
||||
final boolean visibilityEquals = mIcon != null
|
||||
&& mIcon.visible == icon.visible;
|
||||
if (!iconEquals) {
|
||||
setImageDrawable(getIcon(icon));
|
||||
}
|
||||
if (!levelEquals) {
|
||||
setImageLevel(icon.iconLevel);
|
||||
}
|
||||
if (!visibilityEquals) {
|
||||
setVisibility(icon.visible ? VISIBLE : GONE);
|
||||
}
|
||||
mIcon = icon.clone();
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
}
|
||||
|
||||
public void setIcon(String slot, CharSequence text) {
|
||||
|
||||
}
|
||||
|
||||
public void setIcon(String slot, String iconPackage, int iconId, int iconLevel) {
|
||||
@@ -212,6 +211,29 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
public void setIconVisibility(String slot, boolean visible) {
|
||||
enforceStatusBar();
|
||||
|
||||
synchronized (mIcons) {
|
||||
int index = mIcons.getSlotIndex(slot);
|
||||
if (index < 0) {
|
||||
throw new SecurityException("invalid status bar icon slot: " + slot);
|
||||
}
|
||||
|
||||
StatusBarIcon icon = mIcons.getIcon(index);
|
||||
if (icon == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (icon.visible != visible) {
|
||||
icon.visible = visible;
|
||||
|
||||
// Tell the client. If it fails, it'll restart soon and we'll sync up.
|
||||
if (mBar != null) {
|
||||
try {
|
||||
mBar.setIcon(index, icon);
|
||||
} catch (RemoteException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeIcon(String slot) {
|
||||
@@ -380,9 +402,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
return;
|
||||
}
|
||||
|
||||
Slog.d(TAG, "dump!!!");
|
||||
pw.println("status!");
|
||||
|
||||
synchronized (mIcons) {
|
||||
mIcons.dump(pw);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user