1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import android.annotation.NonNull; 18 import android.hardware.display.DisplayManager; 19 import android.view.Display; 20 21 public class DisplayManagerCompat { 22 private final DisplayManager mManager; 23 areUserDisabledHdrTypesAllowed()24 public boolean areUserDisabledHdrTypesAllowed() { 25 return this.mManager.areUserDisabledHdrTypesAllowed(); 26 } 27 DisplayManagerCompat(DisplayManager manager)28 public DisplayManagerCompat(DisplayManager manager) { 29 this.mManager = manager; 30 } 31 32 getGlobalUserPreferredDisplayMode()33 public Display.Mode getGlobalUserPreferredDisplayMode() { 34 return mManager.getGlobalUserPreferredDisplayMode(); 35 } 36 setGlobalUserPreferredDisplayMode(@onNull Display.Mode mode)37 public void setGlobalUserPreferredDisplayMode(@NonNull Display.Mode mode) { 38 mManager.setGlobalUserPreferredDisplayMode(mode); 39 } 40 clearGlobalUserPreferredDisplayMode()41 public void clearGlobalUserPreferredDisplayMode() { 42 mManager.clearGlobalUserPreferredDisplayMode(); 43 } 44 setUserDisabledHdrTypes( @onNull @isplay.HdrCapabilities.HdrType int[] userDisabledTypes)45 public void setUserDisabledHdrTypes( 46 @NonNull @Display.HdrCapabilities.HdrType int[] userDisabledTypes) { 47 mManager.setUserDisabledHdrTypes(userDisabledTypes); 48 } 49 50 public @NonNull getUserDisabledHdrTypes()51 int[] getUserDisabledHdrTypes() { 52 return mManager.getUserDisabledHdrTypes(); 53 } 54 setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed)55 public void setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed) { 56 mManager.setAreUserDisabledHdrTypesAllowed(areUserDisabledHdrTypesAllowed); 57 } 58 } 59