• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 package com.android.incallui;
18 
19 import android.os.Bundle;
20 import android.support.annotation.NonNull;
21 import android.support.annotation.Nullable;
22 import android.support.v7.app.AppCompatActivity;
23 import com.android.incallui.call.CallList;
24 import 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  */
30 public 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
onCreate(@ullable Bundle bundle)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
onDestroy()56   protected void onDestroy() {
57     super.onDestroy();
58     CallList.getInstance().removeListener(this);
59   }
60 
61   @Override
onPause()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
onDisconnect(DialerCall call)71   public void onDisconnect(DialerCall call) {
72     if (callId.equals(call.getId())) {
73       finish();
74     }
75   }
76 
77   @Override
onIncomingCall(DialerCall call)78   public void onIncomingCall(DialerCall call) {}
79 
80   @Override
onUpgradeToVideo(DialerCall call)81   public void onUpgradeToVideo(DialerCall call) {}
82 
83   @Override
onUpgradeToRtt(DialerCall call, int rttRequestId)84   public void onUpgradeToRtt(DialerCall call, int rttRequestId) {}
85 
86   @Override
onSessionModificationStateChange(DialerCall call)87   public void onSessionModificationStateChange(DialerCall call) {}
88 
89   @Override
onCallListChange(CallList callList)90   public void onCallListChange(CallList callList) {}
91 
92   @Override
onWiFiToLteHandover(DialerCall call)93   public void onWiFiToLteHandover(DialerCall call) {}
94 
95   @Override
onHandoverToWifiFailed(DialerCall call)96   public void onHandoverToWifiFailed(DialerCall call) {}
97 
98   @Override
onInternationalCallOnWifi(@onNull DialerCall call)99   public void onInternationalCallOnWifi(@NonNull DialerCall call) {}
100 }
101