• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 package com.android.server.telecom.testapps;
18 
19 import android.app.Activity;
20 import android.content.Intent;
21 import android.net.Uri;
22 import android.os.Bundle;
23 
24 /**
25  * This activity exists in order to add an icon to the launcher. This activity has no UI of its own
26  * and instead starts the notification for {@link TestConnectionService} via
27  * {@link CallServiceNotifier}. After triggering a notification update, this activity immediately
28  * finishes.
29  *
30  * To directly trigger a new incoming call, use the following adb command:
31  *
32  * adb shell am start -a android.telecom.testapps.ACTION_START_INCOMING_CALL -d "tel:123456789"
33  */
34 public class TestCallActivity extends Activity {
35 
36     public static final String ACTION_NEW_INCOMING_CALL =
37             "android.telecom.testapps.ACTION_START_INCOMING_CALL";
38 
39     /*
40      * Action to exercise TelecomManager.addNewUnknownCall().
41      */
42     public static final String ACTION_NEW_UNKNOWN_CALL =
43             "android.telecom.testapps.ACTION_NEW_UNKNOWN_CALL";
44 
45     @Override
onCreate(Bundle icicle)46     protected void onCreate(Bundle icicle) {
47         super.onCreate(icicle);
48         final Intent intent = getIntent();
49         final String action = intent != null ? intent.getAction() : null;
50         final Uri data = intent != null ? intent.getData() : null;
51         if (ACTION_NEW_INCOMING_CALL.equals(action) && data != null) {
52             CallNotificationReceiver.sendIncomingCallIntent(this, data, false);
53         } if (ACTION_NEW_UNKNOWN_CALL.equals(action) && data != null) {
54             CallNotificationReceiver.addNewUnknownCall(this, data, intent.getExtras());
55         } else {
56             CallServiceNotifier.getInstance().updateNotification(this);
57         }
58         finish();
59     }
60 }
61