Loading core/java/android/view/DisplayCutout.java +9 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public final class DisplayCutout { private static final String TAG = "DisplayCutout"; private static final String BOTTOM_MARKER = "@bottom"; private static final String DP_MARKER = "@dp"; private static final String RIGHT_MARKER = "@right"; /** * Category for overlays that allow emulating a display cutout on devices that don't have Loading Loading @@ -373,6 +374,13 @@ public final class DisplayCutout { } } spec = spec.trim(); final float offsetX; if (spec.endsWith(RIGHT_MARKER)) { offsetX = displayWidth; spec = spec.substring(0, spec.length() - RIGHT_MARKER.length()).trim(); } else { offsetX = displayWidth / 2f; } final boolean inDp = spec.endsWith(DP_MARKER); if (inDp) { spec = spec.substring(0, spec.length() - DP_MARKER.length()); Loading @@ -397,7 +405,7 @@ public final class DisplayCutout { if (inDp) { m.postScale(density, density); } m.postTranslate(displayWidth / 2f, 0); m.postTranslate(offsetX, 0); p.transform(m); if (bottomSpec != null) { Loading packages/overlays/DisplayCutoutEmulationCornerOverlay/Android.mk 0 → 100644 +14 −0 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_RRO_THEME := DisplayCutoutEmulationCorner LOCAL_CERTIFICATE := platform LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res LOCAL_PACKAGE_NAME := DisplayCutoutEmulationCornerOverlay LOCAL_SDK_VERSION := current include $(BUILD_RRO_PACKAGE) packages/overlays/DisplayCutoutEmulationCornerOverlay/AndroidManifest.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.internal.display.cutout.emulation.corner" android:versionCode="1" android:versionName="1.0"> <overlay android:targetPackage="android" android:category="com.android.internal.display_cutout_emulation" android:priority="1"/> <application android:label="@string/display_cutout_emulation_overlay" android:hasCode="false"/> </manifest> packages/overlays/DisplayCutoutEmulationCornerOverlay/res/values/config.xml 0 → 100644 +55 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- The bounding path of the cutout region of the main built-in display. Must either be empty if there is no cutout region, or a string that is parsable by {@link android.util.PathParser}. The path is assumed to be specified in display coordinates with pixel units and in the display's native orientation, with the origin of the coordinate system at the center top of the display. To facilitate writing device-independent emulation overlays, the marker `@dp` can be appended after the path string to interpret coordinates in dp instead of px units. Note that a physical cutout should be configured in pixels for the best results. --> <string translatable="false" name="config_mainBuiltInDisplayCutout"> M 0,0 L -48, 0 C -48,48 -48,48 0,48 Z @dp @right </string> <!-- Whether the display cutout region of the main built-in display should be forced to black in software (to avoid aliasing or emulate a cutout that is not physically existent). --> <bool name="config_fillMainBuiltInDisplayCutout">true</bool> <!-- Height of the status bar --> <dimen name="status_bar_height_portrait">48dp</dimen> <dimen name="status_bar_height_landscape">28dp</dimen> <!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) --> <dimen name="quick_qs_offset_height">48dp</dimen> <!-- Total height of QQS (quick_qs_offset_height + 128) --> <dimen name="quick_qs_total_height">176dp</dimen> </resources> packages/overlays/DisplayCutoutEmulationCornerOverlay/res/values/strings.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="display_cutout_emulation_overlay">Corner display cutout</string> </resources> Loading
core/java/android/view/DisplayCutout.java +9 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public final class DisplayCutout { private static final String TAG = "DisplayCutout"; private static final String BOTTOM_MARKER = "@bottom"; private static final String DP_MARKER = "@dp"; private static final String RIGHT_MARKER = "@right"; /** * Category for overlays that allow emulating a display cutout on devices that don't have Loading Loading @@ -373,6 +374,13 @@ public final class DisplayCutout { } } spec = spec.trim(); final float offsetX; if (spec.endsWith(RIGHT_MARKER)) { offsetX = displayWidth; spec = spec.substring(0, spec.length() - RIGHT_MARKER.length()).trim(); } else { offsetX = displayWidth / 2f; } final boolean inDp = spec.endsWith(DP_MARKER); if (inDp) { spec = spec.substring(0, spec.length() - DP_MARKER.length()); Loading @@ -397,7 +405,7 @@ public final class DisplayCutout { if (inDp) { m.postScale(density, density); } m.postTranslate(displayWidth / 2f, 0); m.postTranslate(offsetX, 0); p.transform(m); if (bottomSpec != null) { Loading
packages/overlays/DisplayCutoutEmulationCornerOverlay/Android.mk 0 → 100644 +14 −0 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_RRO_THEME := DisplayCutoutEmulationCorner LOCAL_CERTIFICATE := platform LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res LOCAL_PACKAGE_NAME := DisplayCutoutEmulationCornerOverlay LOCAL_SDK_VERSION := current include $(BUILD_RRO_PACKAGE)
packages/overlays/DisplayCutoutEmulationCornerOverlay/AndroidManifest.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.internal.display.cutout.emulation.corner" android:versionCode="1" android:versionName="1.0"> <overlay android:targetPackage="android" android:category="com.android.internal.display_cutout_emulation" android:priority="1"/> <application android:label="@string/display_cutout_emulation_overlay" android:hasCode="false"/> </manifest>
packages/overlays/DisplayCutoutEmulationCornerOverlay/res/values/config.xml 0 → 100644 +55 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- The bounding path of the cutout region of the main built-in display. Must either be empty if there is no cutout region, or a string that is parsable by {@link android.util.PathParser}. The path is assumed to be specified in display coordinates with pixel units and in the display's native orientation, with the origin of the coordinate system at the center top of the display. To facilitate writing device-independent emulation overlays, the marker `@dp` can be appended after the path string to interpret coordinates in dp instead of px units. Note that a physical cutout should be configured in pixels for the best results. --> <string translatable="false" name="config_mainBuiltInDisplayCutout"> M 0,0 L -48, 0 C -48,48 -48,48 0,48 Z @dp @right </string> <!-- Whether the display cutout region of the main built-in display should be forced to black in software (to avoid aliasing or emulate a cutout that is not physically existent). --> <bool name="config_fillMainBuiltInDisplayCutout">true</bool> <!-- Height of the status bar --> <dimen name="status_bar_height_portrait">48dp</dimen> <dimen name="status_bar_height_landscape">28dp</dimen> <!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) --> <dimen name="quick_qs_offset_height">48dp</dimen> <!-- Total height of QQS (quick_qs_offset_height + 128) --> <dimen name="quick_qs_total_height">176dp</dimen> </resources>
packages/overlays/DisplayCutoutEmulationCornerOverlay/res/values/strings.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2018 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="display_cutout_emulation_overlay">Corner display cutout</string> </resources>