OSDN Git Service

Merge "Update VR API docs." into nyc-dev
[android-x86/frameworks-base.git] / core / java / android / app / Activity.java
index 28386f8..9b4c8bd 100644 (file)
@@ -29,6 +29,7 @@ import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.StyleRes;
 import android.annotation.SystemApi;
+import android.app.VoiceInteractor.Request;
 import android.app.admin.DevicePolicyManager;
 import android.app.assist.AssistContent;
 import android.content.ComponentCallbacks2;
@@ -1272,6 +1273,12 @@ public class Activity extends ContextThemeWrapper
     }
 
     void setVoiceInteractor(IVoiceInteractor voiceInteractor) {
+        if (mVoiceInteractor != null) {
+            for (Request activeRequest: mVoiceInteractor.getActiveRequests()) {
+                activeRequest.cancel();
+                activeRequest.clear();
+            }
+        }
         if (voiceInteractor == null) {
             mVoiceInteractor = null;
         } else {
@@ -2975,6 +2982,18 @@ public class Activity extends ContextThemeWrapper
     }
 
     /**
+     * Puts the activity in picture-in-picture mode if the activity supports.
+     * @see android.R.attr#supportsPictureInPicture
+     * @hide
+     */
+    @Override
+    public void enterPictureInPictureModeIfPossible() {
+        if (mActivityInfo.resizeMode == ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE) {
+            enterPictureInPictureMode();
+        }
+    }
+
+    /**
      * Called to process key events.  You can override this to intercept all
      * key events before they are dispatched to the window.  Be sure to call
      * this implementation for key events that should be handled normally.