Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd3618a9 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge changes I9f324a94,Ic3521f36

* changes:
  Remove managed profile toast
  Log notification interruptions to TRON
parents 25047140 2ad4753f
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -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>

+0 −3
Original line number Diff line number Diff line
@@ -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 -->
+0 −24
Original line number Diff line number Diff line
@@ -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;
    }
+7 −2
Original line number Diff line number Diff line
@@ -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 ----

+26 −2
Original line number Diff line number Diff line
@@ -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() {