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

Commit 8650c7c0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Removing contents hidden string for public notifications" into oc-dr1-dev

parents 51e35963 499c20f2
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -4551,11 +4551,16 @@ public class Notification implements Parcelable
                    savedBundle.getBoolean(EXTRA_SHOW_CHRONOMETER));
            publicExtras.putBoolean(EXTRA_CHRONOMETER_COUNT_DOWN,
                    savedBundle.getBoolean(EXTRA_CHRONOMETER_COUNT_DOWN));
            mN.extras = publicExtras;
            RemoteViews view;
            if (ambient) {
                publicExtras.putCharSequence(EXTRA_TITLE,
                        mContext.getString(com.android.internal.R.string.notification_hidden_text));
            mN.extras = publicExtras;
            final RemoteViews view = ambient ? makeAmbientNotification()
                    : applyStandardTemplate(getBaseLayoutResource());
                view = makeAmbientNotification();
            } else{
                view = makeNotificationHeader(false /* ambient */);
                view.setBoolean(R.id.notification_header, "setExpandOnlyOnButton", true);
            }
            mN.extras = savedBundle;
            mN.mLargeIcon = largeIcon;
            mN.largeIcon = largeIconLegacy;
+16 −2
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ public class NotificationHeaderView extends ViewGroup {
    private Drawable mBackground;
    private int mHeaderBackgroundHeight;
    private boolean mEntireHeaderClickable;
    private boolean mExpandOnlyOnButton;
    private boolean mAcceptAllTouches;

    ViewOutlineProvider mProvider = new ViewOutlineProvider() {
@@ -315,6 +316,7 @@ public class NotificationHeaderView extends ViewGroup {
    public class HeaderTouchListener implements View.OnTouchListener {

        private final ArrayList<Rect> mTouchRects = new ArrayList<>();
        private Rect mExpandButtonRect;
        private int mTouchSlop;
        private boolean mTrackGesture;
        private float mDownX;
@@ -326,7 +328,7 @@ public class NotificationHeaderView extends ViewGroup {
        public void bindTouchRects() {
            mTouchRects.clear();
            addRectAroundView(mIcon);
            addRectAroundView(mExpandButton);
            mExpandButtonRect = addRectAroundView(mExpandButton);
            addWidthRect();
            mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
        }
@@ -340,9 +342,10 @@ public class NotificationHeaderView extends ViewGroup {
            mTouchRects.add(r);
        }

        private void addRectAroundView(View view) {
        private Rect addRectAroundView(View view) {
            final Rect r = getRectAroundView(view);
            mTouchRects.add(r);
            return r;
        }

        private Rect getRectAroundView(View view) {
@@ -395,6 +398,9 @@ public class NotificationHeaderView extends ViewGroup {
            if (mAcceptAllTouches) {
                return true;
            }
            if (mExpandOnlyOnButton) {
                return mExpandButtonRect.contains((int) x, (int) y);
            }
            for (int i = 0; i < mTouchRects.size(); i++) {
                Rect r = mTouchRects.get(i);
                if (r.contains((int) x, (int) y)) {
@@ -440,4 +446,12 @@ public class NotificationHeaderView extends ViewGroup {
    public void setAcceptAllTouches(boolean acceptAllTouches) {
        mAcceptAllTouches = mEntireHeaderClickable || acceptAllTouches;
    }

    /**
     * Sets whether only the expand icon itself should serve as the expand target.
     */
    @RemotableViewMethod
    public void setExpandOnlyOnButton(boolean expandOnlyOnButton) {
        mExpandOnlyOnButton = expandOnlyOnButton;
    }
}
+1 −4
Original line number Diff line number Diff line
@@ -591,10 +591,7 @@
    <string name="notification_header_divider_symbol_with_spaces" translatable="false">" • "</string>

    <!-- Text shown in place of notification contents when the notification is hidden on a secure lockscreen -->
    <string name="notification_hidden_text">Contents hidden</string>

    <!-- Text shown in place of notification contents when the notification is hidden by policy on a secure lockscreen -->
    <string name="notification_hidden_by_policy_text">Contents hidden by policy</string>
    <string name="notification_hidden_text">New notification</string>

    <!-- Text shown when viewing channel settings for notifications related to the virtual keyboard -->
    <string name="notification_channel_virtual_keyboard">Virtual keyboard</string>
+0 −1
Original line number Diff line number Diff line
@@ -2561,7 +2561,6 @@
  <java-symbol type="id" name="notification_material_reply_text_3" />

  <java-symbol type="string" name="notification_hidden_text" />
  <java-symbol type="string" name="notification_hidden_by_policy_text" />
  <java-symbol type="id" name="app_name_text" />
  <java-symbol type="id" name="header_text" />
  <java-symbol type="id" name="expand_button" />
+0 −21
Original line number Diff line number Diff line
@@ -1927,9 +1927,6 @@ public class StatusBar extends SystemUI implements DemoMode,
            boolean sensitive = userPublic && needsRedaction;
            boolean deviceSensitive = devicePublic
                    && !userAllowsPrivateNotificationsInPublic(mCurrentUserId);
            if (sensitive) {
                updatePublicContentView(ent, ent.notification);
            }
            ent.row.setSensitive(sensitive, deviceSensitive);
            ent.row.setNeedsRedaction(needsRedaction);
            if (mGroupManager.isChildInGroupWithSummary(ent.row.getStatusBarNotification())) {
@@ -7206,24 +7203,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        setAreThereNotifications();
    }

    protected void updatePublicContentView(Entry entry,
            StatusBarNotification sbn) {
        final RemoteViews publicContentView = entry.cachedPublicContentView;
        View inflatedView = entry.getPublicContentView();
        if (entry.autoRedacted && publicContentView != null && inflatedView != null) {
            final boolean disabledByPolicy =
                    !adminAllowsUnredactedNotifications(entry.notification.getUserId());
            String notificationHiddenText = mContext.getString(disabledByPolicy
                    ? com.android.internal.R.string.notification_hidden_by_policy_text
                    : com.android.internal.R.string.notification_hidden_text);
            TextView titleView = (TextView) inflatedView.findViewById(android.R.id.title);
            if (titleView != null
                    && !titleView.getText().toString().equals(notificationHiddenText)) {
                titleView.setText(notificationHiddenText);
            }
        }
    }

    protected void notifyHeadsUpScreenOff() {
        maybeEscalateHeadsUp();
    }