19630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown/* 29630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Copyright (C) 2012 The Android Open Source Project 39630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * 49630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Licensed under the Apache License, Version 2.0 (the "License"); 59630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * you may not use this file except in compliance with the License. 69630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * You may obtain a copy of the License at 79630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * 89630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * http://www.apache.org/licenses/LICENSE-2.0 99630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * 109630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Unless required by applicable law or agreed to in writing, software 119630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * distributed under the License is distributed on an "AS IS" BASIS, 129630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * See the License for the specific language governing permissions and 149630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * limitations under the License. 159630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown */ 169630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown 179630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brownpackage com.android.server.power; 189630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown 199630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown/** 209630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Low-level suspend blocker mechanism equivalent to holding a partial wake lock. 219630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * 229630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * This interface is used internally to avoid introducing internal dependencies 239630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * on the high-level wake lock mechanism. 249630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown */ 259630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Browninterface SuspendBlocker { 269630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown /** 279630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Acquires the suspend blocker. 289630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Prevents the CPU from going to sleep. 299630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * 309630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Calls to acquire() nest and must be matched by the same number 319630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * of calls to release(). 329630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown */ 339630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown void acquire(); 349630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown 359630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown /** 369630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Releases the suspend blocker. 379630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * Allows the CPU to go to sleep if no other suspend blockers are held. 389630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * 399630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * It is an error to call release() if the suspend blocker has not been acquired. 409630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown * The system may crash. 419630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown */ 429630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown void release(); 439630704ed3b265f008a8f64ec60a33cf9dcd3345Jeff Brown} 44