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

Commit 66d709f9 authored by Valentin Iftime's avatar Valentin Iftime
Browse files

Move vibrate while unlocked behind a flag

 Keep this feature disabled for the initial release.

Test: atest NotificationAttentionHelperTest

Bug: 270456865
Change-Id: If903fce0b468b06a311453c3647890f2c9985e82
parent 99d20ad8
Loading
Loading
Loading
Loading
+11 −7
Original line number Original line Diff line number Diff line
@@ -301,11 +301,13 @@ public final class NotificationAttentionHelper {
                    mContext.getContentResolver(),
                    mContext.getContentResolver(),
                    Settings.System.NOTIFICATION_COOLDOWN_ALL, DEFAULT_NOTIFICATION_COOLDOWN_ALL,
                    Settings.System.NOTIFICATION_COOLDOWN_ALL, DEFAULT_NOTIFICATION_COOLDOWN_ALL,
                    UserHandle.USER_CURRENT) != 0;
                    UserHandle.USER_CURRENT) != 0;
                if (Flags.vibrateWhileUnlocked()) {
                    mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser(
                    mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser(
                        mContext.getContentResolver(),
                        mContext.getContentResolver(),
                        Settings.System.NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED,
                        Settings.System.NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED,
                        DEFAULT_NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED,
                        DEFAULT_NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED,
                        UserHandle.USER_CURRENT) != 0;
                        UserHandle.USER_CURRENT) != 0;
                }
            } catch (Exception e) {
            } catch (Exception e) {
                Log.e(TAG, "Failed to read Settings: " + e);
                Log.e(TAG, "Failed to read Settings: " + e);
            }
            }
@@ -1364,6 +1366,7 @@ public final class NotificationAttentionHelper {
                            DEFAULT_NOTIFICATION_COOLDOWN_ALL, UserHandle.USER_CURRENT)
                            DEFAULT_NOTIFICATION_COOLDOWN_ALL, UserHandle.USER_CURRENT)
                            != 0;
                            != 0;
                }
                }
                if (Flags.vibrateWhileUnlocked()) {
                    if (NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED_URI.equals(uri)) {
                    if (NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED_URI.equals(uri)) {
                        mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser(
                        mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser(
                            mContext.getContentResolver(),
                            mContext.getContentResolver(),
@@ -1374,6 +1377,7 @@ public final class NotificationAttentionHelper {
                }
                }
            }
            }
        }
        }
    }




    // TODO b/270456865: cleanup most (all?) of these
    // TODO b/270456865: cleanup most (all?) of these
+1 −0
Original line number Original line Diff line number Diff line
@@ -2107,6 +2107,7 @@ public class NotificationAttentionHelperTest extends UiServiceTestCase {
    @Test
    @Test
    public void testBuzzOnlyOnScreenUnlock_politeNotif() throws Exception {
    public void testBuzzOnlyOnScreenUnlock_politeNotif() throws Exception {
        mSetFlagsRule.enableFlags(Flags.FLAG_POLITE_NOTIFICATIONS);
        mSetFlagsRule.enableFlags(Flags.FLAG_POLITE_NOTIFICATIONS);
        mSetFlagsRule.enableFlags(Flags.FLAG_VIBRATE_WHILE_UNLOCKED);
        TestableFlagResolver flagResolver = new TestableFlagResolver();
        TestableFlagResolver flagResolver = new TestableFlagResolver();


        // When NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED setting is enabled
        // When NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED setting is enabled