2 * Copyright (C) 2015 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.systemui.usb;
19 import android.annotation.NonNull;
20 import android.app.Notification;
21 import android.app.Notification.Action;
22 import android.app.NotificationManager;
23 import android.app.PendingIntent;
24 import android.content.BroadcastReceiver;
25 import android.content.Context;
26 import android.content.Intent;
27 import android.content.IntentFilter;
28 import android.content.pm.PackageManager;
29 import android.content.pm.PackageManager.MoveCallback;
30 import android.os.Bundle;
31 import android.os.Handler;
32 import android.os.UserHandle;
33 import android.os.storage.DiskInfo;
34 import android.os.storage.StorageEventListener;
35 import android.os.storage.StorageManager;
36 import android.os.storage.VolumeInfo;
37 import android.os.storage.VolumeRecord;
38 import android.text.TextUtils;
39 import android.text.format.DateUtils;
40 import android.util.Log;
41 import android.util.SparseArray;
43 import com.android.internal.R;
44 import com.android.systemui.SystemUI;
46 import java.util.List;
48 public class StorageNotification extends SystemUI {
49 private static final String TAG = "StorageNotification";
51 private static final int PUBLIC_ID = 0x53505542; // SPUB
52 private static final int PRIVATE_ID = 0x53505256; // SPRV
53 private static final int DISK_ID = 0x5344534b; // SDSK
54 private static final int MOVE_ID = 0x534d4f56; // SMOV
56 private static final String ACTION_SNOOZE_VOLUME = "com.android.systemui.action.SNOOZE_VOLUME";
57 private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD";
59 // TODO: delay some notifications to avoid bumpy fast operations
61 private NotificationManager mNotificationManager;
62 private StorageManager mStorageManager;
64 private static class MoveInfo {
67 public String packageName;
69 public String volumeUuid;
72 private final SparseArray<MoveInfo> mMoves = new SparseArray<>();
74 private final StorageEventListener mListener = new StorageEventListener() {
76 public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
77 onVolumeStateChangedInternal(vol);
81 public void onVolumeRecordChanged(VolumeRecord rec) {
82 // Avoid kicking notifications when getting early metadata before
83 // mounted. If already mounted, we're being kicked because of a
84 // nickname or init'ed change.
85 final VolumeInfo vol = mStorageManager.findVolumeByUuid(rec.getFsUuid());
86 if (vol != null && vol.isMountedReadable()) {
87 onVolumeStateChangedInternal(vol);
92 public void onVolumeForgotten(String fsUuid) {
93 // Stop annoying the user
94 mNotificationManager.cancelAsUser(fsUuid, PRIVATE_ID, UserHandle.ALL);
98 public void onDiskScanned(DiskInfo disk, int volumeCount) {
99 onDiskScannedInternal(disk, volumeCount);
103 public void onDiskDestroyed(DiskInfo disk) {
104 onDiskDestroyedInternal(disk);
108 private final BroadcastReceiver mSnoozeReceiver = new BroadcastReceiver() {
110 public void onReceive(Context context, Intent intent) {
111 // TODO: kick this onto background thread
112 final String fsUuid = intent.getStringExtra(VolumeRecord.EXTRA_FS_UUID);
113 mStorageManager.setVolumeSnoozed(fsUuid, true);
117 private final BroadcastReceiver mFinishReceiver = new BroadcastReceiver() {
119 public void onReceive(Context context, Intent intent) {
120 // When finishing the adoption wizard, clean up any notifications
121 // for moving primary storage
122 mNotificationManager.cancelAsUser(null, MOVE_ID, UserHandle.ALL);
126 private final MoveCallback mMoveCallback = new MoveCallback() {
128 public void onCreated(int moveId, Bundle extras) {
129 final MoveInfo move = new MoveInfo();
130 move.moveId = moveId;
131 move.extras = extras;
132 if (extras != null) {
133 move.packageName = extras.getString(Intent.EXTRA_PACKAGE_NAME);
134 move.label = extras.getString(Intent.EXTRA_TITLE);
135 move.volumeUuid = extras.getString(VolumeRecord.EXTRA_FS_UUID);
137 mMoves.put(moveId, move);
141 public void onStatusChanged(int moveId, int status, long estMillis) {
142 final MoveInfo move = mMoves.get(moveId);
144 Log.w(TAG, "Ignoring unknown move " + moveId);
148 if (PackageManager.isMoveStatusFinished(status)) {
149 onMoveFinished(move, status);
151 onMoveProgress(move, status, estMillis);
157 public void start() {
158 mNotificationManager = mContext.getSystemService(NotificationManager.class);
160 mStorageManager = mContext.getSystemService(StorageManager.class);
161 mStorageManager.registerListener(mListener);
163 mContext.registerReceiver(mSnoozeReceiver, new IntentFilter(ACTION_SNOOZE_VOLUME),
164 android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
165 mContext.registerReceiver(mFinishReceiver, new IntentFilter(ACTION_FINISH_WIZARD),
166 android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
168 // Kick current state into place
169 final List<DiskInfo> disks = mStorageManager.getDisks();
170 for (DiskInfo disk : disks) {
171 onDiskScannedInternal(disk, disk.volumeCount);
174 final List<VolumeInfo> vols = mStorageManager.getVolumes();
175 for (VolumeInfo vol : vols) {
176 onVolumeStateChangedInternal(vol);
179 mContext.getPackageManager().registerMoveCallback(mMoveCallback, new Handler());
181 updateMissingPrivateVolumes();
184 private void updateMissingPrivateVolumes() {
185 final List<VolumeRecord> recs = mStorageManager.getVolumeRecords();
186 for (VolumeRecord rec : recs) {
187 if (rec.getType() != VolumeInfo.TYPE_PRIVATE) continue;
189 final String fsUuid = rec.getFsUuid();
190 final VolumeInfo info = mStorageManager.findVolumeByUuid(fsUuid);
191 if ((info != null && info.isMountedWritable()) || rec.isSnoozed()) {
192 // Yay, private volume is here, or user snoozed
193 mNotificationManager.cancelAsUser(fsUuid, PRIVATE_ID, UserHandle.ALL);
196 // Boo, annoy the user to reinsert the private volume
197 final CharSequence title = mContext.getString(R.string.ext_media_missing_title,
199 final CharSequence text = mContext.getString(R.string.ext_media_missing_message);
201 Notification.Builder builder = new Notification.Builder(mContext)
202 .setSmallIcon(R.drawable.ic_sd_card_48dp)
203 .setColor(mContext.getColor(R.color.system_notification_accent_color))
204 .setContentTitle(title)
205 .setContentText(text)
206 .setContentIntent(buildForgetPendingIntent(rec))
207 .setStyle(new Notification.BigTextStyle().bigText(text))
208 .setVisibility(Notification.VISIBILITY_PUBLIC)
210 .setCategory(Notification.CATEGORY_SYSTEM)
211 .setDeleteIntent(buildSnoozeIntent(fsUuid));
212 SystemUI.overrideNotificationAppName(mContext, builder);
214 mNotificationManager.notifyAsUser(fsUuid, PRIVATE_ID, builder
215 .build(), UserHandle.ALL);
220 private void onDiskScannedInternal(DiskInfo disk, int volumeCount) {
221 if (volumeCount == 0 && disk.size > 0) {
222 // No supported volumes found, give user option to format
223 final CharSequence title = mContext.getString(
224 R.string.ext_media_unsupported_notification_title, disk.getDescription());
225 final CharSequence text = mContext.getString(
226 R.string.ext_media_unsupported_notification_message, disk.getDescription());
228 Notification.Builder builder = new Notification.Builder(mContext)
229 .setSmallIcon(getSmallIcon(disk, VolumeInfo.STATE_UNMOUNTABLE))
230 .setColor(mContext.getColor(R.color.system_notification_accent_color))
231 .setContentTitle(title)
232 .setContentText(text)
233 .setContentIntent(buildInitPendingIntent(disk))
234 .setStyle(new Notification.BigTextStyle().bigText(text))
235 .setVisibility(Notification.VISIBILITY_PUBLIC)
237 .setCategory(Notification.CATEGORY_ERROR);
238 SystemUI.overrideNotificationAppName(mContext, builder);
240 mNotificationManager.notifyAsUser(disk.getId(), DISK_ID, builder.build(),
244 // Yay, we have volumes!
245 mNotificationManager.cancelAsUser(disk.getId(), DISK_ID, UserHandle.ALL);
250 * Remove all notifications for a disk when it goes away.
252 * @param disk The disk that went away.
254 private void onDiskDestroyedInternal(@NonNull DiskInfo disk) {
255 mNotificationManager.cancelAsUser(disk.getId(), DISK_ID, UserHandle.ALL);
258 private void onVolumeStateChangedInternal(VolumeInfo vol) {
259 switch (vol.getType()) {
260 case VolumeInfo.TYPE_PRIVATE:
261 onPrivateVolumeStateChangedInternal(vol);
263 case VolumeInfo.TYPE_PUBLIC:
264 onPublicVolumeStateChangedInternal(vol);
269 private void onPrivateVolumeStateChangedInternal(VolumeInfo vol) {
270 Log.d(TAG, "Notifying about private volume: " + vol.toString());
272 updateMissingPrivateVolumes();
275 private void onPublicVolumeStateChangedInternal(VolumeInfo vol) {
276 Log.d(TAG, "Notifying about public volume: " + vol.toString());
278 final Notification notif;
279 switch (vol.getState()) {
280 case VolumeInfo.STATE_UNMOUNTED:
281 notif = onVolumeUnmounted(vol);
283 case VolumeInfo.STATE_CHECKING:
284 notif = onVolumeChecking(vol);
286 case VolumeInfo.STATE_MOUNTED:
287 case VolumeInfo.STATE_MOUNTED_READ_ONLY:
288 notif = onVolumeMounted(vol);
290 case VolumeInfo.STATE_FORMATTING:
291 notif = onVolumeFormatting(vol);
293 case VolumeInfo.STATE_EJECTING:
294 notif = onVolumeEjecting(vol);
296 case VolumeInfo.STATE_UNMOUNTABLE:
297 notif = onVolumeUnmountable(vol);
299 case VolumeInfo.STATE_REMOVED:
300 notif = onVolumeRemoved(vol);
302 case VolumeInfo.STATE_BAD_REMOVAL:
303 notif = onVolumeBadRemoval(vol);
311 mNotificationManager.notifyAsUser(vol.getId(), PUBLIC_ID, notif, UserHandle.ALL);
313 mNotificationManager.cancelAsUser(vol.getId(), PUBLIC_ID, UserHandle.ALL);
317 private Notification onVolumeUnmounted(VolumeInfo vol) {
322 private Notification onVolumeChecking(VolumeInfo vol) {
323 final DiskInfo disk = vol.getDisk();
324 final CharSequence title = mContext.getString(
325 R.string.ext_media_checking_notification_title, disk.getDescription());
326 final CharSequence text = mContext.getString(
327 R.string.ext_media_checking_notification_message, disk.getDescription());
329 return buildNotificationBuilder(vol, title, text)
330 .setCategory(Notification.CATEGORY_PROGRESS)
331 .setPriority(Notification.PRIORITY_LOW)
336 private Notification onVolumeMounted(VolumeInfo vol) {
337 final VolumeRecord rec = mStorageManager.findRecordByUuid(vol.getFsUuid());
338 final DiskInfo disk = vol.getDisk();
340 // Don't annoy when user dismissed in past. (But make sure the disk is adoptable; we
341 // used to allow snoozing non-adoptable disks too.)
342 if (rec.isSnoozed() && disk.isAdoptable()) {
346 if (disk.isAdoptable() && !rec.isInited()) {
347 final CharSequence title = disk.getDescription();
348 final CharSequence text = mContext.getString(
349 R.string.ext_media_new_notification_message, disk.getDescription());
351 final PendingIntent initIntent = buildInitPendingIntent(vol);
352 return buildNotificationBuilder(vol, title, text)
353 .addAction(new Action(R.drawable.ic_settings_24dp,
354 mContext.getString(R.string.ext_media_init_action), initIntent))
355 .addAction(new Action(R.drawable.ic_eject_24dp,
356 mContext.getString(R.string.ext_media_unmount_action),
357 buildUnmountPendingIntent(vol)))
358 .setContentIntent(initIntent)
359 .setDeleteIntent(buildSnoozeIntent(vol.getFsUuid()))
360 .setCategory(Notification.CATEGORY_SYSTEM)
364 final CharSequence title = disk.getDescription();
365 final CharSequence text = mContext.getString(
366 R.string.ext_media_ready_notification_message, disk.getDescription());
368 final PendingIntent browseIntent = buildBrowsePendingIntent(vol);
369 final Notification.Builder builder = buildNotificationBuilder(vol, title, text)
370 .addAction(new Action(R.drawable.ic_folder_24dp,
371 mContext.getString(R.string.ext_media_browse_action),
373 .addAction(new Action(R.drawable.ic_eject_24dp,
374 mContext.getString(R.string.ext_media_unmount_action),
375 buildUnmountPendingIntent(vol)))
376 .setContentIntent(browseIntent)
377 .setCategory(Notification.CATEGORY_SYSTEM)
378 .setPriority(Notification.PRIORITY_LOW);
379 // USB disks notification can be persistent
381 builder.setOngoing(mContext.getResources().getBoolean(
382 R.bool.config_persistUsbDriveNotification));
384 // Non-adoptable disks can't be snoozed.
385 if (disk.isAdoptable()) {
386 builder.setDeleteIntent(buildSnoozeIntent(vol.getFsUuid()));
389 return builder.build();
393 private Notification onVolumeFormatting(VolumeInfo vol) {
398 private Notification onVolumeEjecting(VolumeInfo vol) {
399 final DiskInfo disk = vol.getDisk();
400 final CharSequence title = mContext.getString(
401 R.string.ext_media_unmounting_notification_title, disk.getDescription());
402 final CharSequence text = mContext.getString(
403 R.string.ext_media_unmounting_notification_message, disk.getDescription());
405 return buildNotificationBuilder(vol, title, text)
406 .setCategory(Notification.CATEGORY_PROGRESS)
407 .setPriority(Notification.PRIORITY_LOW)
412 private Notification onVolumeUnmountable(VolumeInfo vol) {
413 final DiskInfo disk = vol.getDisk();
414 final CharSequence title = mContext.getString(
415 R.string.ext_media_unmountable_notification_title, disk.getDescription());
416 final CharSequence text = mContext.getString(
417 R.string.ext_media_unmountable_notification_message, disk.getDescription());
419 return buildNotificationBuilder(vol, title, text)
420 .setContentIntent(buildInitPendingIntent(vol))
421 .setCategory(Notification.CATEGORY_ERROR)
425 private Notification onVolumeRemoved(VolumeInfo vol) {
426 if (!vol.isPrimary()) {
427 // Ignore non-primary media
431 final DiskInfo disk = vol.getDisk();
432 final CharSequence title = mContext.getString(
433 R.string.ext_media_nomedia_notification_title, disk.getDescription());
434 final CharSequence text = mContext.getString(
435 R.string.ext_media_nomedia_notification_message, disk.getDescription());
437 return buildNotificationBuilder(vol, title, text)
438 .setCategory(Notification.CATEGORY_ERROR)
442 private Notification onVolumeBadRemoval(VolumeInfo vol) {
443 if (!vol.isPrimary()) {
444 // Ignore non-primary media
448 final DiskInfo disk = vol.getDisk();
449 final CharSequence title = mContext.getString(
450 R.string.ext_media_badremoval_notification_title, disk.getDescription());
451 final CharSequence text = mContext.getString(
452 R.string.ext_media_badremoval_notification_message, disk.getDescription());
454 return buildNotificationBuilder(vol, title, text)
455 .setCategory(Notification.CATEGORY_ERROR)
459 private void onMoveProgress(MoveInfo move, int status, long estMillis) {
460 final CharSequence title;
461 if (!TextUtils.isEmpty(move.label)) {
462 title = mContext.getString(R.string.ext_media_move_specific_title, move.label);
464 title = mContext.getString(R.string.ext_media_move_title);
467 final CharSequence text;
471 text = DateUtils.formatDuration(estMillis);
474 final PendingIntent intent;
475 if (move.packageName != null) {
476 intent = buildWizardMovePendingIntent(move);
478 intent = buildWizardMigratePendingIntent(move);
481 Notification.Builder builder = new Notification.Builder(mContext)
482 .setSmallIcon(R.drawable.ic_sd_card_48dp)
483 .setColor(mContext.getColor(R.color.system_notification_accent_color))
484 .setContentTitle(title)
485 .setContentText(text)
486 .setContentIntent(intent)
487 .setStyle(new Notification.BigTextStyle().bigText(text))
488 .setVisibility(Notification.VISIBILITY_PUBLIC)
490 .setCategory(Notification.CATEGORY_PROGRESS)
491 .setPriority(Notification.PRIORITY_LOW)
492 .setProgress(100, status, false)
494 SystemUI.overrideNotificationAppName(mContext, builder);
496 mNotificationManager.notifyAsUser(move.packageName, MOVE_ID,
497 builder.build(), UserHandle.ALL);
500 private void onMoveFinished(MoveInfo move, int status) {
501 if (move.packageName != null) {
502 // We currently ignore finished app moves; just clear the last
503 // published progress
504 mNotificationManager.cancelAsUser(move.packageName, MOVE_ID, UserHandle.ALL);
508 final VolumeInfo privateVol = mContext.getPackageManager().getPrimaryStorageCurrentVolume();
509 final String descrip = mStorageManager.getBestVolumeDescription(privateVol);
511 final CharSequence title;
512 final CharSequence text;
513 if (status == PackageManager.MOVE_SUCCEEDED) {
514 title = mContext.getString(R.string.ext_media_move_success_title);
515 text = mContext.getString(R.string.ext_media_move_success_message, descrip);
517 title = mContext.getString(R.string.ext_media_move_failure_title);
518 text = mContext.getString(R.string.ext_media_move_failure_message);
521 // Jump back into the wizard flow if we moved to a real disk
522 final PendingIntent intent;
523 if (privateVol != null && privateVol.getDisk() != null) {
524 intent = buildWizardReadyPendingIntent(privateVol.getDisk());
525 } else if (privateVol != null) {
526 intent = buildVolumeSettingsPendingIntent(privateVol);
531 Notification.Builder builder = new Notification.Builder(mContext)
532 .setSmallIcon(R.drawable.ic_sd_card_48dp)
533 .setColor(mContext.getColor(R.color.system_notification_accent_color))
534 .setContentTitle(title)
535 .setContentText(text)
536 .setContentIntent(intent)
537 .setStyle(new Notification.BigTextStyle().bigText(text))
538 .setVisibility(Notification.VISIBILITY_PUBLIC)
540 .setCategory(Notification.CATEGORY_SYSTEM)
541 .setPriority(Notification.PRIORITY_LOW)
542 .setAutoCancel(true);
543 SystemUI.overrideNotificationAppName(mContext, builder);
545 mNotificationManager.notifyAsUser(move.packageName, MOVE_ID, builder.build(),
549 private int getSmallIcon(DiskInfo disk, int state) {
552 case VolumeInfo.STATE_CHECKING:
553 case VolumeInfo.STATE_EJECTING:
554 return R.drawable.ic_sd_card_48dp;
556 return R.drawable.ic_sd_card_48dp;
558 } else if (disk.isUsb()) {
559 return R.drawable.ic_usb_48dp;
561 return R.drawable.ic_sd_card_48dp;
565 private Notification.Builder buildNotificationBuilder(VolumeInfo vol, CharSequence title,
567 Notification.Builder builder = new Notification.Builder(mContext)
568 .setSmallIcon(getSmallIcon(vol.getDisk(), vol.getState()))
569 .setColor(mContext.getColor(R.color.system_notification_accent_color))
570 .setContentTitle(title)
571 .setContentText(text)
572 .setStyle(new Notification.BigTextStyle().bigText(text))
573 .setVisibility(Notification.VISIBILITY_PUBLIC)
575 overrideNotificationAppName(mContext, builder);
579 private PendingIntent buildInitPendingIntent(DiskInfo disk) {
580 final Intent intent = new Intent();
581 intent.setClassName("com.android.settings",
582 "com.android.settings.deviceinfo.StorageWizardInit");
583 intent.putExtra(DiskInfo.EXTRA_DISK_ID, disk.getId());
585 final int requestKey = disk.getId().hashCode();
586 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
587 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
590 private PendingIntent buildInitPendingIntent(VolumeInfo vol) {
591 final Intent intent = new Intent();
592 intent.setClassName("com.android.settings",
593 "com.android.settings.deviceinfo.StorageWizardInit");
594 intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
596 final int requestKey = vol.getId().hashCode();
597 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
598 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
601 private PendingIntent buildUnmountPendingIntent(VolumeInfo vol) {
602 final Intent intent = new Intent();
603 intent.setClassName("com.android.settings",
604 "com.android.settings.deviceinfo.StorageUnmountReceiver");
605 intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
607 final int requestKey = vol.getId().hashCode();
608 return PendingIntent.getBroadcastAsUser(mContext, requestKey, intent,
609 PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.CURRENT);
612 private PendingIntent buildBrowsePendingIntent(VolumeInfo vol) {
613 final Intent intent = vol.buildBrowseIntent();
615 final int requestKey = vol.getId().hashCode();
616 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
617 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
620 private PendingIntent buildVolumeSettingsPendingIntent(VolumeInfo vol) {
621 final Intent intent = new Intent();
622 switch (vol.getType()) {
623 case VolumeInfo.TYPE_PRIVATE:
624 intent.setClassName("com.android.settings",
625 "com.android.settings.Settings$PrivateVolumeSettingsActivity");
627 case VolumeInfo.TYPE_PUBLIC:
628 intent.setClassName("com.android.settings",
629 "com.android.settings.Settings$PublicVolumeSettingsActivity");
634 intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
636 final int requestKey = vol.getId().hashCode();
637 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
638 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
641 private PendingIntent buildSnoozeIntent(String fsUuid) {
642 final Intent intent = new Intent(ACTION_SNOOZE_VOLUME);
643 intent.putExtra(VolumeRecord.EXTRA_FS_UUID, fsUuid);
645 final int requestKey = fsUuid.hashCode();
646 return PendingIntent.getBroadcastAsUser(mContext, requestKey, intent,
647 PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.CURRENT);
650 private PendingIntent buildForgetPendingIntent(VolumeRecord rec) {
651 final Intent intent = new Intent();
652 intent.setClassName("com.android.settings",
653 "com.android.settings.Settings$PrivateVolumeForgetActivity");
654 intent.putExtra(VolumeRecord.EXTRA_FS_UUID, rec.getFsUuid());
656 final int requestKey = rec.getFsUuid().hashCode();
657 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
658 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
661 private PendingIntent buildWizardMigratePendingIntent(MoveInfo move) {
662 final Intent intent = new Intent();
663 intent.setClassName("com.android.settings",
664 "com.android.settings.deviceinfo.StorageWizardMigrateProgress");
665 intent.putExtra(PackageManager.EXTRA_MOVE_ID, move.moveId);
667 final VolumeInfo vol = mStorageManager.findVolumeByQualifiedUuid(move.volumeUuid);
669 intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
671 return PendingIntent.getActivityAsUser(mContext, move.moveId, intent,
672 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
675 private PendingIntent buildWizardMovePendingIntent(MoveInfo move) {
676 final Intent intent = new Intent();
677 intent.setClassName("com.android.settings",
678 "com.android.settings.deviceinfo.StorageWizardMoveProgress");
679 intent.putExtra(PackageManager.EXTRA_MOVE_ID, move.moveId);
681 return PendingIntent.getActivityAsUser(mContext, move.moveId, intent,
682 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
685 private PendingIntent buildWizardReadyPendingIntent(DiskInfo disk) {
686 final Intent intent = new Intent();
687 intent.setClassName("com.android.settings",
688 "com.android.settings.deviceinfo.StorageWizardReady");
689 intent.putExtra(DiskInfo.EXTRA_DISK_ID, disk.getId());
691 final int requestKey = disk.getId().hashCode();
692 return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
693 PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);