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

Commit 2184236c authored by rautamak's avatar rautamak Committed by Luca Stefani
Browse files

SystemUI: Allow translucent notifications background on lockscreen [1/3]

Change-Id: I7fc5e3a09288fa55ac0aaff65e222f2c10edeb07
parent 2f01d7f6
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -142,6 +142,8 @@ import com.android.systemui.statusbar.policy.ScrollAdapter;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.Assert;

import lineageos.providers.LineageSettings;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
@@ -162,6 +164,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        NotificationListContainer, ConfigurationListener, Dumpable,
        DynamicPrivacyController.Listener {

    public static final String LOCKSCREEN_TRANSLUCENT_NOTIFICATIONS_BG_ENABLED =
            "lineagesecure:" +
            LineageSettings.Secure.LOCKSCREEN_TRANSLUCENT_NOTIFICATIONS_BG_ENABLED;

    public static final float BACKGROUND_ALPHA_DIMMED = 0.7f;
    private static final String TAG = "StackScroller";
    private static final boolean DEBUG = false;
@@ -186,7 +192,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    private final NotificationSwipeHelper mSwipeHelper;
    private int mCurrentStackHeight = Integer.MAX_VALUE;
    private final Paint mBackgroundPaint = new Paint();
    private final boolean mShouldDrawNotificationBackground;
    private boolean mShouldDrawNotificationBackground;
    private boolean mHighPriorityBeforeSpeedBump;
    private final boolean mAllowLongPress;
    private boolean mDismissRtl;
@@ -559,8 +565,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                getContext(), mMenuEventListener, mFalsingManager);
        mStackScrollAlgorithm = createStackScrollAlgorithm(context);
        initView(context);
        mShouldDrawNotificationBackground =
                res.getBoolean(R.bool.config_drawNotificationBackground);
        mFadeNotificationsOnDismiss =
                res.getBoolean(R.bool.config_fadeNotificationsOnDismiss);
        mRoundnessManager.setAnimatedChildren(mChildrenToAddAnimated);
@@ -575,8 +579,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            blockingHelperManager.setNotificationShadeExpanded(height);
        });

        boolean willDraw = mShouldDrawNotificationBackground || DEBUG;
        setWillNotDraw(!willDraw);
        mBackgroundPaint.setAntiAlias(true);
        if (DEBUG) {
            mDebugPaint = new Paint();
@@ -593,8 +595,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                mHighPriorityBeforeSpeedBump = "1".equals(newValue);
            } else if (key.equals(Settings.Secure.NOTIFICATION_DISMISS_RTL)) {
                updateDismissRtlSetting("1".equals(newValue));
            } else if (key.equals(LOCKSCREEN_TRANSLUCENT_NOTIFICATIONS_BG_ENABLED)) {
                mShouldDrawNotificationBackground = !"1".equals(newValue);
                setWillNotDraw(!mShouldDrawNotificationBackground);
            }
        }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL);
        }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL,
                LOCKSCREEN_TRANSLUCENT_NOTIFICATIONS_BG_ENABLED);

        mEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
            @Override
@@ -609,6 +615,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        dynamicPrivacyController.addListener(this);
        mDynamicPrivacyController = dynamicPrivacyController;
        mStatusbarStateController = (SysuiStatusBarStateController) statusBarStateController;

        boolean willDraw = mShouldDrawNotificationBackground || DEBUG;
        setWillNotDraw(!willDraw);
    }

    private void updateDismissRtlSetting(boolean dismissRtl) {
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.systemui.BatteryMeterView;
import com.android.systemui.DemoMode;
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.settings.CurrentUserTracker;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.phone.ClockController;
import com.android.systemui.statusbar.phone.EdgeBackGestureHandler;
import com.android.systemui.statusbar.phone.NavigationBarView;
@@ -79,6 +80,7 @@ public class TunerServiceImpl extends TunerService {
            NavigationBarView.NAVIGATION_BAR_MENU_ARROW_KEYS,
            NotificationPanelView.DOUBLE_TAP_SLEEP_GESTURE,
            NotificationPanelView.STATUS_BAR_QUICK_QS_PULLDOWN,
            NotificationStackScrollLayout.LOCKSCREEN_TRANSLUCENT_NOTIFICATIONS_BG_ENABLED,
            QSTileHost.TILES_SETTING,
            Settings.Secure.DOZE_ALWAYS_ON,
            StatusBar.FORCE_SHOW_NAVBAR,