diff options
author | Joe Onorato <joeo@android.com> | 2010-05-02 16:28:15 -0700 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-06-02 14:48:41 -0700 |
commit | 0cbda99f8721ad9b03ada04d2637fb75a2a0feca (patch) | |
tree | 99b716653b139e560223dfc764bfc9a746df7bb5 /core | |
parent | 503007dd023668b1e45de948d3673e594d7f5a82 (diff) | |
download | frameworks_base-0cbda99f8721ad9b03ada04d2637fb75a2a0feca.zip frameworks_base-0cbda99f8721ad9b03ada04d2637fb75a2a0feca.tar.gz frameworks_base-0cbda99f8721ad9b03ada04d2637fb75a2a0feca.tar.bz2 |
The status bar draws its icons now.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/StatusBarManager.java | 19 | ||||
-rw-r--r-- | core/java/com/android/internal/statusbar/IStatusBar.aidl | 27 | ||||
-rw-r--r-- | core/java/com/android/internal/statusbar/IStatusBarService.aidl (renamed from core/java/android/app/IStatusBarService.aidl) | 14 | ||||
-rw-r--r-- | core/java/com/android/internal/statusbar/StatusBarIcon.aidl (renamed from core/java/android/app/IStatusBar.aidl) | 13 | ||||
-rw-r--r-- | core/java/com/android/internal/statusbar/StatusBarIcon.java | 83 | ||||
-rw-r--r-- | core/java/com/android/internal/statusbar/StatusBarIconList.aidl | 20 | ||||
-rw-r--r-- | core/java/com/android/internal/statusbar/StatusBarIconList.java | 167 | ||||
-rw-r--r-- | core/res/res/drawable/status_icon_background.xml | 24 | ||||
-rw-r--r-- | core/res/res/layout/status_bar_expanded.xml | 144 | ||||
-rw-r--r-- | core/res/res/layout/status_bar_icon.xml | 46 | ||||
-rw-r--r-- | core/res/res/layout/status_bar_tracking.xml | 48 |
11 files changed, 316 insertions, 289 deletions
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index 746b2d5..8905268 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -23,6 +23,8 @@ import android.os.RemoteException; import android.os.IBinder; import android.os.ServiceManager; +import com.android.internal.statusbar.IStatusBarService; + /** * Allows an app to control the status bar. * @@ -116,27 +118,18 @@ public class StatusBarManager { } } - public IBinder addIcon(String slot, int iconId, int iconLevel) { - try { - return mService.addIcon(slot, mContext.getPackageName(), iconId, iconLevel); - } catch (RemoteException ex) { - // system process is dead anyway. - throw new RuntimeException(ex); - } - } - - public void updateIcon(IBinder key, String slot, int iconId, int iconLevel) { + public void setIcon(String slot, int iconId, int iconLevel) { try { - mService.updateIcon(key, slot, mContext.getPackageName(), iconId, iconLevel); + mService.setIcon(slot, mContext.getPackageName(), iconId, iconLevel); } catch (RemoteException ex) { // system process is dead anyway. throw new RuntimeException(ex); } } - public void removeIcon(IBinder key) { + public void removeIcon(String slot) { try { - mService.removeIcon(key); + mService.removeIcon(slot); } catch (RemoteException ex) { // system process is dead anyway. throw new RuntimeException(ex); diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl new file mode 100644 index 0000000..2a5ae15 --- /dev/null +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2007, 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.internal.statusbar; + +import com.android.internal.statusbar.StatusBarIcon; + +/** @hide */ +oneway interface IStatusBar +{ + void setIcon(int index, in StatusBarIcon icon); + void removeIcon(int index); +} + diff --git a/core/java/android/app/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index ccde41a..0a9c8da 100644 --- a/core/java/android/app/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -14,9 +14,11 @@ * limitations under the License. */ -package android.app; +package com.android.internal.statusbar; -import android.app.IStatusBar; +import com.android.internal.statusbar.IStatusBar; +import com.android.internal.statusbar.StatusBarIcon; +import com.android.internal.statusbar.StatusBarIconList; /** @hide */ interface IStatusBarService @@ -25,10 +27,10 @@ interface IStatusBarService void deactivate(); void toggle(); void disable(int what, IBinder token, String pkg); - IBinder addIcon(String slot, String iconPackage, int iconId, int iconLevel); - void updateIcon(IBinder key, String slot, String iconPackage, int iconId, int iconLevel); - void removeIcon(IBinder key); + void setIcon(String slot, String iconPackage, int iconId, int iconLevel); + void setIconVisibility(String slot, boolean visible); + void removeIcon(String slot); // ---- Methods below are for use by the status bar policy services ---- - void registerStatusBar(IStatusBar callbacks); + void registerStatusBar(IStatusBar callbacks, out StatusBarIconList state); } diff --git a/core/java/android/app/IStatusBar.aidl b/core/java/com/android/internal/statusbar/StatusBarIcon.aidl index 8d571ef..311a077 100644 --- a/core/java/android/app/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/StatusBarIcon.aidl @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2007, The Android Open Source Project +/* + * Copyright (c) 2010, 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. @@ -13,11 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package android.app; -/** @hide */ -interface IStatusBar -{ -} +package com.android.internal.statusbar; + +parcelable StatusBarIcon; diff --git a/core/java/com/android/internal/statusbar/StatusBarIcon.java b/core/java/com/android/internal/statusbar/StatusBarIcon.java new file mode 100644 index 0000000..330b407 --- /dev/null +++ b/core/java/com/android/internal/statusbar/StatusBarIcon.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2010 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.internal.statusbar; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * @hide + */ +public class StatusBarIcon implements Parcelable { + public String iconPackage; + public int iconId; + public int iconLevel; + + private StatusBarIcon() { + } + + public StatusBarIcon(String iconPackage, int iconId, int iconLevel) { + this.iconPackage = iconPackage; + this.iconId = iconId; + this.iconLevel = iconLevel; + } + + public StatusBarIcon clone() { + return new StatusBarIcon(this.iconPackage, this.iconId, this.iconLevel); + } + + /** + * Unflatten the StatusBarIcon from a parcel. + */ + public StatusBarIcon(Parcel in) { + readFromParcel(in); + } + + public void readFromParcel(Parcel in) { + this.iconPackage = in.readString(); + this.iconId = in.readInt(); + this.iconLevel = in.readInt(); + } + + public void writeToParcel(Parcel out, int flags) { + out.writeString(this.iconPackage); + out.writeInt(this.iconId); + out.writeInt(this.iconLevel); + } + + public int describeContents() { + return 0; + } + + /** + * Parcelable.Creator that instantiates StatusBarIcon objects + */ + public static final Parcelable.Creator<StatusBarIcon> CREATOR + = new Parcelable.Creator<StatusBarIcon>() + { + public StatusBarIcon createFromParcel(Parcel parcel) + { + return new StatusBarIcon(parcel); + } + + public StatusBarIcon[] newArray(int size) + { + return new StatusBarIcon[size]; + } + }; +} + diff --git a/core/java/com/android/internal/statusbar/StatusBarIconList.aidl b/core/java/com/android/internal/statusbar/StatusBarIconList.aidl new file mode 100644 index 0000000..c745120 --- /dev/null +++ b/core/java/com/android/internal/statusbar/StatusBarIconList.aidl @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2010, 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.internal.statusbar; + +parcelable StatusBarIconList; + diff --git a/core/java/com/android/internal/statusbar/StatusBarIconList.java b/core/java/com/android/internal/statusbar/StatusBarIconList.java new file mode 100644 index 0000000..61002d5 --- /dev/null +++ b/core/java/com/android/internal/statusbar/StatusBarIconList.java @@ -0,0 +1,167 @@ +/* + * Copyright (C) 2007 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.internal.statusbar; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.io.PrintWriter; + +public class StatusBarIconList implements Parcelable { + private String[] mSlots; + private StatusBarIcon[] mIcons; + + public StatusBarIconList() { + } + + public StatusBarIconList(Parcel in) { + readFromParcel(in); + } + + public void readFromParcel(Parcel in) { + this.mSlots = in.readStringArray(); + final int N = in.readInt(); + if (N < 0) { + mIcons = null; + } else { + mIcons = new StatusBarIcon[N]; + for (int i=0; i<N; i++) { + if (in.readInt() != 0) { + mIcons[i] = new StatusBarIcon(in); + } + } + } + } + + public void writeToParcel(Parcel out, int flags) { + out.writeStringArray(mSlots); + if (mIcons == null) { + out.writeInt(-1); + } else { + final int N = mIcons.length; + out.writeInt(N); + for (int i=0; i<N; i++) { + StatusBarIcon ic = mIcons[i]; + if (ic == null) { + out.writeInt(0); + } else { + out.writeInt(1); + ic.writeToParcel(out, flags); + } + } + } + } + + public int describeContents() { + return 0; + } + + /** + * Parcelable.Creator that instantiates StatusBarIconList objects + */ + public static final Parcelable.Creator<StatusBarIconList> CREATOR + = new Parcelable.Creator<StatusBarIconList>() + { + public StatusBarIconList createFromParcel(Parcel parcel) + { + return new StatusBarIconList(parcel); + } + + public StatusBarIconList[] newArray(int size) + { + return new StatusBarIconList[size]; + } + }; + + public void defineSlots(String[] slots) { + final int N = slots.length; + String[] s = mSlots = new String[N]; + for (int i=0; i<N; i++) { + s[i] = slots[i]; + } + mIcons = new StatusBarIcon[N]; + } + + public int getSlotIndex(String slot) { + final int N = mSlots.length; + for (int i=0; i<N; i++) { + if (slot.equals(mSlots[i])) { + return i; + } + } + return -1; + } + + public int size() { + return mSlots.length; + } + + public void setIcon(int index, StatusBarIcon icon) { + mIcons[index] = icon.clone(); + } + + public void removeIcon(int index) { + mIcons[index] = null; + } + + public String getSlot(int index) { + return mSlots[index]; + } + + public StatusBarIcon getIcon(int index) { + return mIcons[index]; + } + + public int getViewIndex(int index) { + int count = 0; + for (int i=0; i<index; i++) { + if (mIcons[i] != null) { + count++; + } + } + return count; + } + + public void copyFrom(StatusBarIconList that) { + if (that.mSlots == null) { + this.mSlots = null; + this.mIcons = null; + } else { + final int N = that.mSlots.length; + this.mSlots = new String[N]; + this.mIcons = new StatusBarIcon[N]; + for (int i=0; i<N; i++) { + this.mSlots[i] = that.mSlots[i]; + this.mIcons[i] = that.mIcons[i] != null ? that.mIcons[i].clone() : null; + } + } + } + + public void dump(PrintWriter pw) { + 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); + } + } + } +} diff --git a/core/res/res/drawable/status_icon_background.xml b/core/res/res/drawable/status_icon_background.xml deleted file mode 100644 index 9846165..0000000 --- a/core/res/res/drawable/status_icon_background.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* //device/apps/common/res/drawable/status_icon_background.xml -** -** Copyright 2007, 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. -*/ ---> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true" android:drawable="@drawable/icon_highlight_rectangle" /> - <item android:drawable="@color/transparent" /> -</selector> diff --git a/core/res/res/layout/status_bar_expanded.xml b/core/res/res/layout/status_bar_expanded.xml deleted file mode 100644 index 68eb922..0000000 --- a/core/res/res/layout/status_bar_expanded.xml +++ /dev/null @@ -1,144 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* apps/common/assets/default/default/skins/StatusBar.xml -** -** Copyright 2006, 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. -*/ ---> - -<com.android.server.status.ExpandedView xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:focusable="true" - android:descendantFocusability="afterDescendants" - > - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:paddingTop="3dp" - android:paddingBottom="5dp" - android:paddingRight="3dp" - android:background="@drawable/status_bar_header_background" - > - <LinearLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_marginTop="1dp" - android:layout_marginLeft="5dp" - android:layout_gravity="center_vertical" - android:paddingBottom="1dp" - android:orientation="vertical" - > - <TextView android:id="@+id/plmnLabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:textAppearance="?android:attr/textAppearanceLarge" - android:textColor="?android:attr/textColorSecondary" - android:paddingLeft="4dp" - /> - <TextView android:id="@+id/spnLabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:textAppearance="?android:attr/textAppearanceLarge" - android:textColor="?android:attr/textColorSecondary" - android:paddingLeft="4dp" - /> - </LinearLayout> - <TextView android:id="@+id/clear_all_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_marginTop="4dp" - android:layout_marginBottom="1dp" - android:textSize="14sp" - android:textColor="?android:attr/textColorPrimaryInverse" - android:text="@string/status_bar_clear_all_button" - style="?android:attr/buttonStyle" - android:paddingLeft="15dp" - android:paddingRight="15dp" - android:background="@drawable/btn_default_small" - /> - </LinearLayout> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - > - <ScrollView - android:id="@+id/scroll" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fadingEdge="none" - > - <com.android.server.status.NotificationLinearLayout - android:id="@+id/notificationLinearLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - > - - <TextView android:id="@+id/noNotificationsTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@drawable/title_bar_portrait" - android:paddingLeft="5dp" - android:textAppearance="@style/TextAppearance.StatusBar.Title" - android:text="@string/status_bar_no_notifications_title" - /> - - <TextView android:id="@+id/ongoingTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@drawable/title_bar_portrait" - android:paddingLeft="5dp" - android:textAppearance="@style/TextAppearance.StatusBar.Title" - android:text="@string/status_bar_ongoing_events_title" - /> - <LinearLayout android:id="@+id/ongoingItems" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - /> - - <TextView android:id="@+id/latestTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@drawable/title_bar_portrait" - android:paddingLeft="5dp" - android:textAppearance="@style/TextAppearance.StatusBar.Title" - android:text="@string/status_bar_latest_events_title" - /> - <LinearLayout android:id="@+id/latestItems" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - /> - </com.android.server.status.NotificationLinearLayout> - </ScrollView> - - <ImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:src="@drawable/title_bar_shadow" - android:scaleType="fitXY" - /> - - </FrameLayout> -</com.android.server.status.ExpandedView> diff --git a/core/res/res/layout/status_bar_icon.xml b/core/res/res/layout/status_bar_icon.xml deleted file mode 100644 index 0536792..0000000 --- a/core/res/res/layout/status_bar_icon.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* apps/common/assets/default/default/skins/StatusBar.xml -** -** Copyright 2006, 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. -*/ ---> - -<!-- The icons are a fixed size so an app can't mess everything up with bogus images --> -<!-- TODO: the icons are hard coded to 25x25 pixels. Their size should come froem a theme --> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="25dp" - android:layout_height="25dp" - > - - <com.android.server.status.AnimatedImageView android:id="@+id/image" - android:layout_width="match_parent" - android:layout_height="match_parent" - /> - - <TextView android:id="@+id/number" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right|bottom" - android:layout_marginRight="1dp" - android:layout_marginBottom="1dp" - android:textSize="10sp" - android:textColor="#ffffffff" - android:background="@drawable/ic_notification_overlay" - android:gravity="center" - android:textStyle="bold" - /> - -</FrameLayout> diff --git a/core/res/res/layout/status_bar_tracking.xml b/core/res/res/layout/status_bar_tracking.xml deleted file mode 100644 index c0a7a97..0000000 --- a/core/res/res/layout/status_bar_tracking.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - 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. ---> - -<com.android.server.status.TrackingView xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:visibility="gone" - android:focusable="true" - android:descendantFocusability="afterDescendants" - android:paddingBottom="0px" - android:paddingLeft="0px" - android:paddingRight="0px" - > - - <com.android.server.status.TrackingPatternView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - /> - - <com.android.server.status.CloseDragHandle android:id="@+id/close" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - > - <ImageView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:scaleType="fitXY" - android:src="@drawable/status_bar_close_on"/> - - </com.android.server.status.CloseDragHandle> - -</com.android.server.status.TrackingView> |