10a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie/*
20a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* Copyright (C) 2013 Samsung System LSI
30a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* Licensed under the Apache License, Version 2.0 (the "License");
40a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* you may not use this file except in compliance with the License.
50a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* You may obtain a copy of the License at
60a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie*
70a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie*      http://www.apache.org/licenses/LICENSE-2.0
80a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie*
90a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* Unless required by applicable law or agreed to in writing, software
100a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* distributed under the License is distributed on an "AS IS" BASIS,
110a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* See the License for the specific language governing permissions and
130a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie* limitations under the License.
140a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie*/
150a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xiepackage com.android.mms.transaction;
160a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie
170a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xieimport com.android.mms.LogTag;
180a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie
190a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xieimport android.content.BroadcastReceiver;
200a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xieimport android.content.Context;
210a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xieimport android.content.Intent;
220a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xieimport android.util.Log;
230a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie
240a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie/**
250a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie * MmsPushOutboxMessages listens for MMS_SEND_OUTBOX_MSG intent .
260a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie * {@link android.intent.action.MMS_SEND_OUTBOX_MSG},
270a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie * and wakes up the mms service when it receives it.
280a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie * This will tricker the mms service to send any messages stored
290a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie * in the outbox.
300a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie */
310a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xiepublic class MmsPushOutboxMessages extends BroadcastReceiver {
320a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie    private static final String INTENT_MMS_SEND_OUTBOX_MSG = "android.intent.action.MMS_SEND_OUTBOX_MSG";
330a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie    private static final String TAG = "MmsPushOutboxMessages";
340a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie
350a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie    @Override
360a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie    public void onReceive(Context context, Intent intent) {
370a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie        if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
380a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie            Log.v(TAG, "Received the MMS_SEND_OUTBOX_MSG intent: " + intent);
390a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie        }
400a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie        String action = intent.getAction();
410a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie        if(action.equalsIgnoreCase(INTENT_MMS_SEND_OUTBOX_MSG)){
420a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie            Log.d(TAG,"Now waking up the MMS service");
430a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie            context.startService(new Intent(context, TransactionService.class));
440a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie        }
450a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie    }
460a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie
470a17eab8d6635f575bab743c39fb7570ce0f1981Matthew Xie}
48