02-03-2019, 03:59 AM
I added a PARTIAL_WAKE_LOCK to Launcher3 and I am able to wake the Tinker Board from mouse and keyboard after reloading the updated Android image. Note that the PARTIAL_WAKE_LOCK prevents the system from fully going to sleep, but the display still turns off normally after the display off timeout.
If you want to do the same, you can make changes to the two files as below:
1) AndroidManifest.xml at {croot}/packages/apps/Launcher3/AndroidManifest.xml
and 2) Launcher.java at {croot}/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
If you want to do the same, you can make changes to the two files as below:
1) AndroidManifest.xml at {croot}/packages/apps/Launcher3/AndroidManifest.xml
Code:
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6c5990d..07109ab 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -49,6 +49,9 @@
<uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
<uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+
<application
android:backupAgent="com.android.launcher3.LauncherBackupAgent"
android:fullBackupOnly="true"and 2) Launcher.java at {croot}/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
Code:
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 3b5cd02..110a891 100755
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -86,6 +86,9 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
+import android.os.PowerManager;
+
import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
@@ -366,6 +369,9 @@ public class Launcher extends Activity
private RotationPrefChangeHandler mRotationPrefChangeHandler;
+ private PowerManager.WakeLock mWakeLock;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
if (DEBUG_STRICT_MODE) {
@@ -392,6 +398,13 @@ public class Launcher extends Activity
super.onCreate(savedInstanceState);
+ PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
+ this.mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
+ this.mWakeLock.acquire();
+
LauncherAppState app = LauncherAppState.getInstance();
// Load configuration-specific DeviceProfile
@@ -1940,6 +1953,9 @@ public class Launcher extends Activity
public void onDestroy() {
super.onDestroy();
+ this.mWakeLock.release();
+
// Remove all pending runnables
mHandler.removeMessages(ADVANCE_MSG);
mHandler.removeMessages(0);


![[-]](https://tinkerboarding.co.uk/forum/images/collapse.png)