Jeff Brown | 13014b5 | 2014-04-07 19:45:27 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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; |
| 18 | |
Jeff Brown | 061ea99 | 2015-04-17 19:55:47 -0700 | [diff] [blame] | 19 | import android.annotation.NonNull; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 20 | import android.annotation.Nullable; |
Fyodor Kupolov | b501330 | 2015-04-17 17:59:14 -0700 | [diff] [blame] | 21 | import android.content.ComponentName; |
Felipe Leme | a1b79bf | 2016-05-24 13:06:54 -0700 | [diff] [blame] | 22 | import android.content.IIntentSender; |
Makoto Onuki | ea11db1 | 2016-06-24 15:17:44 -0700 | [diff] [blame] | 23 | import android.content.Intent; |
Suprabh Shukla | 6472501 | 2016-06-15 13:19:28 -0700 | [diff] [blame] | 24 | import android.content.res.Configuration; |
Makoto Onuki | ea11db1 | 2016-06-24 15:17:44 -0700 | [diff] [blame] | 25 | import android.os.Bundle; |
Amith Yamasani | 0af6fa7 | 2016-01-17 15:36:19 -0800 | [diff] [blame] | 26 | import android.os.IBinder; |
| 27 | import android.service.voice.IVoiceInteractionSession; |
| 28 | |
| 29 | import com.android.internal.app.IVoiceInteractor; |
Jeff Brown | 061ea99 | 2015-04-17 19:55:47 -0700 | [diff] [blame] | 30 | |
Amith Yamasani | e8222e5 | 2016-04-08 15:28:47 -0700 | [diff] [blame] | 31 | import java.util.List; |
| 32 | |
Jeff Brown | 13014b5 | 2014-04-07 19:45:27 -0700 | [diff] [blame] | 33 | /** |
| 34 | * Activity manager local system service interface. |
| 35 | * |
| 36 | * @hide Only for use within the system server. |
| 37 | */ |
| 38 | public abstract class ActivityManagerInternal { |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * Type for {@link #notifyAppTransitionStarting}: The transition was started because we had |
| 42 | * the surface saved. |
| 43 | */ |
| 44 | public static final int APP_TRANSITION_SAVED_SURFACE = 0; |
| 45 | |
| 46 | /** |
| 47 | * Type for {@link #notifyAppTransitionStarting}: The transition was started because we drew |
| 48 | * the starting window. |
| 49 | */ |
| 50 | public static final int APP_TRANSITION_STARTING_WINDOW = 1; |
| 51 | |
| 52 | /** |
| 53 | * Type for {@link #notifyAppTransitionStarting}: The transition was started because we all |
| 54 | * app windows were drawn |
| 55 | */ |
| 56 | public static final int APP_TRANSITION_WINDOWS_DRAWN = 2; |
| 57 | |
| 58 | /** |
| 59 | * Type for {@link #notifyAppTransitionStarting}: The transition was started because of a |
| 60 | * timeout. |
| 61 | */ |
| 62 | public static final int APP_TRANSITION_TIMEOUT = 3; |
| 63 | |
Jeff Brown | 13014b5 | 2014-04-07 19:45:27 -0700 | [diff] [blame] | 64 | // Called by the power manager. |
Jeff Brown | fbe9670 | 2014-11-19 18:30:58 -0800 | [diff] [blame] | 65 | public abstract void onWakefulnessChanged(int wakefulness); |
| 66 | |
Primiano Tucci | 810c052 | 2014-07-25 18:03:16 +0100 | [diff] [blame] | 67 | public abstract int startIsolatedProcess(String entryPoint, String[] mainArgs, |
| 68 | String processName, String abiOverride, int uid, Runnable crashHandler); |
Jeff Brown | 061ea99 | 2015-04-17 19:55:47 -0700 | [diff] [blame] | 69 | |
| 70 | /** |
| 71 | * Acquires a sleep token with the specified tag. |
| 72 | * |
| 73 | * @param tag A string identifying the purpose of the token (eg. "Dream"). |
| 74 | */ |
| 75 | public abstract SleepToken acquireSleepToken(@NonNull String tag); |
| 76 | |
| 77 | /** |
| 78 | * Sleep tokens cause the activity manager to put the top activity to sleep. |
| 79 | * They are used by components such as dreams that may hide and block interaction |
| 80 | * with underlying activities. |
| 81 | */ |
| 82 | public static abstract class SleepToken { |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 83 | |
Jeff Brown | 061ea99 | 2015-04-17 19:55:47 -0700 | [diff] [blame] | 84 | /** |
| 85 | * Releases the sleep token. |
| 86 | */ |
| 87 | public abstract void release(); |
| 88 | } |
Fyodor Kupolov | b501330 | 2015-04-17 17:59:14 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Returns home activity for the specified user. |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 92 | * |
Fyodor Kupolov | b501330 | 2015-04-17 17:59:14 -0700 | [diff] [blame] | 93 | * @param userId ID of the user or {@link android.os.UserHandle#USER_ALL} |
| 94 | */ |
| 95 | public abstract ComponentName getHomeActivityForUser(int userId); |
Amith Yamasani | 515d406 | 2015-09-28 11:30:06 -0700 | [diff] [blame] | 96 | |
| 97 | /** |
| 98 | * Called when a user has been deleted. This can happen during normal device usage |
| 99 | * or just at startup, when partially removed users are purged. Any state persisted by the |
| 100 | * ActivityManager should be purged now. |
| 101 | * |
| 102 | * @param userId The user being cleaned up. |
| 103 | */ |
| 104 | public abstract void onUserRemoved(int userId); |
Amith Yamasani | 0af6fa7 | 2016-01-17 15:36:19 -0800 | [diff] [blame] | 105 | |
| 106 | public abstract void onLocalVoiceInteractionStarted(IBinder callingActivity, |
| 107 | IVoiceInteractionSession mSession, |
| 108 | IVoiceInteractor mInteractor); |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 109 | |
| 110 | /** |
| 111 | * Callback for window manager to let activity manager know that the starting window has been |
| 112 | * drawn |
| 113 | */ |
| 114 | public abstract void notifyStartingWindowDrawn(); |
| 115 | |
| 116 | /** |
| 117 | * Callback for window manager to let activity manager know that we are finally starting the |
| 118 | * app transition; |
| 119 | * |
| 120 | * @param reason The reason why the app transition started. Must be one of the APP_TRANSITION_* |
| 121 | * values. |
| 122 | */ |
| 123 | public abstract void notifyAppTransitionStarting(int reason); |
Jorim Jaggi | 192086e | 2016-03-11 17:17:03 +0100 | [diff] [blame] | 124 | |
| 125 | /** |
| 126 | * Callback for window manager to let activity manager know that the app transition was |
| 127 | * cancelled. |
| 128 | */ |
| 129 | public abstract void notifyAppTransitionCancelled(); |
| 130 | |
| 131 | /** |
| 132 | * Callback for window manager to let activity manager know that the app transition is finished. |
| 133 | */ |
| 134 | public abstract void notifyAppTransitionFinished(); |
Amith Yamasani | e8222e5 | 2016-04-08 15:28:47 -0700 | [diff] [blame] | 135 | |
| 136 | /** |
| 137 | * Returns the top activity from each of the currently visible stacks. The first entry will be |
| 138 | * the focused activity. |
| 139 | */ |
| 140 | public abstract List<IBinder> getTopVisibleActivities(); |
Tony Mak | 853304c | 2016-04-18 15:17:41 +0100 | [diff] [blame] | 141 | |
| 142 | /** |
| 143 | * Callback for window manager to let activity manager know that docked stack changes its |
| 144 | * minimized state. |
| 145 | */ |
| 146 | public abstract void notifyDockedStackMinimizedChanged(boolean minimized); |
Rubin Xu | f8451b9 | 2016-04-01 15:50:58 +0100 | [diff] [blame] | 147 | |
| 148 | /** |
| 149 | * Kill foreground apps from the specified user. |
| 150 | */ |
| 151 | public abstract void killForegroundAppsForUser(int userHandle); |
Felipe Leme | a1b79bf | 2016-05-24 13:06:54 -0700 | [diff] [blame] | 152 | |
| 153 | /** |
| 154 | * Sets how long a {@link PendingIntent} can be temporarily whitelist to by bypass restrictions |
| 155 | * such as Power Save mode. |
| 156 | */ |
| 157 | public abstract void setPendingIntentWhitelistDuration(IIntentSender target, long duration); |
Suprabh Shukla | 6472501 | 2016-06-15 13:19:28 -0700 | [diff] [blame] | 158 | |
| 159 | /** |
| 160 | * Updates and persists the {@link Configuration} for a given user. |
| 161 | * |
| 162 | * @param values the configuration to update |
| 163 | * @param userId the user to update the configuration for |
| 164 | */ |
| 165 | public abstract void updatePersistentConfigurationForUser(@NonNull Configuration values, |
| 166 | int userId); |
Makoto Onuki | ea11db1 | 2016-06-24 15:17:44 -0700 | [diff] [blame] | 167 | |
| 168 | /** |
Makoto Onuki | 440a1ea | 2016-07-20 14:21:18 -0700 | [diff] [blame] | 169 | * Start activity {@code intents} as if {@code packageName} on user {@code userId} did it. |
Makoto Onuki | 83f6d2d | 2016-07-11 14:30:19 -0700 | [diff] [blame] | 170 | * |
| 171 | * @return error codes used by {@link IActivityManager#startActivity} and its siblings. |
Makoto Onuki | ea11db1 | 2016-06-24 15:17:44 -0700 | [diff] [blame] | 172 | */ |
Makoto Onuki | 440a1ea | 2016-07-20 14:21:18 -0700 | [diff] [blame] | 173 | public abstract int startActivitiesAsPackage(String packageName, |
| 174 | int userId, Intent[] intents, Bundle bOptions); |
Makoto Onuki | 33525d2 | 2016-08-03 15:45:24 -0700 | [diff] [blame] | 175 | |
| 176 | /** |
| 177 | * Get the procstate for the UID. The return value will be between |
| 178 | * {@link ActivityManager#MIN_PROCESS_STATE} and {@link ActivityManager#MAX_PROCESS_STATE}. |
| 179 | * Note if the UID doesn't exist, it'll return {@link ActivityManager#PROCESS_STATE_NONEXISTENT} |
| 180 | * (-1). |
| 181 | */ |
| 182 | public abstract int getUidProcessState(int uid); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 183 | |
| 184 | /** |
| 185 | * Called when Keyguard flags might have changed. |
| 186 | * |
| 187 | * @param callback Callback to run after activity visibilities have been reevaluated. This can |
| 188 | * be used from window manager so that when the callback is called, it's |
| 189 | * guaranteed that all apps have their visibility updated accordingly. |
| 190 | */ |
| 191 | public abstract void notifyKeyguardFlagsChanged(@Nullable Runnable callback); |
Sudheer Shanka | fc46e9b | 2016-10-21 17:55:27 -0700 | [diff] [blame] | 192 | |
| 193 | /** |
| 194 | * @return {@code true} if system is ready, {@code false} otherwise. |
| 195 | */ |
| 196 | public abstract boolean isSystemReady(); |
Jorim Jaggi | e69c931 | 2016-10-31 18:24:38 -0700 | [diff] [blame^] | 197 | |
| 198 | /** |
| 199 | * Called when the trusted state of Keyguard has changed. |
| 200 | */ |
| 201 | public abstract void notifyKeyguardTrustedChanged(); |
Jeff Brown | 13014b5 | 2014-04-07 19:45:27 -0700 | [diff] [blame] | 202 | } |