Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fa993bb authored by Yorke Lee's avatar Yorke Lee
Browse files

Remove unused InCallApp

Move NotificationBroadcastReceiver into its own class.

Change-Id: Ieefc840af7df596bfbb9297847ad164870e48970
parent 9b93ee28
Loading
Loading
Loading
Loading
+74 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 The Android Open Source Project
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -16,17 +16,17 @@

package com.android.incallui;

import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.telecom.VideoProfile;

/**
 * Top-level Application class for the InCall app.
 * Accepts broadcast Intents which will be prepared by {@link StatusBarNotifier} and thus
 * sent from the notification manager.
 * This should be visible from outside, but shouldn't be exported.
 */
public class InCallApp extends Application {
public class NotificationBroadcastReceiver extends BroadcastReceiver {

    /**
     * Intent Action used for hanging up the current call from Notification bar. This will
@@ -46,24 +46,6 @@ public class InCallApp extends Application {
    public static final String ACTION_DECLINE_VIDEO_UPGRADE_REQUEST =
            "com.android.incallui.ACTION_DECLINE_VIDEO_UPGRADE_REQUEST";

    public InCallApp() {
    }

    @Override
    public void onCreate() {
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
    }

    /**
     * Accepts broadcatst Intents which will be prepared by {@link StatusBarNotifier} and thus
     * sent from framework's notification mechanism (which is outside Phone context).
     * This should be visible from outside, but shouldn't be in "exported" state.
     */
    public static class NotificationBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        final String action = intent.getAction();
@@ -88,5 +70,5 @@ public class InCallApp extends Application {
            InCallPresenter.getInstance().declineUpgradeRequest(context);
        }
    }
    }

}
+11 −11
Original line number Diff line number Diff line
@@ -16,9 +16,7 @@

package com.android.incallui;

import android.net.Uri;

import com.google.common.base.Preconditions;
import static com.android.incallui.NotificationBroadcastReceiver.*;

import android.app.Notification;
import android.app.NotificationManager;
@@ -28,6 +26,7 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.telecom.Call.Details;
@@ -39,9 +38,10 @@ import android.text.TextUtils;
import com.android.contacts.common.util.BitmapUtil;
import com.android.incallui.ContactInfoCache.ContactCacheEntry;
import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback;
import com.android.incallui.InCallApp.NotificationBroadcastReceiver;
import com.android.incallui.InCallPresenter.InCallState;

import com.google.common.base.Preconditions;

/**
 * This class adds Notifications to the status bar for the in-call experience.
 */
@@ -442,7 +442,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        Log.i(this, "Will show \"answer\" action in the incoming call Notification");

        PendingIntent answerVoicePendingIntent = createNotificationPendingIntent(
                mContext, InCallApp.ACTION_ANSWER_VOICE_INCOMING_CALL);
                mContext, ACTION_ANSWER_VOICE_INCOMING_CALL);
        builder.addAction(R.drawable.ic_call_white_24dp,
                mContext.getText(R.string.notification_action_answer),
                answerVoicePendingIntent);
@@ -452,7 +452,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        Log.i(this, "Will show \"dismiss\" action in the incoming call Notification");

        PendingIntent declinePendingIntent =
                createNotificationPendingIntent(mContext, InCallApp.ACTION_DECLINE_INCOMING_CALL);
                createNotificationPendingIntent(mContext, ACTION_DECLINE_INCOMING_CALL);
        builder.addAction(R.drawable.ic_close_dk,
                mContext.getText(R.string.notification_action_dismiss),
                declinePendingIntent);
@@ -462,7 +462,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        Log.i(this, "Will show \"hang-up\" action in the ongoing active call Notification");

        PendingIntent hangupPendingIntent =
                createNotificationPendingIntent(mContext, InCallApp.ACTION_HANG_UP_ONGOING_CALL);
                createNotificationPendingIntent(mContext, ACTION_HANG_UP_ONGOING_CALL);
        builder.addAction(R.drawable.ic_call_end_white_24dp,
                mContext.getText(R.string.notification_action_end_call),
                hangupPendingIntent);
@@ -472,7 +472,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        Log.i(this, "Will show \"video\" action in the incoming call Notification");

        PendingIntent answerVideoPendingIntent = createNotificationPendingIntent(
                mContext, InCallApp.ACTION_ANSWER_VIDEO_INCOMING_CALL);
                mContext, ACTION_ANSWER_VIDEO_INCOMING_CALL);
        builder.addAction(R.drawable.ic_videocam,
                mContext.getText(R.string.notification_action_answer_video),
                answerVideoPendingIntent);
@@ -482,7 +482,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        Log.i(this, "Will show \"voice\" action in the incoming call Notification");

        PendingIntent answerVoicePendingIntent = createNotificationPendingIntent(
                mContext, InCallApp.ACTION_ANSWER_VOICE_INCOMING_CALL);
                mContext, ACTION_ANSWER_VOICE_INCOMING_CALL);
        builder.addAction(R.drawable.ic_call_white_24dp,
                mContext.getText(R.string.notification_action_answer_voice),
                answerVoicePendingIntent);
@@ -492,7 +492,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        Log.i(this, "Will show \"accept\" action in the incoming call Notification");

        PendingIntent acceptVideoPendingIntent = createNotificationPendingIntent(
                mContext, InCallApp.ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST);
                mContext, ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST);
        builder.addAction(0, mContext.getText(R.string.notification_action_accept),
                acceptVideoPendingIntent);
    }
@@ -501,7 +501,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        Log.i(this, "Will show \"dismiss\" action in the incoming call Notification");

        PendingIntent declineVideoPendingIntent = createNotificationPendingIntent(
                mContext, InCallApp.ACTION_DECLINE_VIDEO_UPGRADE_REQUEST);
                mContext, ACTION_DECLINE_VIDEO_UPGRADE_REQUEST);
        builder.addAction(0, mContext.getText(R.string.notification_action_dismiss),
                declineVideoPendingIntent);
    }