Merge "Remove redundant wifi-display notification." into lmp-dev
diff --git a/core/res/res/drawable-hdpi/ic_notification_cast_on.png b/core/res/res/drawable-hdpi/ic_notification_cast_on.png
deleted file mode 100644
index 3eaf13a..0000000
--- a/core/res/res/drawable-hdpi/ic_notification_cast_on.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_notification_cast_on.png b/core/res/res/drawable-mdpi/ic_notification_cast_on.png
deleted file mode 100644
index 42de8c4..0000000
--- a/core/res/res/drawable-mdpi/ic_notification_cast_on.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_notification_cast_on.png b/core/res/res/drawable-xhdpi/ic_notification_cast_on.png
deleted file mode 100644
index 142065b..0000000
--- a/core/res/res/drawable-xhdpi/ic_notification_cast_on.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/ic_notification_cast_on.png b/core/res/res/drawable-xxhdpi/ic_notification_cast_on.png
deleted file mode 100644
index d562602..0000000
--- a/core/res/res/drawable-xxhdpi/ic_notification_cast_on.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable/ic_notification_cast_connecting.xml b/core/res/res/drawable/ic_notification_cast_connecting.xml
deleted file mode 100644
index a390bce..0000000
--- a/core/res/res/drawable/ic_notification_cast_connecting.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 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.
- */
--->
-<animation-list
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:oneshot="false">
- <item android:drawable="@drawable/ic_notification_cast_0" android:duration="500" />
- <item android:drawable="@drawable/ic_notification_cast_1" android:duration="500" />
- <item android:drawable="@drawable/ic_notification_cast_2" android:duration="500" />
- <item android:drawable="@drawable/ic_notification_cast_1" android:duration="500" />
-</animation-list>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 50da1fa..fd4b40f 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4409,17 +4409,6 @@
<!-- Title text to append when the display is secure. [CHAR LIMIT=30] -->
<string name="display_manager_overlay_display_secure_suffix">, secure</string>
- <!-- Title of the notification to indicate the process of connecting to a wifi display. [CHAR LIMIT=50] -->
- <string name="wifi_display_notification_connecting_title">Casting screen</string>
- <!-- Message of the notification to indicate the process of connecting to a wifi display. [CHAR LIMIT=80] -->
- <string name="wifi_display_notification_connecting_message">Connecting to <xliff:g id="name">%1$s</xliff:g></string>
- <!-- Title of the notification to indicate an active wifi display connection. [CHAR LIMIT=50] -->
- <string name="wifi_display_notification_connected_title">Casting screen</string>
- <!-- Message of the notification to indicate an active wifi display connection. [CHAR LIMIT=80] -->
- <string name="wifi_display_notification_connected_message">Connected to <xliff:g id="name">%1$s</xliff:g></string>
- <!-- Label of a button to disconnect an active wifi display connection. [CHAR LIMIT=25] -->
- <string name="wifi_display_notification_disconnect">Disconnect</string>
-
<!-- Keyguard strings -->
<!-- Label shown on emergency call button in keyguard -->
<string name="kg_emergency_call_label">Emergency call</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index c580d26..66afffb 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1185,8 +1185,6 @@
<java-symbol type="drawable" name="ic_media_route_off_holo_dark" />
<java-symbol type="drawable" name="ic_media_route_connecting_holo_dark" />
<java-symbol type="drawable" name="ic_media_route_disabled_holo_dark" />
- <java-symbol type="drawable" name="ic_notification_cast_connecting" />
- <java-symbol type="drawable" name="ic_notification_cast_on" />
<java-symbol type="drawable" name="cling_button" />
<java-symbol type="drawable" name="cling_arrow_up" />
<java-symbol type="drawable" name="cling_bg" />
@@ -1723,11 +1721,6 @@
<java-symbol type="string" name="vpn_lockdown_error" />
<java-symbol type="string" name="vpn_lockdown_config" />
<java-symbol type="string" name="wallpaper_binding_label" />
- <java-symbol type="string" name="wifi_display_notification_connecting_title" />
- <java-symbol type="string" name="wifi_display_notification_connecting_message" />
- <java-symbol type="string" name="wifi_display_notification_connected_title" />
- <java-symbol type="string" name="wifi_display_notification_connected_message" />
- <java-symbol type="string" name="wifi_display_notification_disconnect" />
<java-symbol type="style" name="Theme.Dialog.AppError" />
<java-symbol type="style" name="Theme.Micro.Dialog.Alert" />
<java-symbol type="style" name="Theme.Leanback.Dialog.Alert" />
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.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 @@
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 @@
private WifiDisplaySessionInfo mSessionInfo;
private boolean mPendingStatusChangeBroadcast;
- private boolean mPendingNotificationUpdate;
// Called with SyncRoot lock held.
public WifiDisplayAdapter(DisplayManagerService.SyncRoot syncRoot,
@@ -108,8 +96,6 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_CONNECTING;
mActiveDisplay = display;
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -618,7 +514,6 @@
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_NOT_CONNECTED;
mActiveDisplay = null;
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -636,7 +531,6 @@
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_CONNECTED;
mActiveDisplay = display;
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -659,7 +553,6 @@
mActiveDisplay = display;
renameDisplayDeviceLocked(display.getFriendlyDisplayName());
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -675,7 +568,6 @@
mActiveDisplayState = WifiDisplayStatus.DISPLAY_STATE_NOT_CONNECTED;
mActiveDisplay = null;
scheduleStatusChangedBroadcastLocked();
- scheduleUpdateNotificationLocked();
}
}
}
@@ -755,10 +647,6 @@
case MSG_SEND_STATUS_CHANGE_BROADCAST:
handleSendStatusChangeBroadcast();
break;
-
- case MSG_UPDATE_NOTIFICATION:
- handleUpdateNotification();
- break;
}
}
}