Loading packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +6 −3 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ public class TabletStatusBar extends StatusBar { final RemoteViews contentView = notification.notification.contentView; if (false) { if (DEBUG) { Slog.d(TAG, "old notification: when=" + oldNotification.notification.when + " ongoing=" + oldNotification.isOngoing() + " expanded=" + oldEntry.expanded Loading @@ -508,7 +508,7 @@ public class TabletStatusBar extends StatusBar { // Can we just reapply the RemoteViews in place? If when didn't change, the order // didn't change. if (notification.notification.when == oldNotification.notification.when boolean orderUnchanged = (notification.notification.when == oldNotification.notification.when && notification.isOngoing() == oldNotification.isOngoing() && oldEntry.expanded != null && contentView != null Loading @@ -516,7 +516,10 @@ public class TabletStatusBar extends StatusBar { && contentView.getPackage() != null && oldContentView.getPackage() != null && oldContentView.getPackage().equals(contentView.getPackage()) && oldContentView.getLayoutId() == contentView.getLayoutId()) { && oldContentView.getLayoutId() == contentView.getLayoutId()); ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent(); boolean isLastAnyway = rowParent.indexOfChild(oldEntry.row) == rowParent.getChildCount() - 1; if (orderUnchanged || isLastAnyway) { if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key); oldEntry.notification = notification; try { Loading tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +48 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import android.util.Log; import android.net.Uri; import android.os.SystemClock; import android.widget.RemoteViews; import android.widget.TextView; import android.widget.ProgressBar; import android.os.PowerManager; public class NotificationTestList extends TestActivity Loading @@ -44,6 +46,8 @@ public class NotificationTestList extends TestActivity long mActivityCreateTime = System.currentTimeMillis(); long mChronometerBase = 0; boolean mProgressDone = true; final int[] kNumberedIconResIDs = { R.drawable.notification0, R.drawable.notification1, Loading Loading @@ -289,6 +293,50 @@ public class NotificationTestList extends TestActivity } }, new Test("Progress #1") { public void run() { final boolean PROGRESS_UPDATES_WHEN = true; if (!mProgressDone) return; mProgressDone = false; Thread t = new Thread() { public void run() { int x = 0; while (!mProgressDone) { Notification n = new Notification(R.drawable.icon1, null, PROGRESS_UPDATES_WHEN ? System.currentTimeMillis() : mActivityCreateTime); RemoteViews v = new RemoteViews(getPackageName(), R.layout.progress_notification); v.setProgressBar(R.id.progress_bar, 100, x, false); v.setTextViewText(R.id.status_text, "Progress: " + x + "%"); n.contentView = v; n.flags |= Notification.FLAG_ONGOING_EVENT; mNM.notify(500, n); x = (x + 7) % 100; try { Thread.sleep(1000); } catch (InterruptedException e) { break; } } } }; t.start(); } }, new Test("Stop Progress") { public void run() { mProgressDone = true; mNM.cancel(500); } }, new Test("Blue Lights") { public void run() { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +6 −3 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ public class TabletStatusBar extends StatusBar { final RemoteViews contentView = notification.notification.contentView; if (false) { if (DEBUG) { Slog.d(TAG, "old notification: when=" + oldNotification.notification.when + " ongoing=" + oldNotification.isOngoing() + " expanded=" + oldEntry.expanded Loading @@ -508,7 +508,7 @@ public class TabletStatusBar extends StatusBar { // Can we just reapply the RemoteViews in place? If when didn't change, the order // didn't change. if (notification.notification.when == oldNotification.notification.when boolean orderUnchanged = (notification.notification.when == oldNotification.notification.when && notification.isOngoing() == oldNotification.isOngoing() && oldEntry.expanded != null && contentView != null Loading @@ -516,7 +516,10 @@ public class TabletStatusBar extends StatusBar { && contentView.getPackage() != null && oldContentView.getPackage() != null && oldContentView.getPackage().equals(contentView.getPackage()) && oldContentView.getLayoutId() == contentView.getLayoutId()) { && oldContentView.getLayoutId() == contentView.getLayoutId()); ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent(); boolean isLastAnyway = rowParent.indexOfChild(oldEntry.row) == rowParent.getChildCount() - 1; if (orderUnchanged || isLastAnyway) { if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key); oldEntry.notification = notification; try { Loading
tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +48 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import android.util.Log; import android.net.Uri; import android.os.SystemClock; import android.widget.RemoteViews; import android.widget.TextView; import android.widget.ProgressBar; import android.os.PowerManager; public class NotificationTestList extends TestActivity Loading @@ -44,6 +46,8 @@ public class NotificationTestList extends TestActivity long mActivityCreateTime = System.currentTimeMillis(); long mChronometerBase = 0; boolean mProgressDone = true; final int[] kNumberedIconResIDs = { R.drawable.notification0, R.drawable.notification1, Loading Loading @@ -289,6 +293,50 @@ public class NotificationTestList extends TestActivity } }, new Test("Progress #1") { public void run() { final boolean PROGRESS_UPDATES_WHEN = true; if (!mProgressDone) return; mProgressDone = false; Thread t = new Thread() { public void run() { int x = 0; while (!mProgressDone) { Notification n = new Notification(R.drawable.icon1, null, PROGRESS_UPDATES_WHEN ? System.currentTimeMillis() : mActivityCreateTime); RemoteViews v = new RemoteViews(getPackageName(), R.layout.progress_notification); v.setProgressBar(R.id.progress_bar, 100, x, false); v.setTextViewText(R.id.status_text, "Progress: " + x + "%"); n.contentView = v; n.flags |= Notification.FLAG_ONGOING_EVENT; mNM.notify(500, n); x = (x + 7) % 100; try { Thread.sleep(1000); } catch (InterruptedException e) { break; } } } }; t.start(); } }, new Test("Stop Progress") { public void run() { mProgressDone = true; mNM.cancel(500); } }, new Test("Blue Lights") { public void run() { Loading