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.car.dialer.notification; 18 19 import static android.telecom.TelecomManager.ACTION_SHOW_MISSED_CALLS_NOTIFICATION; 20 import static android.telecom.TelecomManager.EXTRA_NOTIFICATION_COUNT; 21 import static android.telecom.TelecomManager.EXTRA_NOTIFICATION_PHONE_NUMBER; 22 23 import android.content.BroadcastReceiver; 24 import android.content.Context; 25 import android.content.Intent; 26 27 import com.android.car.dialer.log.L; 28 import com.android.car.telephony.common.TelecomUtils; 29 30 /** 31 * A {@link BroadcastReceiver} that is used to inform telecom manager that we are showing the 32 * missed call notification that it does not have to show missed call notification on its behalf. 33 * 34 * <p>We only log the intent. The missed call notification is monitored and handled in the {@link 35 * MissedCallNotificationController}. 36 */ 37 public class MissedCallReceiver extends BroadcastReceiver { 38 private static final String TAG = "CD.MissedCallReceiver"; 39 40 @Override onReceive(Context context, Intent intent)41 public void onReceive(Context context, Intent intent) { 42 String action = intent.getAction(); 43 if (!ACTION_SHOW_MISSED_CALLS_NOTIFICATION.equals(action)) { 44 return; 45 } 46 47 int count = intent.getIntExtra(EXTRA_NOTIFICATION_COUNT, 0); 48 String phoneNumber = intent.getStringExtra(EXTRA_NOTIFICATION_PHONE_NUMBER); 49 50 L.d(TAG, "Count: %d PhoneNumber: %s", count, TelecomUtils.piiLog(phoneNumber)); 51 } 52 } 53