| 1 |
/** |
| 2 |
* Copyright (c) 2007, 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.internal.statusbar; |
| 18 |
|
| 19 |
import android.app.Notification; |
| 20 |
import android.content.ComponentName; |
| 21 |
import android.graphics.drawable.Icon; |
| 22 |
import android.graphics.Rect; |
| 23 |
import android.hardware.biometrics.IBiometricContextListener; |
| 24 |
import android.hardware.biometrics.IBiometricSysuiReceiver; |
| 25 |
import android.hardware.biometrics.PromptInfo; |
| 26 |
import android.hardware.fingerprint.IUdfpsHbmListener; |
| 27 |
import android.media.INearbyMediaDevicesProvider; |
| 28 |
import android.media.MediaRoute2Info; |
| 29 |
import android.net.Uri; |
| 30 |
import android.os.Bundle; |
| 31 |
import android.os.UserHandle; |
| 32 |
import android.service.notification.StatusBarNotification; |
| 33 |
|
| 34 |
import com.android.internal.logging.InstanceId; |
| 35 |
import com.android.internal.statusbar.IAddTileResultCallback; |
| 36 |
import com.android.internal.statusbar.ISessionListener; |
| 37 |
import com.android.internal.statusbar.IStatusBar; |
| 38 |
import com.android.internal.statusbar.IUndoMediaTransferCallback; |
| 39 |
import com.android.internal.statusbar.RegisterStatusBarResult; |
| 40 |
import com.android.internal.statusbar.StatusBarIcon; |
| 41 |
import com.android.internal.statusbar.StatusBarIconList; |
| 42 |
import com.android.internal.statusbar.NotificationVisibility; |
| 43 |
|
| 44 |
/** @hide */ |
| 45 |
interface IStatusBarService |
| 46 |
{ |
| 47 |
@UnsupportedAppUsage |
| 48 |
void expandNotificationsPanel(); |
| 49 |
@UnsupportedAppUsage |
| 50 |
void collapsePanels(); |
| 51 |
void togglePanel(); |
| 52 |
@UnsupportedAppUsage |
| 53 |
void disable(int what, IBinder token, String pkg); |
| 54 |
void disableForUser(int what, IBinder token, String pkg, int userId); |
| 55 |
void disable2(int what, IBinder token, String pkg); |
| 56 |
void disable2ForUser(int what, IBinder token, String pkg, int userId); |
| 57 |
int[] getDisableFlags(IBinder token, int userId); |
| 58 |
void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription); |
| 59 |
@UnsupportedAppUsage |
| 60 |
void setIconVisibility(String slot, boolean visible); |
| 61 |
@UnsupportedAppUsage |
| 62 |
void removeIcon(String slot); |
| 63 |
void setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition, |
| 64 |
boolean showImeSwitcher); |
| 65 |
void expandSettingsPanel(String subPanel); |
| 66 |
|
| 67 |
// ---- Methods below are for use by the status bar policy services ---- |
| 68 |
// You need the STATUS_BAR_SERVICE permission |
| 69 |
RegisterStatusBarResult registerStatusBar(IStatusBar callbacks); |
| 70 |
void onPanelRevealed(boolean clearNotificationEffects, int numItems); |
| 71 |
void onPanelHidden(); |
| 72 |
// Mark current notifications as "seen" and stop ringing, vibrating, blinking. |
| 73 |
oneway void clearNotificationEffects(); |
| 74 |
void onNotificationClick(String key, in NotificationVisibility nv); |
| 75 |
void onNotificationActionClick(String key, int actionIndex, in Notification.Action action, in NotificationVisibility nv, boolean generatedByAssistant); |
| 76 |
void onNotificationError(String pkg, String tag, int id, |
| 77 |
int uid, int initialPid, String message, int userId); |
| 78 |
void onClearAllNotifications(int userId); |
| 79 |
void onNotificationClear(String pkg, int userId, String key, |
| 80 |
int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv); |
| 81 |
void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys, |
| 82 |
in NotificationVisibility[] noLongerVisibleKeys); |
| 83 |
void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded, in int notificationLocation); |
| 84 |
void onNotificationDirectReplied(String key); |
| 85 |
void onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount, |
| 86 |
boolean generatedByAsssistant, boolean editBeforeSending); |
| 87 |
void onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, |
| 88 |
in int notificationLocation, boolean modifiedBeforeSending); |
| 89 |
void onNotificationSettingsViewed(String key); |
| 90 |
void onNotificationBubbleChanged(String key, boolean isBubble, int flags); |
| 91 |
void onBubbleMetadataFlagChanged(String key, int flags); |
| 92 |
void hideCurrentInputMethodForBubbles(); |
| 93 |
void grantInlineReplyUriPermission(String key, in Uri uri, in UserHandle user, String packageName); |
| 94 |
oneway void clearInlineReplyUriPermissions(String key); |
| 95 |
void onNotificationFeedbackReceived(String key, in Bundle feedback); |
| 96 |
|
| 97 |
void onGlobalActionsShown(); |
| 98 |
void onGlobalActionsHidden(); |
| 99 |
|
| 100 |
/** |
| 101 |
* These methods are needed for global actions control which the UI is shown in sysui. |
| 102 |
*/ |
| 103 |
void shutdown(); |
| 104 |
void reboot(boolean safeMode); |
| 105 |
|
| 106 |
/** just restarts android without rebooting device. Used for some feature flags. */ |
| 107 |
void restart(); |
| 108 |
|
| 109 |
void addTile(in ComponentName tile); |
| 110 |
void remTile(in ComponentName tile); |
| 111 |
void clickTile(in ComponentName tile); |
| 112 |
@UnsupportedAppUsage |
| 113 |
void handleSystemKey(in int key); |
| 114 |
|
| 115 |
/** |
| 116 |
* Methods to show toast messages for screen pinning |
| 117 |
*/ |
| 118 |
void showPinningEnterExitToast(boolean entering); |
| 119 |
void showPinningEscapeToast(); |
| 120 |
|
| 121 |
// Used to show the authentication dialog (Biometrics, Device Credential) |
| 122 |
void showAuthenticationDialog(in PromptInfo promptInfo, IBiometricSysuiReceiver sysuiReceiver, |
| 123 |
in int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation, |
| 124 |
int userId, long operationId, String opPackageName, long requestId, |
| 125 |
int multiSensorConfig); |
| 126 |
|
| 127 |
// Used to notify the authentication dialog that a biometric has been authenticated |
| 128 |
void onBiometricAuthenticated(int modality); |
| 129 |
// Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc |
| 130 |
void onBiometricHelp(int modality, String message); |
| 131 |
// Used to show an error - the dialog will dismiss after a certain amount of time |
| 132 |
void onBiometricError(int modality, int error, int vendorCode); |
| 133 |
// Used to hide the authentication dialog, e.g. when the application cancels authentication |
| 134 |
void hideAuthenticationDialog(long requestId); |
| 135 |
// Used to notify the biometric service of events that occur outside of an operation. |
| 136 |
void setBiometicContextListener(in IBiometricContextListener listener); |
| 137 |
|
| 138 |
/** |
| 139 |
* Sets an instance of IUdfpsHbmListener for UdfpsController. |
| 140 |
*/ |
| 141 |
void setUdfpsHbmListener(in IUdfpsHbmListener listener); |
| 142 |
|
| 143 |
/** |
| 144 |
* Show a warning that the device is about to go to sleep due to user inactivity. |
| 145 |
*/ |
| 146 |
void showInattentiveSleepWarning(); |
| 147 |
|
| 148 |
/** |
| 149 |
* Dismiss the warning that the device is about to go to sleep due to user inactivity. |
| 150 |
*/ |
| 151 |
void dismissInattentiveSleepWarning(boolean animated); |
| 152 |
|
| 153 |
/** |
| 154 |
* Notifies SystemUI to start tracing. |
| 155 |
*/ |
| 156 |
void startTracing(); |
| 157 |
|
| 158 |
/** |
| 159 |
* Notifies SystemUI to stop tracing. |
| 160 |
*/ |
| 161 |
void stopTracing(); |
| 162 |
|
| 163 |
/** |
| 164 |
* Returns whether SystemUI tracing is enabled. |
| 165 |
*/ |
| 166 |
boolean isTracing(); |
| 167 |
|
| 168 |
/** |
| 169 |
* If true, suppresses the ambient display from showing. If false, re-enables the ambient |
| 170 |
* display. |
| 171 |
*/ |
| 172 |
void suppressAmbientDisplay(boolean suppress); |
| 173 |
|
| 174 |
/** |
| 175 |
* Send a request to SystemUI to put a given active tile in listening state |
| 176 |
*/ |
| 177 |
void requestTileServiceListeningState(in ComponentName componentName, int userId); |
| 178 |
|
| 179 |
void requestAddTile(in ComponentName componentName, in CharSequence label, in Icon icon, int userId, in IAddTileResultCallback callback); |
| 180 |
void cancelRequestAddTile(in String packageName); |
| 181 |
|
| 182 |
/** |
| 183 |
* Sets the navigation bar mode. |
| 184 |
* |
| 185 |
* @param navBarMode the mode of the navigation bar to be set. |
| 186 |
* |
| 187 |
* @hide |
| 188 |
*/ |
| 189 |
void setNavBarMode(int navBarMode); |
| 190 |
|
| 191 |
/** |
| 192 |
* Gets the navigation bar mode. |
| 193 |
* |
| 194 |
* @hide |
| 195 |
*/ |
| 196 |
int getNavBarMode(); |
| 197 |
|
| 198 |
/** |
| 199 |
* Register a listener for certain sessions. Each session may be guarded by its own permission. |
| 200 |
*/ |
| 201 |
void registerSessionListener(int sessionFlags, in ISessionListener listener); |
| 202 |
void unregisterSessionListener(int sessionFlags, in ISessionListener listener); |
| 203 |
|
| 204 |
/** |
| 205 |
* Informs all registered listeners that a session has begun and has the following instanceId. |
| 206 |
* Can only be set by callers with certain permission based on the session type being updated. |
| 207 |
*/ |
| 208 |
void onSessionStarted(int sessionType, in InstanceId instanceId); |
| 209 |
void onSessionEnded(int sessionType, in InstanceId instanceId); |
| 210 |
|
| 211 |
/** Notifies System UI about an update to the media tap-to-transfer sender state. */ |
| 212 |
void updateMediaTapToTransferSenderDisplay( |
| 213 |
int displayState, |
| 214 |
in MediaRoute2Info routeInfo, |
| 215 |
in IUndoMediaTransferCallback undoCallback); |
| 216 |
|
| 217 |
/** Notifies System UI about an update to the media tap-to-transfer receiver state. */ |
| 218 |
void updateMediaTapToTransferReceiverDisplay( |
| 219 |
int displayState, |
| 220 |
in MediaRoute2Info routeInfo, |
| 221 |
in Icon appIcon, |
| 222 |
in CharSequence appName); |
| 223 |
|
| 224 |
/** Registers a nearby media devices provider. */ |
| 225 |
void registerNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider); |
| 226 |
|
| 227 |
/** Unregisters a nearby media devices provider. */ |
| 228 |
void unregisterNearbyMediaDevicesProvider(in INearbyMediaDevicesProvider provider); |
| 229 |
|
| 230 |
/** Shows rear display educational dialog */ |
| 231 |
void showRearDisplayDialog(int currentBaseState); |
| 232 |
} |