Search in sources :

Example 41 with PendingIntent

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);
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 42 with PendingIntent

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);
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 43 with PendingIntent

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);
}
Also used : VolumeInfo(android.os.storage.VolumeInfo) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Example 44 with PendingIntent

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);
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 45 with PendingIntent

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);
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Aggregations

PendingIntent (android.app.PendingIntent)1243 Intent (android.content.Intent)1043 Notification (android.app.Notification)233 NotificationCompat (android.support.v4.app.NotificationCompat)184 NotificationManager (android.app.NotificationManager)160 AlarmManager (android.app.AlarmManager)153 Bundle (android.os.Bundle)78 RemoteViews (android.widget.RemoteViews)67 RemoteException (android.os.RemoteException)64 Resources (android.content.res.Resources)63 Bitmap (android.graphics.Bitmap)62 Context (android.content.Context)59 ComponentName (android.content.ComponentName)56 Uri (android.net.Uri)45 Test (org.junit.Test)44 IntentFilter (android.content.IntentFilter)43 SharedPreferences (android.content.SharedPreferences)38 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)34 UserHandle (android.os.UserHandle)31 IOException (java.io.IOException)30