Skip to content

Commit 6b31880

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Remove intruder alert APIs from JB.
Change-Id: I27042d604fbe15879e7b7aaaac860db2d1efa47f
1 parent 08ce91a commit 6b31880

File tree

3 files changed

+16
-107
lines changed

3 files changed

+16
-107
lines changed

api/current.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3768,7 +3768,6 @@ package android.app {
37683768
method public android.app.Notification.Builder setDefaults(int);
37693769
method public android.app.Notification.Builder setDeleteIntent(android.app.PendingIntent);
37703770
method public android.app.Notification.Builder setFullScreenIntent(android.app.PendingIntent, boolean);
3771-
method public android.app.Notification.Builder setIntruderActionsShowText(boolean);
37723771
method public android.app.Notification.Builder setLargeIcon(android.graphics.Bitmap);
37733772
method public android.app.Notification.Builder setLights(int, int, int);
37743773
method public android.app.Notification.Builder setNumber(int);
@@ -3784,7 +3783,6 @@ package android.app {
37843783
method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
37853784
method public android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
37863785
method public android.app.Notification.Builder setUsesChronometer(boolean);
3787-
method public android.app.Notification.Builder setUsesIntruderAlert(boolean);
37883786
method public android.app.Notification.Builder setVibrate(long[]);
37893787
method public android.app.Notification.Builder setWhen(long);
37903788
}

core/java/android/app/Notification.java

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,6 @@ public class Notification implements Parcelable
189189
*/
190190
public RemoteViews contentView;
191191

192-
/**
193-
* The view that will represent this notification in the pop-up "intruder alert" dialog.
194-
* @hide
195-
*/
196-
public RemoteViews intruderView;
197-
198192
/**
199193
* A large-format version of {@link #contentView}, giving the Notification an
200194
* opportunity to show more detail. The system UI may choose to show this
@@ -589,9 +583,6 @@ public Notification(Parcel parcel)
589583
}
590584

591585
actions = parcel.createTypedArray(Action.CREATOR);
592-
if (parcel.readInt() != 0) {
593-
intruderView = RemoteViews.CREATOR.createFromParcel(parcel);
594-
}
595586
if (parcel.readInt() != 0) {
596587
bigContentView = RemoteViews.CREATOR.createFromParcel(parcel);
597588
}
@@ -658,9 +649,6 @@ public Notification clone() {
658649
for(int i=0; i<this.actions.length; i++) {
659650
that.actions[i] = this.actions[i].clone();
660651
}
661-
if (this.intruderView != null) {
662-
that.intruderView = this.intruderView.clone();
663-
}
664652
if (this.bigContentView != null) {
665653
that.bigContentView = this.bigContentView.clone();
666654
}
@@ -755,13 +743,6 @@ public void writeToParcel(Parcel parcel, int flags)
755743

756744
parcel.writeTypedArray(actions, 0);
757745

758-
if (intruderView != null) {
759-
parcel.writeInt(1);
760-
intruderView.writeToParcel(parcel, 0);
761-
} else {
762-
parcel.writeInt(0);
763-
}
764-
765746
if (bigContentView != null) {
766747
parcel.writeInt(1);
767748
bigContentView.writeToParcel(parcel, 0);
@@ -942,8 +923,6 @@ public static class Builder {
942923
private Bundle mExtras;
943924
private int mPriority;
944925
private ArrayList<Action> mActions = new ArrayList<Action>(3);
945-
private boolean mCanHasIntruder;
946-
private boolean mIntruderActionsShowText;
947926
private boolean mUseChronometer;
948927

949928
/**
@@ -1349,38 +1328,6 @@ public Builder addAction(int icon, CharSequence title, PendingIntent intent) {
13491328
return this;
13501329
}
13511330

1352-
/**
1353-
* Specify whether this notification should pop up as an
1354-
* "intruder alert" (a small window that shares the screen with the
1355-
* current activity). This sort of notification is (as the name implies)
1356-
* very intrusive, so use it sparingly for notifications that require
1357-
* the user's attention.
1358-
*
1359-
* Notes:
1360-
* <ul>
1361-
* <li>Intruder alerts only show when the screen is on.</li>
1362-
* <li>Intruder alerts take precedence over fullScreenIntents.</li>
1363-
* </ul>
1364-
*
1365-
* @param intrude Whether to pop up an intruder alert (default false).
1366-
*/
1367-
public Builder setUsesIntruderAlert(boolean intrude) {
1368-
mCanHasIntruder = intrude;
1369-
return this;
1370-
}
1371-
1372-
/**
1373-
* Control text on intruder alert action buttons. By default, action
1374-
* buttons in intruders do not show textual labels.
1375-
*
1376-
* @param showActionText Whether to show text labels beneath action
1377-
* icons (default false).
1378-
*/
1379-
public Builder setIntruderActionsShowText(boolean showActionText) {
1380-
mIntruderActionsShowText = showActionText;
1381-
return this;
1382-
}
1383-
13841331
private void setFlag(int mask, boolean value) {
13851332
if (value) {
13861333
mFlags |= mask;
@@ -1506,45 +1453,6 @@ private RemoteViews makeBigContentView() {
15061453
return applyStandardTemplateWithActions(R.layout.notification_template_base);
15071454
}
15081455

1509-
private RemoteViews makeIntruderView(boolean showLabels) {
1510-
RemoteViews intruderView = new RemoteViews(mContext.getPackageName(),
1511-
R.layout.notification_intruder_content);
1512-
if (mLargeIcon != null) {
1513-
intruderView.setImageViewBitmap(R.id.icon, mLargeIcon);
1514-
intruderView.setViewVisibility(R.id.icon, View.VISIBLE);
1515-
} else if (mSmallIcon != 0) {
1516-
intruderView.setImageViewResource(R.id.icon, mSmallIcon);
1517-
intruderView.setViewVisibility(R.id.icon, View.VISIBLE);
1518-
} else {
1519-
intruderView.setViewVisibility(R.id.icon, View.GONE);
1520-
}
1521-
if (mContentTitle != null) {
1522-
intruderView.setTextViewText(R.id.title, mContentTitle);
1523-
}
1524-
if (mContentText != null) {
1525-
intruderView.setTextViewText(R.id.text, mContentText);
1526-
}
1527-
if (mActions.size() > 0) {
1528-
intruderView.setViewVisibility(R.id.actions, View.VISIBLE);
1529-
int N = mActions.size();
1530-
if (N>3) N=3;
1531-
final int[] BUTTONS = { R.id.action0, R.id.action1, R.id.action2 };
1532-
for (int i=0; i<N; i++) {
1533-
final Action action = mActions.get(i);
1534-
final int buttonId = BUTTONS[i];
1535-
1536-
intruderView.setViewVisibility(buttonId, View.VISIBLE);
1537-
intruderView.setTextViewText(buttonId, showLabels ? action.title : null);
1538-
intruderView.setTextViewCompoundDrawables(buttonId, 0, action.icon, 0, 0);
1539-
intruderView.setContentDescription(buttonId, action.title);
1540-
intruderView.setOnClickPendingIntent(buttonId, action.actionIntent);
1541-
}
1542-
} else {
1543-
intruderView.setViewVisibility(R.id.actions, View.GONE);
1544-
}
1545-
return intruderView;
1546-
}
1547-
15481456
private RemoteViews generateActionButton(Action action) {
15491457
RemoteViews button = new RemoteViews(mContext.getPackageName(), R.layout.notification_action);
15501458
button.setTextViewCompoundDrawables(R.id.action0, action.icon, 0, 0, 0);
@@ -1579,9 +1487,6 @@ public Notification getNotification() {
15791487
n.ledOffMS = mLedOffMs;
15801488
n.defaults = mDefaults;
15811489
n.flags = mFlags;
1582-
if (mCanHasIntruder) {
1583-
n.intruderView = makeIntruderView(mIntruderActionsShowText);
1584-
}
15851490
n.bigContentView = makeBigContentView();
15861491
if (mLedOnMs != 0 && mLedOffMs != 0) {
15871492
n.flags |= FLAG_SHOW_LIGHTS;

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public class PhoneStatusBar extends BaseStatusBar {
9494
public static final String ACTION_STATUSBAR_START
9595
= "com.android.internal.policy.statusbar.START";
9696

97-
private static final boolean ENABLE_INTRUDERS = true;
97+
private static final boolean ENABLE_INTRUDERS = false;
9898

9999
static final int EXPANDED_LEAVE_ALONE = -10000;
100100
static final int EXPANDED_FULL_OPEN = -10001;
@@ -280,9 +280,11 @@ protected View makeStatusBarView() {
280280
}
281281
mNotificationPanel = expanded.findViewById(R.id.notification_panel);
282282

283-
mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null);
284-
mIntruderAlertView.setVisibility(View.GONE);
285-
mIntruderAlertView.setBar(this);
283+
if (ENABLE_INTRUDERS) {
284+
mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null);
285+
mIntruderAlertView.setVisibility(View.GONE);
286+
mIntruderAlertView.setBar(this);
287+
}
286288

287289
PhoneStatusBarView sb = (PhoneStatusBarView)View.inflate(context,
288290
R.layout.status_bar, null);
@@ -520,12 +522,12 @@ public void addNotification(IBinder key, StatusBarNotification notification) {
520522
}
521523
} catch (RemoteException ex) {
522524
}
525+
526+
/*
527+
* DISABLED due to missing API
523528
if (ENABLE_INTRUDERS && (
524529
// TODO(dsandler): Only if the screen is on
525530
notification.notification.intruderView != null)) {
526-
// notification.notification.fullScreenIntent != null
527-
// || (notification.score >= mIntruderInImmersiveMinScore)
528-
// || (!immersive && (notification.score > mIntruderMinScore)))) {
529531
Slog.d(TAG, "Presenting high-priority notification");
530532
// special new transient ticker mode
531533
// 1. Populate mIntruderAlertView
@@ -554,7 +556,10 @@ public void addNotification(IBinder key, StatusBarNotification notification) {
554556
if (INTRUDER_ALERT_DECAY_MS > 0) {
555557
mHandler.sendEmptyMessageDelayed(MSG_HIDE_INTRUDER, INTRUDER_ALERT_DECAY_MS);
556558
}
557-
} else if (notification.notification.fullScreenIntent != null) {
559+
} else
560+
*/
561+
562+
if (notification.notification.fullScreenIntent != null) {
558563
// not immersive & a full-screen alert should be shown
559564
Slog.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
560565
try {
@@ -675,7 +680,7 @@ public void updateNotification(IBinder key, StatusBarNotification notification)
675680
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
676681

677682
// See if we need to update the intruder.
678-
if (oldNotification == mCurrentlyIntrudingNotification) {
683+
if (ENABLE_INTRUDERS && oldNotification == mCurrentlyIntrudingNotification) {
679684
if (DEBUG) Slog.d(TAG, "updating the current intruder:" + notification);
680685
// XXX: this is a hack for Alarms. The real implementation will need to *update*
681686
// the intruder.
@@ -697,7 +702,7 @@ public void removeNotification(IBinder key) {
697702
// Recalculate the position of the sliding windows and the titles.
698703
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
699704

700-
if (old == mCurrentlyIntrudingNotification) {
705+
if (ENABLE_INTRUDERS && old == mCurrentlyIntrudingNotification) {
701706
mHandler.sendEmptyMessage(MSG_HIDE_INTRUDER);
702707
}
703708

@@ -2039,6 +2044,7 @@ else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
20392044
};
20402045

20412046
private void setIntruderAlertVisibility(boolean vis) {
2047+
if (!ENABLE_INTRUDERS) return;
20422048
if (DEBUG) {
20432049
Slog.v(TAG, (vis ? "showing" : "hiding") + " intruder alert window");
20442050
}

0 commit comments

Comments
 (0)