1/*
2 * Copyright (C) 2017 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
17package com.android.settings.display;
18
19import android.os.PowerManager;
20
21/**
22 * This class replicates a subset of the android.os.PowerManager. The class exists so that we can
23 * use a thin wrapper around the PowerManager in production code and a mock in tests. We cannot
24 * directly mock or shadow the PowerManager, because some of the methods we rely on are newer than
25 * the API version supported by Robolectric or are hidden.
26 */
27public class PowerManagerWrapper {
28    private final PowerManager mPowerManager;
29
30    public PowerManagerWrapper(PowerManager powerManager) {
31        mPowerManager = powerManager;
32    }
33
34    public int getMinimumScreenBrightnessSetting() {
35        return mPowerManager.getMinimumScreenBrightnessSetting();
36    }
37
38    public int getMaximumScreenBrightnessSetting() {
39        return mPowerManager.getMaximumScreenBrightnessSetting();
40    }
41
42    public int getMinimumScreenBrightnessForVrSetting() {
43        return mPowerManager.getMinimumScreenBrightnessForVrSetting();
44    }
45
46    public int getMaximumScreenBrightnessForVrSetting() {
47        return mPowerManager.getMaximumScreenBrightnessForVrSetting();
48    }
49}
50