summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRobert Carr2016-03-24 14:19:32 -0500
committerRobert Carr2016-04-17 22:07:34 -0500
commitc3574f7b0141c69fdca25ccafb80ff334462f9a3 (patch)
tree7830169cb6639cbd8d612b34d27a605362e41c40 /libs
parent47babb84bcd2dcf4943687e33595ba58dc0dbe28 (diff)
downloadframeworks-native-c3574f7b0141c69fdca25ccafb80ff334462f9a3.tar.gz
frameworks-native-c3574f7b0141c69fdca25ccafb80ff334462f9a3.tar.xz
frameworks-native-c3574f7b0141c69fdca25ccafb80ff334462f9a3.zip
Add setOverrideScalingMode to SurfaceControl
Provide an interface for the window manager to override the client specified scaling mode. This makes it possible for the window manager to force windows to be scaleable for animations, etc, even when a resize is pending. Bug: 27891386 Change-Id: Ic4aae9917bd6869ee0dbb425979b4e21c68342a3
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/LayerState.cpp2
-rw-r--r--libs/gui/SurfaceComposerClient.cpp35
-rw-r--r--libs/gui/SurfaceControl.cpp6
3 files changed, 43 insertions, 0 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index e43342e34..d1c576e4c 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -41,6 +41,7 @@ status_t layer_state_t::write(Parcel& output) const
41 output.write(finalCrop); 41 output.write(finalCrop);
42 output.writeStrongBinder(handle); 42 output.writeStrongBinder(handle);
43 output.writeUint64(frameNumber); 43 output.writeUint64(frameNumber);
44 output.writeInt32(overrideScalingMode);
44 output.write(transparentRegion); 45 output.write(transparentRegion);
45 return NO_ERROR; 46 return NO_ERROR;
46} 47}
@@ -68,6 +69,7 @@ status_t layer_state_t::read(const Parcel& input)
68 input.read(finalCrop); 69 input.read(finalCrop);
69 handle = input.readStrongBinder(); 70 handle = input.readStrongBinder();
70 frameNumber = input.readUint64(); 71 frameNumber = input.readUint64();
72 overrideScalingMode = input.readInt32();
71 input.read(transparentRegion); 73 input.read(transparentRegion);
72 return NO_ERROR; 74 return NO_ERROR;
73} 75}
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 418892a1c..e33cc37b2 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -163,6 +163,8 @@ public:
163 status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client, 163 status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
164 const sp<IBinder>& id, const sp<IBinder>& handle, 164 const sp<IBinder>& id, const sp<IBinder>& handle,
165 uint64_t frameNumber); 165 uint64_t frameNumber);
166 status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client,
167 const sp<IBinder>& id, int32_t overrideScalingMode);
166 168
167 void setDisplaySurface(const sp<IBinder>& token, 169 void setDisplaySurface(const sp<IBinder>& token,
168 const sp<IGraphicBufferProducer>& bufferProducer); 170 const sp<IGraphicBufferProducer>& bufferProducer);
@@ -414,6 +416,33 @@ status_t Composer::deferTransactionUntil(
414 return NO_ERROR; 416 return NO_ERROR;
415} 417}
416 418
419status_t Composer::setOverrideScalingMode(
420 const sp<SurfaceComposerClient>& client,
421 const sp<IBinder>& id, int32_t overrideScalingMode) {
422 Mutex::Autolock lock(mLock);
423 layer_state_t* s = getLayerStateLocked(client, id);
424 if (!s) {
425 return BAD_INDEX;
426 }
427
428 switch (overrideScalingMode) {
429 case NATIVE_WINDOW_SCALING_MODE_FREEZE:
430 case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
431 case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP:
432 case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP:
433 case -1:
434 break;
435 default:
436 ALOGE("unknown scaling mode: %d",
437 overrideScalingMode);
438 return BAD_VALUE;
439 }
440
441 s->what |= layer_state_t::eOverrideScalingModeChanged;
442 s->overrideScalingMode = overrideScalingMode;
443 return NO_ERROR;
444}
445
417// --------------------------------------------------------------------------- 446// ---------------------------------------------------------------------------
418 447
419DisplayState& Composer::getDisplayStateLocked(const sp<IBinder>& token) { 448DisplayState& Composer::getDisplayStateLocked(const sp<IBinder>& token) {
@@ -650,6 +679,12 @@ status_t SurfaceComposerClient::deferTransactionUntil(const sp<IBinder>& id,
650 return getComposer().deferTransactionUntil(this, id, handle, frameNumber); 679 return getComposer().deferTransactionUntil(this, id, handle, frameNumber);
651} 680}
652 681
682status_t SurfaceComposerClient::setOverrideScalingMode(
683 const sp<IBinder>& id, int32_t overrideScalingMode) {
684 return getComposer().setOverrideScalingMode(
685 this, id, overrideScalingMode);
686}
687
653// ---------------------------------------------------------------------------- 688// ----------------------------------------------------------------------------
654 689
655void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token, 690void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token,
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 184de7198..314d83a20 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -165,6 +165,12 @@ status_t SurfaceControl::deferTransactionUntil(sp<IBinder> handle,
165 return mClient->deferTransactionUntil(mHandle, handle, frameNumber); 165 return mClient->deferTransactionUntil(mHandle, handle, frameNumber);
166} 166}
167 167
168status_t SurfaceControl::setOverrideScalingMode(int32_t overrideScalingMode) {
169 status_t err = validate();
170 if (err < 0) return err;
171 return mClient->setOverrideScalingMode(mHandle, overrideScalingMode);
172}
173
168status_t SurfaceControl::clearLayerFrameStats() const { 174status_t SurfaceControl::clearLayerFrameStats() const {
169 status_t err = validate(); 175 status_t err = validate();
170 if (err < 0) return err; 176 if (err < 0) return err;