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

Unverified Commit 4f48f599 authored by Michael Bestas's avatar Michael Bestas
Browse files

Revert "frameworks: Add unlinked ringtone and notification volumes"

Conflicts with QPR2 implementation

This reverts commit 345ff7b8.

Change-Id: I3bdcb7d9ca0fbf4e8fdb996b64669c98943578f4
parent 4a348004
Loading
Loading
Loading
Loading
+2 −17
Original line number Diff line number Diff line
@@ -113,7 +113,6 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
    @UnsupportedAppUsage
    private final int mStreamType;
    private final int mMaxStreamVolume;
    private final boolean mVoiceCapable;
    private boolean mAffectedByRingerMode;
    private boolean mNotificationOrRing;
    private final Receiver mReceiver = new Receiver();
@@ -207,8 +206,6 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
            }
        }
        mDefaultUri = defaultUri;
        mVoiceCapable = context.getResources().getBoolean(
                com.android.internal.R.bool.config_voice_capable);
    }

    private boolean hasAudioProductStrategies() {
@@ -257,11 +254,6 @@ 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);
@@ -289,19 +281,13 @@ 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) {
@@ -448,7 +434,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
    }

    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) {
        if (fromTouch && isSeekBarEnabled()) {
        if (fromTouch) {
            postSetVolume(progress);
        }
        if (mCallback != null) {
@@ -645,8 +631,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
        }

        private void updateVolumeSlider(int streamType, int streamValue) {
            final boolean streamMatch = mNotificationOrRing && isNotificationStreamLinked()
                    ? isNotificationOrRing(streamType)
            final boolean streamMatch = mNotificationOrRing ? isNotificationOrRing(streamType)
                    : (streamType == mStreamType);
            if (mSeekBar != null && streamMatch && streamValue != -1) {
                final boolean muted = mAudioManager.isStreamMute(mStreamType)
+0 −8
Original line number Diff line number Diff line
@@ -3632,8 +3632,6 @@ 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);
        }
        @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@@ -10865,12 +10863,6 @@ public final class Settings {
         */
        public static final String ADAPTIVE_CONNECTIVITY_ENABLED = "adaptive_connectivity_enabled";
        /**
         * Boolean value whether to link ringtone and notification volume
         * @hide
         */
        public static final String VOLUME_LINK_NOTIFICATION = "volume_link_notification";
        /**
         * Keys we no longer back up under the current schema, but want to continue to
         * process when restoring historical backup datasets.
+0 −1
Original line number Diff line number Diff line
@@ -347,6 +347,5 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.BLUETOOTH_LE_BROADCAST_PROGRAM_INFO, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Secure.BLUETOOTH_LE_BROADCAST_CODE, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Secure.BLUETOOTH_LE_BROADCAST_APP_SOURCE_NAME, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Secure.VOLUME_LINK_NOTIFICATION, BOOLEAN_VALIDATOR);
    }
}
+0 −3
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ 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;
@@ -125,7 +124,6 @@ public interface VolumeDialogController {
            }
            rt.effectsSuppressorName = effectsSuppressorName;
            rt.activeStream = activeStream;
            rt.linkedNotification = linkedNotification;
            rt.disallowAlarms = disallowAlarms;
            rt.disallowMedia = disallowMedia;
            rt.disallowSystem = disallowSystem;
@@ -159,7 +157,6 @@ 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);
+0 −30
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>
Loading