Remove intruder alert APIs from JB.

Change-Id: I27042d604fbe15879e7b7aaaac860db2d1efa47f
diff --git a/api/current.txt b/api/current.txt
index 746cbaa..080449b 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3768,7 +3768,6 @@
     method public android.app.Notification.Builder setDefaults(int);
     method public android.app.Notification.Builder setDeleteIntent(android.app.PendingIntent);
     method public android.app.Notification.Builder setFullScreenIntent(android.app.PendingIntent, boolean);
-    method public android.app.Notification.Builder setIntruderActionsShowText(boolean);
     method public android.app.Notification.Builder setLargeIcon(android.graphics.Bitmap);
     method public android.app.Notification.Builder setLights(int, int, int);
     method public android.app.Notification.Builder setNumber(int);
@@ -3784,7 +3783,6 @@
     method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
     method public android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
     method public android.app.Notification.Builder setUsesChronometer(boolean);
-    method public android.app.Notification.Builder setUsesIntruderAlert(boolean);
     method public android.app.Notification.Builder setVibrate(long[]);
     method public android.app.Notification.Builder setWhen(long);
   }
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 22d84f0..b581f99 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -190,12 +190,6 @@
     public RemoteViews contentView;
 
     /**
-     * The view that will represent this notification in the pop-up "intruder alert" dialog.
-     * @hide
-     */
-    public RemoteViews intruderView;
-
-    /**
      * A large-format version of {@link #contentView}, giving the Notification an
      * opportunity to show more detail. The system UI may choose to show this
      * instead of the normal content view at its discretion.
@@ -590,9 +584,6 @@
 
         actions = parcel.createTypedArray(Action.CREATOR);
         if (parcel.readInt() != 0) {
-            intruderView = RemoteViews.CREATOR.createFromParcel(parcel);
-        }
-        if (parcel.readInt() != 0) {
             bigContentView = RemoteViews.CREATOR.createFromParcel(parcel);
         }
     }
@@ -658,9 +649,6 @@
         for(int i=0; i<this.actions.length; i++) {
             that.actions[i] = this.actions[i].clone();
         }
-        if (this.intruderView != null) {
-            that.intruderView = this.intruderView.clone();
-        }
         if (this.bigContentView != null) {
             that.bigContentView = this.bigContentView.clone();
         }
@@ -755,13 +743,6 @@
 
         parcel.writeTypedArray(actions, 0);
 
-        if (intruderView != null) {
-            parcel.writeInt(1);
-            intruderView.writeToParcel(parcel, 0);
-        } else {
-            parcel.writeInt(0);
-        }
-
         if (bigContentView != null) {
             parcel.writeInt(1);
             bigContentView.writeToParcel(parcel, 0);
@@ -942,8 +923,6 @@
         private Bundle mExtras;
         private int mPriority;
         private ArrayList<Action> mActions = new ArrayList<Action>(3);
-        private boolean mCanHasIntruder;
-        private boolean mIntruderActionsShowText;
         private boolean mUseChronometer;
 
         /**
@@ -1349,38 +1328,6 @@
             return this;
         }
 
-        /**
-         * Specify whether this notification should pop up as an
-         * "intruder alert" (a small window that shares the screen with the
-         * current activity). This sort of notification is (as the name implies)
-         * very intrusive, so use it sparingly for notifications that require
-         * the user's attention.
-         *
-         * Notes:
-         * <ul>
-         * <li>Intruder alerts only show when the screen is on.</li>
-         * <li>Intruder alerts take precedence over fullScreenIntents.</li>
-         * </ul>
-         *
-         * @param intrude Whether to pop up an intruder alert (default false).
-         */
-        public Builder setUsesIntruderAlert(boolean intrude) {
-            mCanHasIntruder = intrude;
-            return this;
-        }
-
-        /**
-         * Control text on intruder alert action buttons. By default, action
-         * buttons in intruders do not show textual labels.
-         * 
-         * @param showActionText Whether to show text labels beneath action
-         *            icons (default false).
-         */
-        public Builder setIntruderActionsShowText(boolean showActionText) {
-            mIntruderActionsShowText = showActionText;
-            return this;
-        }
-
         private void setFlag(int mask, boolean value) {
             if (value) {
                 mFlags |= mask;
@@ -1506,45 +1453,6 @@
             return applyStandardTemplateWithActions(R.layout.notification_template_base);
         }
 
-        private RemoteViews makeIntruderView(boolean showLabels) {
-            RemoteViews intruderView = new RemoteViews(mContext.getPackageName(),
-                    R.layout.notification_intruder_content);
-            if (mLargeIcon != null) {
-                intruderView.setImageViewBitmap(R.id.icon, mLargeIcon);
-                intruderView.setViewVisibility(R.id.icon, View.VISIBLE);
-            } else if (mSmallIcon != 0) {
-                intruderView.setImageViewResource(R.id.icon, mSmallIcon);
-                intruderView.setViewVisibility(R.id.icon, View.VISIBLE);
-            } else {
-                intruderView.setViewVisibility(R.id.icon, View.GONE);
-            }
-            if (mContentTitle != null) {
-                intruderView.setTextViewText(R.id.title, mContentTitle);
-            }
-            if (mContentText != null) {
-                intruderView.setTextViewText(R.id.text, mContentText);
-            }
-            if (mActions.size() > 0) {
-                intruderView.setViewVisibility(R.id.actions, View.VISIBLE);
-                int N = mActions.size();
-                if (N>3) N=3;
-                final int[] BUTTONS = { R.id.action0, R.id.action1, R.id.action2 };
-                for (int i=0; i<N; i++) {
-                    final Action action = mActions.get(i);
-                    final int buttonId = BUTTONS[i];
-
-                    intruderView.setViewVisibility(buttonId, View.VISIBLE);
-                    intruderView.setTextViewText(buttonId, showLabels ? action.title : null);
-                    intruderView.setTextViewCompoundDrawables(buttonId, 0, action.icon, 0, 0);
-                    intruderView.setContentDescription(buttonId, action.title);
-                    intruderView.setOnClickPendingIntent(buttonId, action.actionIntent);
-                }
-            } else {
-                intruderView.setViewVisibility(R.id.actions, View.GONE);
-            }
-            return intruderView;
-        }
-
         private RemoteViews generateActionButton(Action action) {
             RemoteViews button = new RemoteViews(mContext.getPackageName(), R.layout.notification_action);
             button.setTextViewCompoundDrawables(R.id.action0, action.icon, 0, 0, 0);
@@ -1579,9 +1487,6 @@
             n.ledOffMS = mLedOffMs;
             n.defaults = mDefaults;
             n.flags = mFlags;
-            if (mCanHasIntruder) {
-                n.intruderView = makeIntruderView(mIntruderActionsShowText);
-            }
             n.bigContentView = makeBigContentView();
             if (mLedOnMs != 0 && mLedOffMs != 0) {
                 n.flags |= FLAG_SHOW_LIGHTS;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index f45b3ad..76f7ea6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -94,7 +94,7 @@
     public static final String ACTION_STATUSBAR_START
             = "com.android.internal.policy.statusbar.START";
 
-    private static final boolean ENABLE_INTRUDERS = true;
+    private static final boolean ENABLE_INTRUDERS = false;
 
     static final int EXPANDED_LEAVE_ALONE = -10000;
     static final int EXPANDED_FULL_OPEN = -10001;
@@ -280,9 +280,11 @@
         }
         mNotificationPanel = expanded.findViewById(R.id.notification_panel);
 
-        mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null);
-        mIntruderAlertView.setVisibility(View.GONE);
-        mIntruderAlertView.setBar(this);
+        if (ENABLE_INTRUDERS) {
+            mIntruderAlertView = (IntruderAlertView) View.inflate(context, R.layout.intruder_alert, null);
+            mIntruderAlertView.setVisibility(View.GONE);
+            mIntruderAlertView.setBar(this);
+        }
 
         PhoneStatusBarView sb = (PhoneStatusBarView)View.inflate(context,
                 R.layout.status_bar, null);
@@ -520,12 +522,12 @@
             }
         } catch (RemoteException ex) {
         }
+
+        /*
+         * DISABLED due to missing API
         if (ENABLE_INTRUDERS && (
                    // TODO(dsandler): Only if the screen is on
                 notification.notification.intruderView != null)) {
-//                   notification.notification.fullScreenIntent != null
-//                || (notification.score >= mIntruderInImmersiveMinScore)
-//                || (!immersive && (notification.score > mIntruderMinScore)))) {
             Slog.d(TAG, "Presenting high-priority notification");
             // special new transient ticker mode
             // 1. Populate mIntruderAlertView
@@ -554,7 +556,10 @@
             if (INTRUDER_ALERT_DECAY_MS > 0) {
                 mHandler.sendEmptyMessageDelayed(MSG_HIDE_INTRUDER, INTRUDER_ALERT_DECAY_MS);
             }
-        } else if (notification.notification.fullScreenIntent != null) {
+        } else 
+         */
+        
+        if (notification.notification.fullScreenIntent != null) {
             // not immersive & a full-screen alert should be shown
             Slog.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
             try {
@@ -675,7 +680,7 @@
         updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
 
         // See if we need to update the intruder.
-        if (oldNotification == mCurrentlyIntrudingNotification) {
+        if (ENABLE_INTRUDERS && oldNotification == mCurrentlyIntrudingNotification) {
             if (DEBUG) Slog.d(TAG, "updating the current intruder:" + notification);
             // XXX: this is a hack for Alarms. The real implementation will need to *update* 
             // the intruder.
@@ -697,7 +702,7 @@
             // Recalculate the position of the sliding windows and the titles.
             updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
             
-            if (old == mCurrentlyIntrudingNotification) {
+            if (ENABLE_INTRUDERS && old == mCurrentlyIntrudingNotification) {
                 mHandler.sendEmptyMessage(MSG_HIDE_INTRUDER);
             }
 
@@ -2039,6 +2044,7 @@
     };
 
     private void setIntruderAlertVisibility(boolean vis) {
+        if (!ENABLE_INTRUDERS) return;
         if (DEBUG) {
             Slog.v(TAG, (vis ? "showing" : "hiding") + " intruder alert window");
         }