mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 06:22:55 +01:00
Intercept alarm actions of the google clock application
Implemented blindly based on the information provided in #1199 Fixes #1199
This commit is contained in:
parent
76d704cb04
commit
9517fa211e
@ -40,18 +40,20 @@ public class AlarmClockReceiver extends BroadcastReceiver {
|
||||
|
||||
/** A public action sent by AlarmService when the alarm has started. */
|
||||
public static final String ALARM_ALERT_ACTION = "com.android.deskclock.ALARM_ALERT";
|
||||
public static final String GOOGLE_CLOCK_ALARM_ALERT_ACTION = "com.google.android.deskclock.action.ALARM_ALERT";
|
||||
|
||||
/** A public action sent by AlarmService when the alarm has stopped for any reason. */
|
||||
public static final String ALARM_DONE_ACTION = "com.android.deskclock.ALARM_DONE";
|
||||
public static final String GOOGLE_CLOCK_ALARM_DONE_ACTION = "com.google.android.deskclock.action.ALARM_DONE";
|
||||
private int lastId;
|
||||
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (ALARM_ALERT_ACTION.equals(action)) {
|
||||
if (ALARM_ALERT_ACTION.equals(action) || GOOGLE_CLOCK_ALARM_ALERT_ACTION.equals(action)) {
|
||||
sendAlarm(true);
|
||||
} else if (ALARM_DONE_ACTION.equals(action)) {
|
||||
} else if (ALARM_DONE_ACTION.equals(action) || GOOGLE_CLOCK_ALARM_DONE_ACTION.equals(action)) {
|
||||
sendAlarm(false);
|
||||
}
|
||||
}
|
||||
|
@ -667,6 +667,8 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(AlarmClockReceiver.ALARM_ALERT_ACTION);
|
||||
filter.addAction(AlarmClockReceiver.ALARM_DONE_ACTION);
|
||||
filter.addAction(AlarmClockReceiver.GOOGLE_CLOCK_ALARM_ALERT_ACTION);
|
||||
filter.addAction(AlarmClockReceiver.GOOGLE_CLOCK_ALARM_DONE_ACTION);
|
||||
registerReceiver(mAlarmClockReceiver, filter);
|
||||
}
|
||||
if (mCMWeatherReceiver == null && coordinator != null && coordinator.supportsWeather()) {
|
||||
|
Loading…
Reference in New Issue
Block a user