From 03365ccc395f76c023bb63414eef1bd02aef90e7 Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Tue, 23 Sep 2014 15:51:11 -0400 Subject: [PATCH] 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 --- .../drawable-hdpi/ic_notification_cast_on.png | Bin 470 -> 0 bytes .../drawable-mdpi/ic_notification_cast_on.png | Bin 342 -> 0 bytes .../ic_notification_cast_on.png | Bin 596 -> 0 bytes .../ic_notification_cast_on.png | Bin 934 -> 0 bytes .../ic_notification_cast_connecting.xml | 26 ---- core/res/res/values/strings.xml | 11 -- core/res/res/values/symbols.xml | 7 -- .../server/display/WifiDisplayAdapter.java | 112 ------------------ 8 files changed, 156 deletions(-) delete mode 100644 core/res/res/drawable-hdpi/ic_notification_cast_on.png delete mode 100644 core/res/res/drawable-mdpi/ic_notification_cast_on.png delete mode 100644 core/res/res/drawable-xhdpi/ic_notification_cast_on.png delete mode 100644 core/res/res/drawable-xxhdpi/ic_notification_cast_on.png delete mode 100644 core/res/res/drawable/ic_notification_cast_connecting.xml 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 3eaf13a8520c454571aafde802b5c94f2d034a7e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 470 zcmV;{0V)28P)h2(Mrf^tyH!iNLbw#<_xC-r(*Z0+T>TBAh%)EBD_o+`a z^L?I~`S#8;&oqHCCRI-ncthS$vm5$PcR@oL3LF|S4QZ@Fr6WZ{V5%NI z9XU{`kuQLSgyvGs6-rq{;2qq8eJ}@d)Gg!S+Qc8>^}iiQ#W3!{GDtJu1_~|>ZGm&} z8ae3(jIzc)-W^wlLfXL+xRb&vSQJx7E)30pE-A`_P4o)GlOTR+BPh<56D! zJ<R M07*qoM6N<$f&d%LB>(^b 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 42de8c4d5c10a9765a36a12dd9bd15c6bfd61749..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 342 zcmV-c0jd6pP) ztqm{BXLwxS9}uwgUL1z{=nihFF089x1vnj-`rX%b>2*LDY3Vm^2TagMNDe-Rfh!5- z#|~?KuLVj_sNt;bm0|6#0j3n%*vp~~38}jg&_x+O#4(cxsuD7E8gQ*Cq6lJ+6LJV+ z=OiGBo{VON2ogA8BD*kbcnT=WwIU&7x$nq>d1STydKghh`o3k+jPxx8uyqn(R>87p o6Mh^qvN@s~_5bO=tBU{w03js3-|S_*h5!Hn07*qoM6N<$g2S4N?f?J) 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 142065b4f5756b28a8f4690903420dd1f04e8e18..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~OrP)n`eII?#|wwVVY*Z&lU{$+_V5KKnu_UytNR!_RFDQ=q04;5|U1nB4+9; zGXYsp@{<6=;j2U&C@6Lgn16X1EwJl7)n_0FiXabmz=>pR z45UFsr5Oka0p@qhg9*@V`E44&n(3a=|CaVU39#)R%z;{#Y#h9)Bw!cZ{*dS#^s2N8l8HM$ZH=>IhQWs_0w_T+1d5WRE1-gmol!x6SPl`1kZQ0bxy#FJ z=5nfR;zKYd*|dY;i6xmN{uXejQWYwJ7)#L4HmzuP5`Rj?GMWJ)5-`I22gEOa&%6@Q z1?It}B*_Nbw5!ZN>QD&&n_pF-Fqi@_EFewBG=Xd4y8xA{2(amvY|1F{Cz&tqwSaw) zV24y6cqKu{WWCpb8{*p}aRY8XVsLfqtb{JGzy$GSNdF_KviijX;Ja4>gk{NqMs}yS zi7(3HdWi4HO97^}3~b*btNnFWe?2>)lP*=GFF3uCrAT{=w8NmoYCnK0;%imuomhWX i(E_vpEx;Z76kq@yY1gKT_~v8)0000uMh{Ag+!RK&Xpu=uP*PB6P+=&N zR2b&;zijM34v)K_W;5 zNr)g3^zS3j(4OWEnj;k?LresTptw)cp_5la!j%e=Atr*XnS+wBm~^CqWQd6%5hQ{{ zkO-0xK_W;5O{bs+&<+M=FUH47-_J|HuCxkrvUtNR37b_nEGL^eNLATbnkuLjya%s9 zFL)E7e=#@>YLi+)enB*O2s{8C;2szc_~OmrB3P6rLH-y4SHW5E){rv~T#osKK4pTu z_yw+mX3%f=@T1@q$W5alFMfg+E$Rnzd^@-XW+h3GnnNnU3O!t+#5+&}o-@Zb>bYxn zQUrOShDH_GqOVRXBUF=Gd7oj9RfA4YV5^`UB`AbdpdC!O!Ep}cGW~18q#KW*=N6h1 zMUY21xEpc;H$gtr_jnQn&4?&!Cm0Gii8kPnKB}_r+b&2Ap?+`y>@ZYC zpJFgs|S7usmd8xEI_Y?dr~B z5132ZhxM`181BvfdZD-hJPPX-(f?3(;uw2{wG;26jgQA>0!mi2q)#r0CRjkXd@*#363$jg?d=p7d~5?K%T*LDfnP8evrw3%H(x3dAHp7 zMc`Fz5bS3z&5BC!o%z7eU?$0}F?=~)CLD>oAUecK!6ncIipa4(P|pj z+->Cdhc*o{8m~bSv+3+*a$hnP*UIE|GI<|usvv(<=o|G8xhLJs{` z_1RiMUepn*Y9jx{66MKiBY6Tl0d5=aLHlFCuzD`H=_(&ZklH4! zBW;hFJZ^i!J)K>gmX{Y&5%L0+2ogaeNCb%>5hQ}r8ovb?0D($|dh3*lcmMzZ07*qo IM6N<$g3_*${{R30 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 a390bce58943e..0000000000000 --- a/core/res/res/drawable/ic_notification_cast_connecting.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 50da1fa9a15ca..fd4b40ff2b19a 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -4409,17 +4409,6 @@ , secure - - Casting screen - - Connecting to %1$s - - Casting screen - - Connected to %1$s - - Disconnect - Emergency call diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index c580d268463de..66afffb29a32d 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1185,8 +1185,6 @@ - - @@ -1723,11 +1721,6 @@ - - - - - diff --git a/services/core/java/com/android/server/display/WifiDisplayAdapter.java b/services/core/java/com/android/server/display/WifiDisplayAdapter.java index 9d008b9199461..a17d7319e20f4 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; } } }