Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
fd5cf919
Commit
fd5cf919
authored
10 months ago
by
Evan Laird
Committed by
Android (Google) Code Review
10 months ago
Browse files
Options
Downloads
Plain Diff
Merge "Add pixel scaling to ScreenDecorationUtils" into main
parents
df1c21a4
1bd66245
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/java/com/android/internal/policy/ScreenDecorationsUtils.java
+23
-0
23 additions, 0 deletions
...a/com/android/internal/policy/ScreenDecorationsUtils.java
with
23 additions
and
0 deletions
core/java/com/android/internal/policy/ScreenDecorationsUtils.java
+
23
−
0
View file @
fd5cf919
...
...
@@ -18,6 +18,9 @@ package com.android.internal.policy;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.util.DisplayUtils
;
import
android.view.Display
;
import
android.view.DisplayInfo
;
import
android.view.RoundedCorners
;
import
com.android.internal.R
;
...
...
@@ -57,11 +60,31 @@ public class ScreenDecorationsUtils {
bottomRadius
=
defaultRadius
;
}
// If the physical pixels are scaled, apply it here
float
scale
=
getPhysicalPixelDisplaySizeRatio
(
context
);
if
(
scale
!=
1
f
)
{
topRadius
=
topRadius
*
scale
;
bottomRadius
=
bottomRadius
*
scale
;
}
// Always use the smallest radius to make sure the rounded corners will
// completely cover the display.
return
Math
.
min
(
topRadius
,
bottomRadius
);
}
static
float
getPhysicalPixelDisplaySizeRatio
(
Context
context
)
{
DisplayInfo
displayInfo
=
new
DisplayInfo
();
context
.
getDisplay
().
getDisplayInfo
(
displayInfo
);
final
Display
.
Mode
maxDisplayMode
=
DisplayUtils
.
getMaximumResolutionDisplayMode
(
displayInfo
.
supportedModes
);
if
(
maxDisplayMode
==
null
)
{
return
1
f
;
}
return
DisplayUtils
.
getPhysicalPixelDisplaySizeRatio
(
maxDisplayMode
.
getPhysicalWidth
(),
maxDisplayMode
.
getPhysicalHeight
(),
displayInfo
.
getNaturalWidth
(),
displayInfo
.
getNaturalHeight
());
}
/**
* If live rounded corners are supported on windows.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment