19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* 29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Copyright (C) 2007 The Android Open Source Project 39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * you may not use this file except in compliance with the License. 69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * You may obtain a copy of the License at 79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Unless required by applicable law or agreed to in writing, software 119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * See the License for the specific language governing permissions and 149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * limitations under the License. 159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpackage android.app; 189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.content.Context; 209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.Handler; 219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.IBinder; 2269ddab4575ff684c533c995e07ca15fe18543fc0Jeff Sharkeyimport android.os.RemoteException; 239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.ServiceManager; 24a14acd20b8d563319ea1a5974dca0e9a29f0aaefJeff Sharkeyimport android.os.StrictMode; 254120375d46091df8527bb701882e056fbb0e6b06Dianne Hackbornimport android.os.UserHandle; 269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.util.Log; 279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/** 299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Class to notify the user of events that happen. This is how you tell 309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * the user that something has happened in the background. {@more} 319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Notifications can take different forms: 339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <ul> 349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <li>A persistent icon that goes in the status bar and is accessible 359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * through the launcher, (when the user selects it, a designated Intent 369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * can be launched),</li> 379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <li>Turning on or flashing LEDs on the device, or</li> 389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <li>Alerting the user by flashing the backlight, playing a sound, 399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * or vibrating.</li> 409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * </ul> 419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <p> 43b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * Each of the notify methods takes an int id parameter and optionally a 44b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * {@link String} tag parameter, which may be {@code null}. These parameters 45b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * are used to form a pair (tag, id), or ({@code null}, id) if tag is 46b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * unspecified. This pair identifies this notification from your app to the 47b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * system, so that pair should be unique within your app. If you call one 48b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * of the notify methods with a (tag, id) pair that is currently active and 49b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * a new set of notification parameters, it will be updated. For example, 50b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * if you pass a new status bar icon, the old icon in the status bar will 51b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * be replaced with the new one. This is also the same tag and id you pass 52b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * to the {@link #cancel(int)} or {@link #cancel(String, int)} method to clear 53b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * this notification. 549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <p> 569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * You do not instantiate this class directly; instead, retrieve it through 579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * {@link android.content.Context#getSystemService}. 589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 59558459fe85f56f29a6ed6a4d0adb4a0bd6665884Joe Fernandez * <div class="special reference"> 60558459fe85f56f29a6ed6a4d0adb4a0bd6665884Joe Fernandez * <h3>Developer Guides</h3> 61558459fe85f56f29a6ed6a4d0adb4a0bd6665884Joe Fernandez * <p>For a guide to creating notifications, read the 62558459fe85f56f29a6ed6a4d0adb4a0bd6665884Joe Fernandez * <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Status Bar Notifications</a> 63558459fe85f56f29a6ed6a4d0adb4a0bd6665884Joe Fernandez * developer guide.</p> 64558459fe85f56f29a6ed6a4d0adb4a0bd6665884Joe Fernandez * </div> 65558459fe85f56f29a6ed6a4d0adb4a0bd6665884Joe Fernandez * 669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @see android.app.Notification 679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @see android.content.Context#getSystemService 689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpublic class NotificationManager 709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{ 719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project private static String TAG = "NotificationManager"; 7243a17654cf4bfe7f1ec22bd8b7b32daccdf27c09Joe Onorato private static boolean localLOGV = false; 739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project private static INotificationManager sService; 759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 76d8a43f61680bacf0d4b52a03ff3c7a07307377fcDianne Hackborn /** @hide */ 77d8a43f61680bacf0d4b52a03ff3c7a07307377fcDianne Hackborn static public INotificationManager getService() 789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project { 799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (sService != null) { 809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project return sService; 819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project IBinder b = ServiceManager.getService("notification"); 839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project sService = INotificationManager.Stub.asInterface(b); 849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project return sService; 859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /*package*/ NotificationManager(Context context, Handler handler) 889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project { 899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project mContext = context; 909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 9269ddab4575ff684c533c995e07ca15fe18543fc0Jeff Sharkey /** {@hide} */ 9369ddab4575ff684c533c995e07ca15fe18543fc0Jeff Sharkey public static NotificationManager from(Context context) { 9469ddab4575ff684c533c995e07ca15fe18543fc0Jeff Sharkey return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); 9569ddab4575ff684c533c995e07ca15fe18543fc0Jeff Sharkey } 9669ddab4575ff684c533c995e07ca15fe18543fc0Jeff Sharkey 979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 98e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * Post a notification to be shown in the status bar. If a notification with 99e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * the same id has already been posted by your application and has not yet been canceled, it 100e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * will be replaced by the updated information. 1019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 1029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param id An identifier for this notification unique within your 1039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * application. 104e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * @param notification A {@link Notification} object describing what to show the user. Must not 105e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * be null. 1069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 1079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void notify(int id, Notification notification) 1089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project { 1096ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana notify(null, id, notification); 1106ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana } 1116ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana 1126ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana /** 113e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * Post a notification to be shown in the status bar. If a notification with 114e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * the same tag and id has already been posted by your application and has not yet been 115e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * canceled, it will be replaced by the updated information. 1166ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana * 117b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * @param tag A string identifier for this notification. May be {@code null}. 118b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * @param id An identifier for this notification. The pair (tag, id) must be unique 119b97c34948e5fcb765f46d655bbf358d06ef89a67Peter Collingbourne * within your application. 120e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * @param notification A {@link Notification} object describing what to 121e97a3bce3c91d76b623f57d309f7bf74947494daDaniel Sandler * show the user. Must not be null. 1226ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana */ 1236ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana public void notify(String tag, int id, Notification notification) 1246ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana { 1259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project int[] idOut = new int[1]; 1269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project INotificationManager service = getService(); 1279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project String pkg = mContext.getPackageName(); 12865c4a2b26cd8776b0927e9b0e07ecf53bd31b627Jeff Sharkey if (notification.sound != null) { 12965c4a2b26cd8776b0927e9b0e07ecf53bd31b627Jeff Sharkey notification.sound = notification.sound.getCanonicalUri(); 130a14acd20b8d563319ea1a5974dca0e9a29f0aaefJeff Sharkey if (StrictMode.vmFileUriExposureEnabled()) { 131a14acd20b8d563319ea1a5974dca0e9a29f0aaefJeff Sharkey notification.sound.checkFileUriExposed("Notification.sound"); 132a14acd20b8d563319ea1a5974dca0e9a29f0aaefJeff Sharkey } 13365c4a2b26cd8776b0927e9b0e07ecf53bd31b627Jeff Sharkey } 1349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")"); 1359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project try { 13695d785346b4dae808a2d8f77356175e55a572d96Dianne Hackborn service.enqueueNotificationWithTag(pkg, mContext.getOpPackageName(), tag, id, 137f265ea9d8307282ff1da3915978625a94fc2859eDianne Hackborn notification, idOut, UserHandle.myUserId()); 1384120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn if (id != idOut[0]) { 1394120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]); 1404120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn } 1414120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn } catch (RemoteException e) { 1424120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn } 1434120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn } 1444120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn 1454120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn /** 1464120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn * @hide 1474120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn */ 1484120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn public void notifyAsUser(String tag, int id, Notification notification, UserHandle user) 1494120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn { 1504120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn int[] idOut = new int[1]; 1514120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn INotificationManager service = getService(); 1524120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn String pkg = mContext.getPackageName(); 15365c4a2b26cd8776b0927e9b0e07ecf53bd31b627Jeff Sharkey if (notification.sound != null) { 15465c4a2b26cd8776b0927e9b0e07ecf53bd31b627Jeff Sharkey notification.sound = notification.sound.getCanonicalUri(); 155a14acd20b8d563319ea1a5974dca0e9a29f0aaefJeff Sharkey if (StrictMode.vmFileUriExposureEnabled()) { 156a14acd20b8d563319ea1a5974dca0e9a29f0aaefJeff Sharkey notification.sound.checkFileUriExposed("Notification.sound"); 157a14acd20b8d563319ea1a5974dca0e9a29f0aaefJeff Sharkey } 15865c4a2b26cd8776b0927e9b0e07ecf53bd31b627Jeff Sharkey } 1594120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")"); 1604120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn try { 16195d785346b4dae808a2d8f77356175e55a572d96Dianne Hackborn service.enqueueNotificationWithTag(pkg, mContext.getOpPackageName(), tag, id, 162f265ea9d8307282ff1da3915978625a94fc2859eDianne Hackborn notification, idOut, user.getIdentifier()); 1639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (id != idOut[0]) { 1649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]); 1659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } catch (RemoteException e) { 1679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 1709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 1719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Cancel a previously shown notification. If it's transient, the view 1729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * will be hidden. If it's persistent, it will be removed from the status 1739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * bar. 1749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 1759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void cancel(int id) 1769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project { 1776ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana cancel(null, id); 1786ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana } 1796ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana 1806ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana /** 1816ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana * Cancel a previously shown notification. If it's transient, the view 1826ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana * will be hidden. If it's persistent, it will be removed from the status 1836ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana * bar. 1846ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana */ 1856ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana public void cancel(String tag, int id) 1866ecaff15836581336b1e8fad6ac42f3ff4a13544Fred Quintana { 1879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project INotificationManager service = getService(); 1889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project String pkg = mContext.getPackageName(); 1899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (localLOGV) Log.v(TAG, pkg + ": cancel(" + id + ")"); 1909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project try { 1914120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn service.cancelNotificationWithTag(pkg, tag, id, UserHandle.myUserId()); 1924120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn } catch (RemoteException e) { 1934120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn } 1944120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn } 1954120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn 1964120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn /** 1974120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn * @hide 1984120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn */ 1994120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn public void cancelAsUser(String tag, int id, UserHandle user) 2004120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn { 2014120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn INotificationManager service = getService(); 2024120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn String pkg = mContext.getPackageName(); 2034120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn if (localLOGV) Log.v(TAG, pkg + ": cancel(" + id + ")"); 2044120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn try { 2054120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn service.cancelNotificationWithTag(pkg, tag, id, user.getIdentifier()); 2069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } catch (RemoteException e) { 2079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 2109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 2119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Cancel all previously shown notifications. See {@link #cancel} for the 2129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * detailed behavior. 2139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 2149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void cancelAll() 2159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project { 2169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project INotificationManager service = getService(); 2179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project String pkg = mContext.getPackageName(); 2189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (localLOGV) Log.v(TAG, pkg + ": cancelAll()"); 2199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project try { 2204120375d46091df8527bb701882e056fbb0e6b06Dianne Hackborn service.cancelAllNotifications(pkg, UserHandle.myUserId()); 2219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } catch (RemoteException e) { 2229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 2259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project private Context mContext; 2269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project} 227