Loading packages/SystemUI/res/layout/people_strip.xml +41 −181 Original line number Diff line number Diff line Loading @@ -18,7 +18,10 @@ <com.android.systemui.statusbar.notification.stack.PeopleHubView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="105dp"> android:layout_height="@dimen/notification_section_header_height" android:focusable="true" android:clickable="true" > <com.android.systemui.statusbar.notification.row.NotificationBackgroundView android:id="@+id/backgroundNormal" Loading @@ -34,199 +37,56 @@ android:id="@+id/people_list" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="12dp" android:paddingBottom="12dp" android:gravity="center" android:orientation="horizontal"> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginStart="@dimen/notification_section_header_padding_left" android:gravity="start" android:textAlignment="gravity" android:text="@string/notification_section_header_conversations" android:textSize="12sp" android:textColor="@color/notification_section_header_label_color" android:fontFamily="@*android:string/config_headlineFontFamilyMedium" /> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:layout_width="48dp" android:layout_height="48dp" android:padding="8dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:layout_width="48dp" android:layout_height="48dp" android:padding="8dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:layout_width="48dp" android:layout_height="48dp" android:padding="8dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:layout_width="48dp" android:layout_height="48dp" android:padding="8dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" <ImageView android:layout_width="48dp" android:layout_height="48dp" android:layout_marginEnd="8dp" android:padding="8dp" android:scaleType="fitCenter" /> </LinearLayout> Loading packages/SystemUI/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1163,6 +1163,9 @@ <!-- Section title for notifications that do not vibrate or make noise. [CHAR LIMIT=40] --> <string name="notification_section_header_gentle">Silent notifications</string> <!-- Section title for conversational notifications. [CHAR LIMIT=40] --> <string name="notification_section_header_conversations">Conversations</string> <!-- Content description for accessibility: Tapping this button will dismiss all gentle notifications [CHAR LIMIT=NONE] --> <string name="accessibility_notification_section_header_gentle_clear_all">Clear all silent notifications</string> Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +8 −5 Original line number Diff line number Diff line Loading @@ -344,11 +344,14 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mSavedBubbleKeysPerUser = new SparseSetArray<>(); mCurrentUserId = mNotifUserManager.getCurrentUserId(); mNotifUserManager.addUserChangedListener( newUserId -> { saveBubbles(mCurrentUserId); new NotificationLockscreenUserManager.UserChangedListener() { @Override public void onUserChanged(int newUserId) { BubbleController.this.saveBubbles(mCurrentUserId); mBubbleData.dismissAll(DISMISS_USER_CHANGED); restoreBubbles(newUserId); BubbleController.this.restoreBubbles(newUserId); mCurrentUserId = newUserId; } }); mUserCreatedBubbles = new HashSet<>(); Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java +8 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,12 @@ public interface NotificationLockscreenUserManager { /** Adds a listener to be notified when the current user changes. */ void addUserChangedListener(UserChangedListener listener); /** * Removes a listener previously registered with * {@link #addUserChangedListener(UserChangedListener)} */ void removeUserChangedListener(UserChangedListener listener); SparseArray<UserInfo> getCurrentProfiles(); void setLockscreenPublicMode(boolean isProfilePublic, int userId); Loading Loading @@ -79,6 +85,7 @@ public interface NotificationLockscreenUserManager { /** Notified when the current user changes. */ interface UserChangedListener { void onUserChanged(int userId); default void onUserChanged(int userId) {} default void onCurrentProfilesChanged(SparseArray<UserInfo> currentProfiles) {} } } packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +67 −43 Original line number Diff line number Diff line Loading @@ -117,14 +117,18 @@ public class NotificationLockscreenUserManagerImpl implements @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_USER_SWITCHED.equals(action)) { mCurrentUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1); switch (action) { case Intent.ACTION_USER_SWITCHED: mCurrentUserId = intent.getIntExtra( Intent.EXTRA_USER_HANDLE, UserHandle.USER_ALL); updateCurrentProfilesCache(); Log.v(TAG, "userId " + mCurrentUserId + " is in the house"); updateLockscreenNotificationSetting(); updatePublicMode(); // The filtering needs to happen before the update call below in order to make sure // The filtering needs to happen before the update call below in order to // make sure // the presenter has the updated notifications from the new user getEntryManager().reapplyFilterAndSort("user switched"); mPresenter.onUserSwitched(mCurrentUserId); Loading @@ -132,13 +136,19 @@ public class NotificationLockscreenUserManagerImpl implements for (UserChangedListener listener : mListeners) { listener.onUserChanged(mCurrentUserId); } } else if (Intent.ACTION_USER_ADDED.equals(action)) { break; case Intent.ACTION_USER_ADDED: case Intent.ACTION_MANAGED_PROFILE_AVAILABLE: case Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE: updateCurrentProfilesCache(); } else if (Intent.ACTION_USER_UNLOCKED.equals(action)) { break; case Intent.ACTION_USER_UNLOCKED: // Start the overview connection to the launcher service Dependency.get(OverviewProxyService.class).startConnectionToCurrentUser(); } else if (NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION.equals(action)) { final IntentSender intentSender = intent.getParcelableExtra(Intent.EXTRA_INTENT); break; case NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION: final IntentSender intentSender = intent.getParcelableExtra( Intent.EXTRA_INTENT); final String notificationKey = intent.getStringExtra(Intent.EXTRA_INDEX); if (intentSender != null) { try { Loading @@ -154,7 +164,8 @@ public class NotificationLockscreenUserManagerImpl implements final int rank = entry != null ? entry.getRanking().getRank() : 0; NotificationVisibility.NotificationLocation location = NotificationLogger.getNotificationLocation(entry); final NotificationVisibility nv = NotificationVisibility.obtain(notificationKey, final NotificationVisibility nv = NotificationVisibility.obtain( notificationKey, rank, count, true, location); try { mBarService.onNotificationClick(notificationKey, nv); Loading @@ -162,6 +173,7 @@ public class NotificationLockscreenUserManagerImpl implements /* ignore */ } } break; } } }; Loading Loading @@ -266,6 +278,8 @@ public class NotificationLockscreenUserManagerImpl implements filter.addAction(Intent.ACTION_USER_SWITCHED); filter.addAction(Intent.ACTION_USER_ADDED); filter.addAction(Intent.ACTION_USER_UNLOCKED); filter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE); filter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE); mBroadcastDispatcher.registerReceiver(mBaseBroadcastReceiver, filter); IntentFilter internalFilter = new IntentFilter(); Loading Loading @@ -489,6 +503,11 @@ public class NotificationLockscreenUserManagerImpl implements } } } mMainHandler.post(() -> { for (UserChangedListener listener : mListeners) { listener.onCurrentProfilesChanged(mCurrentProfiles); } }); } public boolean isAnyProfilePublicMode() { Loading Loading @@ -555,6 +574,11 @@ public class NotificationLockscreenUserManagerImpl implements mListeners.add(listener); } @Override public void removeUserChangedListener(UserChangedListener listener) { mListeners.remove(listener); } // public void updatePublicMode() { // //TODO: I think there may be a race condition where mKeyguardViewManager.isShowing() returns // // false when it should be true. Therefore, if we are not on the SHADE, don't even bother Loading Loading
packages/SystemUI/res/layout/people_strip.xml +41 −181 Original line number Diff line number Diff line Loading @@ -18,7 +18,10 @@ <com.android.systemui.statusbar.notification.stack.PeopleHubView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="105dp"> android:layout_height="@dimen/notification_section_header_height" android:focusable="true" android:clickable="true" > <com.android.systemui.statusbar.notification.row.NotificationBackgroundView android:id="@+id/backgroundNormal" Loading @@ -34,199 +37,56 @@ android:id="@+id/people_list" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="12dp" android:paddingBottom="12dp" android:gravity="center" android:orientation="horizontal"> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" android:layout_marginStart="@dimen/notification_section_header_padding_left" android:gravity="start" android:textAlignment="gravity" android:text="@string/notification_section_header_conversations" android:textSize="12sp" android:textColor="@color/notification_section_header_label_color" android:fontFamily="@*android:string/config_headlineFontFamilyMedium" /> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:layout_width="48dp" android:layout_height="48dp" android:padding="8dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:layout_width="48dp" android:layout_height="48dp" android:padding="8dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:layout_width="48dp" android:layout_height="48dp" android:padding="8dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" /> <LinearLayout android:layout_width="70dp" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" android:visibility="invisible"> <ImageView android:id="@+id/person_icon" android:layout_width="36dp" android:layout_height="36dp" android:layout_width="48dp" android:layout_height="48dp" android:padding="8dp" android:scaleType="fitCenter" /> <TextView android:id="@+id/person_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:ellipsize="end" android:maxLines="2" android:textAlignment="center" /> </LinearLayout> <View android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1" <ImageView android:layout_width="48dp" android:layout_height="48dp" android:layout_marginEnd="8dp" android:padding="8dp" android:scaleType="fitCenter" /> </LinearLayout> Loading
packages/SystemUI/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1163,6 +1163,9 @@ <!-- Section title for notifications that do not vibrate or make noise. [CHAR LIMIT=40] --> <string name="notification_section_header_gentle">Silent notifications</string> <!-- Section title for conversational notifications. [CHAR LIMIT=40] --> <string name="notification_section_header_conversations">Conversations</string> <!-- Content description for accessibility: Tapping this button will dismiss all gentle notifications [CHAR LIMIT=NONE] --> <string name="accessibility_notification_section_header_gentle_clear_all">Clear all silent notifications</string> Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +8 −5 Original line number Diff line number Diff line Loading @@ -344,11 +344,14 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mSavedBubbleKeysPerUser = new SparseSetArray<>(); mCurrentUserId = mNotifUserManager.getCurrentUserId(); mNotifUserManager.addUserChangedListener( newUserId -> { saveBubbles(mCurrentUserId); new NotificationLockscreenUserManager.UserChangedListener() { @Override public void onUserChanged(int newUserId) { BubbleController.this.saveBubbles(mCurrentUserId); mBubbleData.dismissAll(DISMISS_USER_CHANGED); restoreBubbles(newUserId); BubbleController.this.restoreBubbles(newUserId); mCurrentUserId = newUserId; } }); mUserCreatedBubbles = new HashSet<>(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java +8 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,12 @@ public interface NotificationLockscreenUserManager { /** Adds a listener to be notified when the current user changes. */ void addUserChangedListener(UserChangedListener listener); /** * Removes a listener previously registered with * {@link #addUserChangedListener(UserChangedListener)} */ void removeUserChangedListener(UserChangedListener listener); SparseArray<UserInfo> getCurrentProfiles(); void setLockscreenPublicMode(boolean isProfilePublic, int userId); Loading Loading @@ -79,6 +85,7 @@ public interface NotificationLockscreenUserManager { /** Notified when the current user changes. */ interface UserChangedListener { void onUserChanged(int userId); default void onUserChanged(int userId) {} default void onCurrentProfilesChanged(SparseArray<UserInfo> currentProfiles) {} } }
packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +67 −43 Original line number Diff line number Diff line Loading @@ -117,14 +117,18 @@ public class NotificationLockscreenUserManagerImpl implements @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_USER_SWITCHED.equals(action)) { mCurrentUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1); switch (action) { case Intent.ACTION_USER_SWITCHED: mCurrentUserId = intent.getIntExtra( Intent.EXTRA_USER_HANDLE, UserHandle.USER_ALL); updateCurrentProfilesCache(); Log.v(TAG, "userId " + mCurrentUserId + " is in the house"); updateLockscreenNotificationSetting(); updatePublicMode(); // The filtering needs to happen before the update call below in order to make sure // The filtering needs to happen before the update call below in order to // make sure // the presenter has the updated notifications from the new user getEntryManager().reapplyFilterAndSort("user switched"); mPresenter.onUserSwitched(mCurrentUserId); Loading @@ -132,13 +136,19 @@ public class NotificationLockscreenUserManagerImpl implements for (UserChangedListener listener : mListeners) { listener.onUserChanged(mCurrentUserId); } } else if (Intent.ACTION_USER_ADDED.equals(action)) { break; case Intent.ACTION_USER_ADDED: case Intent.ACTION_MANAGED_PROFILE_AVAILABLE: case Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE: updateCurrentProfilesCache(); } else if (Intent.ACTION_USER_UNLOCKED.equals(action)) { break; case Intent.ACTION_USER_UNLOCKED: // Start the overview connection to the launcher service Dependency.get(OverviewProxyService.class).startConnectionToCurrentUser(); } else if (NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION.equals(action)) { final IntentSender intentSender = intent.getParcelableExtra(Intent.EXTRA_INTENT); break; case NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION: final IntentSender intentSender = intent.getParcelableExtra( Intent.EXTRA_INTENT); final String notificationKey = intent.getStringExtra(Intent.EXTRA_INDEX); if (intentSender != null) { try { Loading @@ -154,7 +164,8 @@ public class NotificationLockscreenUserManagerImpl implements final int rank = entry != null ? entry.getRanking().getRank() : 0; NotificationVisibility.NotificationLocation location = NotificationLogger.getNotificationLocation(entry); final NotificationVisibility nv = NotificationVisibility.obtain(notificationKey, final NotificationVisibility nv = NotificationVisibility.obtain( notificationKey, rank, count, true, location); try { mBarService.onNotificationClick(notificationKey, nv); Loading @@ -162,6 +173,7 @@ public class NotificationLockscreenUserManagerImpl implements /* ignore */ } } break; } } }; Loading Loading @@ -266,6 +278,8 @@ public class NotificationLockscreenUserManagerImpl implements filter.addAction(Intent.ACTION_USER_SWITCHED); filter.addAction(Intent.ACTION_USER_ADDED); filter.addAction(Intent.ACTION_USER_UNLOCKED); filter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE); filter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE); mBroadcastDispatcher.registerReceiver(mBaseBroadcastReceiver, filter); IntentFilter internalFilter = new IntentFilter(); Loading Loading @@ -489,6 +503,11 @@ public class NotificationLockscreenUserManagerImpl implements } } } mMainHandler.post(() -> { for (UserChangedListener listener : mListeners) { listener.onCurrentProfilesChanged(mCurrentProfiles); } }); } public boolean isAnyProfilePublicMode() { Loading Loading @@ -555,6 +574,11 @@ public class NotificationLockscreenUserManagerImpl implements mListeners.add(listener); } @Override public void removeUserChangedListener(UserChangedListener listener) { mListeners.remove(listener); } // public void updatePublicMode() { // //TODO: I think there may be a race condition where mKeyguardViewManager.isShowing() returns // // false when it should be true. Therefore, if we are not on the SHADE, don't even bother Loading