1 /*
2  * Copyright (C) 2023 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 package com.android.quickstep.util;
17 
18 import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
19 
20 import com.android.launcher3.R;
21 import com.android.launcher3.util.MainThreadInitializedObject;
22 import com.android.launcher3.util.ResourceBasedOverride;
23 import com.android.launcher3.util.SafeCloseable;
24 
25 import java.io.PrintWriter;
26 import java.util.Optional;
27 
28 /** Class to manage Assistant states. */
29 public class AssistStateManager implements ResourceBasedOverride, SafeCloseable {
30 
31     public static final MainThreadInitializedObject<AssistStateManager> INSTANCE =
32             forOverride(AssistStateManager.class, R.string.assist_state_manager_class);
33 
AssistStateManager()34     public AssistStateManager() {}
35 
36     /** Return {@code true} if the Settings toggle is enabled. */
isSettingsAllEntrypointsEnabled()37     public boolean isSettingsAllEntrypointsEnabled() {
38         return false;
39     }
40 
41     /** Whether search supports showing on the lockscreen. */
supportsShowWhenLocked()42     public boolean supportsShowWhenLocked() {
43         return false;
44     }
45 
46     /** Whether ContextualSearchService invocation path is available. */
isContextualSearchServiceAvailable()47     public boolean isContextualSearchServiceAvailable() {
48         return false;
49     }
50 
51     /** Get the Launcher overridden long press nav handle duration to trigger Assistant. */
getLPNHDurationMillis()52     public Optional<Long> getLPNHDurationMillis() {
53         return Optional.empty();
54     }
55 
56     /**
57      * Get the Launcher overridden long press nav handle touch slop multiplier to trigger Assistant.
58      */
getLPNHCustomSlopMultiplier()59     public Optional<Float> getLPNHCustomSlopMultiplier() {
60         return Optional.empty();
61     }
62 
63     /** Get the Launcher overridden long press home duration to trigger Assistant. */
getLPHDurationMillis()64     public Optional<Long> getLPHDurationMillis() {
65         return Optional.empty();
66     }
67 
68     /** Get the Launcher overridden long press home touch slop multiplier to trigger Assistant. */
getLPHCustomSlopMultiplier()69     public Optional<Float> getLPHCustomSlopMultiplier() {
70         return Optional.empty();
71     }
72 
73     /** Get the long press duration data source. */
getDurationDataSource()74     public int getDurationDataSource() {
75         return 0;
76     }
77 
78     /** Get the long press touch slop multiplier data source. */
getSlopDataSource()79     public int getSlopDataSource() {
80         return 0;
81     }
82 
83     /** Get the haptic bit overridden by AGSA. */
getShouldPlayHapticOverride()84     public Optional<Boolean> getShouldPlayHapticOverride() {
85         return Optional.empty();
86     }
87 
88     /** Dump states. */
dump(String prefix, PrintWriter writer)89     public void dump(String prefix, PrintWriter writer) {}
90 
91     @Override
close()92     public void close() {}
93 }
94