summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-09-23 15:51:11 -0400
committerJohn Spurlock <jspurlock@google.com>2014-09-23 15:51:11 -0400
commit03365ccc395f76c023bb63414eef1bd02aef90e7 (patch)
tree64ed2c76a404b3a4ad74e21192cefe4b49c3b938 /services
parent23e79fcef98618fc049af55673b43ea9e70ffa9b (diff)
downloadframeworks_base-03365ccc395f76c023bb63414eef1bd02aef90e7.zip
frameworks_base-03365ccc395f76c023bb63414eef1bd02aef90e7.tar.gz
frameworks_base-03365ccc395f76c023bb63414eef1bd02aef90e7.tar.bz2
Remove redundant wifi-display notification.
Since all devices now appear in quick settings, remove the framework notification and obsolete artifacts. Bug:17607193 Change-Id: If952b826d79c77068285373c6b44a430f78c20b1
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/display/WifiDisplayAdapter.java112
1 files changed, 0 insertions, 112 deletions
diff --git a/services/core/java/com/android/server/display/WifiDisplayAdapter.java b/services/core/java/com/android/server/display/WifiDisplayAdapter.java
index 9d008b9..a17d731 100644
--- a/services/core/java/com/android/server/display/WifiDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/WifiDisplayAdapter.java
@@ -16,18 +16,13 @@
package com.android.server.display;
-import com.android.internal.R;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.IndentingPrintWriter;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.res.Resources;
import android.hardware.display.DisplayManager;
import android.hardware.display.WifiDisplay;
import android.hardware.display.WifiDisplaySessionInfo;
@@ -38,7 +33,6 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.UserHandle;
-import android.provider.Settings;
import android.util.Slog;
import android.view.Display;
import android.view.Surface;
@@ -71,17 +65,12 @@ final class WifiDisplayAdapter extends DisplayAdapter {
private static final boolean DEBUG = false;
private static final int MSG_SEND_STATUS_CHANGE_BROADCAST = 1;
- private static final int MSG_UPDATE_NOTIFICATION = 2;
private static final String ACTION_DISCONNECT = "android.server.display.wfd.DISCONNECT";
private final WifiDisplayHandler mHandler;
private final PersistentDataStore mPersistentDataStore;
private final boolean mSupportsProtectedBuffers;
- private final NotificationManager mNotificationManager;
-
- private PendingIntent mSettingsPendingIntent;
- private PendingIntent mDisconnectPendingIntent;
private WifiDisplayController mDisplayController;
private WifiDisplayDevice mDisplayDevice;
@@ -97,7 +86,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
private WifiDisplaySessionInfo mSessionInfo;
private boolean mPendingStatusChangeBroadcast;
- private boolean mPendingNotificationUpdate;
// Called with SyncRoot lock held.
public WifiDisplayAdapter(DisplayManagerService.SyncRoot syncRoot,
@@ -108,8 +96,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
mPersistentDataStore = persistentDataStore;
mSupportsProtectedBuffers = context.getResources().getBoolean(
com.android.internal.R.bool.config_wifiDisplaySupportsProtectedBuffers);
- mNotificationManager = (NotificationManager)context.getSystemService(
- Context.NOTIFICATION_SERVICE);
}
@Override
@@ -125,7 +111,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
pw.println("mAvailableDisplays=" + Arrays.toString(mAvailableDisplays));
pw.println("mRememberedDisplays=" + Arrays.toString(mRememberedDisplays));
pw.println("mPendingStatusChangeBroadcast=" + mPendingStatusChangeBroadcast);
- pw.println("mPendingNotificationUpdate=" + mPendingNotificationUpdate);
pw.println("mSupportsProtectedBuffers=" + mSupportsProtectedBuffers);
// Try to dump the controller state.
@@ -421,13 +406,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
}
}
- private void scheduleUpdateNotificationLocked() {
- if (!mPendingNotificationUpdate) {
- mPendingNotificationUpdate = true;
- mHandler.sendEmptyMessage(MSG_UPDATE_NOTIFICATION);
- }
- }
-
// Runs on the handler.
private void handleSendStatusChangeBroadcast() {
final Intent intent;
@@ -447,87 +425,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
getContext().sendBroadcastAsUser(intent, UserHandle.ALL);
}
- // Runs on the handler.
- private void handleUpdateNotification() {
- final int state;
- final WifiDisplay display;
- synchronized (getSyncRoot()) {
- if (!mPendingNotificationUpdate) {
- return;
- }
-
- mPendingNotificationUpdate = false;
- state = mActiveDisplayState;
- display = mActiveDisplay;
- }
-
- // Cancel the old notification if there is one.
- mNotificationManager.cancelAsUser(null,
- R.string.wifi_display_notification_disconnect, UserHandle.ALL);
-
- if (state == WifiDisplayStatus.DISPLAY_STATE_CONNECTING
- || state == WifiDisplayStatus.DISPLAY_STATE_CONNECTED) {
- Context context = getContext();
-
- // Initialize pending intents for the notification outside of the lock because
- // creating a pending intent requires a call into the activity manager.
- if (mSettingsPendingIntent == null) {
- Intent settingsIntent = new Intent(Settings.ACTION_WIFI_DISPLAY_SETTINGS);
- settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
- | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- mSettingsPendingIntent = PendingIntent.getActivityAsUser(
- context, 0, settingsIntent, 0, null, UserHandle.CURRENT);
- }
-
- if (mDisconnectPendingIntent == null) {
- Intent disconnectIntent = new Intent(ACTION_DISCONNECT);
- mDisconnectPendingIntent = PendingIntent.getBroadcastAsUser(
- context, 0, disconnectIntent, 0, UserHandle.CURRENT);
- }
-
- // Post the notification.
- Resources r = context.getResources();
- Notification notification;
- if (state == WifiDisplayStatus.DISPLAY_STATE_CONNECTING) {
- notification = new Notification.Builder(context)
- .setContentTitle(r.getString(
- R.string.wifi_display_notification_connecting_title))
- .setContentText(r.getString(
- R.string.wifi_display_notification_connecting_message,
- display.getFriendlyDisplayName()))
- .setContentIntent(mSettingsPendingIntent)
- .setSmallIcon(R.drawable.ic_notification_cast_connecting)
- .setOngoing(true)
- .addAction(android.R.drawable.ic_menu_close_clear_cancel,
- r.getString(R.string.wifi_display_notification_disconnect),
- mDisconnectPendingIntent)
- .setColor(r.getColor(
- com.android.internal.R.color.system_notification_accent_color))
- .build();
- } else {
- notification = new Notification.Builder(context)
- .setContentTitle(r.getString(
- R.string.wifi_display_notification_connected_title))
- .setContentText(r.getString(
- R.string.wifi_display_notification_connected_message,
- display.getFriendlyDisplayName()))
- .setContentIntent(mSettingsPendingIntent)
- .setSmallIcon(R.drawable.ic_notification_cast_on)
- .setOngoing(true)
- .addAction(android.R.drawable.ic_menu_close_clear_cancel,
- r.getString(R.string.wifi_display_notification_disconnect),
- mDisconnectPendingIntent)
- .setColor(r.getColor(
- com.android.internal.R.color.system_notification_accent_color))
- .build();
- }
- mNotificationManager.notifyAsUser(null,
- R.string.wifi_display_notification_disconnect,
- notification, UserHandle.ALL);
- }
- }
-
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -605,7 +502,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_CONNECTING;
mActiveDisplay = display;
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -618,7 +514,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_NOT_CONNECTED;
mActiveDisplay = null;
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -636,7 +531,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_CONNECTED;
mActiveDisplay = display;
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -659,7 +553,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
mActiveDisplay = display;
renameDisplayDeviceLocked(display.getFriendlyDisplayName());
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -675,7 +568,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_NOT_CONNECTED;
mActiveDisplay = null;
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -755,10 +647,6 @@ final class WifiDisplayAdapter extends DisplayAdapter {
case MSG_SEND_STATUS_CHANGE_BROADCAST:
handleSendStatusChangeBroadcast();
break;
-
- case MSG_UPDATE_NOTIFICATION:
- handleUpdateNotification();
- break;
}
}
}