Merge changes Ia5884ef4,Ie495a41d,I3f7066c2,If5faf446,I6ae0740f,I57b2d296,Iea78a637 into kraken

* changes:
  Add a test item the turns on a bunch of extra icons.
  Move the status bar icon list, hopefully for the last time.
  Call into the notification manager when the panel is revealed.
  Move status_bar_latest_event and LatestItemView into SystemUI.apk.
  Start the status bar service based on a configuration option, instead of trampolining through a braodcast receiver.
  Require the STATUS_BAR_SERVICE permission for something to be the status bar.
  Handle errors inflating notifications (and their icons).
This commit is contained in:
Joe Onorato
2010-06-09 14:44:58 -07:00
committed by Android (Google) Code Review
27 changed files with 230 additions and 240 deletions

View File

@@ -32,9 +32,11 @@ interface IStatusBarService
void removeIcon(String slot);
// ---- Methods below are for use by the status bar policy services ----
// You need the STATUS_BAR_SERVICE permission
void registerStatusBar(IStatusBar callbacks, out StatusBarIconList iconList,
out List<IBinder> notificationKeys, out List<StatusBarNotification> notifications);
void visibilityChanged(boolean visible);
void onPanelRevealed();
void onNotificationClick(String pkg, String tag, int id);
void onNotificationError(String pkg, String tag, int id, String message);
void onClearAllNotifications();
}

View File

@@ -908,6 +908,13 @@
android:description="@string/permdesc_statusBar"
android:protectionLevel="signatureOrSystem" />
<!-- Allows an application to be the status bar. Currently used only by SystemUI.apk
@hide -->
<permission android:name="android.permission.STATUS_BAR_SERVICE"
android:label="@string/permlab_statusBarService"
android:description="@string/permdesc_statusBarService"
android:protectionLevel="signature" />
<!-- Allows an application to force a BACK operation on whatever is the
top activity. -->
<permission android:name="android.permission.FORCE_BACK"

View File

@@ -16,7 +16,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/status_bar_item_background_pressed" />
android:drawable="@drawable/status_bar_item_background_pressed" />
<item android:state_focused="true" android:state_pressed="false"
android:drawable="@drawable/status_bar_item_background_focus" />
<item android:drawable="@drawable/status_bar_item_background_normal" />

View File

@@ -117,28 +117,4 @@
<item>3</item>
</integer-array>
<!-- Do not translate. Defines the slots for the right-hand side icons. That is to say, the
icons in the status bar that are not notifications. -->
<string-array name="status_bar_icon_order">
<item><xliff:g id="id">ime</xliff:g></item>
<item><xliff:g id="id">sync_failing</xliff:g></item>
<item><xliff:g id="id">sync_active</xliff:g></item>
<item><xliff:g id="id">gps</xliff:g></item>
<item><xliff:g id="id">bluetooth</xliff:g></item>
<item><xliff:g id="id">tty</xliff:g></item>
<item><xliff:g id="id">speakerphone</xliff:g></item>
<item><xliff:g id="id">mute</xliff:g></item>
<item><xliff:g id="id">volume</xliff:g></item>
<item><xliff:g id="id">tty</xliff:g></item>
<item><xliff:g id="id">wifi</xliff:g></item>
<item><xliff:g id="id">cdma_eri</xliff:g></item>
<item><xliff:g id="id">data_connection</xliff:g></item>
<item><xliff:g id="id">phone_evdo_signal</xliff:g></item>
<item><xliff:g id="id">phone_signal</xliff:g></item>
<item><xliff:g id="id">battery</xliff:g></item>
<item><xliff:g id="id">alarm_clock</xliff:g></item>
<item><xliff:g id="id">secure</xliff:g></item>
<item><xliff:g id="id">clock</xliff:g></item>
</string-array>
</resources>

View File

@@ -19,7 +19,35 @@
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Component to be used as the status bar service. Must implement the IStatusBar
interface. This name is in the ComponentName flattened format (package/class) -->
<string name="config_statusBarComponent">com.android.systemui/com.android.systemui.statusbar.PhoneStatusBarService</string>
<!-- Do not translate. Defines the slots for the right-hand side icons. That is to say, the
icons in the status bar that are not notifications. -->
<string-array name="config_statusBarIcons">
<item><xliff:g id="id">ime</xliff:g></item>
<item><xliff:g id="id">sync_failing</xliff:g></item>
<item><xliff:g id="id">sync_active</xliff:g></item>
<item><xliff:g id="id">gps</xliff:g></item>
<item><xliff:g id="id">bluetooth</xliff:g></item>
<item><xliff:g id="id">tty</xliff:g></item>
<item><xliff:g id="id">speakerphone</xliff:g></item>
<item><xliff:g id="id">mute</xliff:g></item>
<item><xliff:g id="id">volume</xliff:g></item>
<item><xliff:g id="id">tty</xliff:g></item>
<item><xliff:g id="id">wifi</xliff:g></item>
<item><xliff:g id="id">cdma_eri</xliff:g></item>
<item><xliff:g id="id">data_connection</xliff:g></item>
<item><xliff:g id="id">phone_evdo_signal</xliff:g></item>
<item><xliff:g id="id">phone_signal</xliff:g></item>
<item><xliff:g id="id">battery</xliff:g></item>
<item><xliff:g id="id">alarm_clock</xliff:g></item>
<item><xliff:g id="id">secure</xliff:g></item>
<item><xliff:g id="id">clock</xliff:g></item>
</string-array>
<!-- Flag indicating whether the surface flinger has limited
alpha compositing functionality in hardware. If set, the window
manager will disable alpha trasformation in animations where not

View File

@@ -392,6 +392,11 @@
<string name="permdesc_statusBar">Allows application to disable
the status bar or add and remove system icons.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_statusBarService">status bar</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_statusBarService">Allows the application to be the status bar.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_expandStatusBar">expand/collapse status bar</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->

View File

@@ -2,18 +2,13 @@
package="com.android.systemui"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
<application
android:allowClearUserData="false"
android:label="@string/app_label"
android:icon="@drawable/ic_launcher_settings">
<receiver
android:name=".statusbar.StatusBarStarter"
>
<intent-filter>
<action android:name="com.android.internal.policy.statusbar.START" />
</intent-filter>
</receiver>
<service
android:name=".statusbar.PhoneStatusBarService"
android:exported="false"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -4,20 +4,20 @@
android:orientation="vertical"
>
<com.android.server.status.LatestItemView android:id="@+id/content"
<com.android.systemui.statusbar.LatestItemView android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="64sp"
android:background="@drawable/status_bar_item_background"
android:background="@android:drawable/status_bar_item_background"
android:focusable="true"
android:clickable="true"
android:paddingRight="6sp"
>
</com.android.server.status.LatestItemView>
</com.android.systemui.statusbar.LatestItemView>
<View
android:layout_width="match_parent"
android:layout_height="1sp"
android:background="@drawable/divider_horizontal_bright"
android:background="@android:drawable/divider_horizontal_bright"
/>
</LinearLayout>

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/colors.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.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Do not translate. Defines the slots for the right-hand side icons. That is to say, the
icons in the status bar that are not notifications. -->
<string-array name="status_bar_icon_order">
<item><xliff:g id="id">TODO: Remove; not used.</xliff:g></item>
</string-array>
</resources>

View File

@@ -116,7 +116,6 @@ public class PhoneStatusBarService extends StatusBarService {
Object mQueueLock = new Object();
// icons
String[] mRightIconSlots;
LinearLayout mIcons;
IconMerger mNotificationIcons;
LinearLayout mStatusIcons;
@@ -153,6 +152,7 @@ public class PhoneStatusBarService extends StatusBarService {
TrackingView mTrackingView;
WindowManager.LayoutParams mTrackingParams;
int mTrackingPosition; // the position of the top of the tracking view.
private boolean mPanelSlightlyVisible;
// ticker
private Ticker mTicker;
@@ -201,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);
mHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
mIconWidth = mHeight;
@@ -373,6 +372,14 @@ public class PhoneStatusBarService extends StatusBarService {
oldEntry.content.setOnClickListener(new Launcher(contentIntent,
notification.pkg, notification.tag, notification.id));
}
// Update the icon.
final StatusBarIcon ic = new StatusBarIcon(notification.pkg,
notification.notification.icon, notification.notification.iconLevel,
notification.notification.number);
if (!oldEntry.icon.set(ic)) {
handleNotificationError(key, notification, "Couldn't update icon: " + ic);
return;
}
}
catch (RuntimeException e) {
// It failed to add cleanly. Log, and remove the view from the panel.
@@ -380,9 +387,6 @@ public class PhoneStatusBarService extends StatusBarService {
removeNotificationViews(key);
addNotificationViews(key, notification);
}
// Update the icon.
oldEntry.icon.set(new StatusBarIcon(notification.pkg, notification.notification.icon,
notification.notification.iconLevel, notification.notification.number));
} else {
Slog.d(TAG, "not reusing notification");
removeNotificationViews(key);
@@ -429,11 +433,10 @@ public class PhoneStatusBarService extends StatusBarService {
// create the row view
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(com.android.internal.R.layout.status_bar_latest_event,
parent, false);
View row = inflater.inflate(R.layout.status_bar_latest_event, parent, false);
// bind the click event to the content area
ViewGroup content = (ViewGroup)row.findViewById(com.android.internal.R.id.content);
ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
content.setOnFocusChangeListener(mFocusChangeListener);
PendingIntent contentIntent = n.contentIntent;
@@ -451,8 +454,9 @@ public class PhoneStatusBarService extends StatusBarService {
exception = e;
}
if (expanded == null) {
Slog.e(TAG, "couldn't inflate view for package " + notification.pkg, exception);
row.setVisibility(View.GONE);
String ident = notification.pkg + "/0x" + Integer.toHexString(notification.id);
Slog.e(TAG, "couldn't inflate view for notification " + ident);
return null;
} else {
content.addView(expanded);
row.setDrawingCacheEnabled(true);
@@ -474,14 +478,23 @@ public class PhoneStatusBarService extends StatusBarService {
}
// Construct the expanded view.
final View[] views = makeNotificationView(notification, parent);
if (views == null) {
handleNotificationError(key, notification, "Couldn't expand RemoteViews for: "
+ notification);
return;
}
final View row = views[0];
final View content = views[1];
final View expanded = views[2];
// Construct the icon.
StatusBarIconView iconView = new StatusBarIconView(this,
final StatusBarIconView iconView = new StatusBarIconView(this,
notification.pkg + "/0x" + Integer.toHexString(notification.id));
iconView.set(new StatusBarIcon(notification.pkg, notification.notification.icon,
notification.notification.iconLevel, notification.notification.number));
final StatusBarIcon ic = new StatusBarIcon(notification.pkg, notification.notification.icon,
notification.notification.iconLevel, notification.notification.number);
if (!iconView.set(ic)) {
handleNotificationError(key, notification, "Coulding create icon: " + ic);
return;
}
// Add the expanded view.
final int viewIndex = list.add(key, notification, row, content, expanded, iconView);
parent.addView(row, viewIndex);
@@ -967,6 +980,21 @@ public class PhoneStatusBarService extends StatusBarService {
}
}
/**
* Cancel this notification and tell the StatusBarManagerService / NotificationManagerService
* about the failure.
*
* WARNING: this will call back into us. Don't hold any locks.
*/
void handleNotificationError(IBinder key, StatusBarNotification n, String message) {
removeNotification(key);
try {
mBarService.onNotificationError(n.pkg, n.tag, n.id, message);
} catch (RemoteException ex) {
// The end is nigh.
}
}
private class MyTicker extends Ticker {
MyTicker(Context context, StatusBarView sb) {
super(context, sb);
@@ -1268,8 +1296,15 @@ public class PhoneStatusBarService extends StatusBarService {
// because the window itself extends below the content view.
mExpandedParams.y = -disph;
}
visibilityChanged(visible);
mExpandedDialog.getWindow().setAttributes(mExpandedParams);
// As long as this isn't just a repositioning that's not supposed to affect
// the user's perception of what's showing, call to say that the visibility
// has changed. (Otherwise, someone else will call to do that).
if (expandedPosition != EXPANDED_LEAVE_ALONE) {
Slog.d(TAG, "updateExpandedViewPos visibilityChanged(" + visible + ")");
visibilityChanged(visible);
}
}
if (SPEW) {
@@ -1299,12 +1334,11 @@ public class PhoneStatusBarService extends StatusBarService {
* turned off. If any other notifications happen, the lights will turn back on. Steve says
* this is what he wants. (see bug 1131461)
*/
private boolean mPanelSlightlyVisible;
void visibilityChanged(boolean visible) {
if (mPanelSlightlyVisible != visible) {
mPanelSlightlyVisible = visible;
try {
mBarService.visibilityChanged(visible);
mBarService.onPanelRevealed();
} catch (RemoteException ex) {
// Won't fail unless the world has ended.
}

View File

@@ -32,7 +32,6 @@ public class StatusBarIconView extends AnimatedImageView {
private StatusBarIcon mIcon;
@ViewDebug.ExportedProperty private String mSlot;
@ViewDebug.ExportedProperty private boolean mError;
public StatusBarIconView(Context context, String slot) {
super(context);
@@ -52,39 +51,33 @@ public class StatusBarIconView extends AnimatedImageView {
return a.equals(b);
}
public void set(StatusBarIcon icon) {
error: {
final boolean iconEquals = !mError
&& mIcon != null
&& streq(mIcon.iconPackage, icon.iconPackage)
&& mIcon.iconId == icon.iconId;
final boolean levelEquals = !mError
&& iconEquals
&& mIcon.iconLevel == icon.iconLevel;
final boolean visibilityEquals = !mError
&& mIcon != null
&& mIcon.visible == icon.visible;
mError = false;
if (!iconEquals) {
Drawable drawable = getIcon(icon);
if (drawable == null) {
mError = true;
Slog.w(PhoneStatusBarService.TAG, "No icon ID for slot " + mSlot);
break error;
}
setImageDrawable(drawable);
/**
* Returns whether the set succeeded.
*/
public boolean set(StatusBarIcon icon) {
final boolean iconEquals = mIcon != null
&& streq(mIcon.iconPackage, icon.iconPackage)
&& mIcon.iconId == icon.iconId;
final boolean levelEquals = iconEquals
&& mIcon.iconLevel == icon.iconLevel;
final boolean visibilityEquals = mIcon != null
&& mIcon.visible == icon.visible;
if (!iconEquals) {
Drawable drawable = getIcon(icon);
if (drawable == null) {
Slog.w(PhoneStatusBarService.TAG, "No icon for slot " + mSlot);
return false;
}
if (!levelEquals) {
setImageLevel(icon.iconLevel);
}
if (!visibilityEquals) {
setVisibility(icon.visible ? VISIBLE : GONE);
}
mIcon = icon.clone();
setImageDrawable(drawable);
}
if (mError) {
setVisibility(GONE);
if (!levelEquals) {
setImageLevel(icon.iconLevel);
}
if (!visibilityEquals) {
setVisibility(icon.visible ? VISIBLE : GONE);
}
mIcon = icon.clone();
return true;
}
private Drawable getIcon(StatusBarIcon icon) {
@@ -106,7 +99,7 @@ public class StatusBarIconView extends AnimatedImageView {
try {
r = context.getPackageManager().getResourcesForApplication(icon.iconPackage);
} catch (PackageManager.NameNotFoundException ex) {
Slog.e(PhoneStatusBarService.TAG, "Icon package not found: "+icon.iconPackage, ex);
Slog.e(PhoneStatusBarService.TAG, "Icon package not found: " + icon.iconPackage);
return null;
}
} else {

View File

@@ -1,38 +0,0 @@
/*
* 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.systemui.statusbar;
import android.content.Context;
import android.content.Intent;
import android.content.BroadcastReceiver;
import android.util.Log;
/**
* Receive a broadcast from the StatusBarManagerService at boot time, and
* kick off the StatusBarService.
*/
public class StatusBarStarter extends BroadcastReceiver {
private static final String TAG = "StatusBarStarter";
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "StatusBarStarter onReceive intent=" + intent);
context.startService(new Intent(context, PhoneStatusBarService.class));
}
}

View File

@@ -957,12 +957,20 @@ public class PhoneWindowManager implements WindowManagerPolicy {
public int prepareAddWindowLw(WindowState win, WindowManager.LayoutParams attrs) {
switch (attrs.type) {
case TYPE_STATUS_BAR:
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.STATUS_BAR_SERVICE,
"PhoneWindowManager");
// TODO: Need to handle the race condition of the status bar proc
// dying and coming back before the removeWindowLw cleanup has happened.
if (mStatusBar != null) {
return WindowManagerImpl.ADD_MULTIPLE_SINGLETON;
}
mStatusBar = win;
break;
case TYPE_STATUS_BAR_PANEL:
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.STATUS_BAR_SERVICE,
"PhoneWindowManager");
mStatusBarPanels.add(win);
break;
case TYPE_KEYGUARD:

View File

@@ -26,7 +26,7 @@ import com.android.internal.view.IInputMethodManager;
import com.android.internal.view.IInputMethodSession;
import com.android.internal.view.InputBindResult;
import com.android.server.status.StatusBarManagerService;
import com.android.server.StatusBarManagerService;
import org.xmlpull.v1.XmlPullParserException;

View File

@@ -17,7 +17,7 @@
package com.android.server;
import com.android.internal.statusbar.StatusBarNotification;
import com.android.server.status.StatusBarManagerService;
import com.android.server.StatusBarManagerService;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
@@ -303,6 +303,12 @@ class NotificationManagerService extends INotificationManager.Stub
updateLightsLocked();
}
}
public void onNotificationError(String pkg, String tag, int id, String message) {
Slog.d(TAG, "onNotification error pkg=" + pkg + " tag=" + tag + " id=" + id);
cancelNotification(pkg, tag, id, 0, 0);
// TODO: Tell the activity manager.
}
};
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {

View File

@@ -14,11 +14,12 @@
* limitations under the License.
*/
package com.android.server.status;
package com.android.server;
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -55,9 +56,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub
static final String TAG = "StatusBarManagerService";
static final boolean SPEW = true;
public static final String ACTION_STATUSBAR_START
= "com.android.internal.policy.statusbar.START";
final Context mContext;
Handler mHandler = new Handler();
NotificationCallbacks mNotificationCallbacks;
@@ -87,6 +85,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
void onClearAll();
void onNotificationClick(String pkg, String tag, int id);
void onPanelRevealed();
void onNotificationError(String pkg, String tag, int id, String message);
}
/**
@@ -96,7 +95,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
mContext = context;
final Resources res = context.getResources();
mIcons.defineSlots(res.getStringArray(com.android.internal.R.array.status_bar_icon_order));
mIcons.defineSlots(res.getStringArray(com.android.internal.R.array.config_statusBarIcons));
}
public void setNotificationCallbacks(NotificationCallbacks listener) {
@@ -111,9 +110,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub
}
public void systemReady2() {
// Start the status bar app
Intent intent = new Intent(ACTION_STATUSBAR_START);
mContext.sendBroadcast(intent /** permission **/);
ComponentName cn = ComponentName.unflattenFromString(
mContext.getString(com.android.internal.R.string.config_statusBarComponent));
Intent intent = new Intent();
intent.setComponent(cn);
Slog.i(TAG, "Starting service: " + cn);
mContext.startService(intent);
}
// ================================================================================
@@ -248,12 +250,19 @@ public class StatusBarManagerService extends IStatusBarService.Stub
"StatusBarManagerService");
}
private void enforceStatusBarService() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,
"StatusBarManagerService");
}
// ================================================================================
// Callbacks from the status bar service.
// ================================================================================
public void registerStatusBar(IStatusBar bar, StatusBarIconList iconList,
List<IBinder> notificationKeys, List<StatusBarNotification> notifications) {
enforceStatusBarService();
Slog.i(TAG, "registerStatusBar bar=" + bar);
mBar = bar;
synchronized (mIcons) {
@@ -268,18 +277,32 @@ public class StatusBarManagerService extends IStatusBarService.Stub
}
/**
* The status bar service should call this when the user changes whether
* the status bar is visible or not.
* The status bar service should call this each time the user brings the panel from
* invisible to visible in order to clear the notification light.
*/
public void visibilityChanged(boolean visible) {
//Slog.d(TAG, "visibilityChanged visible=" + visible);
public void onPanelRevealed() {
enforceStatusBarService();
// tell the notification manager to turn off the lights.
mNotificationCallbacks.onPanelRevealed();
}
public void onNotificationClick(String pkg, String tag, int id) {
enforceStatusBarService();
mNotificationCallbacks.onNotificationClick(pkg, tag, id);
}
public void onNotificationError(String pkg, String tag, int id, String message) {
enforceStatusBarService();
// WARNING: this will call back into us to do the remove. Don't hold any locks.
mNotificationCallbacks.onNotificationError(pkg, tag, id, message);
}
public void onClearAllNotifications() {
enforceStatusBarService();
mNotificationCallbacks.onClearAll();
}
@@ -423,24 +446,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub
}
}
/**
* The LEDs are turned o)ff when the notification panel is shown, even just a little bit.
* This was added last-minute and is inconsistent with the way the rest of the notifications
* are handled, because the notification isn't really cancelled. The lights are just
* turned off. If any other notifications happen, the lights will turn back on. Steve says
* this is what he wants. (see bug 1131461)
*/
private boolean mPanelSlightlyVisible;
void panelSlightlyVisible(boolean visible) {
if (mPanelSlightlyVisible != visible) {
mPanelSlightlyVisible = visible;
if (visible) {
// tell the notification manager to turn off the lights.
mNotificationCallbacks.onPanelRevealed();
}
}
}
private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();

View File

@@ -17,7 +17,6 @@
package com.android.server;
import com.android.server.am.ActivityManagerService;
import com.android.server.status.StatusBarManagerService;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.SamplingProfilerIntegration;

View File

@@ -1,34 +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.server.status;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.MotionEvent;
import android.widget.FrameLayout;
public class LatestItemView extends FrameLayout {
public LatestItemView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public boolean dispatchTouchEvent(MotionEvent ev) {
return onTouchEvent(ev);
}
}

View File

@@ -1,5 +0,0 @@
<body>
{@hide}
</body>

View File

@@ -123,29 +123,49 @@ public class NotificationTestList extends TestActivity
}
},
new Test("Bad Icon") {
new Test("Bad Icon #1 (when=create)") {
public void run() {
mNM.notify(1, new Notification(NotificationTestList.this,
R.layout.chrono_notification, /* not a drawable! */
null, System.currentTimeMillis()-(1000*60*60*24),
"(453) 123-2328",
"", null));
Notification n = new Notification(R.layout.chrono_notification /* not an icon */,
null, mActivityCreateTime);
n.setLatestEventInfo(NotificationTestList.this, "Persistent #1",
"This is the same notification!!!", makeIntent());
mNM.notify(1, n);
}
},
new Test("Bad resource #2") {
public void run()
{
Notification n = new Notification(NotificationTestList.this,
R.drawable.ic_statusbar_missedcall,
null, System.currentTimeMillis()-(1000*60*60*24),
"(453) 123-2328",
"", null);
n.contentView.setInt(1 /*bogus*/, "bogus method", 666);
mNM.notify(2, n);
new Test("Bad Icon #1 (when=now)") {
public void run() {
Notification n = new Notification(R.layout.chrono_notification /* not an icon */,
null, System.currentTimeMillis());
n.setLatestEventInfo(NotificationTestList.this, "Persistent #1",
"This is the same notification!!!", makeIntent());
mNM.notify(1, n);
}
},
new Test("Bad resource #1 (when=create)") {
public void run() {
Notification n = new Notification(R.drawable.icon2,
null, mActivityCreateTime);
n.setLatestEventInfo(NotificationTestList.this, "Persistent #1",
"This is the same notification!!!", makeIntent());
n.contentView.setInt(1 /*bogus*/, "bogus method", 666);
mNM.notify(1, n);
}
},
new Test("Bad resource #1 (when=now)") {
public void run() {
Notification n = new Notification(R.drawable.icon2,
null, System.currentTimeMillis());
n.setLatestEventInfo(NotificationTestList.this, "Persistent #1",
"This is the same notification!!!", makeIntent());
n.contentView.setInt(1 /*bogus*/, "bogus method", 666);
mNM.notify(1, n);
}
},
new Test("Bad resource #3") {
public void run()
{

View File

@@ -157,5 +157,22 @@ public class StatusBarTest extends TestActivity
}, 3000);
}
},
new Test("More icons") {
public void run() {
for (String slot: new String[] {
"sync_failing",
"gps",
"bluetooth",
"tty",
"speakerphone",
"mute",
"wifi",
"alarm_clock",
"secure",
}) {
mStatusBarManager.setIconVisibility(slot, true);
}
}
},
};
}