1 /*
2  * Copyright 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 android.app.stubs.shared;
18 
19 import android.os.ResultReceiver;
20 
21 interface ICloseSystemDialogsTestsService {
sendCloseSystemDialogsBroadcast()22     void sendCloseSystemDialogsBroadcast();
closeSystemDialogsViaWindowManager(String reason)23     void closeSystemDialogsViaWindowManager(String reason);
closeSystemDialogsViaActivityManager(String reason)24     void closeSystemDialogsViaActivityManager(String reason);
waitForAccessibilityServiceWindow(long timeoutMs)25     boolean waitForAccessibilityServiceWindow(long timeoutMs);
26 
27     const int RESULT_OK = 0;
28     const int RESULT_SECURITY_EXCEPTION = 1;
29     const int RESULT_ERROR = 2;
30 
31     /**
32      * Posts a notification with id {@code notificationId} with a broadcast pending intent, then in
33      * that pending intent sends {@link android.content.Intent#ACTION_CLOSE_SYSTEM_DIALOGS} either
34      * via a regular Context.sendBroadcast() call if usePendingIntent is false or via a
35      * PendingIntent.getBroadcast(...).send() if usePendingIntent is true.
36      *
37      * The caller is responsible for trigerring the notification. The passed in {@code receiver}
38      * will be called once the intent has been sent.
39      */
postNotification(int notificationId, in ResultReceiver receiver, boolean usePendingIntent)40     void postNotification(int notificationId, in ResultReceiver receiver, boolean usePendingIntent);
41 
42     /** Checks that it can call @hide methods. */
waitUntilReady(long timeoutMs)43     boolean waitUntilReady(long timeoutMs);
44 }
45