diff --git a/packages/SystemUI/res/layout/people_space_initial_layout.xml b/packages/SystemUI/res/layout/people_space_initial_layout.xml index ec29d18d607dd..c57ec345ba57f 100644 --- a/packages/SystemUI/res/layout/people_space_initial_layout.xml +++ b/packages/SystemUI/res/layout/people_space_initial_layout.xml @@ -47,7 +47,7 @@ android:id="@+id/name" android:paddingTop="2dp" android:text="@string/empty_user_name" - android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title" android:textColor="?android:attr/textColorPrimary" android:textSize="12sp" android:maxLines="1" @@ -59,7 +59,7 @@ + android:textSize="@dimen/name_text_size_for_large_content" /> @@ -117,11 +117,10 @@ android:ellipsize="end" android:singleLine="true" android:text="@string/empty_user_name" - android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title" android:textColor="?android:attr/textColorSecondary" android:textSize="12sp" /> - diff --git a/packages/SystemUI/res/layout/people_tile_medium_empty.xml b/packages/SystemUI/res/layout/people_tile_medium_empty.xml index 8b2fddc5c9272..ebb61c94eca51 100644 --- a/packages/SystemUI/res/layout/people_tile_medium_empty.xml +++ b/packages/SystemUI/res/layout/people_tile_medium_empty.xml @@ -53,7 +53,7 @@ diff --git a/packages/SystemUI/res/layout/people_tile_small.xml b/packages/SystemUI/res/layout/people_tile_small.xml index 22fcd3bcce37c..553b8a43e033f 100644 --- a/packages/SystemUI/res/layout/people_tile_small.xml +++ b/packages/SystemUI/res/layout/people_tile_small.xml @@ -40,7 +40,7 @@ @@ -50,7 +50,7 @@ android:layout_gravity="center" android:gravity="center" android:paddingHorizontal="8dp" - android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title" android:textColor="?androidprv:attr/textColorOnAccent" android:background="@drawable/people_space_messages_count_background" android:textSize="@dimen/name_text_size_for_small" @@ -69,7 +69,7 @@ android:ellipsize="end" android:maxLines="1" android:paddingHorizontal="4dp" - android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/name_text_size_for_small" /> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 040725e135fd8..76a4c5ffe9196 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1456,7 +1456,8 @@ 64dp 108dp 14sp - 12sp + 12sp + 14sp 12sp 14sp 104dp diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java b/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java index 06817b9e314ee..32fdf0ea4de63 100644 --- a/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java +++ b/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java @@ -282,13 +282,18 @@ public class PeopleTileViewHelper { } private void setMaxLines(RemoteViews views, boolean showSender) { - int nameHeight = getLineHeightFromResource(R.dimen.name_text_size_for_content); + int textSizeResId; + int nameHeight; + if (mLayoutSize == LAYOUT_LARGE) { + textSizeResId = R.dimen.content_text_size_for_large; + nameHeight = getLineHeightFromResource(R.dimen.name_text_size_for_large_content); + } else { + textSizeResId = R.dimen.content_text_size_for_medium; + nameHeight = getLineHeightFromResource(R.dimen.name_text_size_for_medium_content); + } boolean isStatusLayout = views.getLayoutId() == R.layout.people_tile_large_with_status_content; int contentHeight = getContentHeightForLayout(nameHeight, isStatusLayout); - int textSizeResId = mLayoutSize == LAYOUT_LARGE - ? R.dimen.content_text_size_for_large - : R.dimen.content_text_size_for_medium; int lineHeight = getLineHeightFromResource(textSizeResId); int maxAdaptiveLines = Math.floorDiv(contentHeight, lineHeight); int maxLines = Math.max(MIN_CONTENT_MAX_LINES, maxAdaptiveLines); @@ -349,7 +354,7 @@ public class PeopleTileViewHelper { int spaceAvailableForPadding = mHeight - (getSizeInDp(R.dimen.avatar_size_for_medium) + 4 + getLineHeightFromResource( - R.dimen.name_text_size_for_content)); + R.dimen.name_text_size_for_medium_content)); if (DEBUG) { Log.d(TAG, "Medium view for mWidth: " + mWidth + " mHeight: " + mHeight + " with padding space: " + spaceAvailableForPadding); diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java index 775a3afb7bde9..688884730373a 100644 --- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java @@ -183,6 +183,7 @@ public class PeopleSpaceWidgetManager { filter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE); filter.addAction(Intent.ACTION_USER_UNLOCKED); mBroadcastDispatcher.registerReceiver(mBaseBroadcastReceiver, filter, + null /* executor */, UserHandle.ALL); mRegisteredReceivers = true; } @@ -235,6 +236,10 @@ public class PeopleSpaceWidgetManager { * Updates People Space widgets. */ public void updateWidgets(int[] widgetIds) { + mBgExecutor.execute(() -> updateWidgetsInBackground(widgetIds)); + } + + private void updateWidgetsInBackground(int[] widgetIds) { try { if (DEBUG) Log.d(TAG, "updateWidgets called"); if (widgetIds.length == 0) { @@ -675,7 +680,7 @@ public class PeopleSpaceWidgetManager { if (icon != null) { updatedTile.setUserIcon(icon); } - if (DEBUG) Log.d(TAG, "Statuses: " + conversation.getStatuses().toString()); + if (DEBUG) Log.d(TAG, "Statuses: " + conversation.getStatuses()); NotificationChannel channel = conversation.getNotificationChannel(); if (channel != null) { if (DEBUG) Log.d(TAG, "Important:" + channel.isImportantConversation()); @@ -1095,17 +1100,18 @@ public class PeopleSpaceWidgetManager { NotificationManager.Policy.areAllVisualEffectsSuppressed( policy.suppressedVisualEffects); int notificationPolicyState = 0; + // If the user sees notifications in DND, we do not need to evaluate the current DND + // state, just always show notifications. + if (!suppressVisualEffects) { + if (DEBUG) Log.d(TAG, "Visual effects not suppressed."); + return PeopleSpaceTile.SHOW_CONVERSATIONS; + } switch (mNotificationManager.getCurrentInterruptionFilter()) { case INTERRUPTION_FILTER_ALL: if (DEBUG) Log.d(TAG, "All interruptions allowed"); return PeopleSpaceTile.SHOW_CONVERSATIONS; case INTERRUPTION_FILTER_PRIORITY: if (policy.allowConversations()) { - // If the user sees notifications in DND, show notifications in tiles in DND. - if (!suppressVisualEffects) { - if (DEBUG) Log.d(TAG, "Visual effects not suppressed."); - return PeopleSpaceTile.SHOW_CONVERSATIONS; - } if (policy.priorityConversationSenders == CONVERSATION_SENDERS_ANYONE) { if (DEBUG) Log.d(TAG, "All conversations allowed"); // We only show conversations, so we can show everything. @@ -1140,11 +1146,6 @@ public class PeopleSpaceWidgetManager { case INTERRUPTION_FILTER_NONE: case INTERRUPTION_FILTER_ALARMS: default: - // If the user sees notifications in DND, show notifications in tiles in DND. - if (!suppressVisualEffects) { - if (DEBUG) Log.d(TAG, "Visual effects not suppressed."); - return PeopleSpaceTile.SHOW_CONVERSATIONS; - } if (DEBUG) Log.d(TAG, "Block conversations"); return PeopleSpaceTile.BLOCK_CONVERSATIONS; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java index 46a60dc47e7be..7af374308befa 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java @@ -991,8 +991,9 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase { addSecondWidgetForPersonTile(); mManager.updateWidgets(new int[]{WIDGET_ID_WITH_SHORTCUT, SECOND_WIDGET_ID_WITH_SHORTCUT}); - // Delete only one widget for the conversation. + // Delete only one widget for the conversation in background. mManager.deleteWidgets(new int[]{WIDGET_ID_WITH_SHORTCUT}); + mClock.advanceTime(MIN_LINGER_DURATION); // Check deleted storage. SharedPreferences widgetSp = mContext.getSharedPreferences( @@ -1010,8 +1011,9 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase { eq(Arrays.asList(SHORTCUT_ID)), eq(UserHandle.of(0)), eq(LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS)); - // Delete all widgets for the conversation. + // Delete all widgets for the conversation in background. mManager.deleteWidgets(new int[]{SECOND_WIDGET_ID_WITH_SHORTCUT}); + mClock.advanceTime(MIN_LINGER_DURATION); // Check deleted storage. SharedPreferences secondWidgetSp = mContext.getSharedPreferences( @@ -1341,6 +1343,13 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase { PeopleSpaceTile tile = mManager.mTiles.get(WIDGET_ID_WITH_SHORTCUT); assertThat(tile.getNotificationPolicyState()).isEqualTo(expected | SHOW_STARRED_CONTACTS); + + setFinalField("suppressedVisualEffects", SUPPRESSED_EFFECT_FULL_SCREEN_INTENT + | SUPPRESSED_EFFECT_AMBIENT); + mManager.updateWidgetsOnStateChange(ACTION_BOOT_COMPLETED); + + tile = mManager.mTiles.get(WIDGET_ID_WITH_SHORTCUT); + assertThat(tile.getNotificationPolicyState()).isEqualTo(expected | SHOW_CONVERSATIONS); } @Test