From a0430a1860dc3ee56a09c540ebed4ef0af5ab423 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Thu, 11 Feb 2010 23:35:49 -0500 Subject: [PATCH] Disable distracting status bar ticker text in car mode. Bug: 2420702 Change-Id: I17ade6355b60da5e77d17f3556c86a4aaf40d173 --- .../java/com/android/server/DockObserver.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java index 742a7d8c802e5..c90736876ee88 100644 --- a/services/java/com/android/server/DockObserver.java +++ b/services/java/com/android/server/DockObserver.java @@ -21,6 +21,7 @@ import android.app.ActivityManagerNative; 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 @@ class DockObserver extends UEventObserver { 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 @@ class DockObserver extends UEventObserver { // 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 {