• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 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 package com.android.layoutlib.bridge.android;
18 
19 import android.os.BatterySaverPolicyConfig;
20 import android.os.IBinder;
21 import android.os.IPowerManager;
22 import android.os.PowerManager;
23 import android.os.PowerManager.WakeReason;
24 import android.os.PowerSaveState;
25 import android.os.RemoteException;
26 import android.os.WorkSource;
27 
28 /**
29  * Fake implementation of IPowerManager.
30  */
31 public class BridgePowerManager implements IPowerManager {
32 
33     @Override
isInteractive()34     public boolean isInteractive() throws RemoteException {
35         return true;
36     }
37 
38     @Override
isPowerSaveMode()39     public boolean isPowerSaveMode() throws RemoteException {
40         return false;
41     }
42 
43     @Override
setPowerSaveModeEnabled(boolean mode)44     public boolean setPowerSaveModeEnabled(boolean mode) throws RemoteException {
45         return false;
46     }
47 
48     @Override
setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold)49     public boolean setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold)
50             throws RemoteException {
51         return false;
52     }
53 
54     @Override
setAdaptivePowerSavePolicy(BatterySaverPolicyConfig config)55     public boolean setAdaptivePowerSavePolicy(BatterySaverPolicyConfig config)
56             throws RemoteException {
57         return false;
58     }
59 
60     @Override
setAdaptivePowerSaveEnabled(boolean enabled)61     public boolean setAdaptivePowerSaveEnabled(boolean enabled) throws RemoteException {
62         return false;
63     }
64 
65     @Override
getPowerSaveModeTrigger()66     public int getPowerSaveModeTrigger() {
67         return 0;
68     }
69 
getPowerSaveState(int serviceType)70     public PowerSaveState getPowerSaveState(int serviceType) {
71         return null;
72     }
73 
74     @Override
asBinder()75     public IBinder asBinder() {
76         // pass for now.
77         return null;
78     }
79 
80     @Override
acquireWakeLock(IBinder arg0, int arg1, String arg2, String arg2_5, WorkSource arg3, String arg4)81     public void acquireWakeLock(IBinder arg0, int arg1, String arg2, String arg2_5, WorkSource arg3, String arg4)
82             throws RemoteException {
83         // pass for now.
84     }
85 
86     @Override
acquireWakeLockWithUid(IBinder arg0, int arg1, String arg2, String arg2_5, int arg3)87     public void acquireWakeLockWithUid(IBinder arg0, int arg1, String arg2, String arg2_5, int arg3)
88             throws RemoteException {
89         // pass for now.
90     }
91 
92     @Override
powerHint(int hintId, int data)93     public void powerHint(int hintId, int data) {
94         // pass for now.
95     }
96 
97     @Override
crash(String arg0)98     public void crash(String arg0) throws RemoteException {
99         // pass for now.
100     }
101 
102     @Override
goToSleep(long arg0, int arg1, int arg2)103     public void goToSleep(long arg0, int arg1, int arg2) throws RemoteException {
104         // pass for now.
105     }
106 
107     @Override
nap(long arg0)108     public void nap(long arg0) throws RemoteException {
109         // pass for now.
110     }
111 
112     @Override
reboot(boolean confirm, String reason, boolean wait)113     public void reboot(boolean confirm, String reason, boolean wait) {
114         // pass for now.
115     }
116 
117     @Override
rebootSafeMode(boolean confirm, boolean wait)118     public void rebootSafeMode(boolean confirm, boolean wait) {
119         // pass for now.
120     }
121 
122     @Override
shutdown(boolean confirm, String reason, boolean wait)123     public void shutdown(boolean confirm, String reason, boolean wait) {
124         // pass for now.
125     }
126 
127     @Override
releaseWakeLock(IBinder arg0, int arg1)128     public void releaseWakeLock(IBinder arg0, int arg1) throws RemoteException {
129         // pass for now.
130     }
131 
132     @Override
updateWakeLockUids(IBinder arg0, int[] arg1)133     public void updateWakeLockUids(IBinder arg0, int[] arg1) throws RemoteException {
134         // pass for now.
135     }
136 
137     @Override
setAttentionLight(boolean arg0, int arg1)138     public void setAttentionLight(boolean arg0, int arg1) throws RemoteException {
139         // pass for now.
140     }
141 
142     @Override
setStayOnSetting(int arg0)143     public void setStayOnSetting(int arg0) throws RemoteException {
144         // pass for now.
145     }
146 
147     @Override
updateWakeLockWorkSource(IBinder arg0, WorkSource arg1, String arg2)148     public void updateWakeLockWorkSource(IBinder arg0, WorkSource arg1, String arg2) throws RemoteException {
149         // pass for now.
150     }
151 
152     @Override
isWakeLockLevelSupported(int level)153     public boolean isWakeLockLevelSupported(int level) throws RemoteException {
154         // pass for now.
155         return true;
156     }
157 
158     @Override
userActivity(long time, int event, int flags)159     public void userActivity(long time, int event, int flags) throws RemoteException {
160         // pass for now.
161     }
162 
163     @Override
wakeUp(long time, @WakeReason int reason, String details , String opPackageName)164     public void wakeUp(long time, @WakeReason int reason, String details , String opPackageName)
165             throws RemoteException {
166         // pass for now.
167     }
168 
169     @Override
boostScreenBrightness(long time)170     public void boostScreenBrightness(long time) throws RemoteException {
171         // pass for now.
172     }
173 
174     @Override
isDeviceIdleMode()175     public boolean isDeviceIdleMode() throws RemoteException {
176         return false;
177     }
178 
179     @Override
isLightDeviceIdleMode()180     public boolean isLightDeviceIdleMode() throws RemoteException {
181         return false;
182     }
183 
184     @Override
isScreenBrightnessBoosted()185     public boolean isScreenBrightnessBoosted() throws RemoteException {
186         return false;
187     }
188 
189     @Override
getLastShutdownReason()190     public int getLastShutdownReason() {
191         return PowerManager.SHUTDOWN_REASON_UNKNOWN;
192     }
193 
194     @Override
getLastSleepReason()195     public int getLastSleepReason() {
196         return PowerManager.GO_TO_SLEEP_REASON_TIMEOUT;
197     }
198 
199     @Override
setDozeAfterScreenOff(boolean mode)200     public void setDozeAfterScreenOff(boolean mode) throws RemoteException {
201         // pass for now.
202     }
203 
204     @Override
forceSuspend()205     public boolean forceSuspend() {
206         return false;
207     }
208 }
209