1 /*
2  * Copyright (C) 2024 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.systemui.statusbar.phone
18 
19 import android.app.PendingIntent
20 import android.content.Intent
21 import android.os.Bundle
22 import android.os.UserHandle
23 import android.view.View
24 import com.android.systemui.ActivityIntentHelper
25 import com.android.systemui.animation.ActivityTransitionAnimator
26 import com.android.systemui.plugins.ActivityStarter
27 
28 interface ActivityStarterInternal {
29     /**
30      * Starts a pending intent after dismissing keyguard.
31      *
32      * This can be called in a background thread (to prevent calls in [ActivityIntentHelper] in the
33      * main thread).
34      */
startPendingIntentDismissingKeyguardnull35     fun startPendingIntentDismissingKeyguard(
36         intent: PendingIntent,
37         dismissShade: Boolean,
38         intentSentUiThreadCallback: Runnable? = null,
39         associatedView: View? = null,
40         animationController: ActivityTransitionAnimator.Controller? = null,
41         showOverLockscreen: Boolean = false,
42         skipLockscreenChecks: Boolean = false,
43         fillInIntent: Intent? = null,
44         extraOptions: Bundle? = null,
45     )
46 
47     /** Starts an activity after dismissing keyguard. */
48     fun startActivityDismissingKeyguard(
49         intent: Intent,
50         dismissShade: Boolean,
51         onlyProvisioned: Boolean = false,
52         callback: ActivityStarter.Callback? = null,
53         flags: Int = 0,
54         animationController: ActivityTransitionAnimator.Controller? = null,
55         customMessage: String? = null,
56         disallowEnterPictureInPictureWhileLaunching: Boolean = false,
57         userHandle: UserHandle? = null,
58     )
59 
60     /** Starts an Activity. */
61     fun startActivity(
62         intent: Intent,
63         dismissShade: Boolean,
64         animationController: ActivityTransitionAnimator.Controller?,
65         showOverLockscreenWhenLocked: Boolean,
66         userHandle: UserHandle? = null,
67     )
68 
69     /** Executes an action after dismissing keyguard. */
70     fun dismissKeyguardThenExecute(
71         action: ActivityStarter.OnDismissAction,
72         cancel: Runnable?,
73         afterKeyguardGone: Boolean,
74         customMessage: String? = null,
75     )
76 
77     /** Executes an action after dismissing keyguard. */
78     fun executeRunnableDismissingKeyguard(
79         runnable: Runnable?,
80         cancelAction: Runnable? = null,
81         dismissShade: Boolean = false,
82         afterKeyguardGone: Boolean = false,
83         deferred: Boolean = false,
84         willAnimateOnKeyguard: Boolean = false,
85         customMessage: String? = null,
86     )
87 
88     /** Whether we should animate an activity launch. */
89     fun shouldAnimateLaunch(isActivityIntent: Boolean): Boolean
90 }
91