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

Commit 1cc3728b authored by kaiyiz's avatar kaiyiz Committed by Linux Build Service Account
Browse files

Clock: Customize Alarm for carrier

- Customize the default auto silience value and alarm behavier in a
  call.
- Ring alarm in all user profiles even in silent and meeting mode.

Conflicts:
	res/values/config.xml
	src/com/android/deskclock/alarms/AlarmService.java
	src/com/android/deskclock/provider/AlarmInstance.java

CRs-Fixed: 1014635

Change-Id: I1b617f8f97ab6e271dcaaf854800aaae083e8b1e
parent 7a3a23a2
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
<!-- Copyright (c) 2014, The Linux Foundation. All rights reserved.
     Not a Contribution.

     Copyright (C) 2011 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.
@@ -25,4 +28,6 @@
    <item type="integer" name="world_clocks_per_row">1</item>
    <!-- Number of world clocks in a row, for the digital appwidget. -->
    <item type="integer" name="appwidget_world_clocks_per_row">2</item>
    <bool name="config_ring_alarm_force">false</bool>
    <bool name="config_silent_during_call">false</bool>
</resources>
+6 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project
<!-- Copyright (c) 2014, The Linux Foundation. All rights reserved.
     Not a Contribution.

     Copyright (C) 2007 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.
@@ -288,6 +291,8 @@
    <!-- Auto silence summary when turned off -->
    <string name="auto_silence_never">Never</string>

    <string name="default_auto_silence_value">10</string>

    <!-- Entries listed in the ListPreference when invoking the auto silence
         preference. -->
    <string-array name="auto_silence_entries">
+5 −2
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
<!-- Copyright (c) 2014, The Linux Foundation. All rights reserved.
     Not a Contribution.

     Copyright (C) 2009 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.
@@ -50,7 +53,7 @@
            android:title="@string/auto_silence_title"
            android:entries="@array/auto_silence_entries"
            android:entryValues="@array/auto_silence_values"
            android:defaultValue="10"
            android:defaultValue="@string/default_auto_silence_value"
            android:dialogTitle="@string/auto_silence_title" />

       <com.android.deskclock.settings.SnoozeLengthDialog
+10 −2
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public final class AsyncRingtonePlayer {
    private PlaybackDelegate mPlaybackDelegate;

    /** The context. */
    private final Context mContext;
    private static Context mContext;

    /** The key of the preference that controls the crescendo behavior when playing a ringtone. */
    private final String mCrescendoPrefKey;
@@ -367,7 +367,15 @@ public final class AsyncRingtonePlayer {
                            .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
                            .build());
                }

                player.setAudioStreamType(AudioManager.STREAM_ALARM);
                player.setLooping(true);
                player.prepare();
                mAudioManager.requestAudioFocus(null, AudioManager.STREAM_ALARM,
                        AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
                player.start();
            } else if (mContext.getResources().getBoolean(R.bool.config_ring_alarm_force)) {
                mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM,
                mAudioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM), 0);
                player.setAudioStreamType(AudioManager.STREAM_ALARM);
                player.setLooping(true);
                player.prepare();
+8 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -109,7 +112,11 @@ public class AlarmService extends Service {
            // we register onCallStateChanged, we get the initial in-call state
            // which kills the alarm. Check against the initial call state so
            // we don't kill the alarm during a call.
            if (state != TelephonyManager.CALL_STATE_IDLE && state != mInitialCallState) {
            if (AlarmService.this.getResources().getBoolean(R.bool.config_silent_during_call)
                    && state != TelephonyManager.CALL_STATE_IDLE) {
                sendBroadcast(AlarmStateManager.createStateChangeIntent(AlarmService.this,
                        "AlarmService", mCurrentAlarm, AlarmInstance.MISSED_STATE));
            } else if (state != TelephonyManager.CALL_STATE_IDLE && state != mInitialCallState) {
                startService(AlarmStateManager.createStateChangeIntent(AlarmService.this,
                        "AlarmService", mCurrentAlarm, AlarmInstance.MISSED_STATE));
            }
Loading