diff options
author | Adnan Begovic <adnan@cyngn.com> | 2015-12-10 14:54:10 -0800 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-12-10 18:23:12 -0800 |
commit | a037ad401e4a78ce22a9ec2dada8ff3593aa8fa4 (patch) | |
tree | 492f1c38a048480aba40ecffe1707ca82bf5d0d3 /services | |
parent | de980ffe5316bbcbb5871bea44209a45e9b5c0f9 (diff) | |
download | frameworks_base-a037ad401e4a78ce22a9ec2dada8ff3593aa8fa4.zip frameworks_base-a037ad401e4a78ce22a9ec2dada8ff3593aa8fa4.tar.gz frameworks_base-a037ad401e4a78ce22a9ec2dada8ff3593aa8fa4.tar.bz2 |
SystemUi: Handle custom and dynamic tiles the same way.
Change-Id: I885a75444f88a8a0e521af55b413770681c55df6
Diffstat (limited to 'services')
3 files changed, 10 insertions, 30 deletions
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java index cf1340b..1433490 100644 --- a/services/core/java/com/android/server/AlarmManagerService.java +++ b/services/core/java/com/android/server/AlarmManagerService.java @@ -1080,7 +1080,7 @@ class AlarmManagerService extends SystemService { if (a.alarmClock != null) { mNextAlarmClockMayChange = true; //Publish as system user - publishNextAlarmCustomTile(Process.SYSTEM_UID); + publishNextAlarmCustomTile(UserHandle.myUserId()); } boolean needRebatch = false; @@ -2691,11 +2691,6 @@ class AlarmManagerService extends SystemService { long token = Binder.clearCallingIdentity(); try { final UserHandle user = new UserHandle(userId); - if (!QSUtils.isQSTileEnabledForUser( - getContext(), QSConstants.DYNAMIC_TILE_NEXT_ALARM, user.getUserId(userId))) { - return; - } - final int icon = QSUtils.getDynamicQSTileResIconId(getContext(), userId, QSConstants.DYNAMIC_TILE_NEXT_ALARM); final String contentDesc = QSUtils.getDynamicQSTileLabel(getContext(), userId, @@ -2714,13 +2709,18 @@ class AlarmManagerService extends SystemService { final String pkg = alarm.operation.getCreatorPackage(); CustomTile.ExpandedListItem item = new CustomTile.ExpandedListItem(); item.setExpandedListItemDrawable(icon); - item.setExpandedListItemTitle(formatNextAlarm(getContext(), alarm.alarmClock, userId)); + item.setExpandedListItemTitle(formatNextAlarm(getContext(), alarm.alarmClock, + userId)); item.setExpandedListItemSummary(getAlarmApkLabel(pkg)); item.setExpandedListItemOnClickIntent(getCustomTilePendingIntent(user, pkg)); items.add(item); } style.setListItems(items); + // Don't bother posting a tile if no "next alarms" are available. + if (nextAlarm == null) { + return; + } // Build the custom tile CMStatusBarManager statusBarManager = CMStatusBarManager.getInstance(getContext()); CustomTile tile = new CustomTile.Builder(resourceContext) @@ -2790,13 +2790,7 @@ class AlarmManagerService extends SystemService { int count = mNextAlarmClockForUser.size(); for (int i = 0; i < count; i++) { int userId = mNextAlarmClockForUser.keyAt(i); - boolean enabled = QSUtils.isQSTileEnabledForUser( - getContext(), QSConstants.DYNAMIC_TILE_NEXT_ALARM, userId); - if (enabled) { - publishNextAlarmCustomTile(userId); - } else { - unpublishNextAlarmCustomTile(userId); - } + publishNextAlarmCustomTile(userId); } } } diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index e36d118..4f9f972 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -3582,11 +3582,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final int userId = UserHandle.myUserId(); long token = Binder.clearCallingIdentity(); try { - if (!QSUtils.isQSTileEnabledForUser( - mContext, QSConstants.DYNAMIC_TILE_IME_SELECTOR, userId)) { - return; - } - final UserHandle user = new UserHandle(userId); final int icon = QSUtils.getDynamicQSTileResIconId(mContext, userId, QSConstants.DYNAMIC_TILE_IME_SELECTOR); @@ -3639,9 +3634,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } final boolean hasInputMethod = isIMEVisible && imi != null && mCurrentSubtype != null; - final boolean isEnabledForUser = QSUtils.isQSTileEnabledForUser(mContext, - QSConstants.DYNAMIC_TILE_NEXT_ALARM, userId); - boolean enabled = isEnabledForUser && hasInputMethod; + boolean enabled = hasInputMethod; if (enabled) { publishImeSelectorCustomTile(imi); } else { diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 19e39e7..7eab808 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -923,11 +923,6 @@ public class UsbDeviceManager { final int userId = UserHandle.myUserId(); long token = Binder.clearCallingIdentity(); try { - if (!QSUtils.isQSTileEnabledForUser( - mContext, QSConstants.DYNAMIC_TILE_ADB, userId)) { - return; - } - final UserHandle user = new UserHandle(userId); final int icon = QSUtils.getDynamicQSTileResIconId(mContext, userId, QSConstants.DYNAMIC_TILE_ADB); @@ -997,9 +992,7 @@ public class UsbDeviceManager { || CMSettings.Secure.getInt(mContext.getContentResolver(), CMSettings.Secure.ADB_NOTIFY, 1) == 1; boolean isActive = notifEnabled && (usbAdbActive || netAdbActive); - final boolean isEnabledForUser = QSUtils.isQSTileEnabledForUser(mContext, - QSConstants.DYNAMIC_TILE_ADB, userId); - boolean enabled = (userId == UserHandle.USER_OWNER) && isEnabledForUser && isActive; + boolean enabled = (userId == UserHandle.USER_OWNER) && isActive; if (enabled) { publishAdbCustomTile(); } else { |