diff options
author | Daniel Sandler <dsandler@android.com> | 2010-06-23 16:30:39 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2010-06-24 22:09:35 -0400 |
commit | 87160757e827e8e158d233de09d70e7128184729 (patch) | |
tree | c14d78c3feb6526890fd93d90a4aa30366402020 /packages | |
parent | 7dacda1142379df1f1f9854c24e452acdea98436 (diff) | |
download | frameworks_base-87160757e827e8e158d233de09d70e7128184729.zip frameworks_base-87160757e827e8e158d233de09d70e7128184729.tar.gz frameworks_base-87160757e827e8e158d233de09d70e7128184729.tar.bz2 |
Basic handling of Notifications with fullScreenIntent.
If a Notification has a non-null fullScreenIntent AND the
topmost Activity is not immersive, that PendingIntent will
fire (presumably causing a nice dialog or full-screen
activity to appear).
Immersive mode handling for FLAG_HIGH_PRIORITY Notifications
is still unimplemented (although the fullScreenIntent will
be suppressed in immersive mode).
Note that currently your fullScreenIntent notification will
also get posted to the status bar, so you're responsible for
clearing it out (e.g. in onPause in your alert intent). See
forthcoming changes to StatusBarTest for an example.
Change-Id: Ie750d1b7bcc788bd29ee1d8626f971dd47fd2817
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java index 801cb91..5d16e93 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java @@ -312,8 +312,45 @@ public class PhoneStatusBarService extends StatusBarService { public void addNotification(IBinder key, StatusBarNotification notification) { addNotificationViews(key, notification); - // show the ticker - tick(notification); + boolean immersive = false; + try { + immersive = ActivityManagerNative.getDefault().isTopActivityImmersive(); + Slog.d(TAG, "Top activity is " + (immersive?"immersive":"not immersive")); + } catch (RemoteException ex) { + } + if (immersive) { + if ((notification.notification.flags & Notification.FLAG_HIGH_PRIORITY) != 0) { + Slog.d(TAG, "Presenting high-priority notification in immersive activity"); + // @@@ special new transient ticker mode + /* + // 1. Populate mAlertBarView + + ImageView alertIcon = (ImageView) mAlertBarView.findViewById(R.id.alertIcon); + TextView alertText = (TextView) mAlertBarView.findViewById(R.id.alertText); + alertIcon.setImageDrawable(StatusBarIconView.getIcon( + alertIcon.getContext(), + iconView.getStatusBarIcon())); + alertText.setText(notification.notification.tickerText); + + // 2. Animate mAlertBarView in + mAlertBarView.setVisibility(View.VISIBLE); + + // 3. Set alarm to age the notification off (TODO) + */ + } + } else if (notification.notification.fullScreenIntent != null) { + // not immersive & a full-screen alert should be shown + Slog.d(TAG, "Notification has fullScreenIntent and activity is not immersive; sending fullScreenIntent"); + try { + notification.notification.fullScreenIntent.send(); + } catch (PendingIntent.CanceledException e) { + } + } else { + // usual case: status bar visible & not immersive + + // show the ticker + tick(notification); + } // Recalculate the position of the sliding windows and the titles. setAreThereNotifications(); |