blob: dcdc9d66382f7450fac4c3a016a0f87f7be3dfd5 [file] [log] [blame]
yuega489f512018-04-25 12:01:09 -07001/*
2 * Copyright (C) 2018 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.incallui;
18
19import android.os.Bundle;
20import android.support.annotation.NonNull;
21import android.support.annotation.Nullable;
22import android.support.v7.app.AppCompatActivity;
23import com.android.incallui.call.CallList;
24import com.android.incallui.call.DialerCall;
25
26/**
27 * Activity that contains an alert dialog with OK and Cancel buttons to allow user to Accept or
28 * Reject the WAIT inserted as part of the Dial string.
29 */
30public class PostCharDialogActivity extends AppCompatActivity implements CallList.Listener {
31
32 public static final String EXTRA_CALL_ID = "extra_call_id";
33 public static final String EXTRA_POST_DIAL_STRING = "extra_post_dial_string";
34 private static final String TAG_INTERNATIONAL_CALL_ON_WIFI = "tag_international_call_on_wifi";
35
36 private String callId;
37
38 @Override
39 protected void onCreate(@Nullable Bundle bundle) {
40 super.onCreate(bundle);
41
42 callId = getIntent().getStringExtra(EXTRA_CALL_ID);
43 String postDialString = getIntent().getStringExtra(EXTRA_POST_DIAL_STRING);
44 if (callId == null || postDialString == null) {
45 finish();
46 return;
47 }
48
49 PostCharDialogFragment fragment = new PostCharDialogFragment(callId, postDialString);
50 fragment.show(getSupportFragmentManager(), TAG_INTERNATIONAL_CALL_ON_WIFI);
51
52 CallList.getInstance().addListener(this);
53 }
54
55 @Override
56 protected void onDestroy() {
57 super.onDestroy();
58 CallList.getInstance().removeListener(this);
59 }
60
61 @Override
62 protected void onPause() {
63 super.onPause();
64 // We don't expect the activity to resume, except for orientation change.
65 if (!isChangingConfigurations()) {
66 finish();
67 }
68 }
69
70 @Override
71 public void onDisconnect(DialerCall call) {
72 if (callId.equals(call.getId())) {
73 finish();
74 }
75 }
76
77 @Override
78 public void onIncomingCall(DialerCall call) {}
79
80 @Override
81 public void onUpgradeToVideo(DialerCall call) {}
82
83 @Override
84 public void onUpgradeToRtt(DialerCall call, int rttRequestId) {}
85
86 @Override
87 public void onSessionModificationStateChange(DialerCall call) {}
88
89 @Override
90 public void onCallListChange(CallList callList) {}
91
92 @Override
93 public void onWiFiToLteHandover(DialerCall call) {}
94
95 @Override
96 public void onHandoverToWifiFailed(DialerCall call) {}
97
98 @Override
99 public void onInternationalCallOnWifi(@NonNull DialerCall call) {}
100}