Disable distracting status bar ticker text in car mode.
Bug: 2420702
Change-Id: I17ade6355b60da5e77d17f3556c86a4aaf40d173
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index 742a7d8..c907368 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -21,6 +21,7 @@
import android.app.IActivityManager;
import android.app.IUiModeManager;
import android.app.KeyguardManager;
+import android.app.StatusBarManager;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.ActivityNotFoundException;
@@ -71,6 +72,8 @@
private boolean mKeyguardDisabled;
private LockPatternUtils mLockPatternUtils;
+ private StatusBarManager mStatusBarManager;
+
// The broadcast receiver which receives the result of the ordered broadcast sent when
// the dock state changes. The original ordered broadcast is sent with an initial result
// code of RESULT_OK. If any of the registered broadcast receivers changes this value, e.g.,
@@ -234,6 +237,21 @@
// Disabling the car mode clears the night mode.
setMode(Configuration.UI_MODE_TYPE_NORMAL, MODE_NIGHT_NO);
}
+
+ if (mStatusBarManager == null) {
+ mStatusBarManager = (StatusBarManager) mContext.getSystemService(Context.STATUS_BAR_SERVICE);
+ }
+
+ // Fear not: StatusBarService manages a list of requests to disable
+ // features of the status bar; these are ORed together to form the
+ // active disabled list. So if (for example) the device is locked and
+ // the status bar should be totally disabled, the calls below will
+ // have no effect until the device is unlocked.
+ if (mStatusBarManager != null) {
+ mStatusBarManager.disable(enabled
+ ? StatusBarManager.DISABLE_NOTIFICATION_TICKER
+ : StatusBarManager.DISABLE_NONE);
+ }
}
private void setMode(int modeType, int modeNight) throws RemoteException {