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.IBinder; 20 import android.os.IPowerManager; 21 import android.os.PowerManager; 22 import android.os.PowerSaveState; 23 import android.os.RemoteException; 24 import android.os.WorkSource; 25 26 /** 27 * Fake implementation of IPowerManager. 28 * 29 */ 30 public class BridgePowerManager implements IPowerManager { 31 32 @Override isInteractive()33 public boolean isInteractive() throws RemoteException { 34 return true; 35 } 36 37 @Override isPowerSaveMode()38 public boolean isPowerSaveMode() throws RemoteException { 39 return false; 40 } 41 42 @Override setPowerSaveMode(boolean mode)43 public boolean setPowerSaveMode(boolean mode) throws RemoteException { 44 return false; 45 } 46 getPowerSaveState(int serviceType)47 public PowerSaveState getPowerSaveState(int serviceType) { 48 return null; 49 } 50 51 @Override asBinder()52 public IBinder asBinder() { 53 // pass for now. 54 return null; 55 } 56 57 @Override acquireWakeLock(IBinder arg0, int arg1, String arg2, String arg2_5, WorkSource arg3, String arg4)58 public void acquireWakeLock(IBinder arg0, int arg1, String arg2, String arg2_5, WorkSource arg3, String arg4) 59 throws RemoteException { 60 // pass for now. 61 } 62 63 @Override acquireWakeLockWithUid(IBinder arg0, int arg1, String arg2, String arg2_5, int arg3)64 public void acquireWakeLockWithUid(IBinder arg0, int arg1, String arg2, String arg2_5, int arg3) 65 throws RemoteException { 66 // pass for now. 67 } 68 69 @Override powerHint(int hintId, int data)70 public void powerHint(int hintId, int data) { 71 // pass for now. 72 } 73 74 @Override crash(String arg0)75 public void crash(String arg0) throws RemoteException { 76 // pass for now. 77 } 78 79 @Override goToSleep(long arg0, int arg1, int arg2)80 public void goToSleep(long arg0, int arg1, int arg2) throws RemoteException { 81 // pass for now. 82 } 83 84 @Override nap(long arg0)85 public void nap(long arg0) throws RemoteException { 86 // pass for now. 87 } 88 89 @Override reboot(boolean confirm, String reason, boolean wait)90 public void reboot(boolean confirm, String reason, boolean wait) { 91 // pass for now. 92 } 93 94 @Override rebootSafeMode(boolean confirm, boolean wait)95 public void rebootSafeMode(boolean confirm, boolean wait) { 96 // pass for now. 97 } 98 99 @Override shutdown(boolean confirm, String reason, boolean wait)100 public void shutdown(boolean confirm, String reason, boolean wait) { 101 // pass for now. 102 } 103 104 @Override releaseWakeLock(IBinder arg0, int arg1)105 public void releaseWakeLock(IBinder arg0, int arg1) throws RemoteException { 106 // pass for now. 107 } 108 109 @Override updateWakeLockUids(IBinder arg0, int[] arg1)110 public void updateWakeLockUids(IBinder arg0, int[] arg1) throws RemoteException { 111 // pass for now. 112 } 113 114 @Override setAttentionLight(boolean arg0, int arg1)115 public void setAttentionLight(boolean arg0, int arg1) throws RemoteException { 116 // pass for now. 117 } 118 119 @Override setTemporaryScreenAutoBrightnessAdjustmentSettingOverride(float arg0)120 public void setTemporaryScreenAutoBrightnessAdjustmentSettingOverride(float arg0) throws RemoteException { 121 // pass for now. 122 } 123 124 @Override setTemporaryScreenBrightnessSettingOverride(int arg0)125 public void setTemporaryScreenBrightnessSettingOverride(int arg0) throws RemoteException { 126 // pass for now. 127 } 128 129 @Override setStayOnSetting(int arg0)130 public void setStayOnSetting(int arg0) throws RemoteException { 131 // pass for now. 132 } 133 134 @Override updateWakeLockWorkSource(IBinder arg0, WorkSource arg1, String arg2)135 public void updateWakeLockWorkSource(IBinder arg0, WorkSource arg1, String arg2) throws RemoteException { 136 // pass for now. 137 } 138 139 @Override isWakeLockLevelSupported(int level)140 public boolean isWakeLockLevelSupported(int level) throws RemoteException { 141 // pass for now. 142 return true; 143 } 144 145 @Override userActivity(long time, int event, int flags)146 public void userActivity(long time, int event, int flags) throws RemoteException { 147 // pass for now. 148 } 149 150 @Override wakeUp(long time, String reason, String opPackageName)151 public void wakeUp(long time, String reason, String opPackageName) throws RemoteException { 152 // pass for now. 153 } 154 155 @Override boostScreenBrightness(long time)156 public void boostScreenBrightness(long time) throws RemoteException { 157 // pass for now. 158 } 159 160 @Override isDeviceIdleMode()161 public boolean isDeviceIdleMode() throws RemoteException { 162 return false; 163 } 164 165 @Override isLightDeviceIdleMode()166 public boolean isLightDeviceIdleMode() throws RemoteException { 167 return false; 168 } 169 170 @Override isScreenBrightnessBoosted()171 public boolean isScreenBrightnessBoosted() throws RemoteException { 172 return false; 173 } 174 175 @Override getLastShutdownReason()176 public int getLastShutdownReason() { 177 return PowerManager.SHUTDOWN_REASON_UNKNOWN; 178 } 179 } 180