The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Joe Onorato | 7a0f36b | 2010-06-07 10:24:36 -0700 | [diff] [blame] | 17 | package com.android.server; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 18 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | import android.app.StatusBarManager; |
| 20 | import android.content.BroadcastReceiver; |
| 21 | import android.content.Context; |
| 22 | import android.content.Intent; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | import android.content.pm.PackageManager; |
| 24 | import android.content.res.Resources; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | import android.os.Binder; |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 26 | import android.os.Handler; |
Svetoslav Ganov | 6179ea3 | 2011-06-28 01:12:41 -0700 | [diff] [blame] | 27 | import android.os.IBinder; |
| 28 | import android.os.RemoteException; |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 29 | import android.os.UserHandle; |
Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 30 | import android.util.Slog; |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 31 | |
| 32 | import com.android.internal.statusbar.IStatusBar; |
| 33 | import com.android.internal.statusbar.IStatusBarService; |
| 34 | import com.android.internal.statusbar.StatusBarIcon; |
| 35 | import com.android.internal.statusbar.StatusBarIconList; |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 36 | import com.android.internal.statusbar.StatusBarNotification; |
Dianne Hackborn | a924dc0d | 2011-02-17 14:22:17 -0800 | [diff] [blame] | 37 | import com.android.server.wm.WindowManagerService; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 38 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | import java.io.FileDescriptor; |
| 40 | import java.io.PrintWriter; |
| 41 | import java.util.ArrayList; |
| 42 | import java.util.HashMap; |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 43 | import java.util.List; |
| 44 | import java.util.Map; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | |
| 46 | |
| 47 | /** |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 48 | * A note on locking: We rely on the fact that calls onto mBar are oneway or |
| 49 | * if they are local, that they just enqueue messages to not deadlock. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 50 | */ |
Joe Onorato | 089de88 | 2010-04-12 08:18:45 -0700 | [diff] [blame] | 51 | public class StatusBarManagerService extends IStatusBarService.Stub |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 52 | implements WindowManagerService.OnHardKeyboardStatusChangeListener |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | { |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 54 | static final String TAG = "StatusBarManagerService"; |
Joe Onorato | 431bb22 | 2010-10-18 19:13:23 -0400 | [diff] [blame] | 55 | static final boolean SPEW = false; |
Joe Onorato | df7dbb6 | 2009-11-17 10:43:37 -0800 | [diff] [blame] | 56 | |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 57 | final Context mContext; |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 58 | final WindowManagerService mWindowManager; |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 59 | Handler mHandler = new Handler(); |
| 60 | NotificationCallbacks mNotificationCallbacks; |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 61 | volatile IStatusBar mBar; |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 62 | StatusBarIconList mIcons = new StatusBarIconList(); |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 63 | HashMap<IBinder,StatusBarNotification> mNotifications |
| 64 | = new HashMap<IBinder,StatusBarNotification>(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 65 | |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 66 | // for disabling the status bar |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 67 | final ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>(); |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 68 | IBinder mSysUiVisToken = new Binder(); |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 69 | int mDisabled = 0; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 70 | |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 71 | Object mLock = new Object(); |
Daniel Sandler | 60ee256 | 2011-07-22 12:34:33 -0400 | [diff] [blame] | 72 | // encompasses lights-out mode and other flags defined on View |
| 73 | int mSystemUiVisibility = 0; |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 74 | boolean mMenuVisible = false; |
Joe Onorato | 857fd9b | 2011-01-27 15:08:35 -0800 | [diff] [blame] | 75 | int mImeWindowVis = 0; |
| 76 | int mImeBackDisposition; |
| 77 | IBinder mImeToken = null; |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 78 | int mCurrentUserId; |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 79 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 80 | private class DisableRecord implements IBinder.DeathRecipient { |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 81 | int userId; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | String pkg; |
| 83 | int what; |
| 84 | IBinder token; |
| 85 | |
| 86 | public void binderDied() { |
Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 87 | Slog.i(TAG, "binder died for pkg=" + pkg); |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 88 | disableInternal(userId, 0, token, pkg); |
Suchi Amalapurapu | fff2fda | 2009-06-30 21:36:16 -0700 | [diff] [blame] | 89 | token.unlinkToDeath(this, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | } |
| 91 | } |
| 92 | |
| 93 | public interface NotificationCallbacks { |
| 94 | void onSetDisabled(int status); |
| 95 | void onClearAll(); |
Fred Quintana | 6ecaff1 | 2009-09-25 14:23:13 -0700 | [diff] [blame] | 96 | void onNotificationClick(String pkg, String tag, int id); |
Daniel Sandler | 0f0b11c | 2010-08-04 15:54:58 -0400 | [diff] [blame] | 97 | void onNotificationClear(String pkg, String tag, int id); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 98 | void onPanelRevealed(); |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 99 | void onNotificationError(String pkg, String tag, int id, |
| 100 | int uid, int initialPid, String message); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 101 | } |
| 102 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 103 | /** |
| 104 | * Construct the service, add the status bar view to the window manager |
| 105 | */ |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 106 | public StatusBarManagerService(Context context, WindowManagerService windowManager) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 107 | mContext = context; |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 108 | mWindowManager = windowManager; |
| 109 | mWindowManager.setOnHardKeyboardStatusChangeListener(this); |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 110 | |
| 111 | final Resources res = context.getResources(); |
Joe Onorato | 75144ea | 2010-06-07 12:36:25 -0700 | [diff] [blame] | 112 | mIcons.defineSlots(res.getStringArray(com.android.internal.R.array.config_statusBarIcons)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | public void setNotificationCallbacks(NotificationCallbacks listener) { |
| 116 | mNotificationCallbacks = listener; |
| 117 | } |
| 118 | |
| 119 | // ================================================================================ |
Joe Onorato | 25f95f9 | 2010-04-08 18:37:10 -0500 | [diff] [blame] | 120 | // From IStatusBarService |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 121 | // ================================================================================ |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 122 | public void expandNotificationsPanel() { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 123 | enforceExpandStatusBar(); |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 124 | |
| 125 | if (mBar != null) { |
| 126 | try { |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 127 | mBar.animateExpandNotificationsPanel(); |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 128 | } catch (RemoteException ex) { |
| 129 | } |
| 130 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 131 | } |
| 132 | |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 133 | public void collapsePanels() { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 134 | enforceExpandStatusBar(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 135 | |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 136 | if (mBar != null) { |
| 137 | try { |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 138 | mBar.animateCollapsePanels(); |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 139 | } catch (RemoteException ex) { |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 144 | public void expandSettingsPanel() { |
Svetoslav Ganov | e20a177 | 2012-09-25 16:07:46 -0700 | [diff] [blame] | 145 | enforceExpandStatusBar(); |
| 146 | |
| 147 | if (mBar != null) { |
| 148 | try { |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 149 | mBar.animateExpandSettingsPanel(); |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 150 | } catch (RemoteException ex) { |
| 151 | } |
| 152 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | public void disable(int what, IBinder token, String pkg) { |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 156 | disableInternal(mCurrentUserId, what, token, pkg); |
| 157 | } |
| 158 | |
| 159 | private void disableInternal(int userId, int what, IBinder token, String pkg) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 160 | enforceStatusBar(); |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 161 | |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 162 | synchronized (mLock) { |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 163 | disableLocked(userId, what, token, pkg); |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 164 | } |
| 165 | } |
| 166 | |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 167 | private void disableLocked(int userId, int what, IBinder token, String pkg) { |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 168 | // It's important that the the callback and the call to mBar get done |
| 169 | // in the same order when multiple threads are calling this function |
| 170 | // so they are paired correctly. The messages on the handler will be |
| 171 | // handled in the order they were enqueued, but will be outside the lock. |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 172 | manageDisableListLocked(userId, what, token, pkg); |
John Spurlock | 8f3e6d5 | 2012-11-29 13:56:24 -0500 | [diff] [blame] | 173 | |
| 174 | // Ensure state for the current user is applied, even if passed a non-current user. |
| 175 | final int net = gatherDisableActionsLocked(mCurrentUserId); |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 176 | if (net != mDisabled) { |
| 177 | mDisabled = net; |
| 178 | mHandler.post(new Runnable() { |
| 179 | public void run() { |
| 180 | mNotificationCallbacks.onSetDisabled(net); |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 181 | } |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 182 | }); |
| 183 | if (mBar != null) { |
| 184 | try { |
| 185 | mBar.disable(net); |
| 186 | } catch (RemoteException ex) { |
Joe Onorato | f3f0e05 | 2010-05-14 18:49:29 -0700 | [diff] [blame] | 187 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 188 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | |
Svetoslav Ganov | 6179ea3 | 2011-06-28 01:12:41 -0700 | [diff] [blame] | 192 | public void setIcon(String slot, String iconPackage, int iconId, int iconLevel, |
| 193 | String contentDescription) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | enforceStatusBar(); |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 195 | |
| 196 | synchronized (mIcons) { |
| 197 | int index = mIcons.getSlotIndex(slot); |
| 198 | if (index < 0) { |
| 199 | throw new SecurityException("invalid status bar icon slot: " + slot); |
| 200 | } |
| 201 | |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 202 | StatusBarIcon icon = new StatusBarIcon(iconPackage, UserHandle.OWNER, iconId, |
| 203 | iconLevel, 0, |
Svetoslav Ganov | 6179ea3 | 2011-06-28 01:12:41 -0700 | [diff] [blame] | 204 | contentDescription); |
Joe Onorato | 66d7d01 | 2010-05-14 10:05:10 -0700 | [diff] [blame] | 205 | //Slog.d(TAG, "setIcon slot=" + slot + " index=" + index + " icon=" + icon); |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 206 | mIcons.setIcon(index, icon); |
| 207 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 208 | if (mBar != null) { |
| 209 | try { |
| 210 | mBar.setIcon(index, icon); |
| 211 | } catch (RemoteException ex) { |
| 212 | } |
| 213 | } |
| 214 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 215 | } |
| 216 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 217 | public void setIconVisibility(String slot, boolean visible) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 218 | enforceStatusBar(); |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 219 | |
Joe Onorato | 514ad663 | 2010-05-13 18:49:00 -0700 | [diff] [blame] | 220 | synchronized (mIcons) { |
| 221 | int index = mIcons.getSlotIndex(slot); |
| 222 | if (index < 0) { |
| 223 | throw new SecurityException("invalid status bar icon slot: " + slot); |
| 224 | } |
| 225 | |
| 226 | StatusBarIcon icon = mIcons.getIcon(index); |
| 227 | if (icon == null) { |
| 228 | return; |
| 229 | } |
| 230 | |
| 231 | if (icon.visible != visible) { |
| 232 | icon.visible = visible; |
| 233 | |
Joe Onorato | 514ad663 | 2010-05-13 18:49:00 -0700 | [diff] [blame] | 234 | if (mBar != null) { |
| 235 | try { |
| 236 | mBar.setIcon(index, icon); |
| 237 | } catch (RemoteException ex) { |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | } |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | public void removeIcon(String slot) { |
| 245 | enforceStatusBar(); |
| 246 | |
| 247 | synchronized (mIcons) { |
| 248 | int index = mIcons.getSlotIndex(slot); |
| 249 | if (index < 0) { |
| 250 | throw new SecurityException("invalid status bar icon slot: " + slot); |
| 251 | } |
| 252 | |
| 253 | mIcons.removeIcon(index); |
| 254 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 255 | if (mBar != null) { |
| 256 | try { |
| 257 | mBar.removeIcon(index); |
| 258 | } catch (RemoteException ex) { |
| 259 | } |
| 260 | } |
| 261 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 262 | } |
| 263 | |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 264 | /** |
| 265 | * Hide or show the on-screen Menu key. Only call this from the window manager, typically in |
| 266 | * response to a window with FLAG_NEEDS_MENU_KEY set. |
| 267 | */ |
Dianne Hackborn | 7d04932 | 2011-06-14 15:00:32 -0700 | [diff] [blame] | 268 | public void topAppWindowChanged(final boolean menuVisible) { |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 269 | enforceStatusBar(); |
| 270 | |
Dianne Hackborn | 7d04932 | 2011-06-14 15:00:32 -0700 | [diff] [blame] | 271 | if (SPEW) Slog.d(TAG, (menuVisible?"showing":"hiding") + " MENU key"); |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 272 | |
| 273 | synchronized(mLock) { |
Dianne Hackborn | 7d04932 | 2011-06-14 15:00:32 -0700 | [diff] [blame] | 274 | mMenuVisible = menuVisible; |
| 275 | mHandler.post(new Runnable() { |
| 276 | public void run() { |
| 277 | if (mBar != null) { |
| 278 | try { |
| 279 | mBar.topAppWindowChanged(menuVisible); |
| 280 | } catch (RemoteException ex) { |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 281 | } |
| 282 | } |
Dianne Hackborn | 7d04932 | 2011-06-14 15:00:32 -0700 | [diff] [blame] | 283 | } |
| 284 | }); |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 285 | } |
| 286 | } |
| 287 | |
Joe Onorato | 857fd9b | 2011-01-27 15:08:35 -0800 | [diff] [blame] | 288 | public void setImeWindowStatus(final IBinder token, final int vis, final int backDisposition) { |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 289 | enforceStatusBar(); |
| 290 | |
Joe Onorato | 857fd9b | 2011-01-27 15:08:35 -0800 | [diff] [blame] | 291 | if (SPEW) { |
| 292 | Slog.d(TAG, "swetImeWindowStatus vis=" + vis + " backDisposition=" + backDisposition); |
| 293 | } |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 294 | |
| 295 | synchronized(mLock) { |
Joe Onorato | 857fd9b | 2011-01-27 15:08:35 -0800 | [diff] [blame] | 296 | // In case of IME change, we need to call up setImeWindowStatus() regardless of |
| 297 | // mImeWindowVis because mImeWindowVis may not have been set to false when the |
satok | 06e0744 | 2010-11-02 19:46:55 +0900 | [diff] [blame] | 298 | // previous IME was destroyed. |
Joe Onorato | 857fd9b | 2011-01-27 15:08:35 -0800 | [diff] [blame] | 299 | mImeWindowVis = vis; |
| 300 | mImeBackDisposition = backDisposition; |
| 301 | mImeToken = token; |
satok | 06e0744 | 2010-11-02 19:46:55 +0900 | [diff] [blame] | 302 | mHandler.post(new Runnable() { |
| 303 | public void run() { |
| 304 | if (mBar != null) { |
| 305 | try { |
Joe Onorato | 857fd9b | 2011-01-27 15:08:35 -0800 | [diff] [blame] | 306 | mBar.setImeWindowStatus(token, vis, backDisposition); |
satok | 06e0744 | 2010-11-02 19:46:55 +0900 | [diff] [blame] | 307 | } catch (RemoteException ex) { |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 308 | } |
| 309 | } |
satok | 06e0744 | 2010-11-02 19:46:55 +0900 | [diff] [blame] | 310 | } |
| 311 | }); |
satok | 06487a5 | 2010-10-29 11:37:18 +0900 | [diff] [blame] | 312 | } |
| 313 | } |
| 314 | |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 315 | public void setSystemUiVisibility(int vis, int mask) { |
Joe Onorato | 55bf380 | 2011-01-25 13:42:10 -0800 | [diff] [blame] | 316 | // also allows calls from window manager which is in this process. |
Joe Onorato | f63b0f4 | 2010-09-12 17:03:19 -0400 | [diff] [blame] | 317 | enforceStatusBarService(); |
| 318 | |
Jeff Sharkey | 4519a02 | 2011-09-07 23:24:53 -0700 | [diff] [blame] | 319 | if (SPEW) Slog.d(TAG, "setSystemUiVisibility(0x" + Integer.toHexString(vis) + ")"); |
Daniel Sandler | 60ee256 | 2011-07-22 12:34:33 -0400 | [diff] [blame] | 320 | |
Joe Onorato | f63b0f4 | 2010-09-12 17:03:19 -0400 | [diff] [blame] | 321 | synchronized (mLock) { |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 322 | updateUiVisibilityLocked(vis, mask); |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 323 | disableLocked( |
| 324 | mCurrentUserId, |
| 325 | vis & StatusBarManager.DISABLE_MASK, |
| 326 | mSysUiVisToken, |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 327 | "WindowManager.LayoutParams"); |
Joe Onorato | f63b0f4 | 2010-09-12 17:03:19 -0400 | [diff] [blame] | 328 | } |
| 329 | } |
| 330 | |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 331 | private void updateUiVisibilityLocked(final int vis, final int mask) { |
Daniel Sandler | 60ee256 | 2011-07-22 12:34:33 -0400 | [diff] [blame] | 332 | if (mSystemUiVisibility != vis) { |
| 333 | mSystemUiVisibility = vis; |
Joe Onorato | f63b0f4 | 2010-09-12 17:03:19 -0400 | [diff] [blame] | 334 | mHandler.post(new Runnable() { |
| 335 | public void run() { |
| 336 | if (mBar != null) { |
| 337 | try { |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 338 | mBar.setSystemUiVisibility(vis, mask); |
Joe Onorato | f63b0f4 | 2010-09-12 17:03:19 -0400 | [diff] [blame] | 339 | } catch (RemoteException ex) { |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 340 | } |
| 341 | } |
Joe Onorato | f63b0f4 | 2010-09-12 17:03:19 -0400 | [diff] [blame] | 342 | } |
| 343 | }); |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 344 | } |
| 345 | } |
| 346 | |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 347 | public void setHardKeyboardEnabled(final boolean enabled) { |
| 348 | mHandler.post(new Runnable() { |
| 349 | public void run() { |
| 350 | mWindowManager.setHardKeyboardEnabled(enabled); |
| 351 | } |
| 352 | }); |
| 353 | } |
| 354 | |
| 355 | @Override |
| 356 | public void onHardKeyboardStatusChange(final boolean available, final boolean enabled) { |
| 357 | mHandler.post(new Runnable() { |
| 358 | public void run() { |
| 359 | if (mBar != null) { |
| 360 | try { |
| 361 | mBar.setHardKeyboardStatus(available, enabled); |
| 362 | } catch (RemoteException ex) { |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | }); |
| 367 | } |
| 368 | |
Michael Jurka | 3b1fc47 | 2011-06-13 10:54:40 -0700 | [diff] [blame] | 369 | @Override |
| 370 | public void toggleRecentApps() { |
| 371 | if (mBar != null) { |
| 372 | try { |
| 373 | mBar.toggleRecentApps(); |
| 374 | } catch (RemoteException ex) {} |
| 375 | } |
| 376 | } |
| 377 | |
Michael Jurka | 7f2668c | 2012-03-27 07:49:52 -0700 | [diff] [blame] | 378 | @Override |
| 379 | public void preloadRecentApps() { |
| 380 | if (mBar != null) { |
| 381 | try { |
| 382 | mBar.preloadRecentApps(); |
| 383 | } catch (RemoteException ex) {} |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | @Override |
| 388 | public void cancelPreloadRecentApps() { |
| 389 | if (mBar != null) { |
| 390 | try { |
| 391 | mBar.cancelPreloadRecentApps(); |
| 392 | } catch (RemoteException ex) {} |
| 393 | } |
| 394 | } |
| 395 | |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 396 | @Override |
| 397 | public void setCurrentUser(int newUserId) { |
| 398 | if (SPEW) Slog.d(TAG, "Setting current user to user " + newUserId); |
| 399 | mCurrentUserId = newUserId; |
| 400 | } |
| 401 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 402 | private void enforceStatusBar() { |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 403 | mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR, |
Joe Onorato | 089de88 | 2010-04-12 08:18:45 -0700 | [diff] [blame] | 404 | "StatusBarManagerService"); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | private void enforceExpandStatusBar() { |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 408 | mContext.enforceCallingOrSelfPermission(android.Manifest.permission.EXPAND_STATUS_BAR, |
Joe Onorato | 089de88 | 2010-04-12 08:18:45 -0700 | [diff] [blame] | 409 | "StatusBarManagerService"); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 410 | } |
| 411 | |
Joe Onorato | 8bc6c51 | 2010-06-04 16:21:12 -0400 | [diff] [blame] | 412 | private void enforceStatusBarService() { |
| 413 | mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE, |
| 414 | "StatusBarManagerService"); |
| 415 | } |
| 416 | |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 417 | // ================================================================================ |
| 418 | // Callbacks from the status bar service. |
| 419 | // ================================================================================ |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 420 | public void registerStatusBar(IStatusBar bar, StatusBarIconList iconList, |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 421 | List<IBinder> notificationKeys, List<StatusBarNotification> notifications, |
satok | cd7cd29 | 2010-11-20 15:46:23 +0900 | [diff] [blame] | 422 | int switches[], List<IBinder> binders) { |
Joe Onorato | 8bc6c51 | 2010-06-04 16:21:12 -0400 | [diff] [blame] | 423 | enforceStatusBarService(); |
| 424 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 425 | Slog.i(TAG, "registerStatusBar bar=" + bar); |
| 426 | mBar = bar; |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 427 | synchronized (mIcons) { |
| 428 | iconList.copyFrom(mIcons); |
| 429 | } |
| 430 | synchronized (mNotifications) { |
| 431 | for (Map.Entry<IBinder,StatusBarNotification> e: mNotifications.entrySet()) { |
| 432 | notificationKeys.add(e.getKey()); |
| 433 | notifications.add(e.getValue()); |
| 434 | } |
| 435 | } |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 436 | synchronized (mLock) { |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 437 | switches[0] = gatherDisableActionsLocked(mCurrentUserId); |
Daniel Sandler | 60ee256 | 2011-07-22 12:34:33 -0400 | [diff] [blame] | 438 | switches[1] = mSystemUiVisibility; |
Joe Onorato | e4c7b3f | 2010-10-30 12:15:03 -0700 | [diff] [blame] | 439 | switches[2] = mMenuVisible ? 1 : 0; |
Joe Onorato | 857fd9b | 2011-01-27 15:08:35 -0800 | [diff] [blame] | 440 | switches[3] = mImeWindowVis; |
| 441 | switches[4] = mImeBackDisposition; |
| 442 | binders.add(mImeToken); |
Joe Onorato | 9305647 | 2010-09-10 10:30:46 -0400 | [diff] [blame] | 443 | } |
Jeff Brown | 2992ea7 | 2011-01-28 22:04:14 -0800 | [diff] [blame] | 444 | switches[5] = mWindowManager.isHardKeyboardAvailable() ? 1 : 0; |
| 445 | switches[6] = mWindowManager.isHardKeyboardEnabled() ? 1 : 0; |
Joe Onorato | 2314aab | 2010-04-08 16:41:23 -0500 | [diff] [blame] | 446 | } |
Joe Onorato | aaba60b | 2010-05-23 15:18:41 -0400 | [diff] [blame] | 447 | |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 448 | /** |
Joe Onorato | f1f2591 | 2010-06-07 11:52:41 -0700 | [diff] [blame] | 449 | * The status bar service should call this each time the user brings the panel from |
| 450 | * invisible to visible in order to clear the notification light. |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 451 | */ |
Joe Onorato | f1f2591 | 2010-06-07 11:52:41 -0700 | [diff] [blame] | 452 | public void onPanelRevealed() { |
Joe Onorato | 8bc6c51 | 2010-06-04 16:21:12 -0400 | [diff] [blame] | 453 | enforceStatusBarService(); |
| 454 | |
Joe Onorato | f1f2591 | 2010-06-07 11:52:41 -0700 | [diff] [blame] | 455 | // tell the notification manager to turn off the lights. |
| 456 | mNotificationCallbacks.onPanelRevealed(); |
Joe Onorato | 4762c2d | 2010-05-17 15:42:59 -0700 | [diff] [blame] | 457 | } |
| 458 | |
Joe Onorato | aaba60b | 2010-05-23 15:18:41 -0400 | [diff] [blame] | 459 | public void onNotificationClick(String pkg, String tag, int id) { |
Joe Onorato | 8bc6c51 | 2010-06-04 16:21:12 -0400 | [diff] [blame] | 460 | enforceStatusBarService(); |
| 461 | |
Joe Onorato | aaba60b | 2010-05-23 15:18:41 -0400 | [diff] [blame] | 462 | mNotificationCallbacks.onNotificationClick(pkg, tag, id); |
| 463 | } |
| 464 | |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 465 | public void onNotificationError(String pkg, String tag, int id, |
| 466 | int uid, int initialPid, String message) { |
Joe Onorato | 8bc6c51 | 2010-06-04 16:21:12 -0400 | [diff] [blame] | 467 | enforceStatusBarService(); |
| 468 | |
Joe Onorato | 005847b | 2010-06-04 16:08:02 -0400 | [diff] [blame] | 469 | // WARNING: this will call back into us to do the remove. Don't hold any locks. |
Dianne Hackborn | 9d39d0c | 2010-06-24 15:57:42 -0700 | [diff] [blame] | 470 | mNotificationCallbacks.onNotificationError(pkg, tag, id, uid, initialPid, message); |
Joe Onorato | 005847b | 2010-06-04 16:08:02 -0400 | [diff] [blame] | 471 | } |
| 472 | |
Daniel Sandler | 0f0b11c | 2010-08-04 15:54:58 -0400 | [diff] [blame] | 473 | public void onNotificationClear(String pkg, String tag, int id) { |
| 474 | enforceStatusBarService(); |
| 475 | |
| 476 | mNotificationCallbacks.onNotificationClear(pkg, tag, id); |
| 477 | } |
| 478 | |
Joe Onorato | aaba60b | 2010-05-23 15:18:41 -0400 | [diff] [blame] | 479 | public void onClearAllNotifications() { |
Joe Onorato | 8bc6c51 | 2010-06-04 16:21:12 -0400 | [diff] [blame] | 480 | enforceStatusBarService(); |
| 481 | |
Joe Onorato | aaba60b | 2010-05-23 15:18:41 -0400 | [diff] [blame] | 482 | mNotificationCallbacks.onClearAll(); |
| 483 | } |
| 484 | |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 485 | // ================================================================================ |
| 486 | // Callbacks for NotificationManagerService. |
| 487 | // ================================================================================ |
| 488 | public IBinder addNotification(StatusBarNotification notification) { |
| 489 | synchronized (mNotifications) { |
Joe Onorato | a0c56fe | 2010-05-20 10:21:52 -0700 | [diff] [blame] | 490 | IBinder key = new Binder(); |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 491 | mNotifications.put(key, notification); |
Joe Onorato | e345fff | 2010-05-23 15:18:27 -0400 | [diff] [blame] | 492 | if (mBar != null) { |
| 493 | try { |
| 494 | mBar.addNotification(key, notification); |
| 495 | } catch (RemoteException ex) { |
| 496 | } |
| 497 | } |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 498 | return key; |
| 499 | } |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 500 | } |
| 501 | |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 502 | public void updateNotification(IBinder key, StatusBarNotification notification) { |
| 503 | synchronized (mNotifications) { |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 504 | if (!mNotifications.containsKey(key)) { |
| 505 | throw new IllegalArgumentException("updateNotification key not found: " + key); |
| 506 | } |
| 507 | mNotifications.put(key, notification); |
Joe Onorato | e345fff | 2010-05-23 15:18:27 -0400 | [diff] [blame] | 508 | if (mBar != null) { |
| 509 | try { |
| 510 | mBar.updateNotification(key, notification); |
| 511 | } catch (RemoteException ex) { |
| 512 | } |
| 513 | } |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 514 | } |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 515 | } |
| 516 | |
| 517 | public void removeNotification(IBinder key) { |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 518 | synchronized (mNotifications) { |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 519 | final StatusBarNotification n = mNotifications.remove(key); |
| 520 | if (n == null) { |
Daniel Sandler | fe0806a | 2012-05-16 12:41:33 -0400 | [diff] [blame] | 521 | Slog.e(TAG, "removeNotification key not found: " + key); |
| 522 | return; |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 523 | } |
Joe Onorato | e345fff | 2010-05-23 15:18:27 -0400 | [diff] [blame] | 524 | if (mBar != null) { |
| 525 | try { |
| 526 | mBar.removeNotification(key); |
| 527 | } catch (RemoteException ex) { |
| 528 | } |
| 529 | } |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 530 | } |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 531 | } |
Joe Onorato | 2314aab | 2010-04-08 16:41:23 -0500 | [diff] [blame] | 532 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 533 | // ================================================================================ |
| 534 | // Can be called from any thread |
| 535 | // ================================================================================ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 536 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 537 | // lock on mDisableRecords |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 538 | void manageDisableListLocked(int userId, int what, IBinder token, String pkg) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 539 | if (SPEW) { |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 540 | Slog.d(TAG, "manageDisableList userId=" + userId |
| 541 | + " what=0x" + Integer.toHexString(what) + " pkg=" + pkg); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 542 | } |
| 543 | // update the list |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 544 | final int N = mDisableRecords.size(); |
| 545 | DisableRecord tok = null; |
| 546 | int i; |
| 547 | for (i=0; i<N; i++) { |
| 548 | DisableRecord t = mDisableRecords.get(i); |
John Spurlock | 4e6922d | 2012-10-04 14:51:51 -0400 | [diff] [blame] | 549 | if (t.token == token && t.userId == userId) { |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 550 | tok = t; |
| 551 | break; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 552 | } |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 553 | } |
| 554 | if (what == 0 || !token.isBinderAlive()) { |
| 555 | if (tok != null) { |
| 556 | mDisableRecords.remove(i); |
| 557 | tok.token.unlinkToDeath(tok, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 558 | } |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 559 | } else { |
| 560 | if (tok == null) { |
| 561 | tok = new DisableRecord(); |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 562 | tok.userId = userId; |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 563 | try { |
| 564 | token.linkToDeath(tok, 0); |
| 565 | } |
| 566 | catch (RemoteException ex) { |
| 567 | return; // give up |
| 568 | } |
| 569 | mDisableRecords.add(tok); |
| 570 | } |
| 571 | tok.what = what; |
| 572 | tok.token = token; |
| 573 | tok.pkg = pkg; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 574 | } |
| 575 | } |
| 576 | |
| 577 | // lock on mDisableRecords |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 578 | int gatherDisableActionsLocked(int userId) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 579 | final int N = mDisableRecords.size(); |
| 580 | // gather the new net flags |
| 581 | int net = 0; |
| 582 | for (int i=0; i<N; i++) { |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 583 | final DisableRecord rec = mDisableRecords.get(i); |
| 584 | if (rec.userId == userId) { |
| 585 | net |= rec.what; |
| 586 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 587 | } |
| 588 | return net; |
| 589 | } |
| 590 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 591 | // ================================================================================ |
| 592 | // Always called from UI thread |
| 593 | // ================================================================================ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 594 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 595 | protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |
| 596 | if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) |
| 597 | != PackageManager.PERMISSION_GRANTED) { |
| 598 | pw.println("Permission Denial: can't dump StatusBar from from pid=" |
| 599 | + Binder.getCallingPid() |
| 600 | + ", uid=" + Binder.getCallingUid()); |
| 601 | return; |
| 602 | } |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 603 | |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 604 | synchronized (mIcons) { |
| 605 | mIcons.dump(pw); |
| 606 | } |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 607 | |
| 608 | synchronized (mNotifications) { |
Joe Onorato | 75199e3 | 2010-05-29 17:22:51 -0400 | [diff] [blame] | 609 | int i=0; |
| 610 | pw.println("Notification list:"); |
| 611 | for (Map.Entry<IBinder,StatusBarNotification> e: mNotifications.entrySet()) { |
| 612 | pw.printf(" %2d: %s\n", i, e.getValue().toString()); |
| 613 | i++; |
| 614 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 615 | } |
Joe Onorato | 18e69df | 2010-05-17 22:26:12 -0700 | [diff] [blame] | 616 | |
Joe Onorato | 7bb8eeb | 2011-01-27 16:00:58 -0800 | [diff] [blame] | 617 | synchronized (mLock) { |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 618 | pw.println(" mDisabled=0x" + Integer.toHexString(mDisabled)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 619 | final int N = mDisableRecords.size(); |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 620 | pw.println(" mDisableRecords.size=" + N); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 621 | for (int i=0; i<N; i++) { |
| 622 | DisableRecord tok = mDisableRecords.get(i); |
John Spurlock | 13451a2 | 2012-09-28 14:40:41 -0400 | [diff] [blame] | 623 | pw.println(" [" + i + "] userId=" + tok.userId |
| 624 | + " what=0x" + Integer.toHexString(tok.what) |
| 625 | + " pkg=" + tok.pkg |
| 626 | + " token=" + tok.token); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 627 | } |
| 628 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 629 | } |
| 630 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 631 | private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { |
| 632 | public void onReceive(Context context, Intent intent) { |
| 633 | String action = intent.getAction(); |
Joe Onorato | f9e0e6b | 2009-09-08 16:24:36 -0400 | [diff] [blame] | 634 | if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action) |
| 635 | || Intent.ACTION_SCREEN_OFF.equals(action)) { |
Daniel Sandler | 11cf178 | 2012-09-27 14:03:08 -0400 | [diff] [blame] | 636 | collapsePanels(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 637 | } |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 638 | /* |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 639 | else if (Telephony.Intents.SPN_STRINGS_UPDATED_ACTION.equals(action)) { |
| 640 | updateNetworkName(intent.getBooleanExtra(Telephony.Intents.EXTRA_SHOW_SPN, false), |
| 641 | intent.getStringExtra(Telephony.Intents.EXTRA_SPN), |
| 642 | intent.getBooleanExtra(Telephony.Intents.EXTRA_SHOW_PLMN, false), |
| 643 | intent.getStringExtra(Telephony.Intents.EXTRA_PLMN)); |
| 644 | } |
| 645 | else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) { |
| 646 | updateResources(); |
| 647 | } |
Joe Onorato | 0cbda99 | 2010-05-02 16:28:15 -0700 | [diff] [blame] | 648 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 649 | } |
| 650 | }; |
| 651 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 652 | } |