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

Commit ba7e1cd2 authored by Danny Baumann's avatar Danny Baumann Committed by Abhisek Devkota
Browse files

Add back increasing ring feature (1/3)

Change-Id: I76c22ea94f25c576972361ad0ab209accb8ae1de
parent f8750476
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -2885,6 +2885,24 @@ public final class Settings {
         */
         */
        public static final String KEY_APP_SWITCH_LONG_PRESS_ACTION = "key_app_switch_long_press_action";
        public static final String KEY_APP_SWITCH_LONG_PRESS_ACTION = "key_app_switch_long_press_action";


        /**
         * Whether the phone ringtone should be played in an increasing manner
         * @hide
         */
        public static final String INCREASING_RING = "increasing_ring";

        /**
         * Start volume fraction for increasing ring volume
         * @hide
         */
        public static final String INCREASING_RING_START_VOLUME = "increasing_ring_start_vol";

        /**
         * Ramp up time (seconds) for increasing ring
         * @hide
         */
        public static final String INCREASING_RING_RAMP_UP_TIME = "increasing_ring_ramp_up_time";

        /**
        /**
         * I am the lolrus.
         * I am the lolrus.
         * <p>
         * <p>
@@ -2973,6 +2991,9 @@ public final class Settings {
            PHONE_BLACKLIST_UNKNOWN_NUMBER_MODE,
            PHONE_BLACKLIST_UNKNOWN_NUMBER_MODE,
            PHONE_BLACKLIST_REGEX_ENABLED,
            PHONE_BLACKLIST_REGEX_ENABLED,
            STATUS_BAR_SHOW_BATTERY_PERCENT,
            STATUS_BAR_SHOW_BATTERY_PERCENT,
            INCREASING_RING,
            INCREASING_RING_START_VOLUME,
            INCREASING_RING_RAMP_UP_TIME
        };
        };


        /**
        /**
+1 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ interface IRingtonePlayer {
    void play(IBinder token, in Uri uri, in AudioAttributes aa);
    void play(IBinder token, in Uri uri, in AudioAttributes aa);
    void stop(IBinder token);
    void stop(IBinder token);
    boolean isPlaying(IBinder token);
    boolean isPlaying(IBinder token);
    void setVolume(IBinder token, float volume);


    /** Used for Notification sound playback. */
    /** Used for Notification sound playback. */
    void playAsync(in Uri uri, in UserHandle user, boolean looping, in AudioAttributes aa);
    void playAsync(in Uri uri, in UserHandle user, boolean looping, in AudioAttributes aa);
+15 −0
Original line number Original line Diff line number Diff line
@@ -285,6 +285,21 @@ public class Ringtone {
        }
        }
    }
    }


    /**
     * @hide
     */
    public void setVolume(float volume) {
        if (mLocalPlayer != null) {
            mLocalPlayer.setVolume(volume);
        } else if (mAllowRemote && mRemotePlayer != null) {
            try {
                mRemotePlayer.setVolume(mRemoteToken, volume);
            } catch (RemoteException e) {
                Log.w(TAG, "Problem setting ringtone volume: " + e);
            }
        }
    }

    private void destroyLocalPlayer() {
    private void destroyLocalPlayer() {
        if (mLocalPlayer != null) {
        if (mLocalPlayer != null) {
            mLocalPlayer.reset();
            mLocalPlayer.reset();
+12 −0
Original line number Original line Diff line number Diff line
@@ -137,6 +137,18 @@ public class RingtonePlayer extends SystemUI {
            }
            }
        }
        }


        @Override
        public void setVolume(IBinder token, float volume) {
            if (LOGD) Log.d(TAG, "setVolume(token=" + token + ", volume=" + volume + ")");
            Client client;
            synchronized (mClients) {
                client = mClients.get(token);
            }
            if (client != null) {
                client.mRingtone.setVolume(volume);
            }
        }

        @Override
        @Override
        public void playAsync(Uri uri, UserHandle user, boolean looping, AudioAttributes aa) {
        public void playAsync(Uri uri, UserHandle user, boolean looping, AudioAttributes aa) {
            if (LOGD) Log.d(TAG, "playAsync(uri=" + uri + ", user=" + user + ")");
            if (LOGD) Log.d(TAG, "playAsync(uri=" + uri + ", user=" + user + ")");