Merge "Rename shouldUseDefaultUnfoldTransition attribute and update docs" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b85da640d1
@@ -1298,7 +1298,7 @@ package android {
|
|||||||
field public static final int shortcutLongLabel = 16844074; // 0x101052a
|
field public static final int shortcutLongLabel = 16844074; // 0x101052a
|
||||||
field public static final int shortcutShortLabel = 16844073; // 0x1010529
|
field public static final int shortcutShortLabel = 16844073; // 0x1010529
|
||||||
field public static final int shouldDisableView = 16843246; // 0x10101ee
|
field public static final int shouldDisableView = 16843246; // 0x10101ee
|
||||||
field public static final int shouldUseDefaultUnfoldTransition;
|
field public static final int shouldUseDefaultDeviceStateChangeTransition;
|
||||||
field public static final int showAsAction = 16843481; // 0x10102d9
|
field public static final int showAsAction = 16843481; // 0x10102d9
|
||||||
field public static final int showDefault = 16843258; // 0x10101fa
|
field public static final int showDefault = 16843258; // 0x10101fa
|
||||||
field public static final int showDividers = 16843561; // 0x1010329
|
field public static final int showDividers = 16843561; // 0x1010329
|
||||||
@@ -6927,7 +6927,7 @@ package android.app {
|
|||||||
method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
|
method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
|
||||||
method public CharSequence loadLabel(android.content.pm.PackageManager);
|
method public CharSequence loadLabel(android.content.pm.PackageManager);
|
||||||
method public android.graphics.drawable.Drawable loadThumbnail(android.content.pm.PackageManager);
|
method public android.graphics.drawable.Drawable loadThumbnail(android.content.pm.PackageManager);
|
||||||
method public boolean shouldUseDefaultUnfoldTransition();
|
method public boolean shouldUseDefaultDeviceStateChangeTransition();
|
||||||
method public boolean supportsMultipleDisplays();
|
method public boolean supportsMultipleDisplays();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperInfo> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperInfo> CREATOR;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public final class WallpaperInfo implements Parcelable {
|
|||||||
final int mContextDescriptionResource;
|
final int mContextDescriptionResource;
|
||||||
final boolean mShowMetadataInPreview;
|
final boolean mShowMetadataInPreview;
|
||||||
final boolean mSupportsAmbientMode;
|
final boolean mSupportsAmbientMode;
|
||||||
final boolean mShouldUseDefaultUnfoldTransition;
|
final boolean mShouldUseDefaultDeviceStateChangeTransition;
|
||||||
final String mSettingsSliceUri;
|
final String mSettingsSliceUri;
|
||||||
final boolean mSupportMultipleDisplays;
|
final boolean mSupportMultipleDisplays;
|
||||||
|
|
||||||
@@ -146,9 +146,9 @@ public final class WallpaperInfo implements Parcelable {
|
|||||||
mSupportsAmbientMode = sa.getBoolean(
|
mSupportsAmbientMode = sa.getBoolean(
|
||||||
com.android.internal.R.styleable.Wallpaper_supportsAmbientMode,
|
com.android.internal.R.styleable.Wallpaper_supportsAmbientMode,
|
||||||
false);
|
false);
|
||||||
mShouldUseDefaultUnfoldTransition = sa.getBoolean(
|
mShouldUseDefaultDeviceStateChangeTransition = sa.getBoolean(
|
||||||
com.android.internal.R.styleable.Wallpaper_shouldUseDefaultUnfoldTransition,
|
com.android.internal.R.styleable
|
||||||
true);
|
.Wallpaper_shouldUseDefaultDeviceStateChangeTransition, true);
|
||||||
mSettingsSliceUri = sa.getString(
|
mSettingsSliceUri = sa.getString(
|
||||||
com.android.internal.R.styleable.Wallpaper_settingsSliceUri);
|
com.android.internal.R.styleable.Wallpaper_settingsSliceUri);
|
||||||
mSupportMultipleDisplays = sa.getBoolean(
|
mSupportMultipleDisplays = sa.getBoolean(
|
||||||
@@ -175,7 +175,7 @@ public final class WallpaperInfo implements Parcelable {
|
|||||||
mSupportsAmbientMode = source.readInt() != 0;
|
mSupportsAmbientMode = source.readInt() != 0;
|
||||||
mSettingsSliceUri = source.readString();
|
mSettingsSliceUri = source.readString();
|
||||||
mSupportMultipleDisplays = source.readInt() != 0;
|
mSupportMultipleDisplays = source.readInt() != 0;
|
||||||
mShouldUseDefaultUnfoldTransition = source.readInt() != 0;
|
mShouldUseDefaultDeviceStateChangeTransition = source.readInt() != 0;
|
||||||
mService = ResolveInfo.CREATOR.createFromParcel(source);
|
mService = ResolveInfo.CREATOR.createFromParcel(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,23 +399,25 @@ public final class WallpaperInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this wallpaper should receive default zooming updates when unfolding.
|
* Returns whether this wallpaper should receive default zooming updates when the device
|
||||||
* If set to false the wallpaper will not receive zoom events when folding or unfolding
|
* changes its state (e.g. when folding or unfolding a foldable device).
|
||||||
* a foldable device, so it can implement its own unfold transition.
|
* If set to false the wallpaper will not receive zoom events when changing the device state,
|
||||||
|
* so it can implement its own transition instead.
|
||||||
* <p>
|
* <p>
|
||||||
* This corresponds to the value {@link
|
* This corresponds to the value {@link
|
||||||
* android.R.styleable#Wallpaper_shouldUseDefaultUnfoldTransition} in the XML description
|
* android.R.styleable#Wallpaper_shouldUseDefaultDeviceStateChangeTransition} in the
|
||||||
* of the wallpaper.
|
* XML description of the wallpaper.
|
||||||
* <p>
|
* <p>
|
||||||
* The default value is {@code true}.
|
* The default value is {@code true}.
|
||||||
*
|
*
|
||||||
* @see android.R.styleable#Wallpaper_shouldUseDefaultUnfoldTransition
|
* @see android.R.styleable#Wallpaper_shouldUseDefaultDeviceStateChangeTransition
|
||||||
* @return {@code true} if wallpaper should receive default fold/unfold transition updates
|
* @return {@code true} if wallpaper should receive default device state change
|
||||||
|
* transition updates
|
||||||
*
|
*
|
||||||
* @attr ref android.R.styleable#Wallpaper_shouldUseDefaultUnfoldTransition
|
* @attr ref android.R.styleable#Wallpaper_shouldUseDefaultDeviceStateChangeTransition
|
||||||
*/
|
*/
|
||||||
public boolean shouldUseDefaultUnfoldTransition() {
|
public boolean shouldUseDefaultDeviceStateChangeTransition() {
|
||||||
return mShouldUseDefaultUnfoldTransition;
|
return mShouldUseDefaultDeviceStateChangeTransition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dump(Printer pw, String prefix) {
|
public void dump(Printer pw, String prefix) {
|
||||||
@@ -448,7 +450,7 @@ public final class WallpaperInfo implements Parcelable {
|
|||||||
dest.writeInt(mSupportsAmbientMode ? 1 : 0);
|
dest.writeInt(mSupportsAmbientMode ? 1 : 0);
|
||||||
dest.writeString(mSettingsSliceUri);
|
dest.writeString(mSettingsSliceUri);
|
||||||
dest.writeInt(mSupportMultipleDisplays ? 1 : 0);
|
dest.writeInt(mSupportMultipleDisplays ? 1 : 0);
|
||||||
dest.writeInt(mShouldUseDefaultUnfoldTransition ? 1 : 0);
|
dest.writeInt(mShouldUseDefaultDeviceStateChangeTransition ? 1 : 0);
|
||||||
mService.writeToParcel(dest, flags);
|
mService.writeToParcel(dest, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8371,16 +8371,18 @@
|
|||||||
@hide @SystemApi -->
|
@hide @SystemApi -->
|
||||||
<attr name="supportsAmbientMode" format="boolean" />
|
<attr name="supportsAmbientMode" format="boolean" />
|
||||||
|
|
||||||
<!-- Indicates that this wallpaper service should receive zoom updates when unfolding.
|
<!-- Indicates that this wallpaper service should receive zoom transition updates when
|
||||||
|
changing the device state (e.g. when folding or unfolding a foldable device).
|
||||||
When this value is set to true
|
When this value is set to true
|
||||||
{@link android.service.wallpaper.WallpaperService.Engine} could receive zoom updates
|
{@link android.service.wallpaper.WallpaperService.Engine} could receive zoom updates
|
||||||
when folding or unfolding a foldable device. Wallpapers receive zoom updates using
|
before or after changing the device state. Wallpapers receive zoom updates using
|
||||||
{@link android.service.wallpaper.WallpaperService.Engine#onZoomChanged(float)} and
|
{@link android.service.wallpaper.WallpaperService.Engine#onZoomChanged(float)} and
|
||||||
zoom rendering should be handled manually. Default value is true.
|
zoom rendering should be handled manually. Zoom updates are delivered only when
|
||||||
When set to false wallpapers can implement custom folding/unfolding behavior
|
{@link android.service.wallpaper.WallpaperService.Engine} is created and not destroyed.
|
||||||
by listening to {@link android.hardware.Sensor#TYPE_HINGE_ANGLE}.
|
Default value is true.
|
||||||
Corresponds to {@link android.app.WallpaperInfo#shouldUseDefaultUnfoldTransition()} -->
|
Corresponds to
|
||||||
<attr name="shouldUseDefaultUnfoldTransition" format="boolean" />
|
{@link android.app.WallpaperInfo#shouldUseDefaultDeviceStateChangeTransition()} -->
|
||||||
|
<attr name="shouldUseDefaultDeviceStateChangeTransition" format="boolean" />
|
||||||
|
|
||||||
<!-- Uri that specifies a settings Slice for this wallpaper. -->
|
<!-- Uri that specifies a settings Slice for this wallpaper. -->
|
||||||
<attr name="settingsSliceUri" format="string"/>
|
<attr name="settingsSliceUri" format="string"/>
|
||||||
|
|||||||
@@ -3221,7 +3221,7 @@
|
|||||||
<eat-comment />
|
<eat-comment />
|
||||||
|
|
||||||
<staging-public-group type="attr" first-id="0x01ff0000">
|
<staging-public-group type="attr" first-id="0x01ff0000">
|
||||||
<public name="shouldUseDefaultUnfoldTransition" />
|
<public name="shouldUseDefaultDeviceStateChangeTransition" />
|
||||||
</staging-public-group>
|
</staging-public-group>
|
||||||
|
|
||||||
<staging-public-group type="id" first-id="0x01fe0000">
|
<staging-public-group type="id" first-id="0x01fe0000">
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ class WallpaperController @Inject constructor(private val wallpaperManager: Wall
|
|||||||
this.wallpaperInfo = wallpaperInfo
|
this.wallpaperInfo = wallpaperInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
private val shouldUseDefaultUnfoldTransition: Boolean
|
private val shouldUseDefaultDeviceStateChangeTransition: Boolean
|
||||||
get() = wallpaperInfo?.shouldUseDefaultUnfoldTransition()
|
get() = wallpaperInfo?.shouldUseDefaultDeviceStateChangeTransition()
|
||||||
?: true
|
?: true
|
||||||
|
|
||||||
fun setNotificationShadeZoom(zoomOut: Float) {
|
fun setNotificationShadeZoom(zoomOut: Float) {
|
||||||
@@ -50,7 +50,7 @@ class WallpaperController @Inject constructor(private val wallpaperManager: Wall
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setUnfoldTransitionZoom(zoomOut: Float) {
|
fun setUnfoldTransitionZoom(zoomOut: Float) {
|
||||||
if (shouldUseDefaultUnfoldTransition) {
|
if (shouldUseDefaultDeviceStateChangeTransition) {
|
||||||
unfoldTransitionZoomOut = zoomOut
|
unfoldTransitionZoomOut = zoomOut
|
||||||
updateZoom()
|
updateZoom()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class WallpaperControllerTest : SysuiTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun setUnfoldTransitionZoom_defaultUnfoldTransitionIsDisabled_doesNotUpdateWallpaperZoom() {
|
fun setUnfoldTransitionZoom_defaultUnfoldTransitionIsDisabled_doesNotUpdateWallpaperZoom() {
|
||||||
wallaperController.onWallpaperInfoUpdated(createWallpaperInfo(
|
wallaperController.onWallpaperInfoUpdated(createWallpaperInfo(
|
||||||
useDefaultUnfoldTransition = false
|
useDefaultTransition = false
|
||||||
))
|
))
|
||||||
|
|
||||||
wallaperController.setUnfoldTransitionZoom(0.5f)
|
wallaperController.setUnfoldTransitionZoom(0.5f)
|
||||||
@@ -136,9 +136,10 @@ class WallpaperControllerTest : SysuiTestCase() {
|
|||||||
verify(wallpaperManager).setWallpaperZoomOut(any(), anyFloat())
|
verify(wallpaperManager).setWallpaperZoomOut(any(), anyFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createWallpaperInfo(useDefaultUnfoldTransition: Boolean = true): WallpaperInfo {
|
private fun createWallpaperInfo(useDefaultTransition: Boolean = true): WallpaperInfo {
|
||||||
val info = mock(WallpaperInfo::class.java)
|
val info = mock(WallpaperInfo::class.java)
|
||||||
whenever(info.shouldUseDefaultUnfoldTransition()).thenReturn(useDefaultUnfoldTransition)
|
whenever(info.shouldUseDefaultDeviceStateChangeTransition())
|
||||||
|
.thenReturn(useDefaultTransition)
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user