• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_ASSISTANT;
19 
20 import android.annotation.TargetApi;
21 import android.app.TaskInfo;
22 import android.content.Intent;
23 import android.os.Build;
24 
25 import com.android.systemui.shared.system.ActivityManagerWrapper;
26 
27 /**
28  * Utility class for interacting with the Assistant.
29  */
30 @TargetApi(Build.VERSION_CODES.Q)
31 public final class AssistantUtilities {
32 
33     /** Returns true if an Assistant activity that is excluded from recents is running. */
isExcludedAssistantRunning()34     public static boolean isExcludedAssistantRunning() {
35         return isExcludedAssistant(ActivityManagerWrapper.getInstance().getRunningTask());
36     }
37 
38     /** Returns true if the given task holds an Assistant activity that is excluded from recents. */
isExcludedAssistant(TaskInfo info)39     public static boolean isExcludedAssistant(TaskInfo info) {
40         return info != null
41             && info.configuration.windowConfiguration.getActivityType() == ACTIVITY_TYPE_ASSISTANT
42             && (info.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
43     }
44 
AssistantUtilities()45     private AssistantUtilities() {}
46 }
47