There are many hidden services in Android, and StatusBarManager is one of them, which can be seen in Context. java:
[Java]
/**
* Use with {@ link # getSystemService} to retrieve a {@ link
* Android. app. StatusBarManager} for interacting with the status bar.
*
* @ See # getSystemService
* @ See android. app. StatusBarManager
* @ Hide
*/
Public static final String STATUS_BAR_SERVICE = "statusbar ";
/**
* Use with {@ link # getSystemService} to retrieve a {@ link
* Android. app. StatusBarManager} for interacting with the status bar.
*
* @ See # getSystemService
* @ See android. app. StatusBarManager
* @ Hide
*/
Public static final String STATUS_BAR_SERVICE = "statusbar ";
This indicates that the service is not provided externally. If you want to call the service, you must compile it in the source code tree to call the interface marked as @ hide. You can also add the compiled classes. jar package to the project.
StatusBarManager provides some useful interfaces. For example, the disable () method is exactly what we need. Some system-level applications call this method to disable the StatusBar drop-down, such as the phone number and lock screen module. To call this method, you also need the following permissions:
[Html]
<Uses-permission android: name = "android. permission. STATUS_BAR"/>
<Uses-permission android: name = "android. permission. EXPAND_STATUS_BAR"/>
<Uses-permission android: name = "android. permission. STATUS_BAR"/>
<Uses-permission android: name = "android. permission. EXPAND_STATUS_BAR"/>
Get StatusBarManager instance,
[Java]
MStatusBarManager = (StatusBarManager) mContext. getSystemService (Context. STATUS_BAR_SERVICE );
MStatusBarManager = (StatusBarManager) mContext. getSystemService (Context. STATUS_BAR_SERVICE );
Drop-down prohibited,
[Java]
MStatusBarManager. disable (StatusBarManager. DISABLE_EXPAND );
MStatusBarManager. disable (StatusBarManager. DISABLE_EXPAND );
Revoke prohibition,
[Java]
MStatusBarManager. disable (StatusBarManager. DISABLE_NONE );
MStatusBarManager. disable (StatusBarManager. DISABLE_NONE );