Loading core/java/android/preference/SeekBarVolumizer.java +17 −2 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba private final NotificationManager mNotificationManager; private final int mStreamType; private final int mMaxStreamVolume; private final boolean mVoiceCapable; private boolean mAffectedByRingerMode; private boolean mNotificationOrRing; private final Receiver mReceiver = new Receiver(); Loading Loading @@ -129,6 +130,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba } } mDefaultUri = defaultUri; mVoiceCapable = context.getResources().getBoolean( com.android.internal.R.bool.config_voice_capable); } private static boolean isNotificationOrRing(int stream) { Loading @@ -143,6 +146,11 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba return stream == AudioManager.STREAM_MUSIC; } private boolean isNotificationStreamLinked() { return mVoiceCapable && Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.VOLUME_LINK_NOTIFICATION, 1) == 1; } public void setSeekBar(SeekBar seekBar) { if (mSeekBar != null) { mSeekBar.setOnSeekBarChangeListener(null); Loading Loading @@ -170,13 +178,19 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba mSeekBar.setProgress(mLastAudibleStreamVolume, true); } else if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { mSeekBar.setProgress(0, true); mSeekBar.setEnabled(isSeekBarEnabled()); } else if (mMuted) { mSeekBar.setProgress(0, true); } else { mSeekBar.setEnabled(isSeekBarEnabled()); mSeekBar.setProgress(mLastProgress > -1 ? mLastProgress : mOriginalStreamVolume, true); } } private boolean isSeekBarEnabled() { return !(mStreamType == AudioManager.STREAM_NOTIFICATION && isNotificationStreamLinked()); } @Override public boolean handleMessage(Message msg) { switch (msg.what) { Loading Loading @@ -287,7 +301,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) { if (fromTouch) { if (fromTouch && isSeekBarEnabled()) { postSetVolume(progress); } if (mCallback != null) { Loading Loading @@ -463,7 +477,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba } private void updateVolumeSlider(int streamType, int streamValue) { final boolean streamMatch = mNotificationOrRing ? isNotificationOrRing(streamType) final boolean streamMatch = mNotificationOrRing && isNotificationStreamLinked() ? isNotificationOrRing(streamType) : (streamType == mStreamType); if (mSeekBar != null && streamMatch && streamValue != -1) { final boolean muted = mAudioManager.isStreamMute(mStreamType) Loading core/java/android/provider/Settings.java +12 −0 Original line number Diff line number Diff line Loading @@ -2300,6 +2300,8 @@ public final class Settings { // At one time in System, then Global, but now back in Secure MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); MOVED_TO_SECURE.add(Secure.VOLUME_LINK_NOTIFICATION); } private static final HashSet<String> MOVED_TO_GLOBAL; Loading Loading @@ -7990,6 +7992,14 @@ public final class Settings { public static final String PACKAGES_TO_CLEAR_DATA_BEFORE_FULL_RESTORE = "packages_to_clear_data_before_full_restore"; /** * Boolean value whether to link ringtone and notification volume * @hide */ public static final String VOLUME_LINK_NOTIFICATION = "volume_link_notification"; private static final Validator VOLUME_LINK_NOTIFICATION_VALIDATOR = BOOLEAN_VALIDATOR; /** * This are the settings to be backed up. * Loading Loading @@ -8091,6 +8101,7 @@ public final class Settings { VOLUME_HUSH_GESTURE, MANUAL_RINGER_TOGGLE_COUNT, HUSH_GESTURE_USED, VOLUME_LINK_NOTIFICATION, }; /** Loading Loading @@ -8239,6 +8250,7 @@ public final class Settings { VALIDATORS.put(MANUAL_RINGER_TOGGLE_COUNT, MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(VOLUME_LINK_NOTIFICATION, VOLUME_LINK_NOTIFICATION_VALIDATOR); } /** Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/VolumeDialogController.java +3 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public interface VolumeDialogController { public ComponentName effectsSuppressor; public String effectsSuppressorName; public int activeStream = NO_ACTIVE_STREAM; public boolean linkedNotification; public boolean disallowAlarms; public boolean disallowMedia; public boolean disallowSystem; Loading @@ -119,6 +120,7 @@ public interface VolumeDialogController { } rt.effectsSuppressorName = effectsSuppressorName; rt.activeStream = activeStream; rt.linkedNotification = linkedNotification; rt.disallowAlarms = disallowAlarms; rt.disallowMedia = disallowMedia; rt.disallowSystem = disallowSystem; Loading Loading @@ -152,6 +154,7 @@ public interface VolumeDialogController { sep(sb, indent); sb.append("effectsSuppressor:").append(effectsSuppressor); sep(sb, indent); sb.append("effectsSuppressorName:").append(effectsSuppressorName); sep(sb, indent); sb.append("activeStream:").append(activeStream); sep(sb, indent); sb.append("linkedNotification:").append(linkedNotification); sep(sb, indent); sb.append("disallowAlarms:").append(disallowAlarms); sep(sb, indent); sb.append("disallowMedia:").append(disallowMedia); sep(sb, indent); sb.append("disallowSystem:").append(disallowSystem); Loading packages/SystemUI/res/drawable/ic_volume_notification.xml 0 → 100644 +30 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportHeight="24" android:viewportWidth="24" android:tint="?android:attr/colorControlNormal" > <path android:fillColor="#FFFFFFFF" android:pathData="M18,17v-6c0,-3.07 -1.63,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C7.64,5.36 6,7.92 6,11v6H4v2h10h0.38H20v-2H18zM16,17H8v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5V17z"/> <path android:fillColor="#FFFFFFFF" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z"/> </vector> packages/SystemUI/res/drawable/ic_volume_notification_mute.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp" android:tint="?android:attr/colorControlNormal" > <path android:fillColor="#FFFFFFFF" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z"/> <path android:fillColor="#FFFFFFFF" android:pathData="M16,16L2.81,2.81L1.39,4.22l4.85,4.85C6.09,9.68 6,10.33 6,11v6H4v2h12.17l3.61,3.61l1.41,-1.41L16,16zM8,17c0,0 0.01,-6.11 0.01,-6.16L14.17,17H8z"/> <path android:fillColor="#FFFFFFFF" android:pathData="M12,6.5c2.49,0 4,2.02 4,4.5v2.17l2,2V11c0,-3.07 -1.63,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C9.72,4.86 9.05,5.2 8.46,5.63L9.93,7.1C10.51,6.73 11.2,6.5 12,6.5z"/> </vector> Loading
core/java/android/preference/SeekBarVolumizer.java +17 −2 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba private final NotificationManager mNotificationManager; private final int mStreamType; private final int mMaxStreamVolume; private final boolean mVoiceCapable; private boolean mAffectedByRingerMode; private boolean mNotificationOrRing; private final Receiver mReceiver = new Receiver(); Loading Loading @@ -129,6 +130,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba } } mDefaultUri = defaultUri; mVoiceCapable = context.getResources().getBoolean( com.android.internal.R.bool.config_voice_capable); } private static boolean isNotificationOrRing(int stream) { Loading @@ -143,6 +146,11 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba return stream == AudioManager.STREAM_MUSIC; } private boolean isNotificationStreamLinked() { return mVoiceCapable && Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.VOLUME_LINK_NOTIFICATION, 1) == 1; } public void setSeekBar(SeekBar seekBar) { if (mSeekBar != null) { mSeekBar.setOnSeekBarChangeListener(null); Loading Loading @@ -170,13 +178,19 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba mSeekBar.setProgress(mLastAudibleStreamVolume, true); } else if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { mSeekBar.setProgress(0, true); mSeekBar.setEnabled(isSeekBarEnabled()); } else if (mMuted) { mSeekBar.setProgress(0, true); } else { mSeekBar.setEnabled(isSeekBarEnabled()); mSeekBar.setProgress(mLastProgress > -1 ? mLastProgress : mOriginalStreamVolume, true); } } private boolean isSeekBarEnabled() { return !(mStreamType == AudioManager.STREAM_NOTIFICATION && isNotificationStreamLinked()); } @Override public boolean handleMessage(Message msg) { switch (msg.what) { Loading Loading @@ -287,7 +301,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) { if (fromTouch) { if (fromTouch && isSeekBarEnabled()) { postSetVolume(progress); } if (mCallback != null) { Loading Loading @@ -463,7 +477,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba } private void updateVolumeSlider(int streamType, int streamValue) { final boolean streamMatch = mNotificationOrRing ? isNotificationOrRing(streamType) final boolean streamMatch = mNotificationOrRing && isNotificationStreamLinked() ? isNotificationOrRing(streamType) : (streamType == mStreamType); if (mSeekBar != null && streamMatch && streamValue != -1) { final boolean muted = mAudioManager.isStreamMute(mStreamType) Loading
core/java/android/provider/Settings.java +12 −0 Original line number Diff line number Diff line Loading @@ -2300,6 +2300,8 @@ public final class Settings { // At one time in System, then Global, but now back in Secure MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); MOVED_TO_SECURE.add(Secure.VOLUME_LINK_NOTIFICATION); } private static final HashSet<String> MOVED_TO_GLOBAL; Loading Loading @@ -7990,6 +7992,14 @@ public final class Settings { public static final String PACKAGES_TO_CLEAR_DATA_BEFORE_FULL_RESTORE = "packages_to_clear_data_before_full_restore"; /** * Boolean value whether to link ringtone and notification volume * @hide */ public static final String VOLUME_LINK_NOTIFICATION = "volume_link_notification"; private static final Validator VOLUME_LINK_NOTIFICATION_VALIDATOR = BOOLEAN_VALIDATOR; /** * This are the settings to be backed up. * Loading Loading @@ -8091,6 +8101,7 @@ public final class Settings { VOLUME_HUSH_GESTURE, MANUAL_RINGER_TOGGLE_COUNT, HUSH_GESTURE_USED, VOLUME_LINK_NOTIFICATION, }; /** Loading Loading @@ -8239,6 +8250,7 @@ public final class Settings { VALIDATORS.put(MANUAL_RINGER_TOGGLE_COUNT, MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(VOLUME_LINK_NOTIFICATION, VOLUME_LINK_NOTIFICATION_VALIDATOR); } /** Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/VolumeDialogController.java +3 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public interface VolumeDialogController { public ComponentName effectsSuppressor; public String effectsSuppressorName; public int activeStream = NO_ACTIVE_STREAM; public boolean linkedNotification; public boolean disallowAlarms; public boolean disallowMedia; public boolean disallowSystem; Loading @@ -119,6 +120,7 @@ public interface VolumeDialogController { } rt.effectsSuppressorName = effectsSuppressorName; rt.activeStream = activeStream; rt.linkedNotification = linkedNotification; rt.disallowAlarms = disallowAlarms; rt.disallowMedia = disallowMedia; rt.disallowSystem = disallowSystem; Loading Loading @@ -152,6 +154,7 @@ public interface VolumeDialogController { sep(sb, indent); sb.append("effectsSuppressor:").append(effectsSuppressor); sep(sb, indent); sb.append("effectsSuppressorName:").append(effectsSuppressorName); sep(sb, indent); sb.append("activeStream:").append(activeStream); sep(sb, indent); sb.append("linkedNotification:").append(linkedNotification); sep(sb, indent); sb.append("disallowAlarms:").append(disallowAlarms); sep(sb, indent); sb.append("disallowMedia:").append(disallowMedia); sep(sb, indent); sb.append("disallowSystem:").append(disallowSystem); Loading
packages/SystemUI/res/drawable/ic_volume_notification.xml 0 → 100644 +30 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportHeight="24" android:viewportWidth="24" android:tint="?android:attr/colorControlNormal" > <path android:fillColor="#FFFFFFFF" android:pathData="M18,17v-6c0,-3.07 -1.63,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C7.64,5.36 6,7.92 6,11v6H4v2h10h0.38H20v-2H18zM16,17H8v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5V17z"/> <path android:fillColor="#FFFFFFFF" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z"/> </vector>
packages/SystemUI/res/drawable/ic_volume_notification_mute.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp" android:tint="?android:attr/colorControlNormal" > <path android:fillColor="#FFFFFFFF" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z"/> <path android:fillColor="#FFFFFFFF" android:pathData="M16,16L2.81,2.81L1.39,4.22l4.85,4.85C6.09,9.68 6,10.33 6,11v6H4v2h12.17l3.61,3.61l1.41,-1.41L16,16zM8,17c0,0 0.01,-6.11 0.01,-6.16L14.17,17H8z"/> <path android:fillColor="#FFFFFFFF" android:pathData="M12,6.5c2.49,0 4,2.02 4,4.5v2.17l2,2V11c0,-3.07 -1.63,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C9.72,4.86 9.05,5.2 8.46,5.63L9.93,7.1C10.51,6.73 11.2,6.5 12,6.5z"/> </vector>