Merge lp:~karni/ubuntuone-android-music/fix-music-stutter into lp:ubuntuone-android-music

Proposed by Michał Karnicki on 2012-05-16
Status: Merged
Approved by: Chad Miller on 2012-06-04
Approved revision: 566
Merged at revision: 566
Proposed branch: lp:~karni/ubuntuone-android-music/fix-music-stutter
Merge into: lp:ubuntuone-android-music
Diff against target: 55 lines (+18/-2)
3 files modified
project.properties (+1/-1)
src/net/sourceforge/subsonic/androidapp/service/DownloadServiceImpl.java (+1/-1)
src/net/sourceforge/subsonic/androidapp/util/Util.java (+16/-0)
To merge this branch: bzr merge lp:~karni/ubuntuone-android-music/fix-music-stutter
Reviewer Review Type Date Requested Status
Chad Miller (community) 2012-05-16 Approve on 2012-06-04
Review via email: mp+105955@code.launchpad.net

Description of the change

Hold high performance WiFi lock on devices with API >= 12 (HONEYCOMB_MR1), in case the screen is off and WiFi performance may decrease.

See:
http://developer.android.com/reference/android/net/wifi/WifiManager.html#WIFI_MODE_FULL_HIGH_PERF

To post a comment you must log in.
Chad Miller (cmiller) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'project.properties'
2--- project.properties 2012-03-02 19:31:24 +0000
3+++ project.properties 2012-05-16 11:10:22 +0000
4@@ -9,4 +9,4 @@
5
6 android.library.reference.1=../../ubuntuone-android-sso/ubuntuone-android-sso
7 # Project target.
8-target=android-8
9+target=android-12
10
11=== modified file 'src/net/sourceforge/subsonic/androidapp/service/DownloadServiceImpl.java'
12--- src/net/sourceforge/subsonic/androidapp/service/DownloadServiceImpl.java 2011-10-24 19:10:31 +0000
13+++ src/net/sourceforge/subsonic/androidapp/service/DownloadServiceImpl.java 2012-05-16 11:10:22 +0000
14@@ -159,7 +159,7 @@
15 wakeLock.setReferenceCounted(false);
16
17 WifiManager wm = (WifiManager)getSystemService(Context.WIFI_SERVICE);
18- wifiLock = wm.createWifiLock(this.getClass().getName());
19+ wifiLock = wm.createWifiLock(Util.getWifiLockFlag(), this.getClass().getName());
20 wifiLock.setReferenceCounted(false);
21
22 instance = this;
23
24=== modified file 'src/net/sourceforge/subsonic/androidapp/util/Util.java'
25--- src/net/sourceforge/subsonic/androidapp/util/Util.java 2012-04-17 14:43:06 +0000
26+++ src/net/sourceforge/subsonic/androidapp/util/Util.java 2012-05-16 11:10:22 +0000
27@@ -65,7 +65,10 @@
28 import android.media.AudioManager;
29 import android.net.ConnectivityManager;
30 import android.net.NetworkInfo;
31+import android.net.wifi.WifiManager;
32 import android.os.Build;
33+import android.os.Build.VERSION;
34+import android.os.Build.VERSION_CODES;
35 import android.os.Environment;
36 import android.os.Handler;
37 import android.util.Log;
38@@ -873,4 +876,17 @@
39 })
40 .show();
41 }
42+
43+ private static int wifiLockFlag = WifiManager.WIFI_MODE_FULL;
44+
45+ static {
46+ int sdk = Integer.valueOf(VERSION.SDK);
47+ if (sdk >= VERSION_CODES.HONEYCOMB_MR1) {
48+ wifiLockFlag = WifiManager.WIFI_MODE_FULL_HIGH_PERF;
49+ }
50+ }
51+
52+ public static int getWifiLockFlag() {
53+ return wifiLockFlag;
54+ }
55 }

Subscribers

People subscribed via source and target branches

to status/vote changes: