static void onStartScreenPinning(Context context) {
   // For the primary user, the context for the SystemUI component is the SystemUIApplication
   SystemUIApplication app = (SystemUIApplication) getInstanceAndStartIfNeeded(context).mContext;
   PhoneStatusBar statusBar = app.getComponent(PhoneStatusBar.class);
   if (statusBar != null) {
     statusBar.showScreenPinningRequest(false);
   }
 }
 /** Respond to dismissal of the Heads Up window. */
 public void dismiss() {
   if (mHeadsUp == null) return;
   if (mHeadsUp.notification.isClearable()) {
     mBar.onNotificationClear(mHeadsUp.notification);
   } else {
     release();
   }
   mHeadsUp = null;
   mBar.scheduleHeadsUpClose();
 }
 @Override
 public boolean onTouchEvent(MotionEvent ev) {
   if (SystemClock.elapsedRealtime() < mStartTouchTime) {
     return false;
   }
   mBar.resetHeadsUpDecayTimer();
   return mEdgeSwipeHelper.onTouchEvent(ev)
       || mSwipeHelper.onTouchEvent(ev)
       || super.onTouchEvent(ev);
 }
  public boolean showNotification(NotificationData.Entry headsUp) {
    if (mHeadsUp != null && headsUp != null && !mHeadsUp.key.equals(headsUp.key)) {
      // bump any previous heads up back to the shade
      release();
    }

    mHeadsUp = headsUp;
    if (mContentHolder != null) {
      mContentHolder.removeAllViews();
    }

    if (mHeadsUp != null) {
      mMostRecentPackageName = mHeadsUp.notification.getPackageName();
      mHeadsUp.row.setSystemExpanded(true);
      mHeadsUp.row.setSensitive(false);
      mHeadsUp.row.setHeadsUp(true);
      mHeadsUp.row.setHideSensitive(false, false /* animated */, 0 /* delay */, 0 /* duration */);
      if (mContentHolder == null) {
        // too soon!
        return false;
      }
      mContentHolder.setX(0);
      mContentHolder.setVisibility(View.VISIBLE);
      mContentHolder.setAlpha(mMaxAlpha);
      mContentHolder.addView(mHeadsUp.row);
      sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);

      mSwipeHelper.snapChild(mContentHolder, 1f);
      mStartTouchTime = SystemClock.elapsedRealtime() + mTouchSensitivityDelay;

      mHeadsUp.setInterruption();

      // 2. Animate mHeadsUpNotificationView in
      mBar.scheduleHeadsUpOpen(
          TextUtils.equals(
              mHeadsUp.notification.getNotification().category, Notification.CATEGORY_CALL));

      // 3. Set alarm to age the notification off
      mBar.resetHeadsUpDecayTimer();
    }
    return true;
  }
 public void escalate() {
   mBar.scheduleHeadsUpEscalation();
 }
 @Override
 public void onChildDismissed(View v) {
   Log.v(TAG, "User swiped heads up to dismiss");
   mBar.onHeadsUpDismissed();
 }
 public void releaseAndClose() {
   release();
   mBar.scheduleHeadsUpClose();
 }
 /** Push any current Heads Up notification down into the shade. */
 public void release() {
   if (mHeadsUp != null) {
     mBar.displayNotificationFromHeadsUp(mHeadsUp.notification);
   }
   mHeadsUp = null;
 }
 /** Discard the Heads Up notification. */
 public void clear() {
   mHeadsUp = null;
   mBar.scheduleHeadsUpClose();
 }