diff --git a/OffloadingDemo/build.gradle b/OffloadingDemo/build.gradle index 03bced9..aff4f41 100644 --- a/OffloadingDemo/build.gradle +++ b/OffloadingDemo/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.0' + classpath 'com.android.tools.build:gradle:2.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/OffloadingDemo/mobile/mobile.iml b/OffloadingDemo/mobile/mobile.iml index 0b54a15..096e22e 100644 --- a/OffloadingDemo/mobile/mobile.iml +++ b/OffloadingDemo/mobile/mobile.iml @@ -64,14 +64,6 @@ - - - - - - - - @@ -80,6 +72,14 @@ + + + + + + + + diff --git a/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/MainActivity.java b/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/MainActivity.java index 5946936..a332bae 100644 --- a/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/MainActivity.java +++ b/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/MainActivity.java @@ -10,6 +10,7 @@ import android.net.wifi.WifiManager; import android.os.Build; import android.os.Environment; import android.os.Handler; +import android.os.PowerManager; import android.provider.Settings; import android.os.Bundle; import android.util.Log; @@ -228,12 +229,19 @@ public class MainActivity extends Activity { Log.d(TAG, "selected variations " + selectedItemsThrpt); } Utilities.estimateTime(repeatCounts, selectedItems.size(), bytes2send, selectedItemsThrpt); + + // power management + PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); + final PowerManager.WakeLock wakelock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, + "MyWakelockTag"); + new Thread(new Runnable() { @Override public void run() { String[] commd = new String[3]; commd[0] = "su"; commd[1] = "&&"; + wakelock.acquire(); // change screen brightness to 0 Settings.System.putInt(MainActivity.this.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 0); @@ -474,6 +482,7 @@ public class MainActivity extends Activity { e.printStackTrace(); } } + wakelock.release(); // change screen brightness back Settings.System.putInt(MainActivity.this.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 200); diff --git a/OffloadingDemo/wear/wear.iml b/OffloadingDemo/wear/wear.iml index d26af90..55d1459 100644 --- a/OffloadingDemo/wear/wear.iml +++ b/OffloadingDemo/wear/wear.iml @@ -64,14 +64,6 @@ - - - - - - - - @@ -80,6 +72,14 @@ + + + + + + + +