From 40eb29f6dbf7f2b20672ade66b2b79bc2da1e738 Mon Sep 17 00:00:00 2001 From: Hugo <446022570@qq.com> Date: Mon, 29 May 2017 20:37:58 +0800 Subject: [PATCH] fix code --- watcher/src/main/java/com/hugo/watcher/Watcher.java | 3 +-- .../src/main/java/com/hugo/watcher/config/WatcherConfig.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/watcher/src/main/java/com/hugo/watcher/Watcher.java b/watcher/src/main/java/com/hugo/watcher/Watcher.java index d7bbcc2..ba5adb2 100644 --- a/watcher/src/main/java/com/hugo/watcher/Watcher.java +++ b/watcher/src/main/java/com/hugo/watcher/Watcher.java @@ -3,7 +3,6 @@ import android.app.Application; import android.content.Context; import android.content.Intent; -import android.os.Build; import android.provider.Settings; import android.util.Log; import com.hugo.watcher.config.AppBackground; @@ -42,7 +41,7 @@ public void start(Context context) { if (!mWatcherConfig.isDebug) { return; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(context)) { + if (!mWatcherConfig.enableSkipPermission() && !Settings.canDrawOverlays(context)) { Log.e("Watcher", "!!! ---> Can't start Watcher : permission denied for window type"); return; } diff --git a/watcher/src/main/java/com/hugo/watcher/config/WatcherConfig.java b/watcher/src/main/java/com/hugo/watcher/config/WatcherConfig.java index 7184be7..e5bece4 100644 --- a/watcher/src/main/java/com/hugo/watcher/config/WatcherConfig.java +++ b/watcher/src/main/java/com/hugo/watcher/config/WatcherConfig.java @@ -33,7 +33,7 @@ public class WatcherConfig implements Parcelable { public boolean enableShowCurrentActivity = true; public boolean enableSkipPermission() { - return Build.VERSION.SDK_INT < Build.VERSION_CODES.M; + return Build.VERSION.SDK_INT < Build.VERSION_CODES.N; } /**