use of android.app.PendingIntent in project platform_frameworks_base by android.
the class StorageNotification method buildUnmountPendingIntent.
private PendingIntent buildUnmountPendingIntent(VolumeInfo vol) {
final Intent intent = new Intent();
intent.setClassName("com.android.settings", "com.android.settings.deviceinfo.StorageUnmountReceiver");
intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
final int requestKey = vol.getId().hashCode();
return PendingIntent.getBroadcastAsUser(mContext, requestKey, intent, PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.CURRENT);
}
use of android.app.PendingIntent in project platform_frameworks_base by android.
the class StorageNotification method buildWizardReadyPendingIntent.
private PendingIntent buildWizardReadyPendingIntent(DiskInfo disk) {
final Intent intent = new Intent();
intent.setClassName("com.android.settings", "com.android.settings.deviceinfo.StorageWizardReady");
intent.putExtra(DiskInfo.EXTRA_DISK_ID, disk.getId());
final int requestKey = disk.getId().hashCode();
return PendingIntent.getActivityAsUser(mContext, requestKey, intent, PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
}
use of android.app.PendingIntent in project platform_frameworks_base by android.
the class StorageNotification method onMoveFinished.
private void onMoveFinished(MoveInfo move, int status) {
if (move.packageName != null) {
// We currently ignore finished app moves; just clear the last
// published progress
mNotificationManager.cancelAsUser(move.packageName, MOVE_ID, UserHandle.ALL);
return;
}
final VolumeInfo privateVol = mContext.getPackageManager().getPrimaryStorageCurrentVolume();
final String descrip = mStorageManager.getBestVolumeDescription(privateVol);
final CharSequence title;
final CharSequence text;
if (status == PackageManager.MOVE_SUCCEEDED) {
title = mContext.getString(R.string.ext_media_move_success_title);
text = mContext.getString(R.string.ext_media_move_success_message, descrip);
} else {
title = mContext.getString(R.string.ext_media_move_failure_title);
text = mContext.getString(R.string.ext_media_move_failure_message);
}
// Jump back into the wizard flow if we moved to a real disk
final PendingIntent intent;
if (privateVol != null && privateVol.getDisk() != null) {
intent = buildWizardReadyPendingIntent(privateVol.getDisk());
} else if (privateVol != null) {
intent = buildVolumeSettingsPendingIntent(privateVol);
} else {
intent = null;
}
Notification.Builder builder = new Notification.Builder(mContext).setSmallIcon(R.drawable.ic_sd_card_48dp).setColor(mContext.getColor(R.color.system_notification_accent_color)).setContentTitle(title).setContentText(text).setContentIntent(intent).setStyle(new Notification.BigTextStyle().bigText(text)).setVisibility(Notification.VISIBILITY_PUBLIC).setLocalOnly(true).setCategory(Notification.CATEGORY_SYSTEM).setPriority(Notification.PRIORITY_LOW).setAutoCancel(true);
SystemUI.overrideNotificationAppName(mContext, builder);
mNotificationManager.notifyAsUser(move.packageName, MOVE_ID, builder.build(), UserHandle.ALL);
}
use of android.app.PendingIntent in project platform_frameworks_base by android.
the class StorageNotification method buildSnoozeIntent.
private PendingIntent buildSnoozeIntent(String fsUuid) {
final Intent intent = new Intent(ACTION_SNOOZE_VOLUME);
intent.putExtra(VolumeRecord.EXTRA_FS_UUID, fsUuid);
final int requestKey = fsUuid.hashCode();
return PendingIntent.getBroadcastAsUser(mContext, requestKey, intent, PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.CURRENT);
}
use of android.app.PendingIntent in project platform_frameworks_base by android.
the class StorageNotification method buildInitPendingIntent.
private PendingIntent buildInitPendingIntent(DiskInfo disk) {
final Intent intent = new Intent();
intent.setClassName("com.android.settings", "com.android.settings.deviceinfo.StorageWizardInit");
intent.putExtra(DiskInfo.EXTRA_DISK_ID, disk.getId());
final int requestKey = disk.getId().hashCode();
return PendingIntent.getActivityAsUser(mContext, requestKey, intent, PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
}
Aggregations