diff options
author | John Spurlock <jspurlock@google.com> | 2014-08-27 09:36:02 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2014-08-27 09:36:02 -0400 |
commit | 96fe98d0c0bf9a3126da0e14d05463220ac276ab (patch) | |
tree | 5e85dd340238ea694dae0b58f6c9d74e7c283b44 /packages | |
parent | 64d04347a8955eaaa1b3047fe0ba5d7ab54e8a3b (diff) | |
download | frameworks_base-96fe98d0c0bf9a3126da0e14d05463220ac276ab.zip frameworks_base-96fe98d0c0bf9a3126da0e14d05463220ac276ab.tar.gz frameworks_base-96fe98d0c0bf9a3126da0e14d05463220ac276ab.tar.bz2 |
StatusBar: Add new icon slot for cast status.
Bug:17275998
Change-Id: I7e80b3d76480fc2fdcb3aa5d445d895829d341d0
Diffstat (limited to 'packages')
13 files changed, 69 insertions, 2 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_cast_available.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_cast_available.png Binary files differdeleted file mode 100644 index f256fbb..0000000 --- a/packages/SystemUI/res/drawable-hdpi/ic_qs_cast_available.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_cast_connected.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_cast_connected.png Binary files differdeleted file mode 100644 index b946ec9..0000000 --- a/packages/SystemUI/res/drawable-hdpi/ic_qs_cast_connected.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_cast_available.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_cast_available.png Binary files differdeleted file mode 100644 index b1e984c..0000000 --- a/packages/SystemUI/res/drawable-mdpi/ic_qs_cast_available.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_cast_connected.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_cast_connected.png Binary files differdeleted file mode 100644 index ceda1bb..0000000 --- a/packages/SystemUI/res/drawable-mdpi/ic_qs_cast_connected.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_available.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_available.png Binary files differdeleted file mode 100644 index 47be502..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_available.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_connected.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_connected.png Binary files differdeleted file mode 100644 index 4b12809..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_cast_connected.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_cast_available.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_cast_available.png Binary files differdeleted file mode 100644 index 8e225af..0000000 --- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_cast_available.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_cast_connected.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_cast_connected.png Binary files differdeleted file mode 100644 index 937202b..0000000 --- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_cast_connected.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable/stat_sys_cast.xml b/packages/SystemUI/res/drawable/stat_sys_cast.xml new file mode 100644 index 0000000..c9e65e0 --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_cast.xml @@ -0,0 +1,25 @@ +<!-- +Copyright (C) 2014 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="18dp" + android:height="18dp" + android:viewportWidth="48.0" + android:viewportHeight="48.0"> + + <path + android:fillColor="#FFFFFFFF" + android:pathData="M2.0,36.0l0.0,6.0l6.0,0.0C8.0,38.7 5.3,36.0 2.0,36.0zM2.0,28.0l0.0,4.0c5.5,0.0 10.0,4.5 10.0,10.0l4.0,0.0C16.0,34.3 9.7,28.0 2.0,28.0zM38.0,14.0L10.0,14.0l0.0,3.3c7.9,2.6 14.2,8.8 16.7,16.7L38.0,34.0L38.0,14.0zM2.0,20.0l0.0,4.0c9.9,0.0 18.0,8.1 18.0,18.0l4.0,0.0C24.0,29.8 14.1,20.0 2.0,20.0zM42.0,6.0L6.0,6.0c-2.2,0.0 -4.0,1.8 -4.0,4.0l0.0,6.0l4.0,0.0l0.0,-6.0l36.0,0.0l0.0,28.0L28.0,38.0l0.0,4.0l14.0,0.0c2.2,0.0 4.0,-1.8 4.0,-4.0L46.0,10.0C46.0,7.8 44.2,6.0 42.0,6.0z"/> +</vector> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 120af1d..0fe389a 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -392,6 +392,9 @@ <!-- Content description of the ringer silent icon in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_ringer_silent">Ringer silent.</string> + <!-- Content description of the cast icon in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> + <string name="accessibility_casting">@string/quick_settings_casting</string> + <!-- Content description to tell the user that this button will remove an application from recents --> <string name="accessibility_recents_item_will_be_dismissed">Dismiss <xliff:g id="app" example="Calendar">%s</xliff:g>.</string> <!-- Content description to tell the user an application has been removed from recents --> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java index 936479b..c5d06b9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java @@ -120,6 +120,11 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode { : 0; updateSlot("speakerphone", null, iconId); } + String cast = args.getString("cast"); + if (cast != null) { + int iconId = cast.equals("cast") ? R.drawable.stat_sys_cast : 0; + updateSlot("cast", null, iconId); + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 95232d4..f662b3d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -562,7 +562,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, addNavigationBar(); // Lastly, call to the icon policy to install/update all the icons. - mIconPolicy = new PhoneStatusBarPolicy(mContext); + mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController); mSettingsObserver.onChange(false); // set up mHeadsUpObserver.onChange(true); // set up diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index bd52cd3..237b782 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -33,6 +33,8 @@ import android.util.Log; import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.systemui.R; +import com.android.systemui.statusbar.policy.CastController; +import com.android.systemui.statusbar.policy.CastController.CastDevice; /** * This class contains all of the policy about which icons are installed in the status @@ -46,6 +48,7 @@ public class PhoneStatusBarPolicy { private static final boolean SHOW_SYNC_ICON = false; private static final String SLOT_SYNC_ACTIVE = "sync_active"; + private static final String SLOT_CAST = "cast"; private static final String SLOT_BLUETOOTH = "bluetooth"; private static final String SLOT_TTY = "tty"; private static final String SLOT_ZEN = "zen"; @@ -56,6 +59,7 @@ public class PhoneStatusBarPolicy { private final Context mContext; private final StatusBarManager mService; private final Handler mHandler = new Handler(); + private final CastController mCast; // Assume it's all good unless we hear otherwise. We don't always seem // to get broadcasts that it *is* there. @@ -98,8 +102,9 @@ public class PhoneStatusBarPolicy { } }; - public PhoneStatusBarPolicy(Context context) { + public PhoneStatusBarPolicy(Context context, CastController cast) { mContext = context; + mCast = cast; mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE); // listen for broadcasts @@ -151,6 +156,11 @@ public class PhoneStatusBarPolicy { mService.setIcon(SLOT_VOLUME, R.drawable.stat_sys_ringer_vibrate, 0, null); mService.setIconVisibility(SLOT_VOLUME, false); updateVolumeZen(); + + // cast + mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0, null); + mService.setIconVisibility(SLOT_CAST, false); + mCast.addCallback(mCastCallback); } public void setZenMode(int zen) { @@ -287,4 +297,28 @@ public class PhoneStatusBarPolicy { mService.setIconVisibility(SLOT_TTY, false); } } + + private void updateCast() { + boolean isCasting = false; + for (CastDevice device : mCast.getCastDevices()) { + if (device.state == CastDevice.STATE_CONNECTING + || device.state == CastDevice.STATE_CONNECTED) { + isCasting = true; + break; + } + } + if (DEBUG) Log.v(TAG, "updateCast: isCasting: " + isCasting); + if (isCasting) { + mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0, + mContext.getString(R.string.accessibility_casting)); + } + mService.setIconVisibility(SLOT_CAST, isCasting); + } + + private final CastController.Callback mCastCallback = new CastController.Callback() { + @Override + public void onCastDevicesChanged() { + updateCast(); + } + }; } |