blob: 2c90e62d3a1bcae33991c46b566cc33e759c246c [file] [log] [blame]
San Mehat64e6a452010-02-04 20:53:48 -08001/*
Jeff Sharkey56bd3122015-04-14 10:30:34 -07002 * Copyright (C) 2015 The Android Open Source Project
San Mehat64e6a452010-02-04 20:53:48 -08003 *
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 Onoratofe4f3ae2010-06-04 11:25:26 -070017package com.android.systemui.usb;
San Mehat64e6a452010-02-04 20:53:48 -080018
Philip P. Moltmann75b230b2016-04-11 15:27:58 -070019import android.annotation.NonNull;
San Mehat64e6a452010-02-04 20:53:48 -080020import android.app.Notification;
Jeff Sharkey56bd3122015-04-14 10:30:34 -070021import android.app.Notification.Action;
San Mehat64e6a452010-02-04 20:53:48 -080022import android.app.NotificationManager;
23import android.app.PendingIntent;
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -070024import android.content.BroadcastReceiver;
25import android.content.Context;
San Mehat64e6a452010-02-04 20:53:48 -080026import android.content.Intent;
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -070027import android.content.IntentFilter;
Jeff Sharkeyb36586a2015-04-27 08:42:28 -070028import android.content.pm.PackageManager;
29import android.content.pm.PackageManager.MoveCallback;
Jeff Sharkey50a05452015-04-29 11:24:52 -070030import android.os.Bundle;
Jeff Sharkeyb36586a2015-04-27 08:42:28 -070031import android.os.Handler;
Dianne Hackborn50cdf7c32012-09-23 17:08:57 -070032import android.os.UserHandle;
Jeff Sharkey56bd3122015-04-14 10:30:34 -070033import android.os.storage.DiskInfo;
San Mehatb1043402010-02-05 08:26:50 -080034import android.os.storage.StorageEventListener;
35import android.os.storage.StorageManager;
Jeff Sharkey56bd3122015-04-14 10:30:34 -070036import android.os.storage.VolumeInfo;
Jeff Sharkeyb36586a2015-04-27 08:42:28 -070037import android.os.storage.VolumeRecord;
38import android.text.TextUtils;
39import android.text.format.DateUtils;
John Spurlockcd686b52013-06-05 10:13:46 -040040import android.util.Log;
Jeff Sharkey50a05452015-04-29 11:24:52 -070041import android.util.SparseArray;
San Mehat64e6a452010-02-04 20:53:48 -080042
Jeff Sharkey56bd3122015-04-14 10:30:34 -070043import com.android.internal.R;
Chris Wren5e6c0ff2017-01-05 12:57:06 -050044import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
John Spurlock3e309b22013-06-25 11:01:29 -040045import com.android.systemui.SystemUI;
46
Jeff Sharkey56bd3122015-04-14 10:30:34 -070047import java.util.List;
48
John Spurlock3e309b22013-06-25 11:01:29 -040049public class StorageNotification extends SystemUI {
San Mehat64e6a452010-02-04 20:53:48 -080050 private static final String TAG = "StorageNotification";
51
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -070052 private static final String ACTION_SNOOZE_VOLUME = "com.android.systemui.action.SNOOZE_VOLUME";
Jeff Sharkeydf27d3b2015-06-16 13:51:48 -070053 private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD";
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -070054
Jeff Sharkey56bd3122015-04-14 10:30:34 -070055 // TODO: delay some notifications to avoid bumpy fast operations
San Mehat64e6a452010-02-04 20:53:48 -080056
Jeff Sharkey56bd3122015-04-14 10:30:34 -070057 private NotificationManager mNotificationManager;
San Mehatb1043402010-02-05 08:26:50 -080058 private StorageManager mStorageManager;
San Mehat64e6a452010-02-04 20:53:48 -080059
Jeff Sharkey50a05452015-04-29 11:24:52 -070060 private static class MoveInfo {
61 public int moveId;
62 public Bundle extras;
63 public String packageName;
64 public String label;
65 public String volumeUuid;
66 }
67
68 private final SparseArray<MoveInfo> mMoves = new SparseArray<>();
69
Jeff Sharkey56bd3122015-04-14 10:30:34 -070070 private final StorageEventListener mListener = new StorageEventListener() {
71 @Override
72 public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
Jeff Sharkeyb36586a2015-04-27 08:42:28 -070073 onVolumeStateChangedInternal(vol);
John Spurlock3e309b22013-06-25 11:01:29 -040074 }
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -070075
76 @Override
Jeff Sharkey50a05452015-04-29 11:24:52 -070077 public void onVolumeRecordChanged(VolumeRecord rec) {
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -070078 // Avoid kicking notifications when getting early metadata before
79 // mounted. If already mounted, we're being kicked because of a
80 // nickname or init'ed change.
Jeff Sharkey50a05452015-04-29 11:24:52 -070081 final VolumeInfo vol = mStorageManager.findVolumeByUuid(rec.getFsUuid());
Jeff Sharkeyb36586a2015-04-27 08:42:28 -070082 if (vol != null && vol.isMountedReadable()) {
83 onVolumeStateChangedInternal(vol);
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -070084 }
Jeff Sharkey50a05452015-04-29 11:24:52 -070085 }
Jeff Sharkeyb36586a2015-04-27 08:42:28 -070086
Jeff Sharkey50a05452015-04-29 11:24:52 -070087 @Override
88 public void onVolumeForgotten(String fsUuid) {
89 // Stop annoying the user
Chris Wren5e6c0ff2017-01-05 12:57:06 -050090 mNotificationManager.cancelAsUser(fsUuid, SystemMessage.NOTE_STORAGE_PRIVATE,
91 UserHandle.ALL);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -070092 }
93
94 @Override
95 public void onDiskScanned(DiskInfo disk, int volumeCount) {
96 onDiskScannedInternal(disk, volumeCount);
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -070097 }
Philip P. Moltmann75b230b2016-04-11 15:27:58 -070098
99 @Override
100 public void onDiskDestroyed(DiskInfo disk) {
101 onDiskDestroyedInternal(disk);
102 }
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700103 };
104
105 private final BroadcastReceiver mSnoozeReceiver = new BroadcastReceiver() {
106 @Override
107 public void onReceive(Context context, Intent intent) {
108 // TODO: kick this onto background thread
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700109 final String fsUuid = intent.getStringExtra(VolumeRecord.EXTRA_FS_UUID);
110 mStorageManager.setVolumeSnoozed(fsUuid, true);
111 }
112 };
113
Jeff Sharkeydf27d3b2015-06-16 13:51:48 -0700114 private final BroadcastReceiver mFinishReceiver = new BroadcastReceiver() {
115 @Override
116 public void onReceive(Context context, Intent intent) {
117 // When finishing the adoption wizard, clean up any notifications
118 // for moving primary storage
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500119 mNotificationManager.cancelAsUser(null, SystemMessage.NOTE_STORAGE_MOVE,
120 UserHandle.ALL);
Jeff Sharkeydf27d3b2015-06-16 13:51:48 -0700121 }
122 };
123
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700124 private final MoveCallback mMoveCallback = new MoveCallback() {
125 @Override
Jeff Sharkey50a05452015-04-29 11:24:52 -0700126 public void onCreated(int moveId, Bundle extras) {
127 final MoveInfo move = new MoveInfo();
128 move.moveId = moveId;
129 move.extras = extras;
130 if (extras != null) {
131 move.packageName = extras.getString(Intent.EXTRA_PACKAGE_NAME);
132 move.label = extras.getString(Intent.EXTRA_TITLE);
133 move.volumeUuid = extras.getString(VolumeRecord.EXTRA_FS_UUID);
134 }
135 mMoves.put(moveId, move);
136 }
137
138 @Override
139 public void onStatusChanged(int moveId, int status, long estMillis) {
140 final MoveInfo move = mMoves.get(moveId);
141 if (move == null) {
142 Log.w(TAG, "Ignoring unknown move " + moveId);
143 return;
144 }
145
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700146 if (PackageManager.isMoveStatusFinished(status)) {
Jeff Sharkey50a05452015-04-29 11:24:52 -0700147 onMoveFinished(move, status);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700148 } else {
Jeff Sharkey50a05452015-04-29 11:24:52 -0700149 onMoveProgress(move, status, estMillis);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700150 }
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700151 }
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700152 };
San Mehat64e6a452010-02-04 20:53:48 -0800153
John Spurlock3e309b22013-06-25 11:01:29 -0400154 @Override
155 public void start() {
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700156 mNotificationManager = mContext.getSystemService(NotificationManager.class);
John Spurlock3e309b22013-06-25 11:01:29 -0400157
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700158 mStorageManager = mContext.getSystemService(StorageManager.class);
159 mStorageManager.registerListener(mListener);
Daniel Sandler5b8743f2010-11-03 09:43:46 -0400160
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700161 mContext.registerReceiver(mSnoozeReceiver, new IntentFilter(ACTION_SNOOZE_VOLUME),
162 android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
Jeff Sharkeydf27d3b2015-06-16 13:51:48 -0700163 mContext.registerReceiver(mFinishReceiver, new IntentFilter(ACTION_FINISH_WIZARD),
164 android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700165
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700166 // Kick current state into place
Jeff Sharkeyf5a6bd72015-05-19 14:42:38 -0700167 final List<DiskInfo> disks = mStorageManager.getDisks();
168 for (DiskInfo disk : disks) {
169 onDiskScannedInternal(disk, disk.volumeCount);
170 }
171
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700172 final List<VolumeInfo> vols = mStorageManager.getVolumes();
173 for (VolumeInfo vol : vols) {
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700174 onVolumeStateChangedInternal(vol);
175 }
176
177 mContext.getPackageManager().registerMoveCallback(mMoveCallback, new Handler());
178
179 updateMissingPrivateVolumes();
180 }
181
182 private void updateMissingPrivateVolumes() {
183 final List<VolumeRecord> recs = mStorageManager.getVolumeRecords();
184 for (VolumeRecord rec : recs) {
185 if (rec.getType() != VolumeInfo.TYPE_PRIVATE) continue;
186
187 final String fsUuid = rec.getFsUuid();
188 final VolumeInfo info = mStorageManager.findVolumeByUuid(fsUuid);
Jeff Sharkey52fc3c0f2015-06-14 20:58:54 -0700189 if ((info != null && info.isMountedWritable()) || rec.isSnoozed()) {
190 // Yay, private volume is here, or user snoozed
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500191 mNotificationManager.cancelAsUser(fsUuid, SystemMessage.NOTE_STORAGE_PRIVATE,
192 UserHandle.ALL);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700193
194 } else {
195 // Boo, annoy the user to reinsert the private volume
196 final CharSequence title = mContext.getString(R.string.ext_media_missing_title,
197 rec.getNickname());
198 final CharSequence text = mContext.getString(R.string.ext_media_missing_message);
199
Adrian Roose25c18d2016-06-17 15:59:49 -0700200 Notification.Builder builder = new Notification.Builder(mContext)
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700201 .setSmallIcon(R.drawable.ic_sd_card_48dp)
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700202 .setColor(mContext.getColor(R.color.system_notification_accent_color))
203 .setContentTitle(title)
204 .setContentText(text)
Jeff Sharkey50a05452015-04-29 11:24:52 -0700205 .setContentIntent(buildForgetPendingIntent(rec))
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700206 .setStyle(new Notification.BigTextStyle().bigText(text))
207 .setVisibility(Notification.VISIBILITY_PUBLIC)
208 .setLocalOnly(true)
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700209 .setCategory(Notification.CATEGORY_SYSTEM)
Adrian Roose25c18d2016-06-17 15:59:49 -0700210 .setDeleteIntent(buildSnoozeIntent(fsUuid));
211 SystemUI.overrideNotificationAppName(mContext, builder);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700212
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500213 mNotificationManager.notifyAsUser(fsUuid, SystemMessage.NOTE_STORAGE_PRIVATE,
214 builder.build(), UserHandle.ALL);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700215 }
San Mehat64e6a452010-02-04 20:53:48 -0800216 }
217 }
218
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700219 private void onDiskScannedInternal(DiskInfo disk, int volumeCount) {
Jeff Sharkeyf5a6bd72015-05-19 14:42:38 -0700220 if (volumeCount == 0 && disk.size > 0) {
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700221 // No supported volumes found, give user option to format
222 final CharSequence title = mContext.getString(
Jeff Sharkey52fc3c0f2015-06-14 20:58:54 -0700223 R.string.ext_media_unsupported_notification_title, disk.getDescription());
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700224 final CharSequence text = mContext.getString(
Jeff Sharkey52fc3c0f2015-06-14 20:58:54 -0700225 R.string.ext_media_unsupported_notification_message, disk.getDescription());
San Mehat64e6a452010-02-04 20:53:48 -0800226
Adrian Roose25c18d2016-06-17 15:59:49 -0700227 Notification.Builder builder = new Notification.Builder(mContext)
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700228 .setSmallIcon(getSmallIcon(disk, VolumeInfo.STATE_UNMOUNTABLE))
229 .setColor(mContext.getColor(R.color.system_notification_accent_color))
230 .setContentTitle(title)
231 .setContentText(text)
Jeff Sharkey50a05452015-04-29 11:24:52 -0700232 .setContentIntent(buildInitPendingIntent(disk))
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700233 .setStyle(new Notification.BigTextStyle().bigText(text))
234 .setVisibility(Notification.VISIBILITY_PUBLIC)
235 .setLocalOnly(true)
Adrian Roose25c18d2016-06-17 15:59:49 -0700236 .setCategory(Notification.CATEGORY_ERROR);
237 SystemUI.overrideNotificationAppName(mContext, builder);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700238
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500239 mNotificationManager.notifyAsUser(disk.getId(), SystemMessage.NOTE_STORAGE_DISK,
240 builder.build(), UserHandle.ALL);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700241
242 } else {
243 // Yay, we have volumes!
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500244 mNotificationManager.cancelAsUser(disk.getId(), SystemMessage.NOTE_STORAGE_DISK,
245 UserHandle.ALL);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700246 }
247 }
248
Philip P. Moltmann75b230b2016-04-11 15:27:58 -0700249 /**
250 * Remove all notifications for a disk when it goes away.
251 *
252 * @param disk The disk that went away.
253 */
254 private void onDiskDestroyedInternal(@NonNull DiskInfo disk) {
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500255 mNotificationManager.cancelAsUser(disk.getId(), SystemMessage.NOTE_STORAGE_DISK,
256 UserHandle.ALL);
Philip P. Moltmann75b230b2016-04-11 15:27:58 -0700257 }
258
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700259 private void onVolumeStateChangedInternal(VolumeInfo vol) {
260 switch (vol.getType()) {
261 case VolumeInfo.TYPE_PRIVATE:
262 onPrivateVolumeStateChangedInternal(vol);
263 break;
264 case VolumeInfo.TYPE_PUBLIC:
265 onPublicVolumeStateChangedInternal(vol);
266 break;
267 }
268 }
269
270 private void onPrivateVolumeStateChangedInternal(VolumeInfo vol) {
271 Log.d(TAG, "Notifying about private volume: " + vol.toString());
272
273 updateMissingPrivateVolumes();
274 }
275
276 private void onPublicVolumeStateChangedInternal(VolumeInfo vol) {
277 Log.d(TAG, "Notifying about public volume: " + vol.toString());
San Mehat64e6a452010-02-04 20:53:48 -0800278
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700279 final Notification notif;
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700280 switch (vol.getState()) {
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700281 case VolumeInfo.STATE_UNMOUNTED:
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700282 notif = onVolumeUnmounted(vol);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700283 break;
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700284 case VolumeInfo.STATE_CHECKING:
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700285 notif = onVolumeChecking(vol);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700286 break;
287 case VolumeInfo.STATE_MOUNTED:
Jeff Sharkey27de30d2015-04-18 16:20:27 -0700288 case VolumeInfo.STATE_MOUNTED_READ_ONLY:
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700289 notif = onVolumeMounted(vol);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700290 break;
291 case VolumeInfo.STATE_FORMATTING:
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700292 notif = onVolumeFormatting(vol);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700293 break;
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700294 case VolumeInfo.STATE_EJECTING:
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700295 notif = onVolumeEjecting(vol);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700296 break;
297 case VolumeInfo.STATE_UNMOUNTABLE:
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700298 notif = onVolumeUnmountable(vol);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700299 break;
300 case VolumeInfo.STATE_REMOVED:
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700301 notif = onVolumeRemoved(vol);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700302 break;
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700303 case VolumeInfo.STATE_BAD_REMOVAL:
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700304 notif = onVolumeBadRemoval(vol);
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700305 break;
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700306 default:
307 notif = null;
308 break;
309 }
310
311 if (notif != null) {
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500312 mNotificationManager.notifyAsUser(vol.getId(), SystemMessage.NOTE_STORAGE_PUBLIC,
313 notif, UserHandle.ALL);
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700314 } else {
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500315 mNotificationManager.cancelAsUser(vol.getId(), SystemMessage.NOTE_STORAGE_PUBLIC,
316 UserHandle.ALL);
San Mehat64e6a452010-02-04 20:53:48 -0800317 }
318 }
319
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700320 private Notification onVolumeUnmounted(VolumeInfo vol) {
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700321 // Ignored
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700322 return null;
San Mehat64e6a452010-02-04 20:53:48 -0800323 }
324
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700325 private Notification onVolumeChecking(VolumeInfo vol) {
Jeff Sharkey27de30d2015-04-18 16:20:27 -0700326 final DiskInfo disk = vol.getDisk();
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700327 final CharSequence title = mContext.getString(
328 R.string.ext_media_checking_notification_title, disk.getDescription());
329 final CharSequence text = mContext.getString(
330 R.string.ext_media_checking_notification_message, disk.getDescription());
San Mehat64e6a452010-02-04 20:53:48 -0800331
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700332 return buildNotificationBuilder(vol, title, text)
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700333 .setCategory(Notification.CATEGORY_PROGRESS)
334 .setPriority(Notification.PRIORITY_LOW)
335 .setOngoing(true)
336 .build();
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700337 }
San Mehat64e6a452010-02-04 20:53:48 -0800338
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700339 private Notification onVolumeMounted(VolumeInfo vol) {
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700340 final VolumeRecord rec = mStorageManager.findRecordByUuid(vol.getFsUuid());
Jeff Sharkey27de30d2015-04-18 16:20:27 -0700341 final DiskInfo disk = vol.getDisk();
Makoto Onukib138cb22015-06-23 17:32:02 -0700342
343 // Don't annoy when user dismissed in past. (But make sure the disk is adoptable; we
344 // used to allow snoozing non-adoptable disks too.)
345 if (rec.isSnoozed() && disk.isAdoptable()) {
346 return null;
347 }
348
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700349 if (disk.isAdoptable() && !rec.isInited()) {
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700350 final CharSequence title = disk.getDescription();
351 final CharSequence text = mContext.getString(
352 R.string.ext_media_new_notification_message, disk.getDescription());
San Mehat64e6a452010-02-04 20:53:48 -0800353
Jeff Sharkey50a05452015-04-29 11:24:52 -0700354 final PendingIntent initIntent = buildInitPendingIntent(vol);
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700355 return buildNotificationBuilder(vol, title, text)
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700356 .addAction(new Action(R.drawable.ic_settings_24dp,
357 mContext.getString(R.string.ext_media_init_action), initIntent))
358 .addAction(new Action(R.drawable.ic_eject_24dp,
359 mContext.getString(R.string.ext_media_unmount_action),
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700360 buildUnmountPendingIntent(vol)))
Jeff Sharkey50a05452015-04-29 11:24:52 -0700361 .setContentIntent(initIntent)
Jeff Sharkey52fc3c0f2015-06-14 20:58:54 -0700362 .setDeleteIntent(buildSnoozeIntent(vol.getFsUuid()))
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700363 .setCategory(Notification.CATEGORY_SYSTEM)
364 .build();
John Spurlock209bede2013-07-17 12:23:27 -0400365
San Mehat64e6a452010-02-04 20:53:48 -0800366 } else {
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700367 final CharSequence title = disk.getDescription();
368 final CharSequence text = mContext.getString(
369 R.string.ext_media_ready_notification_message, disk.getDescription());
370
Jeff Sharkey50a05452015-04-29 11:24:52 -0700371 final PendingIntent browseIntent = buildBrowsePendingIntent(vol);
Makoto Onukib138cb22015-06-23 17:32:02 -0700372 final Notification.Builder builder = buildNotificationBuilder(vol, title, text)
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700373 .addAction(new Action(R.drawable.ic_folder_24dp,
374 mContext.getString(R.string.ext_media_browse_action),
Jeff Sharkey50a05452015-04-29 11:24:52 -0700375 browseIntent))
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700376 .addAction(new Action(R.drawable.ic_eject_24dp,
377 mContext.getString(R.string.ext_media_unmount_action),
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700378 buildUnmountPendingIntent(vol)))
Jeff Sharkey50a05452015-04-29 11:24:52 -0700379 .setContentIntent(browseIntent)
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700380 .setCategory(Notification.CATEGORY_SYSTEM)
Makoto Onukib138cb22015-06-23 17:32:02 -0700381 .setPriority(Notification.PRIORITY_LOW);
382 // Non-adoptable disks can't be snoozed.
383 if (disk.isAdoptable()) {
384 builder.setDeleteIntent(buildSnoozeIntent(vol.getFsUuid()));
385 }
386
387 return builder.build();
San Mehat64e6a452010-02-04 20:53:48 -0800388 }
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700389 }
390
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700391 private Notification onVolumeFormatting(VolumeInfo vol) {
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700392 // Ignored
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700393 return null;
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700394 }
395
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700396 private Notification onVolumeEjecting(VolumeInfo vol) {
Jeff Sharkey27de30d2015-04-18 16:20:27 -0700397 final DiskInfo disk = vol.getDisk();
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700398 final CharSequence title = mContext.getString(
399 R.string.ext_media_unmounting_notification_title, disk.getDescription());
400 final CharSequence text = mContext.getString(
401 R.string.ext_media_unmounting_notification_message, disk.getDescription());
402
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700403 return buildNotificationBuilder(vol, title, text)
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700404 .setCategory(Notification.CATEGORY_PROGRESS)
405 .setPriority(Notification.PRIORITY_LOW)
406 .setOngoing(true)
407 .build();
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700408 }
409
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700410 private Notification onVolumeUnmountable(VolumeInfo vol) {
Jeff Sharkey27de30d2015-04-18 16:20:27 -0700411 final DiskInfo disk = vol.getDisk();
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700412 final CharSequence title = mContext.getString(
413 R.string.ext_media_unmountable_notification_title, disk.getDescription());
414 final CharSequence text = mContext.getString(
415 R.string.ext_media_unmountable_notification_message, disk.getDescription());
416
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700417 return buildNotificationBuilder(vol, title, text)
Jeff Sharkey52fc3c0f2015-06-14 20:58:54 -0700418 .setContentIntent(buildInitPendingIntent(vol))
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700419 .setCategory(Notification.CATEGORY_ERROR)
420 .build();
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700421 }
422
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700423 private Notification onVolumeRemoved(VolumeInfo vol) {
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700424 if (!vol.isPrimary()) {
425 // Ignore non-primary media
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700426 return null;
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700427 }
428
Jeff Sharkey27de30d2015-04-18 16:20:27 -0700429 final DiskInfo disk = vol.getDisk();
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700430 final CharSequence title = mContext.getString(
431 R.string.ext_media_nomedia_notification_title, disk.getDescription());
432 final CharSequence text = mContext.getString(
433 R.string.ext_media_nomedia_notification_message, disk.getDescription());
434
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700435 return buildNotificationBuilder(vol, title, text)
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700436 .setCategory(Notification.CATEGORY_ERROR)
437 .build();
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700438 }
439
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700440 private Notification onVolumeBadRemoval(VolumeInfo vol) {
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700441 if (!vol.isPrimary()) {
442 // Ignore non-primary media
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700443 return null;
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700444 }
445
Jeff Sharkey27de30d2015-04-18 16:20:27 -0700446 final DiskInfo disk = vol.getDisk();
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700447 final CharSequence title = mContext.getString(
448 R.string.ext_media_badremoval_notification_title, disk.getDescription());
449 final CharSequence text = mContext.getString(
450 R.string.ext_media_badremoval_notification_message, disk.getDescription());
451
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700452 return buildNotificationBuilder(vol, title, text)
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700453 .setCategory(Notification.CATEGORY_ERROR)
454 .build();
Jeff Sharkey7e92ef32015-04-17 17:35:07 -0700455 }
456
Jeff Sharkey50a05452015-04-29 11:24:52 -0700457 private void onMoveProgress(MoveInfo move, int status, long estMillis) {
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700458 final CharSequence title;
Jeff Sharkey50a05452015-04-29 11:24:52 -0700459 if (!TextUtils.isEmpty(move.label)) {
460 title = mContext.getString(R.string.ext_media_move_specific_title, move.label);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700461 } else {
462 title = mContext.getString(R.string.ext_media_move_title);
463 }
464
465 final CharSequence text;
466 if (estMillis < 0) {
467 text = null;
468 } else {
469 text = DateUtils.formatDuration(estMillis);
470 }
471
Jeff Sharkey50a05452015-04-29 11:24:52 -0700472 final PendingIntent intent;
473 if (move.packageName != null) {
474 intent = buildWizardMovePendingIntent(move);
475 } else {
476 intent = buildWizardMigratePendingIntent(move);
477 }
478
Adrian Roose25c18d2016-06-17 15:59:49 -0700479 Notification.Builder builder = new Notification.Builder(mContext)
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700480 .setSmallIcon(R.drawable.ic_sd_card_48dp)
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700481 .setColor(mContext.getColor(R.color.system_notification_accent_color))
482 .setContentTitle(title)
483 .setContentText(text)
Jeff Sharkey50a05452015-04-29 11:24:52 -0700484 .setContentIntent(intent)
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700485 .setStyle(new Notification.BigTextStyle().bigText(text))
486 .setVisibility(Notification.VISIBILITY_PUBLIC)
487 .setLocalOnly(true)
488 .setCategory(Notification.CATEGORY_PROGRESS)
489 .setPriority(Notification.PRIORITY_LOW)
490 .setProgress(100, status, false)
Adrian Roose25c18d2016-06-17 15:59:49 -0700491 .setOngoing(true);
492 SystemUI.overrideNotificationAppName(mContext, builder);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700493
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500494 mNotificationManager.notifyAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE,
Adrian Roose25c18d2016-06-17 15:59:49 -0700495 builder.build(), UserHandle.ALL);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700496 }
497
Jeff Sharkey50a05452015-04-29 11:24:52 -0700498 private void onMoveFinished(MoveInfo move, int status) {
499 if (move.packageName != null) {
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700500 // We currently ignore finished app moves; just clear the last
501 // published progress
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500502 mNotificationManager.cancelAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE,
503 UserHandle.ALL);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700504 return;
505 }
506
Jeff Sharkey50a05452015-04-29 11:24:52 -0700507 final VolumeInfo privateVol = mContext.getPackageManager().getPrimaryStorageCurrentVolume();
508 final String descrip = mStorageManager.getBestVolumeDescription(privateVol);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700509
510 final CharSequence title;
511 final CharSequence text;
512 if (status == PackageManager.MOVE_SUCCEEDED) {
513 title = mContext.getString(R.string.ext_media_move_success_title);
514 text = mContext.getString(R.string.ext_media_move_success_message, descrip);
515 } else {
516 title = mContext.getString(R.string.ext_media_move_failure_title);
517 text = mContext.getString(R.string.ext_media_move_failure_message);
518 }
519
Jeff Sharkey50a05452015-04-29 11:24:52 -0700520 // Jump back into the wizard flow if we moved to a real disk
521 final PendingIntent intent;
522 if (privateVol != null && privateVol.getDisk() != null) {
523 intent = buildWizardReadyPendingIntent(privateVol.getDisk());
Jeff Sharkeyef10ee02015-07-05 14:17:27 -0700524 } else if (privateVol != null) {
Jeff Sharkey50a05452015-04-29 11:24:52 -0700525 intent = buildVolumeSettingsPendingIntent(privateVol);
Jeff Sharkeyef10ee02015-07-05 14:17:27 -0700526 } else {
527 intent = null;
Jeff Sharkey50a05452015-04-29 11:24:52 -0700528 }
529
Adrian Roose25c18d2016-06-17 15:59:49 -0700530 Notification.Builder builder = new Notification.Builder(mContext)
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700531 .setSmallIcon(R.drawable.ic_sd_card_48dp)
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700532 .setColor(mContext.getColor(R.color.system_notification_accent_color))
533 .setContentTitle(title)
534 .setContentText(text)
Jeff Sharkey50a05452015-04-29 11:24:52 -0700535 .setContentIntent(intent)
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700536 .setStyle(new Notification.BigTextStyle().bigText(text))
537 .setVisibility(Notification.VISIBILITY_PUBLIC)
538 .setLocalOnly(true)
539 .setCategory(Notification.CATEGORY_SYSTEM)
540 .setPriority(Notification.PRIORITY_LOW)
Adrian Roose25c18d2016-06-17 15:59:49 -0700541 .setAutoCancel(true);
542 SystemUI.overrideNotificationAppName(mContext, builder);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700543
Chris Wren5e6c0ff2017-01-05 12:57:06 -0500544 mNotificationManager.notifyAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE,
545 builder.build(), UserHandle.ALL);
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700546 }
547
548 private int getSmallIcon(DiskInfo disk, int state) {
549 if (disk.isSd()) {
550 switch (state) {
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700551 case VolumeInfo.STATE_CHECKING:
552 case VolumeInfo.STATE_EJECTING:
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700553 return R.drawable.ic_sd_card_48dp;
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700554 default:
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700555 return R.drawable.ic_sd_card_48dp;
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700556 }
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700557 } else if (disk.isUsb()) {
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700558 return R.drawable.ic_usb_48dp;
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700559 } else {
Jeff Sharkeya49d5fc2015-05-13 11:40:30 -0700560 return R.drawable.ic_sd_card_48dp;
Jeff Sharkeye6c04f92015-04-18 21:38:05 -0700561 }
562 }
563
564 private Notification.Builder buildNotificationBuilder(VolumeInfo vol, CharSequence title,
565 CharSequence text) {
Adrian Roose25c18d2016-06-17 15:59:49 -0700566 Notification.Builder builder = new Notification.Builder(mContext)
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700567 .setSmallIcon(getSmallIcon(vol.getDisk(), vol.getState()))
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700568 .setColor(mContext.getColor(R.color.system_notification_accent_color))
569 .setContentTitle(title)
570 .setContentText(text)
571 .setStyle(new Notification.BigTextStyle().bigText(text))
572 .setVisibility(Notification.VISIBILITY_PUBLIC)
573 .setLocalOnly(true);
Adrian Roose25c18d2016-06-17 15:59:49 -0700574 overrideNotificationAppName(mContext, builder);
575 return builder;
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700576 }
577
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700578 private PendingIntent buildInitPendingIntent(DiskInfo disk) {
579 final Intent intent = new Intent();
580 intent.setClassName("com.android.settings",
581 "com.android.settings.deviceinfo.StorageWizardInit");
582 intent.putExtra(DiskInfo.EXTRA_DISK_ID, disk.getId());
583
584 final int requestKey = disk.getId().hashCode();
585 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
586 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
587 }
588
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700589 private PendingIntent buildInitPendingIntent(VolumeInfo vol) {
590 final Intent intent = new Intent();
591 intent.setClassName("com.android.settings",
592 "com.android.settings.deviceinfo.StorageWizardInit");
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700593 intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
594
595 final int requestKey = vol.getId().hashCode();
596 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
597 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700598 }
599
600 private PendingIntent buildUnmountPendingIntent(VolumeInfo vol) {
601 final Intent intent = new Intent();
602 intent.setClassName("com.android.settings",
603 "com.android.settings.deviceinfo.StorageUnmountReceiver");
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700604 intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
605
606 final int requestKey = vol.getId().hashCode();
607 return PendingIntent.getBroadcastAsUser(mContext, requestKey, intent,
608 PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.CURRENT);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700609 }
610
611 private PendingIntent buildBrowsePendingIntent(VolumeInfo vol) {
612 final Intent intent = vol.buildBrowseIntent();
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700613
614 final int requestKey = vol.getId().hashCode();
615 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
616 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700617 }
618
Jeff Sharkey50a05452015-04-29 11:24:52 -0700619 private PendingIntent buildVolumeSettingsPendingIntent(VolumeInfo vol) {
Jeff Sharkey56bd3122015-04-14 10:30:34 -0700620 final Intent intent = new Intent();
Jeff Sharkey50a05452015-04-29 11:24:52 -0700621 switch (vol.getType()) {
622 case VolumeInfo.TYPE_PRIVATE:
623 intent.setClassName("com.android.settings",
624 "com.android.settings.Settings$PrivateVolumeSettingsActivity");
625 break;
626 case VolumeInfo.TYPE_PUBLIC:
627 intent.setClassName("com.android.settings",
628 "com.android.settings.Settings$PublicVolumeSettingsActivity");
629 break;
630 default:
631 return null;
632 }
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700633 intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
634
635 final int requestKey = vol.getId().hashCode();
636 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
637 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
638 }
639
Jeff Sharkey52fc3c0f2015-06-14 20:58:54 -0700640 private PendingIntent buildSnoozeIntent(String fsUuid) {
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700641 final Intent intent = new Intent(ACTION_SNOOZE_VOLUME);
Jeff Sharkey52fc3c0f2015-06-14 20:58:54 -0700642 intent.putExtra(VolumeRecord.EXTRA_FS_UUID, fsUuid);
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700643
Jeff Sharkey52fc3c0f2015-06-14 20:58:54 -0700644 final int requestKey = fsUuid.hashCode();
Jeff Sharkeyd95d3bf2015-04-14 21:39:44 -0700645 return PendingIntent.getBroadcastAsUser(mContext, requestKey, intent,
646 PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.CURRENT);
San Mehat64e6a452010-02-04 20:53:48 -0800647 }
Jeff Sharkeyb36586a2015-04-27 08:42:28 -0700648
649 private PendingIntent buildForgetPendingIntent(VolumeRecord rec) {
650 final Intent intent = new Intent();
651 intent.setClassName("com.android.settings",
652 "com.android.settings.Settings$PrivateVolumeForgetActivity");
653 intent.putExtra(VolumeRecord.EXTRA_FS_UUID, rec.getFsUuid());
654
655 final int requestKey = rec.getFsUuid().hashCode();
656 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
657 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
658 }
Jeff Sharkey50a05452015-04-29 11:24:52 -0700659
660 private PendingIntent buildWizardMigratePendingIntent(MoveInfo move) {
661 final Intent intent = new Intent();
662 intent.setClassName("com.android.settings",
663 "com.android.settings.deviceinfo.StorageWizardMigrateProgress");
664 intent.putExtra(PackageManager.EXTRA_MOVE_ID, move.moveId);
665
666 final VolumeInfo vol = mStorageManager.findVolumeByQualifiedUuid(move.volumeUuid);
Suprabh Shuklaaf6c4192016-04-27 14:05:54 -0700667 if (vol != null) {
668 intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
669 }
Jeff Sharkey50a05452015-04-29 11:24:52 -0700670 return PendingIntent.getActivityAsUser(mContext, move.moveId, intent,
671 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
672 }
673
674 private PendingIntent buildWizardMovePendingIntent(MoveInfo move) {
675 final Intent intent = new Intent();
676 intent.setClassName("com.android.settings",
677 "com.android.settings.deviceinfo.StorageWizardMoveProgress");
678 intent.putExtra(PackageManager.EXTRA_MOVE_ID, move.moveId);
679
680 return PendingIntent.getActivityAsUser(mContext, move.moveId, intent,
681 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
682 }
683
684 private PendingIntent buildWizardReadyPendingIntent(DiskInfo disk) {
685 final Intent intent = new Intent();
686 intent.setClassName("com.android.settings",
687 "com.android.settings.deviceinfo.StorageWizardReady");
688 intent.putExtra(DiskInfo.EXTRA_DISK_ID, disk.getId());
689
690 final int requestKey = disk.getId().hashCode();
691 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
692 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
693 }
San Mehat64e6a452010-02-04 20:53:48 -0800694}