diff options
author | Andrew Dolgov <[email protected]> | 2017-05-30 12:51:18 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-05-30 12:51:18 +0300 |
commit | bfaafc92cb45d05fd462ed6092134375875f5df4 (patch) | |
tree | 9ad778dea5df8e2b1acc28432f9ff018868efc2b /org.fox.ttrss/src | |
parent | efb22befbd3fd4474c802013ec176c505d48c96a (diff) |
some more widget-related bullshit
Diffstat (limited to 'org.fox.ttrss/src')
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java index de459b5e..d0f329ea 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java @@ -1,10 +1,13 @@ package org.fox.ttrss.widget; import android.app.Service; +import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.os.Build; import android.os.Handler; import android.os.IBinder; +import android.os.PowerManager; import android.preference.PreferenceManager; import android.util.Log; @@ -39,6 +42,14 @@ public class WidgetUpdateService extends Service { public void onStart(Intent intent, int startId) { Log.d(TAG, "onStart"); + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); + if (pm.isDeviceIdleMode()) { + Log.d(TAG, "device in idle mode, bailing out"); + return; + } + } + try { sendResultIntent(-1, UPDATE_IN_PROGRESS); @@ -100,7 +111,7 @@ public class WidgetUpdateService extends Service { @Override protected void onLoginFailed(int requestId, ApiRequest ar) { - Log.d(TAG, "login failed: " + ar.getErrorMessage()); + Log.d(TAG, "login failed: " + getString(ar.getErrorMessage())); ++m_updateFailures; sendResultIntent(-1, UPDATE_RESULT_ERROR_LOGIN); |