1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5  * except in compliance with the License. You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the
10  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11  * KIND, either express or implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */
14 
15 package com.android.systemui.plugins.statusbar;
16 
17 import android.service.notification.SnoozeCriterion;
18 import android.service.notification.StatusBarNotification;
19 import android.view.MotionEvent;
20 import android.view.View;
21 import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
22 
23 import com.android.systemui.plugins.annotations.DependsOn;
24 import com.android.systemui.plugins.annotations.ProvidesInterface;
25 import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;
26 
27 @ProvidesInterface(version = NotificationSwipeActionHelper.VERSION)
28 @DependsOn(target = SnoozeOption.class)
29 public interface NotificationSwipeActionHelper {
30     public static final String ACTION = "com.android.systemui.action.PLUGIN_NOTIFICATION_SWIPE_ACTION";
31 
32     public static final int VERSION = 1;
33 
34     /**
35      * Call this to dismiss a notification.
36      */
dismiss(View animView, float velocity)37     public void dismiss(View animView, float velocity);
38 
39     /**
40      * Call this to snap a notification to provided {@code targetLeft}.
41      */
snapOpen(View animView, int targetLeft, float velocity)42     public void snapOpen(View animView, int targetLeft, float velocity);
43 
44     /**
45      * Call this to snooze a notification based on the provided {@link SnoozeOption}.
46      */
snooze(StatusBarNotification sbn, SnoozeOption snoozeOption)47     public void snooze(StatusBarNotification sbn, SnoozeOption snoozeOption);
48 
getMinDismissVelocity()49     public float getMinDismissVelocity();
50 
isDismissGesture(MotionEvent ev)51     public boolean isDismissGesture(MotionEvent ev);
52 
53     /** Returns true if the gesture should be rejected. */
isFalseGesture()54     boolean isFalseGesture();
55 
56     @ProvidesInterface(version = SnoozeOption.VERSION)
57     public interface SnoozeOption {
58         public static final int VERSION = 2;
59 
getSnoozeCriterion()60         public SnoozeCriterion getSnoozeCriterion();
61 
getDescription()62         public CharSequence getDescription();
63 
getConfirmation()64         public CharSequence getConfirmation();
65 
getMinutesToSnoozeFor()66         public int getMinutesToSnoozeFor();
67 
getAccessibilityAction()68         public AccessibilityAction getAccessibilityAction();
69     }
70 }
71