OSDN Git Service

System suspend HAL interface.
authorTri Vo <trong@google.com>
Sun, 8 Apr 2018 23:59:14 +0000 (16:59 -0700)
committerTri Vo <trong@google.com>
Wed, 15 Aug 2018 00:32:14 +0000 (17:32 -0700)
Bug: 78888165
Test: SystemSuspendV1_0UnitTest
Change-Id: I3c3537a72dac65d316aeb77fd7b2d7cff4fb67e5
Merged-In: I3c3537a72dac65d316aeb77fd7b2d7cff4fb67e5
(cherry picked from commit 2fbf967c4f47b7f3977893fd4a2988d32eff4c27)

suspend/1.0/Android.bp [new file with mode: 0644]
suspend/1.0/ISystemSuspend.hal [new file with mode: 0644]
suspend/1.0/IWakeLock.hal [new file with mode: 0644]

diff --git a/suspend/1.0/Android.bp b/suspend/1.0/Android.bp
new file mode 100644 (file)
index 0000000..3f7bf93
--- /dev/null
@@ -0,0 +1,16 @@
+hidl_interface {
+    name: "android.system.suspend@1.0",
+    root: "android.system",
+    vndk: {
+        enabled: true,
+    },
+    srcs: [
+        "ISystemSuspend.hal",
+        "IWakeLock.hal",
+    ],
+    interfaces: [
+        "android.hidl.base@1.0",
+    ],
+    gen_java: false,
+}
+
diff --git a/suspend/1.0/ISystemSuspend.hal b/suspend/1.0/ISystemSuspend.hal
new file mode 100644 (file)
index 0000000..c9677e0
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 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 android.system.suspend@1.0;
+
+import IWakeLock;
+
+interface ISystemSuspend {
+    /**
+     * Starts automatic system suspension.
+     *
+     * @return status true on success, false otherwise.
+     */
+    enableAutosuspend() generates (bool success);
+
+    /**
+     * Acquires an IWakeLock instance. Any allocated IWakeLock must block the
+     * device from suspending. This method must be able to be called
+     * independently of enableAutosuspend().
+     *
+     * @return lock the interface for the created wake lock.
+     */
+    acquireWakeLock() generates (IWakeLock lock);
+};
diff --git a/suspend/1.0/IWakeLock.hal b/suspend/1.0/IWakeLock.hal
new file mode 100644 (file)
index 0000000..fd11bea
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2018 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 android.system.suspend@1.0;
+
+/**
+ * Allocating an IWakeLock instance must block system suspend. Deallocating an
+ * IWakeLock must initiate system suspend if no other wake lock is allocated.
+ */
+interface IWakeLock {};