Merge Android 13 QPR1
Bug: 261731544 Merged-In: I5be6e32d05aa219ae787cb5a3242a2cc4f9e87f4 Change-Id: If803f4950c21576bfafaa4d6b63742537450c7e4
This commit is contained in:
@@ -61,6 +61,7 @@
|
|||||||
android:icon="@drawable/app_sample_code"
|
android:icon="@drawable/app_sample_code"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
android:theme="@android:style/Theme.Material.Light.DarkActionBar">
|
android:theme="@android:style/Theme.Material.Light.DarkActionBar">
|
||||||
|
|
||||||
<!-- This is how we can request a library but still allow the app
|
<!-- This is how we can request a library but still allow the app
|
||||||
|
|||||||
@@ -69,6 +69,13 @@
|
|||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:text="@string/activity_picture_in_picture_seamless_resize_toggle" />
|
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
|
<RadioGroup
|
||||||
android:id="@+id/current_position"
|
android:id="@+id/current_position"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
<string name="activity_picture_in_picture_auto_pip_toggle">Enable auto PiP</string>
|
<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_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_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_content_pip">Enter content PiP</string>
|
||||||
<string name="enter_picture_in_picture">Manually enter PiP</string>
|
<string name="enter_picture_in_picture">Manually enter PiP</string>
|
||||||
<string name="action_custom_close">Close PiP</string>
|
<string name="action_custom_close">Close PiP</string>
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
import android.window.OnBackInvokedDispatcher;
|
||||||
|
|
||||||
import com.example.android.apis.R;
|
import com.example.android.apis.R;
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ public class PictureInPicture extends Activity {
|
|||||||
private static final String EXTRA_ENABLE_AUTO_PIP = "auto_pip";
|
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_SOURCE_RECT_HINT = "source_rect_hint";
|
||||||
private static final String EXTRA_ENABLE_SEAMLESS_RESIZE = "seamless_resize";
|
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 String EXTRA_CURRENT_POSITION = "current_position";
|
||||||
|
|
||||||
private static final int TABLET_BREAK_POINT_DP = 700;
|
private static final int TABLET_BREAK_POINT_DP = 700;
|
||||||
@@ -98,6 +100,7 @@ public class PictureInPicture extends Activity {
|
|||||||
private Switch mAutoPipToggle;
|
private Switch mAutoPipToggle;
|
||||||
private Switch mSourceRectHintToggle;
|
private Switch mSourceRectHintToggle;
|
||||||
private Switch mSeamlessResizeToggle;
|
private Switch mSeamlessResizeToggle;
|
||||||
|
private Switch mEnterPipOnBackToggle;
|
||||||
private RadioGroup mCurrentPositionGroup;
|
private RadioGroup mCurrentPositionGroup;
|
||||||
private List<RemoteAction> mPipActions;
|
private List<RemoteAction> mPipActions;
|
||||||
private RemoteAction mCloseAction;
|
private RemoteAction mCloseAction;
|
||||||
@@ -114,6 +117,7 @@ public class PictureInPicture extends Activity {
|
|||||||
mAutoPipToggle = findViewById(R.id.auto_pip_toggle);
|
mAutoPipToggle = findViewById(R.id.auto_pip_toggle);
|
||||||
mSourceRectHintToggle = findViewById(R.id.source_rect_hint_toggle);
|
mSourceRectHintToggle = findViewById(R.id.source_rect_hint_toggle);
|
||||||
mSeamlessResizeToggle = findViewById(R.id.seamless_resize_toggle);
|
mSeamlessResizeToggle = findViewById(R.id.seamless_resize_toggle);
|
||||||
|
mEnterPipOnBackToggle = findViewById(R.id.enter_pip_on_back);
|
||||||
mCurrentPositionGroup = findViewById(R.id.current_position);
|
mCurrentPositionGroup = findViewById(R.id.current_position);
|
||||||
|
|
||||||
// Attach listeners
|
// Attach listeners
|
||||||
@@ -121,6 +125,15 @@ public class PictureInPicture extends Activity {
|
|||||||
mAutoPipToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
|
mAutoPipToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
|
||||||
mSourceRectHintToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
|
mSourceRectHintToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
|
||||||
mSeamlessResizeToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
|
mSeamlessResizeToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
|
||||||
|
mEnterPipOnBackToggle.setOnCheckedChangeListener(mOnToggleChangedListener);
|
||||||
|
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
|
||||||
|
OnBackInvokedDispatcher.PRIORITY_DEFAULT, () -> {
|
||||||
|
if (mEnterPipOnBackToggle.isChecked()) {
|
||||||
|
enterPictureInPictureMode();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
mCurrentPositionGroup.setOnCheckedChangeListener(mOnPositionChangedListener);
|
mCurrentPositionGroup.setOnCheckedChangeListener(mOnPositionChangedListener);
|
||||||
findViewById(R.id.enter_pip_button).setOnClickListener(v -> enterPictureInPictureMode());
|
findViewById(R.id.enter_pip_button).setOnClickListener(v -> enterPictureInPictureMode());
|
||||||
findViewById(R.id.enter_content_pip_button).setOnClickListener(v -> enterContentPip());
|
findViewById(R.id.enter_content_pip_button).setOnClickListener(v -> enterContentPip());
|
||||||
@@ -132,6 +145,8 @@ public class PictureInPicture extends Activity {
|
|||||||
intent.getBooleanExtra(EXTRA_ENABLE_SOURCE_RECT_HINT, false));
|
intent.getBooleanExtra(EXTRA_ENABLE_SOURCE_RECT_HINT, false));
|
||||||
mSeamlessResizeToggle.setChecked(
|
mSeamlessResizeToggle.setChecked(
|
||||||
intent.getBooleanExtra(EXTRA_ENABLE_SEAMLESS_RESIZE, false));
|
intent.getBooleanExtra(EXTRA_ENABLE_SEAMLESS_RESIZE, false));
|
||||||
|
mEnterPipOnBackToggle.setChecked(
|
||||||
|
intent.getBooleanExtra(EXTRA_ENTER_PIP_ON_BACK, false));
|
||||||
final int positionId = "end".equalsIgnoreCase(
|
final int positionId = "end".equalsIgnoreCase(
|
||||||
intent.getStringExtra(EXTRA_CURRENT_POSITION))
|
intent.getStringExtra(EXTRA_CURRENT_POSITION))
|
||||||
? R.id.radio_current_end
|
? R.id.radio_current_end
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
Pkg.UserSrc=false
|
Pkg.UserSrc=false
|
||||||
Pkg.Revision=${PLATFORM_SDK_VERSION}.0.0
|
Pkg.Revision=${PLATFORM_SDK_VERSION}.0.1
|
||||||
#Pkg.Revision=33.0.0 rc4
|
#Pkg.Revision=33.0.0 rc4
|
||||||
|
|||||||
Reference in New Issue
Block a user