Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe7080e3 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Make NotificationActivityStarter params non-nullable

I added checks a few weeks ago that would've notified us if there was
something wrong, and since no issues popped up it's safe to make this
change.

NotificationGutsManagerWithScenesTest was failing with this change, so I
took the opportunity to clean it up and make it use mockito-kotlin.

Fix: 369599778
Test: builds, existing tests pass
Flag: EXEMPT trivial change that has been verified to be safe
Change-Id: I2640196d4af1e709a54c3f54e21c886736f063a0
parent aae95605
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -32,13 +32,13 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
interface NotificationActivityStarter {

    /** Called when the user clicks on the notification bubble icon. */
    fun onNotificationBubbleIconClicked(entry: NotificationEntry?)
    fun onNotificationBubbleIconClicked(entry: NotificationEntry)

    /** Called when the user clicks on the surface of a notification. */
    fun onNotificationClicked(entry: NotificationEntry?, row: ExpandableNotificationRow?)
    fun onNotificationClicked(entry: NotificationEntry, row: ExpandableNotificationRow)

    /** Called when the user clicks on a button in the notification guts which fires an intent. */
    fun startNotificationGutsIntent(intent: Intent?, appUid: Int, row: ExpandableNotificationRow?)
    fun startNotificationGutsIntent(intent: Intent, appUid: Int, row: ExpandableNotificationRow)

    /**
     * Called when the user clicks "Manage" or "History" in the Shade. Prefer using
@@ -56,7 +56,7 @@ interface NotificationActivityStarter {
    fun startSettingsIntent(view: View, intentInfo: SettingsIntent)

    /** Called when the user succeed to drop notification to proper target view. */
    fun onDragSuccess(entry: NotificationEntry?)
    fun onDragSuccess(entry: NotificationEntry)

    val isCollapsingToShowActivityOverLockscreen: Boolean
        get() = false
+6 −12
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
import static android.service.notification.NotificationListenerService.REASON_CLICK;

import static com.android.systemui.statusbar.phone.CentralSurfaces.getActivityOptions;
import static com.android.systemui.util.kotlin.NullabilityKt.expectNotNull;

import android.app.ActivityManager;
import android.app.ActivityOptions;
@@ -231,8 +230,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
     * @param entry notification that bubble icon was clicked
     */
    @Override
    public void onNotificationBubbleIconClicked(NotificationEntry entry) {
        expectNotNull(TAG, "entry", entry);
    public void onNotificationBubbleIconClicked(@NonNull NotificationEntry entry) {
        Runnable action = () -> {
            mBubblesManagerOptional.ifPresent(bubblesManager ->
                    bubblesManager.onUserChangedBubble(entry, !entry.isBubble()));
@@ -258,9 +256,8 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
     * @param row   row for that notification
     */
    @Override
    public void onNotificationClicked(NotificationEntry entry, ExpandableNotificationRow row) {
        expectNotNull(TAG, "entry", entry);
        expectNotNull(TAG, "row", row);
    public void onNotificationClicked(@NonNull NotificationEntry entry,
            @NonNull ExpandableNotificationRow row) {
        mLogger.logStartingActivityFromClick(entry, row.isHeadsUpState(),
                mKeyguardStateController.isVisible(),
                mNotificationShadeWindowController.getPanelExpanded());
@@ -442,8 +439,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
     * @param entry notification entry that is dropped.
     */
    @Override
    public void onDragSuccess(NotificationEntry entry) {
        expectNotNull(TAG, "entry", entry);
    public void onDragSuccess(@NonNull NotificationEntry entry) {
        // this method is not responsible for intent sending.
        // will focus follow operation only after drag-and-drop that notification.
        final NotificationVisibility nv = mVisibilityProvider.obtain(entry, true);
@@ -534,10 +530,8 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
    }

    @Override
    public void startNotificationGutsIntent(final Intent intent, final int appUid,
            ExpandableNotificationRow row) {
        expectNotNull(TAG, "intent", intent);
        expectNotNull(TAG, "row", row);
    public void startNotificationGutsIntent(@NonNull final Intent intent, final int appUid,
            @NonNull ExpandableNotificationRow row) {
        boolean animate = mActivityStarter.shouldAnimateLaunch(true /* isActivityIntent */);
        ActivityStarter.OnDismissAction onDismissAction = new ActivityStarter.OnDismissAction() {
            @Override
+147 −209

File changed.

Preview size limit exceeded, changes collapsed.