summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/power/SuspendBlocker.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android/server/power/SuspendBlocker.java')
-rw-r--r--services/java/com/android/server/power/SuspendBlocker.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/services/java/com/android/server/power/SuspendBlocker.java b/services/java/com/android/server/power/SuspendBlocker.java
new file mode 100644
index 000000000000..70b278a6f2df
--- /dev/null
+++ b/services/java/com/android/server/power/SuspendBlocker.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.power;
+
+/**
+ * Low-level suspend blocker mechanism equivalent to holding a partial wake lock.
+ *
+ * This interface is used internally to avoid introducing internal dependencies
+ * on the high-level wake lock mechanism.
+ */
+interface SuspendBlocker {
+ /**
+ * Acquires the suspend blocker.
+ * Prevents the CPU from going to sleep.
+ *
+ * Calls to acquire() nest and must be matched by the same number
+ * of calls to release().
+ */
+ void acquire();
+
+ /**
+ * Releases the suspend blocker.
+ * Allows the CPU to go to sleep if no other suspend blockers are held.
+ *
+ * It is an error to call release() if the suspend blocker has not been acquired.
+ * The system may crash.
+ */
+ void release();
+}