Commit 78bb115d authored by jyx's avatar jyx

权限优化

parent db6c1e31
...@@ -95,7 +95,8 @@ public class AlarmManager implements WeakHandler.IHandler { ...@@ -95,7 +95,8 @@ public class AlarmManager implements WeakHandler.IHandler {
if (userTime % APP_OUT_TIMING_MINTER == 0) { if (userTime % APP_OUT_TIMING_MINTER == 0) {
// 应用在前台时,不弹出应用外广告 // 应用在前台时,不弹出应用外广告
if (ForegroundOrBackground.isForeground2() || ScreenLockerUtils.INSTANCE.canShowScreenLocker(MintsApplication.getContext())) { if (ForegroundOrBackground.isForeground2() ||
ScreenLockerUtils.INSTANCE.canShowScreenLocker(MintsApplication.getContext())) {
return; return;
} }
......
...@@ -459,11 +459,15 @@ object WifiDataManager { ...@@ -459,11 +459,15 @@ object WifiDataManager {
* *
* APP_OUT_MAIN_SWITCH=false 表示 关闭总开关 * APP_OUT_MAIN_SWITCH=false 表示 关闭总开关
* isBlack=true 表示 是反策略黑名单 * isBlack=true 表示 是反策略黑名单
* @return true 不弹 false 弹
*/ */
private fun isBlackOrClose(): Boolean { private fun isBlackOrClose(): Boolean {
val isBlack = AntiAuditManager.instance.isBlack() val isBlack = AntiAuditManager.instance.isBlack()
LogUtil.d(TAG, "isBlackOrClose() 是否黑名单: -> !APP_OUT_MAIN_SWITCH=${!APP_OUT_MAIN_SWITCH} , isBlack=${isBlack}") LogUtil.d(
TAG,
"isBlackOrClose() 是否黑名单: -> !APP_OUT_MAIN_SWITCH=${!APP_OUT_MAIN_SWITCH} , isBlack=${isBlack}"
)
return (!APP_OUT_MAIN_SWITCH || isBlack) return (!APP_OUT_MAIN_SWITCH || isBlack)
} }
......
...@@ -35,7 +35,9 @@ import com.mints.flowbox.ui.widgets.dialog.PowerDialog ...@@ -35,7 +35,9 @@ import com.mints.flowbox.ui.widgets.dialog.PowerDialog
import com.mints.flowbox.utils.WifiUtils import com.mints.flowbox.utils.WifiUtils
import com.mints.library.utils.GlideUtils import com.mints.library.utils.GlideUtils
import com.tbruyelle.rxpermissions.RxPermissions import com.tbruyelle.rxpermissions.RxPermissions
import com.yilan.sdk.common.util.PhoneUtil
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
import net.phone.PhoneBrandUtils
import rx.Observable import rx.Observable
/** /**
...@@ -453,10 +455,19 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -453,10 +455,19 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
private fun checkPermission() { private fun checkPermission() {
val request: Observable<Boolean> = val request: Observable<Boolean> =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (PhoneBrandUtils.isXiaomi()) {
RxPermissions(this) RxPermissions(this)
.request( .request(
Manifest.permission.ACCESS_COARSE_LOCATION Manifest.permission.ACCESS_FINE_LOCATION
) )
} else {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
)
}
} else { } else {
RxPermissions(this) RxPermissions(this)
.request( .request(
......
...@@ -47,6 +47,7 @@ import com.mints.library.utils.nodoubleclick.AntiShake ...@@ -47,6 +47,7 @@ import com.mints.library.utils.nodoubleclick.AntiShake
import com.tbruyelle.rxpermissions.RxPermissions import com.tbruyelle.rxpermissions.RxPermissions
import kotlinx.android.synthetic.main.fragment_wifi.* import kotlinx.android.synthetic.main.fragment_wifi.*
import kotlinx.android.synthetic.main.fragment_wifi.swipeRefreshLayout import kotlinx.android.synthetic.main.fragment_wifi.swipeRefreshLayout
import net.phone.PhoneBrandUtils
import rx.Observable import rx.Observable
import java.util.* import java.util.*
import kotlin.random.Random import kotlin.random.Random
...@@ -542,10 +543,19 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -542,10 +543,19 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
private fun checkPermission() { private fun checkPermission() {
val request: Observable<Boolean> = val request: Observable<Boolean> =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (PhoneBrandUtils.isXiaomi()) {
RxPermissions(requireActivity()) RxPermissions(requireActivity())
.request( .request(
Manifest.permission.ACCESS_COARSE_LOCATION Manifest.permission.ACCESS_FINE_LOCATION
)
} else {
RxPermissions(requireActivity())
.request(
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
) )
}
} else { } else {
RxPermissions(activity!!) RxPermissions(activity!!)
.request( .request(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment