Remove volume_separate_notification flag
Fully enable the feature Bug: b/255363741, b/38477228 Test: make DEBUG_ROBOLECTRIC=1 ROBOTEST_FILTER="NotificationVolumePreferenceControllerTest|SeparateRingVolumePreferenceControllerTest|RingerModeAffectedPreferenceControllerTest|SoundSettingsTest" RunSettingsRoboTests -j40 Change-Id: Iec490fc254f71b6461dbf9f9beb4a11645a4a497
This commit is contained in:
@@ -16,28 +16,22 @@
|
||||
|
||||
package com.android.settings.notification;
|
||||
|
||||
import android.app.ActivityThread;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.service.notification.NotificationListenerService;
|
||||
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
|
||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* This slider represents both ring and notification
|
||||
*/
|
||||
@@ -61,33 +55,14 @@ public class RingVolumePreferenceController extends
|
||||
mVibrateIconId = R.drawable.ic_volume_ringer_vibrate;
|
||||
mSilentIconId = R.drawable.ic_notifications_off_24dp;
|
||||
|
||||
mSeparateNotification = isSeparateNotificationConfigEnabled();
|
||||
updateRingerMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* As the responsibility of this slider changes, so should its title & icon
|
||||
*/
|
||||
private void onDeviceConfigChange(DeviceConfig.Properties properties) {
|
||||
Set<String> changeSet = properties.getKeyset();
|
||||
if (changeSet.contains(SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION)) {
|
||||
boolean valueUpdated = readSeparateNotificationVolumeConfig();
|
||||
if (valueUpdated) {
|
||||
updateEffectsSuppressor();
|
||||
selectPreferenceIconState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mReceiver.register(true);
|
||||
readSeparateNotificationVolumeConfig();
|
||||
Binder.withCleanCallingIdentity(()
|
||||
-> DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
ActivityThread.currentApplication().getMainExecutor(), this::onDeviceConfigChange));
|
||||
updateEffectsSuppressor();
|
||||
selectPreferenceIconState();
|
||||
|
||||
@@ -101,8 +76,6 @@ public class RingVolumePreferenceController extends
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mReceiver.register(false);
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
DeviceConfig.removeOnPropertiesChangedListener(this::onDeviceConfigChange));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,9 +85,7 @@ public class RingVolumePreferenceController extends
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
boolean separateNotification = isSeparateNotificationConfigEnabled();
|
||||
return !separateNotification && !mHelper.isSingleVolume()
|
||||
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -124,14 +95,10 @@ public class RingVolumePreferenceController extends
|
||||
|
||||
@Override
|
||||
protected boolean hintsMatch(int hints) {
|
||||
boolean notificationSeparated = isSeparateNotificationConfigEnabled();
|
||||
return (hints & NotificationListenerService.HINT_HOST_DISABLE_CALL_EFFECTS) != 0
|
||||
|| (hints & NotificationListenerService.HINT_HOST_DISABLE_EFFECTS) != 0
|
||||
|| ((hints & NotificationListenerService.HINT_HOST_DISABLE_NOTIFICATION_EFFECTS)
|
||||
!= 0 && !notificationSeparated);
|
||||
|| (hints & NotificationListenerService.HINT_HOST_DISABLE_EFFECTS) != 0;
|
||||
}
|
||||
|
||||
|
||||
private final class H extends Handler {
|
||||
private static final int UPDATE_EFFECTS_SUPPRESSOR = 1;
|
||||
private static final int UPDATE_RINGER_MODE = 2;
|
||||
|
||||
Reference in New Issue
Block a user