diff options
5 files changed, 0 insertions, 139 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt index 4e0393341faf..4313aea44326 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicyTest.kt @@ -36,7 +36,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.internal.statusbar.StatusBarIcon import com.android.settingslib.notification.modes.TestModeBuilder -import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.display.domain.interactor.ConnectedDisplayInteractor @@ -480,8 +479,6 @@ class PhoneStatusBarPolicyTest : SysuiTestCase() { override fun getZen(): Int = zen - override fun getManualRule(): ZenModeConfig.ZenRule = throw NotImplementedError() - override fun getConfig(): ZenModeConfig = throw NotImplementedError() override fun getConsolidatedPolicy(): NotificationManager.Policy = consolidatedPolicy @@ -490,14 +487,6 @@ class PhoneStatusBarPolicyTest : SysuiTestCase() { override fun isZenAvailable() = throw NotImplementedError() - override fun getEffectsSuppressor() = throw NotImplementedError() - - override fun isCountdownConditionSupported() = throw NotImplementedError() - override fun getCurrentUser() = throw NotImplementedError() - - override fun isVolumeRestricted() = throw NotImplementedError() - - override fun areNotificationsHiddenInShade() = throw NotImplementedError() } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.kt index 9abdf42e735c..22250082944e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.kt @@ -91,45 +91,6 @@ class ZenModeControllerImplTest : SysuiTestCase() { } @Test - fun testAreNotificationsHiddenInShade_zenOffShadeSuppressed() { - config.suppressedVisualEffects = - NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST - controller.updateZenMode(Settings.Global.ZEN_MODE_OFF) - controller.updateZenModeConfig() - assertThat(controller.areNotificationsHiddenInShade()).isFalse() - } - - @Test - fun testAreNotificationsHiddenInShade_zenOnShadeNotSuppressed() { - val policy = - NotificationManager.Policy( - 0, - 0, - 0, - NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR, - ) - whenever(mNm.consolidatedNotificationPolicy).thenReturn(policy) - controller.updateConsolidatedNotificationPolicy() - controller.updateZenMode(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS) - assertThat(controller.areNotificationsHiddenInShade()).isFalse() - } - - @Test - fun testAreNotificationsHiddenInShade_zenOnShadeSuppressed() { - val policy = - NotificationManager.Policy( - 0, - 0, - 0, - NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST, - ) - whenever(mNm.consolidatedNotificationPolicy).thenReturn(policy) - controller.updateConsolidatedNotificationPolicy() - controller.updateZenMode(Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS) - assertThat(controller.areNotificationsHiddenInShade()).isTrue() - } - - @Test fun testModeChange() = testScope.runTest { val states = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java index 23e40b220a68..90d21b588ef0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeController.java @@ -17,11 +17,8 @@ package com.android.systemui.statusbar.policy; import android.app.NotificationManager; -import android.content.ComponentName; import android.net.Uri; -import android.service.notification.Condition; import android.service.notification.ZenModeConfig; -import android.service.notification.ZenModeConfig.ZenRule; import com.android.systemui.statusbar.policy.ZenModeController.Callback; import com.android.systemui.statusbar.policy.domain.interactor.ZenModeInteractor; @@ -35,25 +32,17 @@ import com.android.systemui.statusbar.policy.domain.interactor.ZenModeInteractor public interface ZenModeController extends CallbackController<Callback> { void setZen(int zen, Uri conditionId, String reason); int getZen(); - ZenRule getManualRule(); ZenModeConfig getConfig(); /** Gets consolidated zen policy that will apply when DND is on in priority only mode */ NotificationManager.Policy getConsolidatedPolicy(); long getNextAlarm(); boolean isZenAvailable(); - ComponentName getEffectsSuppressor(); - boolean isCountdownConditionSupported(); int getCurrentUser(); - boolean isVolumeRestricted(); - boolean areNotificationsHiddenInShade(); public static interface Callback { default void onZenChanged(int zen) {} - default void onConditionsChanged(Condition[] conditions) {} default void onNextAlarmChanged() {} default void onZenAvailableChanged(boolean available) {} - default void onEffectsSupressorChanged() {} - default void onManualRuleChanged(ZenRule rule) {} default void onConfigChanged(ZenModeConfig config) {} /** Called when the consolidated zen policy changes */ default void onConsolidatedPolicyChanged(NotificationManager.Policy policy) {} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java index 0cba94016ffb..9ad8619faacc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java @@ -20,7 +20,6 @@ import android.app.AlarmManager; import android.app.Flags; import android.app.NotificationManager; import android.content.BroadcastReceiver; -import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -35,7 +34,6 @@ import android.os.UserManager; import android.provider.Settings.Global; import android.provider.Settings.Secure; import android.service.notification.ZenModeConfig; -import android.service.notification.ZenModeConfig.ZenRule; import android.text.format.DateFormat; import android.util.Log; @@ -92,7 +90,6 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable { } final IntentFilter filter = new IntentFilter( AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED); - filter.addAction(NotificationManager.ACTION_EFFECTS_SUPPRESSOR_CHANGED); mBroadcastDispatcher.registerReceiver(mReceiver, filter, null, UserHandle.of(mUserId)); mRegistered = true; @@ -156,21 +153,6 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable { } @Override - public boolean isVolumeRestricted() { - return mUserManager.hasUserRestriction(UserManager.DISALLOW_ADJUST_VOLUME, - UserHandle.of(mUserId)); - } - - @Override - public boolean areNotificationsHiddenInShade() { - if (mZenMode != Global.ZEN_MODE_OFF) { - return (mConsolidatedNotificationPolicy.suppressedVisualEffects - & NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST) != 0; - } - return false; - } - - @Override public void addCallback(@NonNull Callback callback) { synchronized (mCallbacksLock) { Log.d(TAG, "Added callback " + callback.getClass()); @@ -206,11 +188,6 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable { } @Override - public ZenRule getManualRule() { - return mConfig == null ? null : mConfig.manualRule; - } - - @Override public ZenModeConfig getConfig() { return mConfig; } @@ -228,17 +205,6 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable { } @Override - public ComponentName getEffectsSuppressor() { - return NotificationManager.from(mContext).getEffectsSuppressor(); - } - - @Override - public boolean isCountdownConditionSupported() { - return NotificationManager.from(mContext) - .isSystemConditionProviderEnabled(ZenModeConfig.COUNTDOWN_PATH); - } - - @Override public int getCurrentUser() { return mUserTracker.getUserId(); } @@ -247,10 +213,6 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable { fireSafeChange(Callback::onNextAlarmChanged); } - private void fireEffectsSuppressorChanged() { - fireSafeChange(Callback::onEffectsSupressorChanged); - } - private void fireZenChanged(int zen) { fireSafeChange(c -> c.onZenChanged(zen)); } @@ -259,10 +221,6 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable { fireSafeChange(c -> c.onZenAvailableChanged(available)); } - private void fireManualRuleChanged(ZenRule rule) { - fireSafeChange(c -> c.onManualRuleChanged(rule)); - } - private void fireConsolidatedPolicyChanged(NotificationManager.Policy policy) { fireSafeChange(c -> c.onConsolidatedPolicyChanged(policy)); } @@ -302,16 +260,10 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable { protected void updateZenModeConfig() { final ZenModeConfig config = mNoMan.getZenModeConfig(); if (Objects.equals(config, mConfig)) return; - final ZenRule oldRule = mConfig != null ? mConfig.manualRule : null; mConfig = config; mZenUpdateTime = System.currentTimeMillis(); fireConfigChanged(config); - final ZenRule newRule = config != null ? config.manualRule : null; - if (!Objects.equals(oldRule, newRule)) { - fireManualRuleChanged(newRule); - } - final NotificationManager.Policy consolidatedPolicy = mNoMan.getConsolidatedNotificationPolicy(); if (!Objects.equals(consolidatedPolicy, mConsolidatedNotificationPolicy)) { @@ -327,9 +279,6 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable { if (AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED.equals(intent.getAction())) { fireNextAlarmChanged(); } - if (NotificationManager.ACTION_EFFECTS_SUPPRESSOR_CHANGED.equals(intent.getAction())) { - fireEffectsSuppressorChanged(); - } } }; diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/utils/leaks/FakeZenModeController.java b/packages/SystemUI/tests/utils/src/com/android/systemui/utils/leaks/FakeZenModeController.java index 75df4e67db23..f239aed8f1b3 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/utils/leaks/FakeZenModeController.java +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/utils/leaks/FakeZenModeController.java @@ -15,10 +15,8 @@ package com.android.systemui.utils.leaks; import android.app.NotificationManager; -import android.content.ComponentName; import android.net.Uri; import android.service.notification.ZenModeConfig; -import android.service.notification.ZenModeConfig.ZenRule; import android.testing.LeakCheck; import com.android.systemui.statusbar.policy.ZenModeController; @@ -40,11 +38,6 @@ public class FakeZenModeController extends BaseLeakChecker<Callback> implements } @Override - public ZenRule getManualRule() { - return null; - } - - @Override public ZenModeConfig getConfig() { return null; } @@ -65,27 +58,7 @@ public class FakeZenModeController extends BaseLeakChecker<Callback> implements } @Override - public ComponentName getEffectsSuppressor() { - return null; - } - - @Override - public boolean isCountdownConditionSupported() { - return false; - } - - @Override public int getCurrentUser() { return 0; } - - @Override - public boolean isVolumeRestricted() { - return false; - } - - @Override - public boolean areNotificationsHiddenInShade() { - return false; - } } |