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

Unverified Commit 1a5fe9ac authored by Michael W's avatar Michael W Committed by Michael Bestas
Browse files

DeskClock: Remove or update old stuff

Change-Id: Ib7c7fb7e2bece7252a4ed396ad0b551ce4b4098f
parent 447215ad
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -274,22 +274,6 @@ public final class ClockFragment extends DeskClockFragment {
        }
    }

    /**
     * Prior to L, a ContentObserver was used to monitor changes to the next scheduled alarm.
     * In L and beyond this is accomplished via a system broadcast of
     * {@link AlarmManager#ACTION_NEXT_ALARM_CLOCK_CHANGED}.
     */
    private final class AlarmObserverPreL extends ContentObserver {
        private AlarmObserverPreL() {
            super(new Handler());
        }

        @Override
        public void onChange(boolean selfChange) {
            refreshAlarm();
        }
    }

    /**
     * Update the display of the scheduled alarm as it changes.
     */
+1 −1
Original line number Diff line number Diff line
@@ -436,7 +436,7 @@ public class DeskClock extends BaseActivity

    @Override
    public void onRequestPermissionsResult(int requestCode,
                                           String permissions[], int[] grantResults) {
                                           String[] permissions, int[] grantResults) {
        if (requestCode == CODE_FOR_ALARM_PERMISSION){
            LogUtils.i("Power off alarm permission is granted.");
        }
+4 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.deskclock.alarms;
import android.content.Context;
import android.media.AudioAttributes;
import android.os.Build;
import android.os.VibrationEffect;
import android.os.Vibrator;

import com.android.deskclock.AsyncRingtonePlayer;
@@ -60,7 +61,8 @@ final class AlarmKlaxon {

        if (instance.mVibrate) {
            final Vibrator vibrator = getVibrator(context);
            vibrator.vibrate(VIBRATE_PATTERN, 0, new AudioAttributes.Builder()
            VibrationEffect effect = VibrationEffect.createWaveform(VIBRATE_PATTERN, 0);
            vibrator.vibrate(effect, new AudioAttributes.Builder()
                    .setUsage(AudioAttributes.USAGE_ALARM)
                    .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
                    .build());
@@ -70,7 +72,7 @@ final class AlarmKlaxon {
    }

    private static Vibrator getVibrator(Context context) {
        return ((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE));
        return context.getSystemService(Vibrator.class);
    }

    private static synchronized AsyncRingtonePlayer getAsyncRingtonePlayer(Context context) {
+0 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.deskclock.alarms;

import static android.content.Context.ALARM_SERVICE;
import static android.provider.Settings.System.NEXT_ALARM_FORMATTED;

import android.app.AlarmManager;
import android.app.AlarmManager.AlarmClockInfo;
@@ -26,10 +25,8 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.text.format.DateFormat;
import android.widget.Toast;

+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.deskclock.alarms;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.VibrationEffect;
import android.os.Vibrator;

import androidx.fragment.app.Fragment;
@@ -96,7 +97,8 @@ public final class AlarmTimeClickHandler {
                // Buzz the vibrator to preview the alarm firing behavior.
                final Vibrator v = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
                if (v.hasVibrator()) {
                    v.vibrate(300);
                    v.vibrate(VibrationEffect.createOneShot(300,
                            VibrationEffect.DEFAULT_AMPLITUDE));
                }
            }
        }
Loading