Home | History | Annotate | Download | only in action
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      3  *
      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 package com.android.messaging.datamodel.action;
     17 
     18 import android.os.Parcel;
     19 import android.os.Parcelable;
     20 
     21 import com.android.messaging.datamodel.BugleNotifications;
     22 
     23 /**
     24  * Updates the message notification (generally, to include voice replies we've
     25  * made since the notification was first posted).
     26  */
     27 public class UpdateMessageNotificationAction extends Action {
     28 
     29     public static void updateMessageNotification() {
     30         new UpdateMessageNotificationAction().start();
     31     }
     32 
     33     private UpdateMessageNotificationAction() {
     34     }
     35 
     36     @Override
     37     protected Object executeAction() {
     38         BugleNotifications.update(true /* silent */, BugleNotifications.UPDATE_MESSAGES);
     39         return null;
     40     }
     41 
     42     private UpdateMessageNotificationAction(final Parcel in) {
     43         super(in);
     44     }
     45 
     46     public static final Parcelable.Creator<UpdateMessageNotificationAction> CREATOR
     47             = new Parcelable.Creator<UpdateMessageNotificationAction>() {
     48         @Override
     49         public UpdateMessageNotificationAction createFromParcel(final Parcel in) {
     50             return new UpdateMessageNotificationAction(in);
     51         }
     52 
     53         @Override
     54         public UpdateMessageNotificationAction[] newArray(final int size) {
     55             return new UpdateMessageNotificationAction[size];
     56         }
     57     };
     58 
     59     @Override
     60     public void writeToParcel(final Parcel parcel, final int flags) {
     61         writeActionToParcel(parcel, flags);
     62     }
     63 }
     64