Loading core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2784,6 +2784,11 @@ the display's native orientation. --> <string translatable="false" name="config_mainBuiltInDisplayCutout"></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">false</bool> <!-- Ultrasound support for Mic/speaker path --> <!-- Whether the default microphone audio source supports near-ultrasound frequencies (range of 18 - 21 kHz). --> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -3203,6 +3203,7 @@ <java-symbol type="string" name="global_action_logout" /> <java-symbol type="string" name="config_mainBuiltInDisplayCutout" /> <java-symbol type="bool" name="config_fillMainBuiltInDisplayCutout" /> <java-symbol type="drawable" name="ic_logout" /> <java-symbol type="array" name="config_autoBrightnessDisplayValuesNits" /> Loading packages/SystemUI/src/com/android/systemui/EmulatedDisplayCutout.java +18 −16 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ import android.view.ViewGroup.LayoutParams; import android.view.WindowInsets; import android.view.WindowManager; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import java.util.Collections; import java.util.List; Loading @@ -45,18 +48,28 @@ import java.util.List; * Emulates a display cutout by drawing its shape in an overlay as supplied by * {@link DisplayCutout}. */ public class EmulatedDisplayCutout extends SystemUI { public class EmulatedDisplayCutout extends SystemUI implements ConfigurationListener { private View mOverlay; private boolean mAttached; private WindowManager mWindowManager; @Override public void start() { Dependency.get(ConfigurationController.class).addCallback(this); mWindowManager = mContext.getSystemService(WindowManager.class); mContext.getContentResolver().registerContentObserver( Settings.Global.getUriFor(Settings.Global.EMULATE_DISPLAY_CUTOUT), false, mObserver, UserHandle.USER_ALL); mObserver.onChange(false); updateAttached(); } @Override public void onOverlayChanged() { updateAttached(); } private void updateAttached() { boolean shouldAttach = mContext.getResources().getBoolean( com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout); setAttached(shouldAttach); } private void setAttached(boolean attached) { Loading Loading @@ -94,17 +107,6 @@ public class EmulatedDisplayCutout extends SystemUI { return lp; } private ContentObserver mObserver = new ContentObserver(new Handler(Looper.getMainLooper())) { @Override public void onChange(boolean selfChange) { boolean emulateCutout = Settings.Global.getInt( mContext.getContentResolver(), Settings.Global.EMULATE_DISPLAY_CUTOUT, Settings.Global.EMULATE_DISPLAY_CUTOUT_OFF) != Settings.Global.EMULATE_DISPLAY_CUTOUT_OFF; setAttached(emulateCutout); } }; private static class CutoutView extends View { private final Paint mPaint = new Paint(); private final Path mBounds = new Path(); Loading packages/overlays/DisplayCutoutEmulationOverlay/Android.mk 0 → 100644 +13 −0 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_RRO_THEME := DisplayCutoutEmulation LOCAL_CERTIFICATE := platform LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res LOCAL_PACKAGE_NAME := DisplayCutoutEmulationOverlay include $(BUILD_RRO_PACKAGE) packages/overlays/DisplayCutoutEmulationOverlay/AndroidManifest.xml 0 → 100644 +8 −0 Original line number Diff line number Diff line <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.internal.display.cutout.emulation" android:versionCode="1" android:versionName="1.0"> <overlay android:targetPackage="android" android:priority="1"/> <application android:label="@string/display_cutout_emulation_overlay" android:hasCode="false"/> </manifest> Loading
core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2784,6 +2784,11 @@ the display's native orientation. --> <string translatable="false" name="config_mainBuiltInDisplayCutout"></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">false</bool> <!-- Ultrasound support for Mic/speaker path --> <!-- Whether the default microphone audio source supports near-ultrasound frequencies (range of 18 - 21 kHz). --> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -3203,6 +3203,7 @@ <java-symbol type="string" name="global_action_logout" /> <java-symbol type="string" name="config_mainBuiltInDisplayCutout" /> <java-symbol type="bool" name="config_fillMainBuiltInDisplayCutout" /> <java-symbol type="drawable" name="ic_logout" /> <java-symbol type="array" name="config_autoBrightnessDisplayValuesNits" /> Loading
packages/SystemUI/src/com/android/systemui/EmulatedDisplayCutout.java +18 −16 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ import android.view.ViewGroup.LayoutParams; import android.view.WindowInsets; import android.view.WindowManager; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import java.util.Collections; import java.util.List; Loading @@ -45,18 +48,28 @@ import java.util.List; * Emulates a display cutout by drawing its shape in an overlay as supplied by * {@link DisplayCutout}. */ public class EmulatedDisplayCutout extends SystemUI { public class EmulatedDisplayCutout extends SystemUI implements ConfigurationListener { private View mOverlay; private boolean mAttached; private WindowManager mWindowManager; @Override public void start() { Dependency.get(ConfigurationController.class).addCallback(this); mWindowManager = mContext.getSystemService(WindowManager.class); mContext.getContentResolver().registerContentObserver( Settings.Global.getUriFor(Settings.Global.EMULATE_DISPLAY_CUTOUT), false, mObserver, UserHandle.USER_ALL); mObserver.onChange(false); updateAttached(); } @Override public void onOverlayChanged() { updateAttached(); } private void updateAttached() { boolean shouldAttach = mContext.getResources().getBoolean( com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout); setAttached(shouldAttach); } private void setAttached(boolean attached) { Loading Loading @@ -94,17 +107,6 @@ public class EmulatedDisplayCutout extends SystemUI { return lp; } private ContentObserver mObserver = new ContentObserver(new Handler(Looper.getMainLooper())) { @Override public void onChange(boolean selfChange) { boolean emulateCutout = Settings.Global.getInt( mContext.getContentResolver(), Settings.Global.EMULATE_DISPLAY_CUTOUT, Settings.Global.EMULATE_DISPLAY_CUTOUT_OFF) != Settings.Global.EMULATE_DISPLAY_CUTOUT_OFF; setAttached(emulateCutout); } }; private static class CutoutView extends View { private final Paint mPaint = new Paint(); private final Path mBounds = new Path(); Loading
packages/overlays/DisplayCutoutEmulationOverlay/Android.mk 0 → 100644 +13 −0 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_RRO_THEME := DisplayCutoutEmulation LOCAL_CERTIFICATE := platform LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res LOCAL_PACKAGE_NAME := DisplayCutoutEmulationOverlay include $(BUILD_RRO_PACKAGE)
packages/overlays/DisplayCutoutEmulationOverlay/AndroidManifest.xml 0 → 100644 +8 −0 Original line number Diff line number Diff line <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.internal.display.cutout.emulation" android:versionCode="1" android:versionName="1.0"> <overlay android:targetPackage="android" android:priority="1"/> <application android:label="@string/display_cutout_emulation_overlay" android:hasCode="false"/> </manifest>