• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.server.wm;
18 
19 import android.os.IBinder;
20 
21 import java.util.Collection;
22 
23 /**
24  * Callback to decide activity starts and related operations based on originating tokens.
25  */
26 public interface BackgroundActivityStartCallback {
27     /**
28      * Returns true if the background activity start originating from {@code tokens} should be
29      * allowed or not.
30      *
31      * Note that if the start was allowed due to a mechanism other than tokens (eg. permission),
32      * this won't be called.
33      *
34      * This will be called holding the WM and local lock, don't do anything costly or invoke AM/WM
35      * methods here directly.
36      */
isActivityStartAllowed(Collection<IBinder> tokens, int uid, String packageName)37     boolean isActivityStartAllowed(Collection<IBinder> tokens, int uid, String packageName);
38 
39     /**
40      * Returns whether {@code uid} can send {@link android.content.Intent
41      * #ACTION_CLOSE_SYSTEM_DIALOGS}, presumably to start activities, based on the originating
42      * tokens {@code tokens} currently associated with potential activity starts.
43      *
44      * This will be called holding the AM and local lock, don't do anything costly or invoke AM/WM
45      * methods here directly.
46      */
canCloseSystemDialogs(Collection<IBinder> tokens, int uid)47     boolean canCloseSystemDialogs(Collection<IBinder> tokens, int uid);
48 }
49