Update to new method to check if app supports picture-in-picture.
- With change ag/1705896, we are no longer using resizeMode to check for picture-in-picture support. Bug: 34256643 Test: make -j40 RunSettingsRoboTests Change-Id: Iea0c6e76db52d994295922580f14bb0cb0d65451
This commit is contained in:
@@ -24,7 +24,7 @@ package com.android.settings.applications;
|
||||
public interface ActivityInfoWrapper {
|
||||
|
||||
/**
|
||||
* Returns the resizeMode of the activity.
|
||||
* Returns whether this activity supports picture-in-picture.
|
||||
*/
|
||||
int getResizeMode();
|
||||
boolean supportsPictureInPicture();
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public class ActivityInfoWrapperImpl implements ActivityInfoWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResizeMode() {
|
||||
return mInfo.resizeMode;
|
||||
public boolean supportsPictureInPicture() {
|
||||
return mInfo.supportsPictureInPicture();
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.applications;
|
||||
import static android.app.AppOpsManager.MODE_ALLOWED;
|
||||
import static android.app.AppOpsManager.MODE_ERRORED;
|
||||
import static android.app.AppOpsManager.OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE;
|
||||
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
|
||||
import static android.content.pm.PackageManager.GET_ACTIVITIES;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
@@ -91,7 +90,7 @@ public class PictureInPictureSettings extends EmptyTextSettings {
|
||||
// picture-in-picture
|
||||
if (activities != null) {
|
||||
for (int i = activities.length - 1; i >= 0; i--) {
|
||||
if (activities[i].getResizeMode() == RESIZE_MODE_RESIZEABLE_AND_PIPABLE) {
|
||||
if (activities[i].supportsPictureInPicture()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -107,9 +107,7 @@ public class PictureInPictureSettingsTest {
|
||||
if (resizeableActivityState.length > 0) {
|
||||
activities = new ActivityInfoWrapper[resizeableActivityState.length];
|
||||
for (int i = 0; i < activities.length; i++) {
|
||||
activities[i] = new MockActivityInfo(resizeableActivityState[i]
|
||||
? ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE
|
||||
: ActivityInfo.RESIZE_MODE_UNRESIZEABLE);
|
||||
activities[i] = new MockActivityInfo(resizeableActivityState[i]);
|
||||
}
|
||||
}
|
||||
return PictureInPictureSettings.checkPackageHasPictureInPictureActivities(packageName,
|
||||
@@ -118,15 +116,15 @@ public class PictureInPictureSettingsTest {
|
||||
|
||||
private class MockActivityInfo implements ActivityInfoWrapper {
|
||||
|
||||
private int mResizeMode;
|
||||
private boolean mSupportsPictureInPicture;
|
||||
|
||||
public MockActivityInfo(int resizeMode) {
|
||||
mResizeMode = resizeMode;
|
||||
public MockActivityInfo(boolean supportsPictureInPicture) {
|
||||
mSupportsPictureInPicture = supportsPictureInPicture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResizeMode() {
|
||||
return mResizeMode;
|
||||
public boolean supportsPictureInPicture() {
|
||||
return mSupportsPictureInPicture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user