Remove unused stuff.

Change-Id: I85864ed242cb39c7298e82cb83beba8f98db6a6d
This commit is contained in:
Joe Onorato
2010-05-17 16:13:12 -07:00
parent 4762c2d75a
commit 6528b35585
6 changed files with 3 additions and 356 deletions

View File

@@ -1,122 +0,0 @@
/*
* Copyright (C) 2008 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.policy.statusbar.phone;
import android.util.Slog;
public class IconData {
/**
* Indicates ths item represents a piece of text.
*/
public static final int TEXT = 1;
/**
* Indicates ths item represents an icon.
*/
public static final int ICON = 2;
/**
* The type of this item. One of TEXT, ICON, or LEVEL_ICON.
*/
public int type;
/**
* The slot that this icon will be in if it is not a notification
*/
public String slot;
/**
* The package containting the icon to draw for this item. Valid if this is
* an ICON type.
*/
public String iconPackage;
/**
* The icon to draw for this item. Valid if this is an ICON type.
*/
public int iconId;
/**
* The level associated with the icon. Valid if this is a LEVEL_ICON type.
*/
public int iconLevel;
/**
* The "count" number.
*/
public int number;
/**
* The text associated with the icon. Valid if this is a TEXT type.
*/
public CharSequence text;
private IconData() {
}
public static IconData makeIcon(String slot,
String iconPackage, int iconId, int iconLevel, int number) {
IconData data = new IconData();
data.type = ICON;
data.slot = slot;
data.iconPackage = iconPackage;
data.iconId = iconId;
data.iconLevel = iconLevel;
data.number = number;
return data;
}
public static IconData makeText(String slot, CharSequence text) {
IconData data = new IconData();
data.type = TEXT;
data.slot = slot;
data.text = text;
return data;
}
public void copyFrom(IconData that) {
this.type = that.type;
this.slot = that.slot;
this.iconPackage = that.iconPackage;
this.iconId = that.iconId;
this.iconLevel = that.iconLevel;
this.number = that.number;
this.text = that.text; // should we clone this?
}
public IconData clone() {
IconData that = new IconData();
that.copyFrom(this);
return that;
}
public String toString() {
if (this.type == TEXT) {
return "IconData(slot=" + (this.slot != null ? "'" + this.slot + "'" : "null")
+ " text='" + this.text + "')";
}
else if (this.type == ICON) {
return "IconData(slot=" + (this.slot != null ? "'" + this.slot + "'" : "null")
+ " package=" + this.iconPackage
+ " iconId=" + Integer.toHexString(this.iconId)
+ " iconLevel=" + this.iconLevel + ")";
}
else {
return "IconData(type=" + type + ")";
}
}
}

View File

@@ -24,7 +24,6 @@ import android.widget.LinearLayout;
public class IconMerger extends LinearLayout {
PhoneStatusBarService service;
StatusBarIconData moreIcon;
public IconMerger(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -117,7 +116,7 @@ public class IconMerger extends LinearLayout {
// and provide the value later. We're the only one changing this value show it
// should be ordered correctly.
if (false) {
this.moreIcon.update(number);
// TODO this.moreIcon.update(number);
} else {
mBugWorkaroundNumber = number;
mBugWorkaroundHandler.post(mBugWorkaroundRunnable);
@@ -128,8 +127,10 @@ public class IconMerger extends LinearLayout {
private Handler mBugWorkaroundHandler = new Handler();
private Runnable mBugWorkaroundRunnable = new Runnable() {
public void run() {
/* TODO
IconMerger.this.moreIcon.update(mBugWorkaroundNumber);
IconMerger.this.moreIcon.view.invalidate();
*/
}
};
}

View File

@@ -119,16 +119,8 @@ public class PhoneStatusBarService extends StatusBarService {
Object mQueueLock = new Object();
NotificationCallbacks mNotificationCallbacks;
// All accesses to mIconMap and mNotificationData are syncronized on those objects,
// but this is only so dump() can work correctly. Modifying these outside of the UI
// thread will not work, there are places in the code that unlock and reaquire between
// reads and require them to not be modified.
// icons
HashMap<IBinder,StatusBarIconData> mIconMap = new HashMap<IBinder,StatusBarIconData>();
ArrayList<StatusBarIconData> mIconList = new ArrayList<StatusBarIconData>();
String[] mRightIconSlots;
StatusBarIconData[] mRightIcons;
LinearLayout mIcons;
IconMerger mNotificationIcons;
LinearLayout mStatusIcons;
@@ -209,7 +201,6 @@ public class PhoneStatusBarService extends StatusBarService {
private void makeStatusBarView(Context context) {
Resources res = context.getResources();
mRightIconSlots = res.getStringArray(R.array.status_bar_icon_order);
mRightIcons = new StatusBarIconData[mRightIconSlots.length];
mHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
mIconWidth = mHeight;
@@ -994,18 +985,6 @@ public class PhoneStatusBarService extends StatusBarService {
+ " scroll " + mScrollView.getScrollX() + "," + mScrollView.getScrollY());
pw.println("mNotificationLinearLayout: " + viewInfo(mNotificationLinearLayout));
}
synchronized (mIconMap) {
final int N = mIconMap.size();
pw.println(" mIconMap.size=" + N);
Set<IBinder> keys = mIconMap.keySet();
int i=0;
for (IBinder key: keys) {
StatusBarIconData icon = mIconMap.get(key);
pw.println(" [" + i + "] key=" + key);
pw.println(" data=" + icon.mData);
i++;
}
}
synchronized (mNotificationData) {
int N = mNotificationData.ongoingCount();
pw.println(" ongoingCount.size=" + N);

View File

@@ -1,23 +0,0 @@
/*
* Copyright (C) 2008 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.policy.statusbar.phone;
public class StatusBarException extends RuntimeException {
StatusBarException(String msg) {
super(msg);
}
}

View File

@@ -1,186 +0,0 @@
/*
* Copyright (C) 2008 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.policy.statusbar.phone;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.Slog;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
public class StatusBarIconData {
// TODO: get this from a resource
private static final int ICON_GAP = 8;
private static final int ICON_WIDTH = 25;
private static final int ICON_HEIGHT = 25;
public View view;
IconData mData;
private TextView mTextView;
private AnimatedImageView mImageView;
private TextView mNumberView;
public StatusBarIconData(Context context, IconData data, ViewGroup parent) {
mData = data.clone();
switch (data.type) {
case IconData.TEXT: {
TextView t;
t = new TextView(context);
mTextView = t;
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.MATCH_PARENT);
t.setTextSize(16);
t.setTextColor(0xff000000);
t.setTypeface(Typeface.DEFAULT_BOLD);
t.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
t.setPadding(6, 0, 0, 0);
t.setLayoutParams(layoutParams);
t.setText(data.text);
this.view = t;
break;
}
case IconData.ICON: {
// container
LayoutInflater inflater = (LayoutInflater)context.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.status_bar_icon, parent, false);
this.view = v;
// icon
AnimatedImageView im = (AnimatedImageView)v.findViewById(R.id.image);
im.setImageDrawable(getIcon(context, data));
im.setImageLevel(data.iconLevel);
mImageView = im;
// number
TextView nv = (TextView)v.findViewById(R.id.number);
mNumberView = nv;
if (data.number > 0) {
nv.setText("" + data.number);
nv.setVisibility(View.VISIBLE);
} else {
nv.setVisibility(View.GONE);
}
break;
}
}
}
public void update(Context context, IconData data) throws StatusBarException {
if (mData.type != data.type) {
throw new StatusBarException("status bar entry type can't change");
}
switch (data.type) {
case IconData.TEXT:
if (!TextUtils.equals(mData.text, data.text)) {
TextView tv = mTextView;
tv.setText(data.text);
}
break;
case IconData.ICON:
if (((mData.iconPackage != null && data.iconPackage != null)
&& !mData.iconPackage.equals(data.iconPackage))
|| mData.iconId != data.iconId
|| mData.iconLevel != data.iconLevel) {
ImageView im = mImageView;
im.setImageDrawable(getIcon(context, data));
im.setImageLevel(data.iconLevel);
}
if (mData.number != data.number) {
TextView nv = mNumberView;
if (data.number > 0) {
nv.setText("" + data.number);
} else {
nv.setText("");
}
}
break;
}
mData.copyFrom(data);
}
public void update(int number) {
if (mData.number != number) {
TextView nv = mNumberView;
if (number > 0) {
nv.setText("" + number);
} else {
nv.setText("");
}
}
mData.number = number;
}
/**
* Returns the right icon to use for this item, respecting the iconId and
* iconPackage (if set)
*
* @param context Context to use to get resources if iconPackage is not set
* @return Drawable for this item, or null if the package or item could not
* be found
*/
static Drawable getIcon(Context context, IconData data) {
Resources r = null;
if (data.iconPackage != null) {
try {
r = context.getPackageManager().getResourcesForApplication(data.iconPackage);
} catch (PackageManager.NameNotFoundException ex) {
Slog.e(PhoneStatusBarService.TAG, "Icon package not found: " + data.iconPackage, ex);
return null;
}
} else {
r = context.getResources();
}
if (data.iconId == 0) {
Slog.w(PhoneStatusBarService.TAG, "No icon ID for slot " + data.slot);
return null;
}
try {
return r.getDrawable(data.iconId);
} catch (RuntimeException e) {
Slog.w(PhoneStatusBarService.TAG, "Icon not found in "
+ (data.iconPackage != null ? data.iconId : "<system>")
+ ": " + Integer.toHexString(data.iconId));
}
return null;
}
int getNumber() {
return mData.number;
}
}

View File

@@ -37,7 +37,6 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
import com.android.server.status.IconData;
import com.android.server.status.NotificationData;
public abstract class StatusBarService extends Service implements CommandQueue.Callbacks {
@@ -49,7 +48,6 @@ public abstract class StatusBarService extends Service implements CommandQueue.C
/* TODO
H mHandler = new H();
Object mQueueLock = new Object();
ArrayList<PendingOp> mQueue = new ArrayList<PendingOp>();
NotificationCallbacks mNotificationCallbacks;
*/