Tyler Gunn | 33b6729 | 2015-04-27 15:41:35 -0700 | [diff] [blame] | 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 | |
| 17 | package com.android.server.telecom.testapps; |
| 18 | |
| 19 | import android.content.BroadcastReceiver; |
| 20 | import android.content.Context; |
| 21 | import android.content.Intent; |
| 22 | import android.util.Log; |
| 23 | |
| 24 | /** |
| 25 | * Test in call service broadcast receiver. |
| 26 | */ |
| 27 | public class TestInCallServiceBroadcastReceiver extends BroadcastReceiver { |
| 28 | private static final String TAG = "TestInCallServiceBR"; |
| 29 | |
| 30 | /** |
| 31 | * Sends an upgrade to video request for any live calls. |
| 32 | */ |
| 33 | public static final String ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE = |
| 34 | "android.server.telecom.testapps.ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE"; |
| 35 | |
| 36 | /** |
| 37 | * Handles broadcasts directed at the {@link TestInCallServiceImpl}. |
| 38 | * |
| 39 | * @param context The Context in which the receiver is running. |
| 40 | * @param intent The Intent being received. |
| 41 | */ |
| 42 | @Override |
| 43 | public void onReceive(Context context, Intent intent) { |
| 44 | String action = intent.getAction(); |
| 45 | Log.v(TAG, "onReceive: " + action); |
| 46 | |
| 47 | if (ACTION_SEND_UPDATE_REQUEST_FROM_TEST_INCALL_SERVICE.equals(action)) { |
Tyler Gunn | ac30f08 | 2015-05-05 11:42:05 -0700 | [diff] [blame^] | 48 | final int videoState = Integer.parseInt(intent.getData().getSchemeSpecificPart()); |
| 49 | TestCallList.getInstance().sendUpgradeToVideoRequest(videoState); |
Tyler Gunn | 33b6729 | 2015-04-27 15:41:35 -0700 | [diff] [blame] | 50 | } |
| 51 | } |
| 52 | } |