Merge "camera2: @hide android.statistics.predictedColor*"
diff --git a/docs/html/google/play/publishing/multiple-apks.jd b/docs/html/google/play/publishing/multiple-apks.jd
index 3c7ed0f..ab08e6f 100644
--- a/docs/html/google/play/publishing/multiple-apks.jd
+++ b/docs/html/google/play/publishing/multiple-apks.jd
@@ -82,6 +82,7 @@
 <ul>
   <li>Support different OpenGL texture compression formats with each APK.</li>
   <li>Support different screen sizes and densities with each APK.</li>
+  <li>Support different device feature sets with each APK.</li>
   <li>Support different platform versions with each APK.</li>
   <li>Support different CPU architectures with each APK (such as for ARM, x86, and MIPS, when your
   app uses the <a href="{@docRoot}tools/sdk/ndk/index.html">Android NDK</a>).</li>
@@ -248,6 +249,17 @@
   <br/>
   </li>
 
+  <li><strong>Device feature sets</strong>
+    <p>This is based on your manifest file's <a 
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> 
+element(s).</p>
+    <p>For example, you can provide one APK for devices that support multitouch and another
+APK for devices that do not support multitouch. See 
+<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html#features-reference">Features
+Reference</a> for a list of features supported by the platform.</p>
+  <br/>
+  </li>
+
   <li><strong>API level</strong>
     <p>This is based on your manifest file's <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a> element.
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 a8920e4..124a6bc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1432,6 +1432,7 @@
     }
 
     private void releaseFocus() {
+        if (mStatusBarWindow == null) return;
         WindowManager.LayoutParams lp =
                 (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();
         lp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
@@ -1463,8 +1464,10 @@
             mHandler.sendEmptyMessage(MSG_CLOSE_SEARCH_PANEL);
         }
 
-        mStatusBarWindow.cancelExpandHelper();
-        mStatusBarView.collapseAllPanels(true);
+        if (mStatusBarWindow != null) {
+            mStatusBarWindow.cancelExpandHelper();
+            mStatusBarView.collapseAllPanels(true);
+        }
     }
 
     public ViewPropertyAnimator setVisibilityWhenDone(
@@ -1673,7 +1676,7 @@
         if (SPEW) Log.d(TAG, "makeExpandedInvisible: mExpandedVisible=" + mExpandedVisible
                 + " mExpandedVisible=" + mExpandedVisible);
 
-        if (!mExpandedVisible) {
+        if (!mExpandedVisible || mStatusBarWindow == null) {
             return;
         }
 
@@ -2076,7 +2079,8 @@
         // until status bar window is attached to the window manager,
         // because...  well, what's the point otherwise?  And trying to
         // run a ticker without being attached will crash!
-        if (n.getNotification().tickerText != null && mStatusBarWindow.getWindowToken() != null) {
+        if (n.getNotification().tickerText != null && mStatusBarWindow != null
+                && mStatusBarWindow.getWindowToken() != null) {
             if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
                             | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
                 mTicker.addEntry(n);
@@ -2726,9 +2730,11 @@
         super.destroy();
         if (mStatusBarWindow != null) {
             mWindowManager.removeViewImmediate(mStatusBarWindow);
+            mStatusBarWindow = null;
         }
         if (mNavigationBarView != null) {
             mWindowManager.removeViewImmediate(mNavigationBarView);
+            mNavigationBarView = null;
         }
         mContext.unregisterReceiver(mBroadcastReceiver);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index d0e9a99..d9e3fdf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -170,7 +170,7 @@
         mBar.makeExpandedInvisibleSoon();
         mFadingPanel = null;
         mLastFullyOpenedPanel = null;
-        if (mScrimColor != 0 && ActivityManager.isHighEndGfx()) {
+        if (mScrimColor != 0 && ActivityManager.isHighEndGfx() && mBar.mStatusBarWindow != null) {
             mBar.mStatusBarWindow.setBackgroundColor(0);
         }
     }
@@ -214,7 +214,8 @@
             Log.v(TAG, "panelExpansionChanged: f=" + frac);
         }
 
-        if (panel == mFadingPanel && mScrimColor != 0 && ActivityManager.isHighEndGfx()) {
+        if (panel == mFadingPanel && mScrimColor != 0 && ActivityManager.isHighEndGfx()
+                && mBar.mStatusBarWindow != null) {
             if (mShouldFade) {
                 frac = mPanelExpandedFractionSum; // don't judge me
                 // let's start this 20% of the way down the screen