use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by ResurrectionRemix.
the class PhoneStatusBar method resetUserExpandedStates.
public void resetUserExpandedStates() {
ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
final int notificationCount = activeNotifications.size();
for (int i = 0; i < notificationCount; i++) {
NotificationData.Entry entry = activeNotifications.get(i);
if (entry.row != null) {
entry.row.resetUserExpansion();
}
}
}
use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by DirtyUnicorns.
the class BaseStatusBar method updateNotification.
public void updateNotification(StatusBarNotification notification, RankingMap ranking) {
if (DEBUG)
Log.d(TAG, "updateNotification(" + notification + ")");
final String key = notification.getKey();
Entry entry = mNotificationData.get(key);
if (entry == null) {
return;
} else {
mHeadsUpEntriesToRemoveOnSwitch.remove(entry);
mRemoteInputEntriesToRemoveOnCollapse.remove(entry);
}
Notification n = notification.getNotification();
mNotificationData.updateRanking(ranking);
boolean updateTicker = n.tickerText != null && !TextUtils.equals(n.tickerText, entry.notification.getNotification().tickerText);
boolean applyInPlace;
try {
applyInPlace = entry.cacheContentViews(mContext, notification.getNotification());
} catch (RuntimeException e) {
Log.e(TAG, "Unable to get notification remote views", e);
applyInPlace = false;
}
boolean shouldPeek = shouldPeek(entry, notification);
boolean alertAgain = alertAgain(entry, n);
if (DEBUG) {
Log.d(TAG, "applyInPlace=" + applyInPlace + " shouldPeek=" + shouldPeek + " alertAgain=" + alertAgain);
}
final StatusBarNotification oldNotification = entry.notification;
entry.notification = notification;
mGroupManager.onEntryUpdated(entry, oldNotification);
boolean updateSuccessful = false;
if (applyInPlace) {
if (DEBUG)
Log.d(TAG, "reusing notification for key: " + key);
try {
if (entry.icon != null) {
// Update the icon
final StatusBarIcon ic = new StatusBarIcon(notification.getUser(), notification.getPackageName(), n.getSmallIcon(), n.iconLevel, n.number, StatusBarIconView.contentDescForNotification(mContext, n));
entry.icon.setNotification(n);
if (!entry.icon.set(ic)) {
handleNotificationError(notification, "Couldn't update icon: " + ic);
return;
}
}
updateNotificationViews(entry, notification);
updateSuccessful = true;
} catch (RuntimeException e) {
// It failed to apply cleanly.
Log.w(TAG, "Couldn't reapply views for package " + notification.getPackageName(), e);
}
}
if (!updateSuccessful) {
if (DEBUG)
Log.d(TAG, "not reusing notification for key: " + key);
final StatusBarIcon ic = new StatusBarIcon(notification.getUser(), notification.getPackageName(), n.getSmallIcon(), n.iconLevel, n.number, StatusBarIconView.contentDescForNotification(mContext, n));
entry.icon.setNotification(n);
entry.icon.set(ic);
if (!inflateViews(entry, mStackScroller)) {
handleNotificationError(notification, "Couldn't update remote views for: " + notification);
}
}
updateHeadsUp(key, entry, shouldPeek, alertAgain);
updateNotifications();
if (!notification.isClearable()) {
// The user may have performed a dismiss action on the notification, since it's
// not clearable we should snap it back.
mStackScroller.snapViewIfNeeded(entry.row);
}
// Is this for you?
boolean isForCurrentUser = isNotificationForCurrentProfiles(notification);
Log.d(TAG, "notification is " + (isForCurrentUser ? "" : "not ") + "for you");
// Restart the ticker if it's still running
if (updateTicker && isForCurrentUser) {
haltTicker();
tick(notification, false, false, null);
}
setAreThereNotifications();
}
use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by DirtyUnicorns.
the class BaseStatusBar method updateRowStates.
/**
* Updates expanded, dimmed and locked states of notification rows.
*/
protected void updateRowStates() {
mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
final int N = mStackScroller.getChildCount();
int visibleNotifications = 0;
boolean onKeyguard = mState == StatusBarState.KEYGUARD;
int maxNotifications = 0;
if (onKeyguard) {
maxNotifications = getMaxKeyguardNotifications(true);
}
Stack<ExpandableNotificationRow> stack = new Stack<>();
for (int i = N - 1; i >= 0; i--) {
View child = mStackScroller.getChildAt(i);
if (!(child instanceof ExpandableNotificationRow)) {
continue;
}
stack.push((ExpandableNotificationRow) child);
}
while (!stack.isEmpty()) {
ExpandableNotificationRow row = stack.pop();
NotificationData.Entry entry = row.getEntry();
boolean childNotification = mGroupManager.isChildInGroupWithSummary(entry.notification);
if (onKeyguard) {
row.setOnKeyguard(true);
} else {
row.setOnKeyguard(false);
row.setSystemExpanded(visibleNotifications == 0 && !childNotification);
}
boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup(entry.notification) && !entry.row.isRemoved();
boolean childWithVisibleSummary = childNotification && mGroupManager.getGroupSummary(entry.notification).getVisibility() == View.VISIBLE;
boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
if (suppressedSummary || (isLockscreenPublicMode() && !mShowLockscreenNotifications) || (onKeyguard && !childWithVisibleSummary && (visibleNotifications >= maxNotifications || !showOnKeyguard))) {
entry.row.setVisibility(View.GONE);
if (onKeyguard && showOnKeyguard && !childNotification && !suppressedSummary) {
mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
}
} else {
boolean wasGone = entry.row.getVisibility() == View.GONE;
if (wasGone) {
entry.row.setVisibility(View.VISIBLE);
}
if (!childNotification && !entry.row.isRemoved()) {
if (wasGone) {
// notify the scroller of a child addition
mStackScroller.generateAddAnimation(entry.row, !showOnKeyguard);
}
visibleNotifications++;
}
}
if (row.isSummaryWithChildren()) {
List<ExpandableNotificationRow> notificationChildren = row.getNotificationChildren();
int size = notificationChildren.size();
for (int i = size - 1; i >= 0; i--) {
stack.push(notificationChildren.get(i));
}
}
}
mStackScroller.updateOverflowContainerVisibility(onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0);
mStackScroller.changeViewPosition(mDismissView, mStackScroller.getChildCount() - 1);
mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - 2);
mStackScroller.changeViewPosition(mKeyguardIconOverflowContainer, mStackScroller.getChildCount() - 3);
}
use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by DirtyUnicorns.
the class BaseStatusBar method onDensityOrFontScaleChanged.
protected void onDensityOrFontScaleChanged() {
ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
for (int i = 0; i < activeNotifications.size(); i++) {
Entry entry = activeNotifications.get(i);
boolean exposedGuts = entry.row.getGuts() == mNotificationGutsExposed;
entry.row.reInflateViews();
if (exposedGuts) {
mNotificationGutsExposed = entry.row.getGuts();
bindGuts(entry.row);
}
inflateViews(entry, mStackScroller);
}
}
use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by DirtyUnicorns.
the class PhoneStatusBar method startKeyguard.
protected void startKeyguard() {
Trace.beginSection("PhoneStatusBar#startKeyguard");
KeyguardViewMediator keyguardViewMediator = getComponent(KeyguardViewMediator.class);
mFingerprintUnlockController = new FingerprintUnlockController(mContext, mStatusBarWindowManager, mDozeScrimController, keyguardViewMediator, mScrimController, this);
mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this, getBouncerContainer(), mStatusBarWindowManager, mScrimController, mFingerprintUnlockController);
mKeyguardIndicationController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mFingerprintUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mIconPolicy.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mRemoteInputController.addCallback(mStatusBarKeyguardViewManager);
mRemoteInputController.addCallback(new RemoteInputController.Callback() {
@Override
public void onRemoteInputSent(Entry entry) {
if (FORCE_REMOTE_INPUT_HISTORY && mKeysKeptForRemoteInput.contains(entry.key)) {
removeNotification(entry.key, null);
} else if (mRemoteInputEntriesToRemoveOnCollapse.contains(entry)) {
// We're currently holding onto this notification, but from the apps point of
// view it is already canceled, so we'll need to cancel it on the apps behalf
// after sending - unless the app posts an update in the mean time, so wait a
// bit.
mHandler.postDelayed(() -> {
if (mRemoteInputEntriesToRemoveOnCollapse.remove(entry)) {
removeNotification(entry.key, null);
}
}, REMOTE_INPUT_KEPT_ENTRY_AUTO_CANCEL_DELAY);
}
}
});
mKeyguardViewMediatorCallback = keyguardViewMediator.getViewMediatorCallback();
mLightStatusBarController.setFingerprintUnlockController(mFingerprintUnlockController);
Trace.endSection();
}
Aggregations