summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-05-19 16:35:48 -0700
committerYorke Lee <yorkelee@google.com>2015-05-19 16:40:43 -0700
commit0fa993bb132d2cbcda5000f7063120e5c2fc3253 (patch)
treeeb9e3a7b9b2aef6f93df80b90bd813a542e79eed
parent9b93ee28398fe8c160c377fd07e16da7948fef2e (diff)
Remove unused InCallApp
Move NotificationBroadcastReceiver into its own class. Change-Id: Ieefc840af7df596bfbb9297847ad164870e48970
-rw-r--r--InCallUI/src/com/android/incallui/InCallApp.java92
-rw-r--r--InCallUI/src/com/android/incallui/NotificationBroadcastReceiver.java74
-rw-r--r--InCallUI/src/com/android/incallui/StatusBarNotifier.java22
3 files changed, 85 insertions, 103 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallApp.java b/InCallUI/src/com/android/incallui/InCallApp.java
deleted file mode 100644
index d5b6fb922..000000000
--- a/InCallUI/src/com/android/incallui/InCallApp.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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.
- */
-public class InCallApp extends Application {
-
- /**
- * Intent Action used for hanging up the current call from Notification bar. This will
- * choose first ringing call, first active call, or first background call (typically in
- * STATE_HOLDING state).
- */
- public static final String ACTION_DECLINE_INCOMING_CALL =
- "com.android.incallui.ACTION_DECLINE_INCOMING_CALL";
- public static final String ACTION_HANG_UP_ONGOING_CALL =
- "com.android.incallui.ACTION_HANG_UP_ONGOING_CALL";
- public static final String ACTION_ANSWER_VIDEO_INCOMING_CALL =
- "com.android.incallui.ACTION_ANSWER_VIDEO_INCOMING_CALL";
- public static final String ACTION_ANSWER_VOICE_INCOMING_CALL =
- "com.android.incallui.ACTION_ANSWER_VOICE_INCOMING_CALL";
- public static final String ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST =
- "com.android.incallui.ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST";
- 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();
- Log.i(this, "Broadcast from Notification: " + action);
-
- // TODO: Commands of this nature should exist in the CallList.
- if (action.equals(ACTION_ANSWER_VIDEO_INCOMING_CALL)) {
- InCallPresenter.getInstance().answerIncomingCall(
- context, VideoProfile.STATE_BIDIRECTIONAL);
- } else if (action.equals(ACTION_ANSWER_VOICE_INCOMING_CALL)) {
- InCallPresenter.getInstance().answerIncomingCall(
- context, VideoProfile.STATE_AUDIO_ONLY);
- } else if (action.equals(ACTION_DECLINE_INCOMING_CALL)) {
- InCallPresenter.getInstance().declineIncomingCall(context);
- } else if (action.equals(ACTION_HANG_UP_ONGOING_CALL)) {
- InCallPresenter.getInstance().hangUpOngoingCall(context);
- } else if (action.equals(ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST)) {
- //TODO: Change calltype after adding support for TX and RX
- InCallPresenter.getInstance().acceptUpgradeRequest(
- VideoProfile.STATE_BIDIRECTIONAL, context);
- } else if (action.equals(ACTION_DECLINE_VIDEO_UPGRADE_REQUEST)) {
- InCallPresenter.getInstance().declineUpgradeRequest(context);
- }
- }
- }
-}
diff --git a/InCallUI/src/com/android/incallui/NotificationBroadcastReceiver.java b/InCallUI/src/com/android/incallui/NotificationBroadcastReceiver.java
new file mode 100644
index 000000000..2543b783d
--- /dev/null
+++ b/InCallUI/src/com/android/incallui/NotificationBroadcastReceiver.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.incallui;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.telecom.VideoProfile;
+
+/**
+ * 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 NotificationBroadcastReceiver extends BroadcastReceiver {
+
+ /**
+ * Intent Action used for hanging up the current call from Notification bar. This will
+ * choose first ringing call, first active call, or first background call (typically in
+ * STATE_HOLDING state).
+ */
+ public static final String ACTION_DECLINE_INCOMING_CALL =
+ "com.android.incallui.ACTION_DECLINE_INCOMING_CALL";
+ public static final String ACTION_HANG_UP_ONGOING_CALL =
+ "com.android.incallui.ACTION_HANG_UP_ONGOING_CALL";
+ public static final String ACTION_ANSWER_VIDEO_INCOMING_CALL =
+ "com.android.incallui.ACTION_ANSWER_VIDEO_INCOMING_CALL";
+ public static final String ACTION_ANSWER_VOICE_INCOMING_CALL =
+ "com.android.incallui.ACTION_ANSWER_VOICE_INCOMING_CALL";
+ public static final String ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST =
+ "com.android.incallui.ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST";
+ public static final String ACTION_DECLINE_VIDEO_UPGRADE_REQUEST =
+ "com.android.incallui.ACTION_DECLINE_VIDEO_UPGRADE_REQUEST";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final String action = intent.getAction();
+ Log.i(this, "Broadcast from Notification: " + action);
+
+ // TODO: Commands of this nature should exist in the CallList.
+ if (action.equals(ACTION_ANSWER_VIDEO_INCOMING_CALL)) {
+ InCallPresenter.getInstance().answerIncomingCall(
+ context, VideoProfile.STATE_BIDIRECTIONAL);
+ } else if (action.equals(ACTION_ANSWER_VOICE_INCOMING_CALL)) {
+ InCallPresenter.getInstance().answerIncomingCall(
+ context, VideoProfile.STATE_AUDIO_ONLY);
+ } else if (action.equals(ACTION_DECLINE_INCOMING_CALL)) {
+ InCallPresenter.getInstance().declineIncomingCall(context);
+ } else if (action.equals(ACTION_HANG_UP_ONGOING_CALL)) {
+ InCallPresenter.getInstance().hangUpOngoingCall(context);
+ } else if (action.equals(ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST)) {
+ //TODO: Change calltype after adding support for TX and RX
+ InCallPresenter.getInstance().acceptUpgradeRequest(
+ VideoProfile.STATE_BIDIRECTIONAL, context);
+ } else if (action.equals(ACTION_DECLINE_VIDEO_UPGRADE_REQUEST)) {
+ InCallPresenter.getInstance().declineUpgradeRequest(context);
+ }
+ }
+
+}
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index a54536ce6..195d5c631 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -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);
}