From 183d4f5142b0093f3b3648a231070febe775183f Mon Sep 17 00:00:00 2001 From: Jon West Date: Fri, 1 Mar 2024 15:50:43 -0500 Subject: [PATCH] Create power-management-aidl --- .../interfaces/power-management-aidl | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 knowledgebase/bliss-bass/interfaces/power-management-aidl diff --git a/knowledgebase/bliss-bass/interfaces/power-management-aidl b/knowledgebase/bliss-bass/interfaces/power-management-aidl new file mode 100644 index 00000000..78ade715 --- /dev/null +++ b/knowledgebase/bliss-bass/interfaces/power-management-aidl @@ -0,0 +1,71 @@ +## Bliss Power Management AIDL Interface: + + +``` +package org.blissos.powermanagerclient; + +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.widget.Button; +import org.blissos.powermanager.BlissPowerManager; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Button rebootBtn = findViewById(R.id.rebootBtn); + Button shutdownBtn = findViewById(R.id.shutdownBtn); + Button sleepBtn = findViewById(R.id.sleepBtn); + + BlissPowerManager blissPowerManager = BlissPowerManager.getInstance(this); + + rebootBtn.setOnClickListener(v -> blissPowerManager.reboot()); + shutdownBtn.setOnClickListener(v -> blissPowerManager.shutdown()); + sleepBtn.setOnClickListener(v -> blissPowerManager.sleep()); + } +} +``` + + +1) copy paste “**system_libs/bliss-power-framework.jar**” from sample app + +2) gradle: + + +``` +implementation fileTree(dir: 'system_libs/', include: ['*.jar']) +``` + + +3) java: + + +``` +import org.blissos.powermanager.BlissPowerManager; + +BlissPowerManager blissPowerManager = BlissPowerManager.getInstance(this); +blissPowerManager.reboot() +blissPowerManager.shutdown() +blissPowerManager.sleep() +``` + + + +##### ADB Interface: + + +``` +adb shell service call blisspower +``` + + +**<parameters>** is the method number in aidl + +1: reboot + +2: shutdown + +3: sleep