Merge tag 'android-13.0.0_r16' into int/13/fp3
Android 13.0.0 Release 16 (TQ1A.221205.011)
* tag 'android-13.0.0_r16':
Update build tools version for b/237714065
Add ability to enter PiP on back pressed in ApiDemos
Change-Id: Icccf56923eebe79ebd46f8c41b5b1880c2fe0f63
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index aad0074..159437c 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -61,6 +61,7 @@
android:icon="@drawable/app_sample_code"
android:hardwareAccelerated="true"
android:supportsRtl="true"
+ android:enableOnBackInvokedCallback="true"
android:theme="@android:style/Theme.Material.Light.DarkActionBar">
<!-- This is how we can request a library but still allow the app
diff --git a/samples/ApiDemos/res/layout/picture_in_picture.xml b/samples/ApiDemos/res/layout/picture_in_picture.xml
index f29bd08..e33d373 100644
--- a/samples/ApiDemos/res/layout/picture_in_picture.xml
+++ b/samples/ApiDemos/res/layout/picture_in_picture.xml
@@ -69,6 +69,13 @@
android:padding="8dp"
android:text="@string/activity_picture_in_picture_seamless_resize_toggle" />
+ <Switch
+ android:id="@+id/enter_pip_on_back"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:text="@string/activity_picture_in_picture_enter_pip_on_back_toggle" />
+
<RadioGroup
android:id="@+id/current_position"
android:layout_width="match_parent"
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index eccba7b..3e1478a 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -66,6 +66,7 @@
<string name="activity_picture_in_picture_auto_pip_toggle">Enable auto PiP</string>
<string name="activity_picture_in_picture_source_rect_hint_toggle">Enable source rect hint</string>
<string name="activity_picture_in_picture_seamless_resize_toggle">Enable seamless resize</string>
+ <string name="activity_picture_in_picture_enter_pip_on_back_toggle">Enter PiP on back</string>
<string name="enter_content_pip">Enter content PiP</string>
<string name="enter_picture_in_picture">Manually enter PiP</string>
<string name="action_custom_close">Close PiP</string>
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/PictureInPicture.java b/samples/ApiDemos/src/com/example/android/apis/app/PictureInPicture.java
index 60731be..f2c08c8 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/PictureInPicture.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/PictureInPicture.java
@@ -44,6 +44,7 @@
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.Switch;
+import android.window.OnBackInvokedDispatcher;
import com.example.android.apis.R;
@@ -54,6 +55,7 @@
private static final String EXTRA_ENABLE_AUTO_PIP = "auto_pip";
private static final String EXTRA_ENABLE_SOURCE_RECT_HINT = "source_rect_hint";
private static final String EXTRA_ENABLE_SEAMLESS_RESIZE = "seamless_resize";
+ private static final String EXTRA_ENTER_PIP_ON_BACK = "enter_pip_on_back";
private static final String EXTRA_CURRENT_POSITION = "current_position";
private static final int TABLET_BREAK_POINT_DP = 700;
@@ -98,6 +100,7 @@
private Switch mAutoPipToggle;
private Switch mSourceRectHintToggle;
private Switch mSeamlessResizeToggle;
+ private Switch mEnterPipOnBackToggle;
private RadioGroup mCurrentPositionGroup;
private List<RemoteAction> mPipActions;
private RemoteAction mCloseAction;
@@ -114,6 +117,7 @@
mAutoPipToggle = findViewById(R.id.auto_pip_toggle);
mSourceRectHintToggle = findViewById(R.id.source_rect_hint_toggle);
mSeamlessResizeToggle = findViewById(R.id.seamless_resize_toggle);
+ mEnterPipOnBackToggle = findViewById(R.id.enter_pip_on_back);
mCurrentPositionGroup = findViewById(R.id.current_position);
// Attach listeners
@@ -121,6 +125,15 @@
mAutoPipToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
mSourceRectHintToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
mSeamlessResizeToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
+ mEnterPipOnBackToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
+ getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
+ OnBackInvokedDispatcher.PRIORITY_DEFAULT, () -> {
+ if (mEnterPipOnBackToggle.isChecked()) {
+ enterPictureInPictureMode();
+ } else {
+ finish();
+ }
+ });
mCurrentPositionGroup.setOnCheckedChangeListener(mOnPositionChangedListener);
findViewById(R.id.enter_pip_button).setOnClickListener(v -> enterPictureInPictureMode());
findViewById(R.id.enter_content_pip_button).setOnClickListener(v -> enterContentPip());
@@ -132,6 +145,8 @@
intent.getBooleanExtra(EXTRA_ENABLE_SOURCE_RECT_HINT, false));
mSeamlessResizeToggle.setChecked(
intent.getBooleanExtra(EXTRA_ENABLE_SEAMLESS_RESIZE, false));
+ mEnterPipOnBackToggle.setChecked(
+ intent.getBooleanExtra(EXTRA_ENTER_PIP_ON_BACK, false));
final int positionId = "end".equalsIgnoreCase(
intent.getStringExtra(EXTRA_CURRENT_POSITION))
? R.id.radio_current_end
diff --git a/sdk/build_tools_source.prop_template b/sdk/build_tools_source.prop_template
index 8490e59..6da346c 100644
--- a/sdk/build_tools_source.prop_template
+++ b/sdk/build_tools_source.prop_template
@@ -1,3 +1,3 @@
Pkg.UserSrc=false
-Pkg.Revision=${PLATFORM_SDK_VERSION}.0.0
+Pkg.Revision=${PLATFORM_SDK_VERSION}.0.1
#Pkg.Revision=33.0.0 rc4