summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server
diff options
context:
space:
mode:
authorChris Miller <chris@redyeti.net>2010-07-10 22:27:14 +0100
committerChris Miller <chris@redyeti.net>2010-07-11 15:21:49 -0700
commitc254e65a7070252943b23f32540eac6472e941e4 (patch)
treec503892b1dc899ea620897b636e6309786eb7e0b /services/java/com/android/server
parent39a5d188dd20bdebee7a1da4e1f57455739c016f (diff)
downloadframeworks_base-c254e65a7070252943b23f32540eac6472e941e4.zip
frameworks_base-c254e65a7070252943b23f32540eac6472e941e4.tar.gz
frameworks_base-c254e65a7070252943b23f32540eac6472e941e4.tar.bz2
Added dBm level to the status bar.
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r--services/java/com/android/server/status/IconData.java42
-rw-r--r--services/java/com/android/server/status/StatusBarIcon.java24
-rw-r--r--services/java/com/android/server/status/StatusBarPolicy.java22
3 files changed, 72 insertions, 16 deletions
diff --git a/services/java/com/android/server/status/IconData.java b/services/java/com/android/server/status/IconData.java
index 3eafdfe..9aaaba1 100644
--- a/services/java/com/android/server/status/IconData.java
+++ b/services/java/com/android/server/status/IconData.java
@@ -16,6 +16,7 @@
package com.android.server.status;
+import android.provider.Settings;
import android.util.Slog;
public class IconData {
@@ -35,6 +36,13 @@ public class IconData {
public static final int ICON_NUMBER = 3;
/**
+ * Default colors to use for any text appearing on each type of icon.
+ */
+ private static final int DEFAULT_TEXT_COLOR = 0xff000000;
+ private static final int DEFAULT_ICON_COLOR = 0xffffffff;
+ private static final int DEFAULT_ICON_NUMBER_COLOR = 0xffffffff;
+
+ /**
* The type of this item. One of TEXT, ICON, or LEVEL_ICON.
*/
public int type;
@@ -70,6 +78,23 @@ public class IconData {
*/
public CharSequence text;
+ /**
+ * The default color of any text associated with this icon.
+ */
+ public int textColor;
+
+ /**
+ * The system setting that holds the text color for this icon.
+ */
+ public String colorSetting;
+
+ /**
+ * The system setting that determines whether the icon is visible or not.
+ * Currently this only applies to the TEXT type.
+ */
+ public String visibleSetting;
+ public boolean defVisibility;
+
private IconData() {
}
@@ -82,19 +107,26 @@ public class IconData {
data.iconId = iconId;
data.iconLevel = iconLevel;
data.number = number;
+ data.textColor = DEFAULT_ICON_COLOR;
+ data.colorSetting = Settings.System.NOTIF_COUNT_COLOR;
return data;
}
- public static IconData makeText(String slot, CharSequence text) {
+ public static IconData makeText(String slot, CharSequence text, String colorSetting,
+ String visibleSetting, boolean defVisibility) {
IconData data = new IconData();
data.type = TEXT;
data.slot = slot;
data.text = text;
+ data.textColor = DEFAULT_TEXT_COLOR;
+ data.colorSetting = colorSetting;
+ data.visibleSetting = visibleSetting;
+ data.defVisibility = defVisibility;
return data;
}
public static IconData makeIconNumber(String slot,
- String iconPackage, int iconId, int iconLevel, int number) {
+ String iconPackage, int iconId, int iconLevel, int number, String colorSetting) {
IconData data = new IconData();
data.type = ICON_NUMBER;
data.slot = slot;
@@ -102,6 +134,8 @@ public class IconData {
data.iconId = iconId;
data.iconLevel = iconLevel;
data.number = number;
+ data.textColor = DEFAULT_ICON_NUMBER_COLOR;
+ data.colorSetting = colorSetting;
return data;
}
@@ -113,6 +147,10 @@ public class IconData {
this.iconLevel = that.iconLevel;
this.number = that.number;
this.text = that.text; // should we clone this?
+ this.textColor = that.textColor;
+ this.colorSetting = that.colorSetting;
+ this.visibleSetting = that.visibleSetting;
+ this.defVisibility = that.defVisibility;
}
public IconData clone() {
diff --git a/services/java/com/android/server/status/StatusBarIcon.java b/services/java/com/android/server/status/StatusBarIcon.java
index 3f211d9..d8986fc 100644
--- a/services/java/com/android/server/status/StatusBarIcon.java
+++ b/services/java/com/android/server/status/StatusBarIcon.java
@@ -74,10 +74,10 @@ class StatusBarIcon {
t.setText(data.text);
this.view = t;
- clockColor = Settings.System.getInt(mContext.getContentResolver(), Settings.System.CLOCK_COLOR, clockColor);
- t.setTextColor(clockColor);
+ data.textColor = Settings.System.getInt(mContext.getContentResolver(), data.colorSetting, data.textColor);
+ t.setTextColor(data.textColor);
- if (getBoolean(Settings.System.SHOW_STATUS_CLOCK, true)) {
+ if (getBoolean(context, data.visibleSetting, data.defVisibility)) {
t.setVisibility(View.VISIBLE);
}
else {
@@ -105,9 +105,9 @@ class StatusBarIcon {
mNumberView = nv;
if (data.number > 0) {
nv.setText("" + data.number);
- notifCountColor = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.NOTIF_COUNT_COLOR, notifCountColor);
- nv.setTextColor(notifCountColor);
+ data.textColor = Settings.System.getInt(mContext.getContentResolver(),
+ data.colorSetting, data.textColor);
+ nv.setTextColor(data.textColor);
nv.setVisibility(View.VISIBLE);
} else {
nv.setVisibility(View.GONE);
@@ -155,10 +155,10 @@ class StatusBarIcon {
mNumberView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
}
- mNumberView.setBackgroundDrawable(null);
- batteryPercentColor = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.BATTERY_PERCENTAGE_STATUS_COLOR, batteryPercentColor);
- mNumberView.setTextColor(batteryPercentColor);
+ mNumberView.setBackgroundDrawable(null);
+ data.textColor = Settings.System.getInt(context.getContentResolver(),
+ data.colorSetting, data.textColor);
+ mNumberView.setTextColor(data.textColor);
mNumberView.setTextSize(12);
if (data.number == 100) {
@@ -262,8 +262,8 @@ class StatusBarIcon {
int getNumber() {
return mData.number;
}
- private boolean getBoolean(String systemSettingKey, boolean defaultValue) {
- return 1 == android.provider.Settings.System.getInt(mContext.getContentResolver(), systemSettingKey, defaultValue ? 1 : 0);
+ private boolean getBoolean(Context context, String systemSettingKey, boolean defaultValue) {
+ return 1 == android.provider.Settings.System.getInt(context.getContentResolver(), systemSettingKey, defaultValue ? 1 : 0);
}
}
diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java
index b202a28..452662c 100644
--- a/services/java/com/android/server/status/StatusBarPolicy.java
+++ b/services/java/com/android/server/status/StatusBarPolicy.java
@@ -122,6 +122,9 @@ public class StatusBarPolicy {
//***** Signal strength icons
private IconData mPhoneData;
+ private IBinder mPhoneDbmIcon;
+ private IconData mPhoneDbmData;
+
//GSM/UMTS
private static final int[] sSignalImages = new int[] {
com.android.internal.R.drawable.stat_sys_signal_0,
@@ -418,7 +421,7 @@ public class StatusBarPolicy {
// clock
mCalendar = Calendar.getInstance(TimeZone.getDefault());
- mClockData = IconData.makeText("clock", "");
+ mClockData = IconData.makeText("clock", "", Settings.System.CLOCK_COLOR, Settings.System.SHOW_STATUS_CLOCK, true);
mClockIcon = service.addIcon(mClockData, null);
updateClock();
@@ -429,7 +432,8 @@ public class StatusBarPolicy {
// battery
mBatteryData = IconData.makeIconNumber("battery",
- null, com.android.internal.R.drawable.stat_sys_battery_unknown, 0, 0);
+ null, com.android.internal.R.drawable.stat_sys_battery_unknown, 0, 0,
+ Settings.System.BATTERY_PERCENTAGE_STATUS_COLOR);
mBatteryIcon = service.addIcon(mBatteryData, null);
// phone_signal
@@ -438,6 +442,10 @@ public class StatusBarPolicy {
null, com.android.internal.R.drawable.stat_sys_signal_null, 0, 0);
mPhoneIcon = service.addIcon(mPhoneData, null);
+ // dbm signal level
+ mPhoneDbmData = IconData.makeText("phone_dbm_signal", "", Settings.System.DBM_COLOR, Settings.System.SHOW_STATUS_DBM, false);
+ mPhoneDbmIcon = service.addIcon(mPhoneDbmData, null);
+
// register for phone state notifications.
((TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE))
.listen(mPhoneStateListener,
@@ -994,6 +1002,7 @@ public class StatusBarPolicy {
private final void updateSignalStrength() {
int iconLevel = -1;
+ int dBm = 0;
int[] iconList;
// Display signal strength while in "emergency calls only" mode
@@ -1006,6 +1015,7 @@ public class StatusBarPolicy {
mPhoneData.iconId = com.android.internal.R.drawable.stat_sys_signal_null;
}
mService.updateIcon(mPhoneIcon, mPhoneData, null);
+ mService.updateIcon(mPhoneDbmIcon, mPhoneDbmData, null);
return;
}
@@ -1022,6 +1032,10 @@ public class StatusBarPolicy {
else if (asu >= 5) iconLevel = 2;
else iconLevel = 1;
+ if (asu != 99) {
+ dBm = asu * 2 - 113;
+ }
+
// Though mPhone is a Manager, this call is not an IPC
if (mPhone.isNetworkRoaming()) {
iconList = sSignalImages_r;
@@ -1036,15 +1050,19 @@ public class StatusBarPolicy {
// If a voice call is made then RSSI should switch to 1x.
if ((mPhoneState == TelephonyManager.CALL_STATE_IDLE) && isEvdo()){
iconLevel = getEvdoLevel();
+ dBm = mSignalStrength.getEvdoDbm();
if (false) {
Slog.d(TAG, "use Evdo level=" + iconLevel + " to replace Cdma Level=" + getCdmaLevel());
}
} else {
iconLevel = getCdmaLevel();
+ dBm = mSignalStrength.getCdmaDbm();
}
}
mPhoneData.iconId = iconList[iconLevel];
mService.updateIcon(mPhoneIcon, mPhoneData, null);
+ mPhoneDbmData.text = Integer.toString(dBm);
+ mService.updateIcon(mPhoneDbmIcon, mPhoneDbmData, null);
}
private int getCdmaLevel() {