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

Commit 0b7dff0e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adds setting for direction of dismiss gesture."

parents a0f377fb a18dc57f
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -8248,6 +8248,16 @@ public final class Settings {
        private static final Validator NOTIFICATION_BADGING_VALIDATOR = BOOLEAN_VALIDATOR;
        /**
         * Whether notifications are dismissed by a right-to-left swipe (instead of a left-to-right
         * swipe).
         *
         * @hide
         */
        public static final String NOTIFICATION_DISMISS_RTL = "notification_dismiss_rtl";
        private static final Validator NOTIFICATION_DISMISS_RTL_VALIDATOR = BOOLEAN_VALIDATOR;
        /**
         * Comma separated list of QS tiles that have been auto-added already.
         * @hide
@@ -8550,6 +8560,7 @@ public final class Settings {
            ASSIST_GESTURE_WAKE_ENABLED,
            VR_DISPLAY_MODE,
            NOTIFICATION_BADGING,
            NOTIFICATION_DISMISS_RTL,
            QS_AUTO_ADDED_TILES,
            SCREENSAVER_ENABLED,
            SCREENSAVER_COMPONENTS,
@@ -8712,6 +8723,7 @@ public final class Settings {
            VALIDATORS.put(ASSIST_GESTURE_WAKE_ENABLED, ASSIST_GESTURE_WAKE_ENABLED_VALIDATOR);
            VALIDATORS.put(VR_DISPLAY_MODE, VR_DISPLAY_MODE_VALIDATOR);
            VALIDATORS.put(NOTIFICATION_BADGING, NOTIFICATION_BADGING_VALIDATOR);
            VALIDATORS.put(NOTIFICATION_DISMISS_RTL, NOTIFICATION_DISMISS_RTL_VALIDATOR);
            VALIDATORS.put(QS_AUTO_ADDED_TILES, QS_AUTO_ADDED_TILES_VALIDATOR);
            VALIDATORS.put(SCREENSAVER_ENABLED, SCREENSAVER_ENABLED_VALIDATOR);
            VALIDATORS.put(SCREENSAVER_COMPONENTS, SCREENSAVER_COMPONENTS_VALIDATOR);
+9 −3
Original line number Diff line number Diff line
@@ -20,14 +20,14 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

import com.android.systemui.plugins.Plugin;
import com.android.systemui.plugins.annotations.DependsOn;
import com.android.systemui.plugins.annotations.ProvidesInterface;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.OnMenuEventListener;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem;

import java.util.ArrayList;

@ProvidesInterface(action = NotificationMenuRowPlugin.ACTION,
        version = NotificationMenuRowPlugin.VERSION)
@@ -148,6 +148,12 @@ public interface NotificationMenuRowPlugin extends Plugin {
     */
    public boolean canBeDismissed();

    /**
     * Informs the menu whether dismiss gestures are left-to-right or right-to-left.
     */
    default void setDismissRtl(boolean dismissRtl) {
    }

    /**
     * Determines whether the menu should remain open given its current state, or snap closed.
     * @return true if the menu should remain open, false otherwise.
+8 −0
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@ public interface NotificationLockscreenUserManager {

    boolean isCurrentProfile(int userId);

    /** Adds a listener to be notified when the current user changes. */
    void addUserChangedListener(UserChangedListener listener);

    void destroy();

    SparseArray<UserInfo> getCurrentProfiles();
@@ -58,4 +61,9 @@ public interface NotificationLockscreenUserManager {
    boolean needsRedaction(NotificationEntry entry);

    boolean userAllowsPrivateNotificationsInPublic(int currentUserId);

    /** Notified when the current user changes. */
    interface UserChangedListener {
        void onUserChanged(int userId);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ import com.android.systemui.statusbar.policy.KeyguardMonitor;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * Handles keeping track of the current user, profiles, and various things related to hiding
@@ -78,6 +80,7 @@ public class NotificationLockscreenUserManagerImpl implements
    private final SparseBooleanArray mUsersAllowingNotifications = new SparseBooleanArray();
    private final UserManager mUserManager;
    private final IStatusBarService mBarService;
    private final List<UserChangedListener> mListeners = new ArrayList<>();

    private boolean mShowLockscreenNotifications;
    private boolean mAllowLockscreenRemoteInput;
@@ -112,6 +115,10 @@ public class NotificationLockscreenUserManagerImpl implements
                updatePublicMode();
                mPresenter.onUserSwitched(mCurrentUserId);
                getEntryManager().getNotificationData().filterAndSort();

                for (UserChangedListener listener : mListeners) {
                    listener.onUserChanged(mCurrentUserId);
                }
            } else if (Intent.ACTION_USER_ADDED.equals(action)) {
                updateCurrentProfilesCache();
            } else if (Intent.ACTION_USER_UNLOCKED.equals(action)) {
@@ -502,6 +509,10 @@ public class NotificationLockscreenUserManagerImpl implements
        }
    }

    @Override
    public void addUserChangedListener(UserChangedListener listener) {
        mListeners.add(listener);
    }

//    public void updatePublicMode() {
//        //TODO: I think there may be a race condition where mKeyguardViewManager.isShowing() returns
@@ -541,6 +552,7 @@ public class NotificationLockscreenUserManagerImpl implements
    public void destroy() {
        mContext.unregisterReceiver(mBaseBroadcastReceiver);
        mContext.unregisterReceiver(mAllUsersReceiver);
        mListeners.clear();
    }

    @Override
+5 −0
Original line number Diff line number Diff line
@@ -3092,6 +3092,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    /** Sets whether dismiss gestures are right-to-left (instead of left-to-right). */
    public void setDismissRtl(boolean dismissRtl) {
        mMenuRow.setDismissRtl(dismissRtl);
    }

    private static class NotificationViewState extends ExpandableViewState {

        @Override
Loading