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.net.Uri;
21 import android.content.ComponentName;
22 import android.graphics.Rect;
23 import android.os.Bundle;
24 import android.os.UserHandle;
25 import android.service.notification.StatusBarNotification;
26 import android.hardware.biometrics.IBiometricServiceReceiverInternal;
27 
28 import com.android.internal.statusbar.IStatusBar;
29 import com.android.internal.statusbar.RegisterStatusBarResult;
30 import com.android.internal.statusbar.StatusBarIcon;
31 import com.android.internal.statusbar.StatusBarIconList;
32 import com.android.internal.statusbar.NotificationVisibility;
33 
34 /** @hide */
35 interface IStatusBarService
36 {
37     @UnsupportedAppUsage
expandNotificationsPanel()38     void expandNotificationsPanel();
39     @UnsupportedAppUsage
collapsePanels()40     void collapsePanels();
togglePanel()41     void togglePanel();
42     @UnsupportedAppUsage
disable(int what, IBinder token, String pkg)43     void disable(int what, IBinder token, String pkg);
disableForUser(int what, IBinder token, String pkg, int userId)44     void disableForUser(int what, IBinder token, String pkg, int userId);
disable2(int what, IBinder token, String pkg)45     void disable2(int what, IBinder token, String pkg);
disable2ForUser(int what, IBinder token, String pkg, int userId)46     void disable2ForUser(int what, IBinder token, String pkg, int userId);
getDisableFlags(IBinder token, int userId)47     int[] getDisableFlags(IBinder token, int userId);
setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription)48     void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
49     @UnsupportedAppUsage
setIconVisibility(String slot, boolean visible)50     void setIconVisibility(String slot, boolean visible);
51     @UnsupportedAppUsage
removeIcon(String slot)52     void removeIcon(String slot);
setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition, boolean showImeSwitcher, boolean isMultiClientImeEnabled)53     void setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition,
54             boolean showImeSwitcher, boolean isMultiClientImeEnabled);
expandSettingsPanel(String subPanel)55     void expandSettingsPanel(String subPanel);
56 
57     // ---- Methods below are for use by the status bar policy services ----
58     // You need the STATUS_BAR_SERVICE permission
registerStatusBar(IStatusBar callbacks)59     RegisterStatusBarResult registerStatusBar(IStatusBar callbacks);
onPanelRevealed(boolean clearNotificationEffects, int numItems)60     void onPanelRevealed(boolean clearNotificationEffects, int numItems);
onPanelHidden()61     void onPanelHidden();
62     // Mark current notifications as "seen" and stop ringing, vibrating, blinking.
clearNotificationEffects()63     void clearNotificationEffects();
onNotificationClick(String key, in NotificationVisibility nv)64     void onNotificationClick(String key, in NotificationVisibility nv);
onNotificationActionClick(String key, int actionIndex, in Notification.Action action, in NotificationVisibility nv, boolean generatedByAssistant)65     void onNotificationActionClick(String key, int actionIndex, in Notification.Action action, in NotificationVisibility nv, boolean generatedByAssistant);
onNotificationError(String pkg, String tag, int id, int uid, int initialPid, String message, int userId)66     void onNotificationError(String pkg, String tag, int id,
67             int uid, int initialPid, String message, int userId);
onClearAllNotifications(int userId)68     void onClearAllNotifications(int userId);
onNotificationClear(String pkg, String tag, int id, int userId, String key, int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv)69     void onNotificationClear(String pkg, String tag, int id, int userId, String key,
70             int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv);
onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys, in NotificationVisibility[] noLongerVisibleKeys)71     void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys,
72             in NotificationVisibility[] noLongerVisibleKeys);
onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded, in int notificationLocation)73     void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded, in int notificationLocation);
onNotificationDirectReplied(String key)74     void onNotificationDirectReplied(String key);
onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount, boolean generatedByAsssistant, boolean editBeforeSending)75     void onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount,
76             boolean generatedByAsssistant, boolean editBeforeSending);
onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, in int notificationLocation, boolean modifiedBeforeSending)77     void onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply,
78             in int notificationLocation, boolean modifiedBeforeSending);
onNotificationSettingsViewed(String key)79     void onNotificationSettingsViewed(String key);
onNotificationBubbleChanged(String key, boolean isBubble, int flags)80     void onNotificationBubbleChanged(String key, boolean isBubble, int flags);
onBubbleNotificationSuppressionChanged(String key, boolean isSuppressed)81     void onBubbleNotificationSuppressionChanged(String key, boolean isSuppressed);
hideCurrentInputMethodForBubbles()82     void hideCurrentInputMethodForBubbles();
grantInlineReplyUriPermission(String key, in Uri uri, in UserHandle user, String packageName)83     void grantInlineReplyUriPermission(String key, in Uri uri, in UserHandle user, String packageName);
clearInlineReplyUriPermissions(String key)84     void clearInlineReplyUriPermissions(String key);
85 
onGlobalActionsShown()86     void onGlobalActionsShown();
onGlobalActionsHidden()87     void onGlobalActionsHidden();
88 
89     /**
90      * These methods are needed for global actions control which the UI is shown in sysui.
91      */
shutdown()92     void shutdown();
reboot(boolean safeMode)93     void reboot(boolean safeMode);
94 
addTile(in ComponentName tile)95     void addTile(in ComponentName tile);
remTile(in ComponentName tile)96     void remTile(in ComponentName tile);
clickTile(in ComponentName tile)97     void clickTile(in ComponentName tile);
98     @UnsupportedAppUsage
handleSystemKey(in int key)99     void handleSystemKey(in int key);
100 
101     /**
102      * Methods to show toast messages for screen pinning
103      */
showPinningEnterExitToast(boolean entering)104     void showPinningEnterExitToast(boolean entering);
showPinningEscapeToast()105     void showPinningEscapeToast();
106 
107     // Used to show the authentication dialog (Biometrics, Device Credential)
showAuthenticationDialog(in Bundle bundle, IBiometricServiceReceiverInternal receiver, int biometricModality, boolean requireConfirmation, int userId, String opPackageName, long operationId, int sysUiSessionId)108     void showAuthenticationDialog(in Bundle bundle, IBiometricServiceReceiverInternal receiver,
109             int biometricModality, boolean requireConfirmation, int userId, String opPackageName,
110             long operationId, int sysUiSessionId);
111     // Used to notify the authentication dialog that a biometric has been authenticated
onBiometricAuthenticated()112     void onBiometricAuthenticated();
113     // Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
onBiometricHelp(String message)114     void onBiometricHelp(String message);
115     // Used to show an error - the dialog will dismiss after a certain amount of time
onBiometricError(int modality, int error, int vendorCode)116     void onBiometricError(int modality, int error, int vendorCode);
117     // Used to hide the authentication dialog, e.g. when the application cancels authentication
hideAuthenticationDialog()118     void hideAuthenticationDialog();
119 
120     /**
121      * Show a warning that the device is about to go to sleep due to user inactivity.
122      */
showInattentiveSleepWarning()123     void showInattentiveSleepWarning();
124 
125     /**
126      * Dismiss the warning that the device is about to go to sleep due to user inactivity.
127      */
dismissInattentiveSleepWarning(boolean animated)128     void dismissInattentiveSleepWarning(boolean animated);
129 
130     /**
131      * Notifies SystemUI to start tracing.
132      */
startTracing()133     void startTracing();
134 
135     /**
136      * Notifies SystemUI to stop tracing.
137      */
stopTracing()138     void stopTracing();
139 
140     /**
141      * Returns whether SystemUI tracing is enabled.
142      */
isTracing()143     boolean isTracing();
144 
145     /**
146      * If true, suppresses the ambient display from showing. If false, re-enables the ambient
147      * display.
148      */
suppressAmbientDisplay(boolean suppress)149     void suppressAmbientDisplay(boolean suppress);
150 }
151