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.telecomeventui; 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 android.text.TextUtils; 24 import com.android.incallui.call.CallList; 25 import com.android.incallui.call.DialerCall; 26 27 /** 28 * Activity containing dialog that may be shown when users place an outgoing call to an 29 * international number while on Wifi. 30 */ 31 public class InternationalCallOnWifiDialogActivity extends AppCompatActivity 32 implements CallList.Listener { 33 34 public static final String EXTRA_CALL_ID = "extra_call_id"; 35 private static final String TAG_INTERNATIONAL_CALL_ON_WIFI = "tag_international_call_on_wifi"; 36 37 private String callId; 38 39 @Override onCreate(@ullable Bundle bundle)40 protected void onCreate(@Nullable Bundle bundle) { 41 super.onCreate(bundle); 42 43 callId = getIntent().getStringExtra(EXTRA_CALL_ID); 44 if (TextUtils.isEmpty(callId)) { 45 finish(); 46 return; 47 } 48 49 InternationalCallOnWifiDialogFragment fragment = 50 InternationalCallOnWifiDialogFragment.newInstance(callId); 51 fragment.show(getSupportFragmentManager(), TAG_INTERNATIONAL_CALL_ON_WIFI); 52 53 CallList.getInstance().addListener(this); 54 } 55 56 @Override onDestroy()57 protected void onDestroy() { 58 super.onDestroy(); 59 CallList.getInstance().removeListener(this); 60 } 61 62 @Override onPause()63 protected void onPause() { 64 super.onPause(); 65 // We don't expect the activity to resume, except for orientation change. 66 if (!isChangingConfigurations()) { 67 finish(); 68 } 69 } 70 71 @Override onDisconnect(DialerCall call)72 public void onDisconnect(DialerCall call) { 73 if (callId.equals(call.getId())) { 74 finish(); 75 } 76 } 77 78 @Override onIncomingCall(DialerCall call)79 public void onIncomingCall(DialerCall call) {} 80 81 @Override onUpgradeToVideo(DialerCall call)82 public void onUpgradeToVideo(DialerCall call) {} 83 84 @Override onUpgradeToRtt(DialerCall call, int rttRequestId)85 public void onUpgradeToRtt(DialerCall call, int rttRequestId) {} 86 87 @Override onSessionModificationStateChange(DialerCall call)88 public void onSessionModificationStateChange(DialerCall call) {} 89 90 @Override onCallListChange(CallList callList)91 public void onCallListChange(CallList callList) {} 92 93 @Override onWiFiToLteHandover(DialerCall call)94 public void onWiFiToLteHandover(DialerCall call) {} 95 96 @Override onHandoverToWifiFailed(DialerCall call)97 public void onHandoverToWifiFailed(DialerCall call) {} 98 99 @Override onInternationalCallOnWifi(@onNull DialerCall call)100 public void onInternationalCallOnWifi(@NonNull DialerCall call) {} 101 } 102