blob: 1d489628057c218cfb2c01b9effc17f5e65af27b [file] [log] [blame]
Santos Cordon10e68322013-12-12 16:06:56 -08001/*
2 * Copyright (C) 2013 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
17package com.android.telecomm;
18
19import android.app.Activity;
20import android.content.Intent;
21import android.content.res.Configuration;
22import android.os.Bundle;
23import android.util.Log;
24import android.widget.Toast;
25
26/**
27 * Activity that handles system CALL actions and forwards them to {@link CallsManager}.
28 * Handles all three CALL action types: CALL, CALL_PRIVILEGED, and CALL_EMERGENCY.
29 * TODO(santoscordon): Connect with CallsManager.
30 */
31public class CallActivity extends Activity {
32 private static final String TAG = CallActivity.class.getSimpleName();
33 private static boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
34
35 /**
36 * {@inheritDoc}
37 *
38 * This method is the single point of entry for the CALL intent, which is used by built-in apps
39 * like Contacts & Dialer, as well as 3rd party apps to initiate outgoing calls.
40 */
41 @Override
42 protected void onCreate(Bundle bundle) {
43 super.onCreate(bundle);
44
45 // TODO(santoscordon): This activity will be displayed until the next screen which could be
46 // the in-call UI and error dialog or potentially a call-type selection dialog.
47 // Traditionally, this has been a black screen with a spinner. We need to reevaluate if this
48 // is still desired and add back if necessary. Currently, the activity is set to NoDisplay
49 // theme which means it shows no UI.
50
51 Intent intent = getIntent();
52 Configuration configuration = getResources().getConfiguration();
53
54 if (DEBUG) {
55 Log.d(TAG, "onCreate: this = " + this + ", bundle= " + bundle);
56 Log.d(TAG, " - intent = " + intent);
57 Log.d(TAG, " - configuration = " + configuration);
58 }
59
60 // TODO(santoscordon): Figure out if there is something to restore from bundle.
61 // See OutgoingCallBroadcaster in services/Telephony for more.
62
63 processIntent(intent);
64
65 // TODO(santoscordon): Remove this finish() once this app does more than just show a toast.
66 finish();
67
68 if (DEBUG) {
69 Log.d(TAG, "onCreate: end");
70 }
71 }
72
73 /**
74 * Processes CALL, CALL_PRIVILEGED, and CALL_EMERGENCY intents.
75 *
76 * @param intent Call intent containing data about the handle to call.
77 */
78 private void processIntent(Intent intent) {
79 // TODO(santoscordon): Pass intent data through to CallsManager. At the moment, we just
80 // display a toast of the data.
81 String toastContent = "[" + intent.getAction() + "] " + intent.getDataString();
82 Toast.makeText(this, toastContent, Toast.LENGTH_LONG).show();
83 }
84}