Example usage for android.os Parcel setDataPosition

List of usage examples for android.os Parcel setDataPosition

Introduction

In this page you can find the example usage for android.os Parcel setDataPosition.

Prototype

public final void setDataPosition(int pos) 

Source Link

Document

Move the current read/write position in the parcel.

Usage

From source file:com.android.emailcommon.provider.HostAuthTests.java

public void testParceling() {
    final HostAuth orig = new HostAuth();
    // Fill in some data
    orig.mPort = 993;/*from w w  w  .j  av a  2  s  .c om*/
    orig.mProtocol = "imap";
    orig.mAddress = "example.com";
    orig.mLogin = "user";
    orig.mPassword = "supersecret";
    orig.mDomain = "domain";
    orig.mClientCertAlias = "certalias";

    final Parcel p1 = Parcel.obtain();
    orig.writeToParcel(p1, 0);
    p1.setDataPosition(0);
    final HostAuth unparceled1 = new HostAuth(p1);
    p1.recycle();
    assertEquals(orig, unparceled1);
    assertEquals(orig.mCredentialKey, unparceled1.mCredentialKey);
    assertEquals(orig.mCredential, unparceled1.mCredential);

    orig.getOrCreateCredential(new MockContext());

    final Parcel p2 = Parcel.obtain();
    orig.writeToParcel(p2, 0);
    p2.setDataPosition(0);
    final HostAuth unparceled2 = new HostAuth(p2);
    p2.recycle();
    assertEquals(orig, unparceled2);
    assertEquals(orig.mCredentialKey, unparceled2.mCredentialKey);
    assertEquals(orig.mCredential, unparceled2.mCredential);
}

From source file:io.github.data4all.model.data.TransformationParamBeanTest.java

/**
 * Create a new Parcel to save/parcelable the testRelationMember, afterwards
 * a new relation member is created from the parcel and we check if it
 * contains all attributes./* w  w w.j  a v a 2  s .  c o  m*/
 */
@Test
public void test_parcelable_transformationbean() {
    Parcel newParcel = Parcel.obtain();
    Location location = new Location("test");
    location.setLatitude(10);
    location.setLongitude(20);
    TransformationParamBean testBean = new TransformationParamBean(10, 20, 30, 40, 50, location);

    testBean.writeToParcel(newParcel, 0);
    newParcel.setDataPosition(0);
    TransformationParamBean deParcelBean = TransformationParamBean.CREATOR.createFromParcel(newParcel);

    assertEquals(testBean.getHeight(), deParcelBean.getHeight(), 0);
    assertEquals(testBean.getCameraMaxHorizontalViewAngle(), deParcelBean.getCameraMaxHorizontalViewAngle(), 0);
    assertEquals(testBean.getCameraMaxVerticalViewAngle(), deParcelBean.getCameraMaxVerticalViewAngle(), 0);
    assertEquals(testBean.getPhotoWidth(), deParcelBean.getPhotoWidth(), 0);
    assertEquals(testBean.getPhotoHeight(), deParcelBean.getPhotoHeight(), 0);

    assertEquals(location.getProvider(), deParcelBean.getLocation().getProvider());
    assertEquals(location.getLatitude(), deParcelBean.getLocation().getLatitude(), 0);
    assertEquals(location.getLongitude(), deParcelBean.getLocation().getLongitude(), 0);
}

From source file:com.granita.tasks.notification.NotificationActionIntentService.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
@Override/*from w  ww . j a  v  a  2s  .  c  om*/
protected void onHandleIntent(Intent intent) {
    mAuthority = getString(R.string.org_dmfs_tasks_authority);

    final String action = intent.getAction();
    final Context context = this;

    if (intent.hasExtra(EXTRA_NOTIFICATION_ID)) {
        Uri taskUri = intent.getData();
        int notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1);

        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
        notificationManager.cancel(notificationId);

        if (ACTION_COMPLETE.equals(action)) {
            markCompleted(taskUri);

        } else if (intent.hasExtra(EXTRA_TASK_DUE) && intent.hasExtra(EXTRA_TIMEZONE)) {
            long due = intent.getLongExtra(EXTRA_TASK_DUE, -1);
            String tz = intent.getStringExtra(EXTRA_TIMEZONE);
            boolean allDay = intent.getBooleanExtra(EXTRA_ALLDAY, false);
            if (ACTION_DELAY_1H.equals(action)) {
                Time time = new Time(tz);
                time.set(due);
                time.allDay = false;
                time.hour++;
                time.normalize(true);
                delayTask(taskUri, time);
            } else if (ACTION_DELAY_1D.equals(action)) {
                if (tz == null) {
                    tz = "UTC";
                }
                Time time = new Time(tz);
                time.set(due);
                time.allDay = allDay;
                time.monthDay++;
                time.normalize(true);
                delayTask(taskUri, time);
            }

        }

    } else if (intent.hasExtra(NotificationActionUtils.EXTRA_NOTIFICATION_ACTION)) {

        /*
         * Grab the alarm from the intent. Since the remote AlarmManagerService fills in the Intent to add some extra data, it must unparcel the
         * NotificationAction object. It throws a ClassNotFoundException when unparcelling. To avoid this, do the marshalling ourselves.
         */
        final NotificationAction notificationAction;
        final byte[] data = intent.getByteArrayExtra(NotificationActionUtils.EXTRA_NOTIFICATION_ACTION);
        if (data != null) {
            final Parcel in = Parcel.obtain();
            in.unmarshall(data, 0, data.length);
            in.setDataPosition(0);
            notificationAction = NotificationAction.CREATOR.createFromParcel(in,
                    NotificationAction.class.getClassLoader());
        } else {
            return;
        }

        if (NotificationActionUtils.ACTION_UNDO.equals(action)) {
            NotificationActionUtils.cancelUndoTimeout(context, notificationAction);
            NotificationActionUtils.cancelUndoNotification(context, notificationAction);
            resendNotification(notificationAction);
        } else if (ACTION_COMPLETE.equals(action)) {
            // All we need to do is switch to an Undo notification
            NotificationActionUtils.createUndoNotification(context, notificationAction);
            NotificationActionUtils.registerUndoTimeout(this, notificationAction);
        } else {
            if (NotificationActionUtils.ACTION_UNDO_TIMEOUT.equals(action)
                    || NotificationActionUtils.ACTION_DESTRUCT.equals(action)) {
                // Process the action
                NotificationActionUtils.cancelUndoTimeout(this, notificationAction);
                NotificationActionUtils.processUndoNotification(this, notificationAction);
                processDesctructiveNotification(notificationAction);
            }
        }
    }

}

From source file:net.geniecode.ttr.ScheduleReceiver.java

@SuppressWarnings("deprecation")
@SuppressLint({ "Recycle", "NewApi", "InlinedApi" })
@Override//from w w w .  j  a  v a2s .  c  om
public void onReceive(Context context, Intent intent) {
    if (!Schedules.SCHEDULE_ACTION.equals(intent.getAction())) {
        // Unknown intent, bail.
        return;
    }

    Schedule schedule = null;
    // Grab the schedule from the intent. Since the remote AlarmManagerService
    // fills in the Intent to add some extra data, it must unparcel the
    // Schedule object. It throws a ClassNotFoundException when unparcelling.
    // To avoid this, do the marshalling ourselves.
    final byte[] data = intent.getByteArrayExtra(Schedules.SCHEDULE_RAW_DATA);
    if (data != null) {
        Parcel in = Parcel.obtain();
        in.unmarshall(data, 0, data.length);
        in.setDataPosition(0);
        schedule = Schedule.CREATOR.createFromParcel(in);
    }

    if (schedule == null) {
        // Make sure we set the next schedule if needed.
        Schedules.setNextSchedule(context);
        return;
    }

    // Disable this schedule if it does not repeat.
    if (!schedule.daysOfWeek.isRepeatSet()) {
        Schedules.enableSchedule(context, schedule.id, false);
    } else {
        // Enable the next schedule if there is one. The above call to
        // enableSchedule will call setNextSchedule so avoid calling it twice.
        Schedules.setNextSchedule(context);
    }

    long now = System.currentTimeMillis();

    if (now > schedule.time + STALE_WINDOW) {
        return;
    }

    // Get telephony service
    mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    // Execute only for devices with versions of Android less than 4.2
    if (android.os.Build.VERSION.SDK_INT < 17) {
        // Get flight mode state
        boolean isEnabled = Settings.System.getInt(context.getContentResolver(),
                Settings.System.AIRPLANE_MODE_ON, 0) == 1;

        // Get Wi-Fi service
        mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);

        if ((schedule.aponoff) && (!isEnabled) && (schedule.mode.equals("1"))
                && (mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE)) {
            // Enable flight mode
            Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON,
                    isEnabled ? 0 : 1);

            // Get Wi-Fi state and disable that one too, just in case
            // (On some devices it doesn't get disabled when the flight mode is
            // turned on, so we do it here)
            boolean isWifiEnabled = mWifiManager.isWifiEnabled();

            SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);

            if (isWifiEnabled) {
                SharedPreferences.Editor editor = settings.edit();
                editor.putBoolean(WIFI_STATE, isWifiEnabled);
                editor.commit();
                mWifiManager.setWifiEnabled(false);
            } else {
                SharedPreferences.Editor editor = settings.edit();
                editor.putBoolean(WIFI_STATE, isWifiEnabled);
                editor.commit();
            }

            // Post an intent to reload
            Intent relintent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
            relintent.putExtra("state", !isEnabled);
            context.sendBroadcast(relintent);
        } else if ((!schedule.aponoff) && (isEnabled) && (schedule.mode.equals("1"))) {
            // Disable flight mode
            Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON,
                    isEnabled ? 0 : 1);

            // Restore previously remembered Wi-Fi state
            SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
            Boolean WiFiState = settings.getBoolean(WIFI_STATE, true);

            if (WiFiState) {
                mWifiManager.setWifiEnabled(true);
            }

            // Post an intent to reload
            Intent relintent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
            relintent.putExtra("state", !isEnabled);
            context.sendBroadcast(relintent);
        }
        // Check whether there are ongoing phone calls, and if so
        // show notification instead of just enabling the flight mode
        else if ((schedule.aponoff) && (!isEnabled) && (schedule.mode.equals("1"))
                && (mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)) {
            setNotification(context);
        }
        // Execute for devices with Android 4.2   or higher
    } else {
        // Get flight mode state
        String result = Settings.Global.getString(context.getContentResolver(),
                Settings.Global.AIRPLANE_MODE_ON);

        if ((schedule.aponoff) && (result.equals("0")) && (schedule.mode.equals("1"))
                && (mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE)) {
            // Keep the device awake while enabling flight mode
            Intent service = new Intent(context, ScheduleIntentService.class);
            startWakefulService(context, service);
        } else if ((!schedule.aponoff) && (result.equals("1")) && (schedule.mode.equals("1"))) {
            // Keep the device awake while enabling flight mode
            Intent service = new Intent(context, ScheduleIntentService.class);
            startWakefulService(context, service);
        } else if ((schedule.aponoff) && (result.equals("0")) && (schedule.mode.equals("1"))
                && (mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)) {
            setNotification(context);
        }
    }

    // Get audio service
    mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

    // Get current ringer mode and set silent or normal mode accordingly
    switch (mAudioManager.getRingerMode()) {
    case AudioManager.RINGER_MODE_SILENT:
        if ((!schedule.silentonoff) && (schedule.mode.equals("2"))) {
            mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        }
        break;
    case AudioManager.RINGER_MODE_NORMAL:
        if ((schedule.silentonoff) && (schedule.mode.equals("2"))) {
            mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
        }
        break;
    case AudioManager.RINGER_MODE_VIBRATE:
        // If the phone is set to vibrate let's make it completely silent
        if ((schedule.silentonoff) && (schedule.mode.equals("2"))) {
            mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
        }
        // or restore the regular sounds on it if that's scheduled
        else if ((!schedule.silentonoff) && (schedule.mode.equals("2"))) {
            mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        }
        break;
    }
}

From source file:com.marianhello.bgloc.Config.java

public Parcel toParcel() {
    Parcel parcel = Parcel.obtain();
    this.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    return parcel;
}

From source file:com.tct.mail.NotificationActionIntentService.java

@Override
protected void onHandleIntent(final Intent intent) {
    final Context context = this;
    final String action = intent.getAction();
    // TS: chao.zhang 2015-09-21 EMAIL FEATURE-585337 ADD_S
    //NOTE: handle the refresh intent.
    if (ACTION_REFRESH.equals(action)) {
        boolean cleanStatus = intent.getBooleanExtra(NotificationUtils.EXTRA_NEED_CLEAN_STATUS, false);
        long boxId = intent.getLongExtra(NotificationUtils.EXTRA_OUTBOX_ID, -1);
        //after click the action,cancel the notification.
        int notificationId = intent.getIntExtra(NotificationUtils.EXTRA_FAIL_NOTIFICATION_ID, 0);
        NotificationManager mNotificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.cancel(notificationId);
        if (boxId == -1) {
            LogUtils.e(LOG_TAG,//w ww  .  j av a  2 s.com
                    "can't find the oubox during handle Intent ACTION_REFRESH in NotificationActionIntentService#onHandleIntent");
            return;
        }
        Uri refreshUri = intent.getData();
        if (cleanStatus && isOutboxNotEmpty(context, boxId)) {
            // 1.clean failed status
            cleanFaildMailStatus(context, boxId);
            // 2.start refresh(sync) the outbox
            context.getContentResolver().query(refreshUri, null, null, null, null);
            // 3. show the sending toast
            // Why add toast to Handler? cause the notificationActionIntentService is
            // asynchronous,so want show toast,
            // only must add toast to Main thread.
            Handler handler = new Handler(Looper.getMainLooper());
            handler.post(new Runnable() {
                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    Toast.makeText(getApplicationContext(), R.string.sending, Toast.LENGTH_SHORT).show();
                }
            });
        }
        return;
    }
    // TS: chao.zhang 2015-09-21 EMAIL FEATURE-585337 ADD_E
    else if (ACTION_CALENDAR_NEVER_ASK_AGAIN.equals(action)) {
        NotificationManager mNotificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        if (mNotificationManager != null) {
            mNotificationManager.cancel(NotificationController.EXCHANGE_NEWCALENDAR_NOTIFICATION_ID);
        }
        MailPrefs.get(context).setIgnoreExchangeCalendarPermission(true); //TS: zheng.zou 2016-1-22 EMAIL BUGFIX-1431088 ADD
        return;
    } else if (ACTION_CONTACTS_NEVER_ASK_AGAIN.equals(action)) {
        NotificationManager mNotificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        if (mNotificationManager != null) {
            mNotificationManager.cancel(NotificationController.EXCHANGE_NEWCONTACTS_NOTIFICATION_ID);
        }
        MailPrefs.get(context).setIgnoreExchangeContactPermission(true); //TS: zheng.zou 2016-1-22 EMAIL BUGFIX-1431088 ADD
        return;
    } else if (ACTION_STORAGE_NEVER_ASK_AGAIN.equals(action)) { //TS: zheng.zou 2016-1-22 EMAIL BUGFIX-1431088 ADD_S
        NotificationManager mNotificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        if (mNotificationManager != null) {
            mNotificationManager.cancel(NotificationController.EXCHANGE_NEWSTORAGE_NOTIFICATION_ID);
        }
        MailPrefs.get(context).setIgnoreExchangeStoragePermission(true);
        //TS: zheng.zou 2016-1-22 EMAIL BUGFIX-1431088 ADD_E
    }
    /*
     * Grab the alarm from the intent. Since the remote AlarmManagerService fills in the Intent
     * to add some extra data, it must unparcel the NotificationAction object. It throws a
     * ClassNotFoundException when unparcelling.
     * To avoid this, do the marshalling ourselves.
     */
    final NotificationAction notificationAction;
    final byte[] data = intent.getByteArrayExtra(EXTRA_NOTIFICATION_ACTION);
    if (data != null) {
        final Parcel in = Parcel.obtain();
        in.unmarshall(data, 0, data.length);
        in.setDataPosition(0);
        notificationAction = NotificationAction.CREATOR.createFromParcel(in,
                NotificationAction.class.getClassLoader());
    } else {
        LogUtils.wtf(LOG_TAG, "data was null trying to unparcel the NotificationAction");
        return;
    }

    final Message message = notificationAction.getMessage();

    final ContentResolver contentResolver = getContentResolver();

    LogUtils.i(LOG_TAG, "Handling %s", action);

    logNotificationAction(action, notificationAction);

    if (notificationAction.getSource() == NotificationAction.SOURCE_REMOTE) {
        // Skip undo if the action is bridged from remote node.  This should be similar to the
        // logic after the Undo notification expires in a regular flow.
        LogUtils.d(LOG_TAG, "Canceling %s", notificationAction.getNotificationId());
        NotificationManagerCompat.from(context).cancel(notificationAction.getNotificationId());
        NotificationActionUtils.processDestructiveAction(this, notificationAction);
        NotificationActionUtils.resendNotifications(context, notificationAction.getAccount(),
                notificationAction.getFolder());
        return;
    }

    if (ACTION_UNDO.equals(action)) {
        NotificationActionUtils.cancelUndoTimeout(context, notificationAction);
        NotificationActionUtils.cancelUndoNotification(context, notificationAction);
    } else if (ACTION_ARCHIVE_REMOVE_LABEL.equals(action) || ACTION_DELETE.equals(action)) {
        // All we need to do is switch to an Undo notification
        NotificationActionUtils.createUndoNotification(context, notificationAction);

        NotificationActionUtils.registerUndoTimeout(context, notificationAction);
    } else {
        if (ACTION_UNDO_TIMEOUT.equals(action) || ACTION_DESTRUCT.equals(action)) {
            // Process the action
            NotificationActionUtils.cancelUndoTimeout(this, notificationAction);
            NotificationActionUtils.processUndoNotification(this, notificationAction);
        } else if (ACTION_MARK_READ.equals(action)) {
            final Uri uri = message.uri;

            final ContentValues values = new ContentValues(1);
            values.put(UIProvider.MessageColumns.READ, 1);

            contentResolver.update(uri, values, null, null);
        }

        NotificationActionUtils.resendNotifications(context, notificationAction.getAccount(),
                notificationAction.getFolder());
    }
}

From source file:org.thoughtcrime.securesms.ShareActivity.java

private void handleResolvedMedia(Intent intent, boolean animate) {
    long threadId = intent.getLongExtra(EXTRA_THREAD_ID, -1);
    int distributionType = intent.getIntExtra(EXTRA_DISTRIBUTION_TYPE, -1);
    Address address = null;//w w  w. j a v  a 2s  . c  om

    if (intent.hasExtra(EXTRA_ADDRESS_MARSHALLED)) {
        Parcel parcel = Parcel.obtain();
        byte[] marshalled = intent.getByteArrayExtra(EXTRA_ADDRESS_MARSHALLED);
        parcel.unmarshall(marshalled, 0, marshalled.length);
        parcel.setDataPosition(0);
        address = parcel.readParcelable(getClassLoader());
        parcel.recycle();
    }

    boolean hasResolvedDestination = threadId != -1 && address != null && distributionType != -1;

    if (!hasResolvedDestination && animate) {
        ViewUtil.fadeIn(contactsFragment.getView(), 300);
        ViewUtil.fadeOut(progressWheel, 300);
    } else if (!hasResolvedDestination) {
        contactsFragment.getView().setVisibility(View.VISIBLE);
        progressWheel.setVisibility(View.GONE);
    } else {
        createConversation(threadId, address, distributionType);
    }
}

From source file:org.droid2droid.internal.AbstractRemoteAndroidImpl.java

protected final void updateData(Parcel data) // TODO: a placer plutot cot serveur
{
    if (UPDATE_PARCEL) {
        int v = VERSION.SDK_INT;
        data.setDataPosition(0);
        if (v >= 10) // Gingerbread_MR1+
        {//from  ww w.j a  v a2 s.c om
            data.readInt();
        }
        String enforceInterfaceName = data.readString(); // Read the interface name (see Parcel.cpp)
        assert (enforceInterfaceName != null);
        byte[] bufDatas = data.marshall(); // Return all the buffer (with the specific enforceInterface
        int startDatas = data.dataPosition(); // Position after the first string

        // Create a new one with interface name + buffers
        Parcel p = Parcel.obtain();
        p.setDataPosition(0);
        p.writeString(enforceInterfaceName);
        int sizeInterface = p.dataPosition();
        byte[] bufInterface = p.marshall(); // Part of buffer only for the string
        p.recycle();

        // Extract the rest of the buffer
        byte[] result = new byte[sizeInterface + bufDatas.length - startDatas];
        System.arraycopy(bufInterface, 0, result, 0, sizeInterface);
        System.arraycopy(bufDatas, startDatas, result, sizeInterface, bufDatas.length - startDatas);
        data.unmarshall(result, 0, result.length);
    }
}

From source file:ca.farrelltonsolar.classic.PVOutputUploader.java

private Bundle deserializeBundle(byte[] data) {
    Bundle bundle = null;/*from www. java  2s  . co  m*/
    final Parcel parcel = Parcel.obtain();
    try {
        final ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
        final byte[] buffer = new byte[1024];
        final GZIPInputStream zis = new GZIPInputStream(new ByteArrayInputStream(data));
        int len = 0;
        while ((len = zis.read(buffer)) != -1) {
            byteBuffer.write(buffer, 0, len);
        }
        zis.close();
        parcel.unmarshall(byteBuffer.toByteArray(), 0, byteBuffer.size());
        parcel.setDataPosition(0);
        bundle = parcel.readBundle();
    } catch (IOException ex) {
        Log.w(getClass().getName(), String.format("deserializeBundle failed ex: %s", ex));
        bundle = null;
    } finally {
        parcel.recycle();
    }
    return bundle;
}

From source file:org.dmfs.tasks.notification.NotificationUpdaterService.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void resolveUndoAction(Intent intent) {
    if (!intent.hasExtra(NotificationActionUtils.EXTRA_NOTIFICATION_ACTION)) {
        return;/*from  ww w  . java  2 s  . co  m*/
    }

    /*
     * Grab the alarm from the intent. Since the remote AlarmManagerService fills in the Intent to add some extra data, it must unparcel the
     * NotificationAction object. It throws a ClassNotFoundException when unparcelling. To avoid this, do the marshalling ourselves.
     */
    final NotificationAction notificationAction;
    final String action = intent.getAction();
    final byte[] data = intent.getByteArrayExtra(NotificationActionUtils.EXTRA_NOTIFICATION_ACTION);
    if (data != null) {
        final Parcel in = Parcel.obtain();
        in.unmarshall(data, 0, data.length);
        in.setDataPosition(0);
        notificationAction = NotificationAction.CREATOR.createFromParcel(in);
    } else {
        return;
    }

    if (NotificationActionUtils.ACTION_UNDO.equals(action)) {
        NotificationActionUtils.cancelUndoTimeout(this, notificationAction);
        NotificationActionUtils.cancelUndoNotification(this, notificationAction);
        resendNotification(notificationAction);
    } else if (ACTION_COMPLETE.equals(action)) {
        // All we need to do is switch to an Undo notification
        NotificationActionUtils.createUndoNotification(this, notificationAction);
        NotificationActionUtils.registerUndoTimeout(this, notificationAction);
    } else {
        if (NotificationActionUtils.ACTION_UNDO_TIMEOUT.equals(action)
                || NotificationActionUtils.ACTION_DESTRUCT.equals(action)) {
            // Process the action
            NotificationActionUtils.cancelUndoTimeout(this, notificationAction);
            NotificationActionUtils.processUndoNotification(this, notificationAction);
            processDesctructiveNotification(notificationAction);
        }
    }
}