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

Commit feabb7a3 authored by Robyn Coultas's avatar Robyn Coultas Committed by Isaac Katzenelson
Browse files

Show TimerAlertFullScreen upon any timer expiry

Bug: 7333666
Change-Id: If4f3583e4963d75a88ba8a4967475dbde76a7868
parent 1638996c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -191,7 +191,8 @@
                android:theme="@style/AlarmAlertFullScreenTheme"
                android:launchMode="singleInstance"
                showOnLockScreen="true"
                android:taskAffinity=""/>
                android:taskAffinity=""
                android:configChanges="orientation|screenSize|keyboardHidden|keyboard|navigation"/>

        <service android:name="TimerRingService"
                android:exported="false"
+14 −10
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public class AlarmAlertFullScreen extends Activity implements GlowPadView.OnTrig
    private static final long PING_AUTO_REPEAT_DELAY_MSEC = 1200;

    private boolean mPingEnabled = true;
    boolean mCallSnoozeonStop = true;

    // Receives the ALARM_KILLED action from the AlarmKlaxon,
    // and also ALARM_SNOOZE_ACTION / ALARM_DISMISS_ACTION from other applications
@@ -185,6 +186,7 @@ public class AlarmAlertFullScreen extends Activity implements GlowPadView.OnTrig
        if (LOG) {
            Log.v("AlarmAlertFullScreen - snooze");
        }
        mCallSnoozeonStop = false;

        final String snooze =
                PreferenceManager.getDefaultSharedPreferences(this)
@@ -249,6 +251,7 @@ public class AlarmAlertFullScreen extends Activity implements GlowPadView.OnTrig
        if (LOG) {
            Log.v("AlarmAlertFullScreen - dismiss");
        }
        mCallSnoozeonStop = false;

        Log.i(killed ? "Alarm killed" : "Alarm dismissed by user");
        // The service told us that the alarm has been killed, do not modify
@@ -300,6 +303,17 @@ public class AlarmAlertFullScreen extends Activity implements GlowPadView.OnTrig
        }
    }

    @Override
    protected void onStop() {
        if (LOG) {
            Log.v("AlarmAlertFullScreen - onStop snooze=" + mCallSnoozeonStop);
        }
        if (mCallSnoozeonStop) {
            snooze();
        }
        super.onStop();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
@@ -344,16 +358,6 @@ public class AlarmAlertFullScreen extends Activity implements GlowPadView.OnTrig
        return super.dispatchKeyEvent(event);
    }

    @Override
    public void onBackPressed() {
        // Don't allow back to dismiss. This method is overriden by AlarmAlert
        // so that the dialog is dismissed.
        if (LOG) {
            Log.v("AlarmAlertFullScreen - onBackPressed");
        }
        return;
    }


    @Override
    public void onGrabbed(View v, int handle) {
+2 −1
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.media.MediaPlayer;
import android.media.MediaPlayer.OnErrorListener;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -56,6 +55,7 @@ public class AlarmKlaxon extends Service {
    // Internal messages
    private static final int KILLER = 1000;
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case KILLER:
@@ -174,6 +174,7 @@ public class AlarmKlaxon extends Service {
            // RingtoneManager.
            mMediaPlayer = new MediaPlayer();
            mMediaPlayer.setOnErrorListener(new OnErrorListener() {
                @Override
                public boolean onError(MediaPlayer mp, int what, int extra) {
                    Log.e("Error occurred while playing audio.");
                    mp.stop();
+1 −8
Original line number Diff line number Diff line
@@ -38,17 +38,12 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.view.animation.ScaleAnimation;
import android.view.animation.Transformation;
import android.view.animation.TranslateAnimation;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;

import com.android.deskclock.stopwatch.StopwatchFragment;
import com.android.deskclock.stopwatch.StopwatchService;
@@ -258,9 +253,7 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
        SharedPreferences.Editor editor = prefs.edit();
        editor.putBoolean(Timers.NOTIF_APP_OPEN, false);
        editor.apply();
        Intent timerIntent = new Intent();
        timerIntent.setAction(Timers.NOTIF_IN_USE_SHOW);
        sendBroadcast(timerIntent);
        Utils.showInUseNotifications(this);

        super.onPause();
    }
+1 −2
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.media.MediaPlayer.OnErrorListener;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.IBinder;
import android.os.Vibrator;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;

@@ -105,7 +104,7 @@ public class TimerRingService extends Service {
        }

        if (Log.LOGV) {
            Log.v("TimerRingSErvice.play()");
            Log.v("TimerRingService.play()");
        }

        // TODO: Reuse mMediaPlayer instead of creating a new one and/or use
Loading