diff options
author | 2018-06-20 12:59:50 +0000 | |
---|---|---|
committer | 2018-06-20 12:59:50 +0000 | |
commit | fd3618a971cfd690dbeddfb502fce076566ff498 (patch) | |
tree | 4ee22b01ee071e5768306d8d9e71d90ff0cdfdeb | |
parent | 25047140a236f2f5e7b799379d211aa5fe1183fe (diff) | |
parent | 2ad4753fb699726d81ef4a8cde8b9149c64df193 (diff) |
Merge changes I9f324a94,Ic3521f36
* changes:
Remove managed profile toast
Log notification interruptions to TRON
5 files changed, 33 insertions, 34 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index eed1df0ffbee..8b631b095901 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -763,9 +763,6 @@ <dimen name="volume_expander_margin_end">2dp</dimen> <dimen name="volume_expander_margin_top">6dp</dimen> - <!-- Padding between icon and text for managed profile toast --> - <dimen name="managed_profile_toast_padding">4dp</dimen> - <!-- Thickness of the assist disclosure beams --> <dimen name="assist_disclosure_thickness">2.5dp</dimen> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 84a76bcadf47..915fc6e37770 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1326,9 +1326,6 @@ <!-- Hide quick settings tile confirmation button --> <string name="quick_settings_reset_confirmation_button">Hide</string> - <!-- Toast shown when user unlocks screen and managed profile activity is in the foreground --> - <string name="managed_profile_foreground_toast">You\'re using your work profile</string> - <!-- volume stream names. All nouns. --> <string name="stream_voice_call">Call</string> <!-- STREAM_VOICE_CALL --> <string name="stream_system">System</string> <!-- STREAM_SYSTEM --> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java index 7e397e8bdd35..2f62d595d19e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java @@ -109,16 +109,6 @@ public class NotificationLockscreenUserManager implements Dumpable { } else if (Intent.ACTION_USER_UNLOCKED.equals(action)) { // Start the overview connection to the launcher service Dependency.get(OverviewProxyService.class).startConnectionToCurrentUser(); - } else if (Intent.ACTION_USER_PRESENT.equals(action)) { - try { - final int lastResumedActivityUserId = - ActivityTaskManager.getService().getLastResumedActivityUserId(); - if (mUserManager.isManagedProfile(lastResumedActivityUserId)) { - showForegroundManagedProfileActivityToast(); - } - } catch (RemoteException e) { - // Abandon hope activity manager not running. - } } else if (NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION.equals(action)) { final IntentSender intentSender = intent.getParcelableExtra(Intent.EXTRA_INTENT); final String notificationKey = intent.getStringExtra(Intent.EXTRA_INDEX); @@ -225,7 +215,6 @@ public class NotificationLockscreenUserManager implements Dumpable { IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_SWITCHED); filter.addAction(Intent.ACTION_USER_ADDED); - filter.addAction(Intent.ACTION_USER_PRESENT); filter.addAction(Intent.ACTION_USER_UNLOCKED); mContext.registerReceiver(mBaseBroadcastReceiver, filter); @@ -238,19 +227,6 @@ public class NotificationLockscreenUserManager implements Dumpable { mSettingsObserver.onChange(false); // set up } - private void showForegroundManagedProfileActivityToast() { - Toast toast = Toast.makeText(mContext, - R.string.managed_profile_foreground_toast, - Toast.LENGTH_SHORT); - TextView text = toast.getView().findViewById(android.R.id.message); - text.setCompoundDrawablesRelativeWithIntrinsicBounds( - R.drawable.stat_sys_managed_profile_status, 0, 0, 0); - int paddingPx = mContext.getResources().getDimensionPixelSize( - R.dimen.managed_profile_toast_padding); - text.setCompoundDrawablePadding(paddingPx); - toast.show(); - } - public boolean shouldShowLockscreenNotifications() { return mShowLockscreenNotifications; } diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index d2990de96a6a..a80ea0238ea8 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -6118,8 +6118,13 @@ message MetricsEvent { // ---- End P Constants, all P constants go above this line ---- - // First Q constant in master goes here: - // Please delete these lines and use 1500 for your first enum. + // Time since this notification last interrupted (visibly or audible) the user + NOTIFICATION_SINCE_INTERRUPTION_MILLIS = 1500; + + // OPEN: Notification interrupted the user, either audibly or visually. + // Tagged data: NOTIFICATION_SINCE_INTERRUPTION_MILLIS + // CATEGORY: NOTIFICATION + NOTIFICATION_INTERRUPTION = 1501; // ---- End Q Constants, all Q constants go above this line ---- diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java index 39d0bf58c3b1..75b9f1311b75 100644 --- a/services/core/java/com/android/server/notification/NotificationRecord.java +++ b/services/core/java/com/android/server/notification/NotificationRecord.java @@ -128,6 +128,11 @@ public final class NotificationRecord { // The most recent update time, or the creation time if no updates. private long mUpdateTimeMs; + // The most recent interruption time, or the creation time if no updates. Differs from the + // above value because updates are filtered based on whether they actually interrupted the + // user + private long mInterruptionTimeMs; + // Is this record an update of an old record? public boolean isUpdate; private int mPackagePriority; @@ -180,6 +185,7 @@ public final class NotificationRecord { mRankingTimeMs = calculateRankingTimeMs(0L); mCreationTimeMs = sbn.getPostTime(); mUpdateTimeMs = mCreationTimeMs; + mInterruptionTimeMs = mCreationTimeMs; mContext = context; stats = new NotificationUsageStats.SingleNotificationStats(); mChannel = channel; @@ -525,6 +531,7 @@ public final class NotificationRecord { pw.println(prefix + "mCreationTimeMs=" + mCreationTimeMs); pw.println(prefix + "mVisibleSinceMs=" + mVisibleSinceMs); pw.println(prefix + "mUpdateTimeMs=" + mUpdateTimeMs); + pw.println(prefix + "mInterruptionTimeMs=" + mInterruptionTimeMs); pw.println(prefix + "mSuppressedVisualEffects= " + mSuppressedVisualEffects); if (mPreChannelsNotification) { pw.println(prefix + String.format("defaults=0x%08x flags=0x%08x", @@ -786,6 +793,10 @@ public final class NotificationRecord { return mVisibleSinceMs == 0 ? 0 : (int) (now - mVisibleSinceMs); } + public int getInterruptionMs(long now) { + return (int) (now - mInterruptionTimeMs); + } + /** * Set the visibility of the notification. */ @@ -844,7 +855,7 @@ public final class NotificationRecord { public void setSeen() { mStats.setSeen(); if (mTextChanged) { - mIsInterruptive = true; + setInterruptive(true); } } @@ -940,6 +951,17 @@ public final class NotificationRecord { public void setInterruptive(boolean interruptive) { mIsInterruptive = interruptive; + final long now = System.currentTimeMillis(); + mInterruptionTimeMs = interruptive ? now : mInterruptionTimeMs; + + if (interruptive) { + MetricsLogger.action(getLogMaker() + .setCategory(MetricsEvent.NOTIFICATION_INTERRUPTION) + .setType(MetricsEvent.TYPE_OPEN) + .addTaggedData(MetricsEvent.NOTIFICATION_SINCE_INTERRUPTION_MILLIS, + getInterruptionMs(now))); + MetricsLogger.histogram(mContext, "note_interruptive", getInterruptionMs(now)); + } } public void setTextChanged(boolean textChanged) { @@ -1116,7 +1138,9 @@ public final class NotificationRecord { sbn.getNotification().isGroupSummary() ? 1 : 0) .addTaggedData(MetricsEvent.NOTIFICATION_SINCE_CREATE_MILLIS, getLifespanMs(now)) .addTaggedData(MetricsEvent.NOTIFICATION_SINCE_UPDATE_MILLIS, getFreshnessMs(now)) - .addTaggedData(MetricsEvent.NOTIFICATION_SINCE_VISIBLE_MILLIS, getExposureMs(now)); + .addTaggedData(MetricsEvent.NOTIFICATION_SINCE_VISIBLE_MILLIS, getExposureMs(now)) + .addTaggedData(MetricsEvent.NOTIFICATION_SINCE_INTERRUPTION_MILLIS, + getInterruptionMs(now)); } public LogMaker getLogMaker() { |