1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.internal.accessibility.common;
18 
19 import android.annotation.IntDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 
24 /**
25  * Collection of common constants for accessibility shortcut.
26  */
27 public final class ShortcutConstants {
ShortcutConstants()28     private ShortcutConstants() {}
29 
30     /**
31      * Package name of the accessibility chooser and used for {@link android.content.Intent}.
32      */
33     public static final String CHOOSER_PACKAGE_NAME = "android";
34 
35     public static final char SERVICES_SEPARATOR = ':';
36 
37     /**
38      * Annotation for different user shortcut type UI type.
39      *
40      * {@code DEFAULT} for displaying default value.
41      * {@code SOFTWARE} for displaying specifying the accessibility services or features which
42      * choose accessibility button in the navigation bar as preferred shortcut.
43      * {@code HARDWARE} for displaying specifying the accessibility services or features which
44      * choose accessibility shortcut as preferred shortcut.
45      * {@code TRIPLETAP} for displaying specifying magnification to be toggled via quickly
46      * tapping screen 3 times as preferred shortcut.
47      */
48     @Retention(RetentionPolicy.SOURCE)
49     @IntDef({
50             UserShortcutType.DEFAULT,
51             UserShortcutType.SOFTWARE,
52             UserShortcutType.HARDWARE,
53             UserShortcutType.TRIPLETAP,
54     })
55     public @interface UserShortcutType {
56         int DEFAULT = 0;
57         int SOFTWARE = 1; // 1 << 0
58         int HARDWARE = 2; // 1 << 1
59         int TRIPLETAP = 4; // 1 << 2
60     }
61 
62     /**
63      * Annotation for the different accessibility fragment type.
64      *
65      * {@code VOLUME_SHORTCUT_TOGGLE} for displaying appearance with switch bar and only one
66      * shortcut option that is volume key shortcut.
67      * {@code INVISIBLE_TOGGLE} for displaying appearance without switch bar.
68      * {@code TOGGLE} for displaying appearance with switch bar.
69      * {@code LAUNCH_ACTIVITY} for displaying appearance with pop-up action that is for launch
70      * activity.
71      */
72     @Retention(RetentionPolicy.SOURCE)
73     @IntDef({
74             AccessibilityFragmentType.VOLUME_SHORTCUT_TOGGLE,
75             AccessibilityFragmentType.INVISIBLE_TOGGLE,
76             AccessibilityFragmentType.TOGGLE,
77             AccessibilityFragmentType.LAUNCH_ACTIVITY,
78     })
79     public @interface AccessibilityFragmentType {
80         int VOLUME_SHORTCUT_TOGGLE = 0;
81         int INVISIBLE_TOGGLE = 1;
82         int TOGGLE = 2;
83         int LAUNCH_ACTIVITY = 3;
84     }
85 
86     /**
87      * Annotation for different shortcut menu mode.
88      *
89      * {@code LAUNCH} for clicking list item to trigger the service callback.
90      * {@code EDIT} for clicking list item and save button to disable the service.
91      */
92     @Retention(RetentionPolicy.SOURCE)
93     @IntDef({
94             ShortcutMenuMode.LAUNCH,
95             ShortcutMenuMode.EDIT,
96     })
97     public @interface ShortcutMenuMode {
98         int LAUNCH = 0;
99         int EDIT = 1;
100     }
101 }
102