1 /*
2  * Copyright (C) 2019 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 static android.telecom.TelecomManager.EXTRA_CALL_DURATION;
20 import static android.telecom.TelecomManager.EXTRA_DISCONNECT_CAUSE;
21 import static android.telecom.TelecomManager.EXTRA_HANDLE;
22 
23 import android.app.Activity;
24 import android.content.Intent;
25 import android.os.Bundle;
26 import android.telecom.Log;
27 
28 public class PostCallActivity extends Activity {
29 
30     public static final String ACTION_POST_CALL = "android.telecom.action.POST_CALL";
31     public static final int DEFAULT_DISCONNECT_CAUSE = -1;
32     public static final int DEFAULT_DURATION = -1;
33 
34     @Override
onCreate(Bundle icicle)35     protected void onCreate(Bundle icicle) {
36         super.onCreate(icicle);
37 
38         final Intent intent = getIntent();
39         final String action = intent != null ? intent.getAction() : null;
40         Log.i(this, "action: %s", action);
41         if (ACTION_POST_CALL.equals(action)) {
42             Log.i(this, "extra handle: " +
43                     intent.getParcelableExtra(EXTRA_HANDLE));
44             Log.i(this, "extra disconnect cause: " +
45                     intent.getIntExtra(EXTRA_DISCONNECT_CAUSE, DEFAULT_DISCONNECT_CAUSE));
46             Log.i(this, "extra duration: " +
47                     intent.getIntExtra(EXTRA_CALL_DURATION, DEFAULT_DURATION));
48         }
49     }
50 }
51