Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
permission_handler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songyanzhi
permission_handler
Commits
3feb94b5
Unverified
Commit
3feb94b5
authored
Jan 19, 2020
by
Maurits van Beusekom
Committed by
GitHub
Jan 19, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #193 from Baseflow/fix_warnings
Fix several warnings
parents
5ae7c8ef
f30261e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
android/src/main/java/com/baseflow/permissionhandler/PermissionHandlerPlugin.java
+6
-6
No files found.
android/src/main/java/com/baseflow/permissionhandler/PermissionHandlerPlugin.java
View file @
3feb94b5
...
...
@@ -19,6 +19,7 @@ import android.telephony.TelephonyManager;
import
android.text.TextUtils
;
import
android.util.Log
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.RequiresApi
;
import
androidx.core.app.NotificationManagerCompat
;
import
io.flutter.plugin.common.PluginRegistry.ActivityResultListener
;
...
...
@@ -213,7 +214,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
private
Map
<
Integer
,
Integer
>
mRequestResults
=
new
HashMap
<>();
@Override
public
void
onMethodCall
(
MethodCall
call
,
Result
result
)
{
public
void
onMethodCall
(
MethodCall
call
,
@NonNull
Result
result
)
{
switch
(
call
.
method
)
{
case
"checkPermissionStatus"
:
{
@PermissionGroup
final
int
permission
=
(
int
)
call
.
arguments
;
...
...
@@ -293,7 +294,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
PowerManager
pm
=
(
PowerManager
)
context
.
getSystemService
(
Context
.
POWER_SERVICE
);
// PowerManager.isIgnoringBatteryOptimizations has been included in Android M first.
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
M
)
{
if
(
pm
.
isIgnoringBatteryOptimizations
(
packageName
))
{
if
(
pm
!=
null
&&
pm
.
isIgnoringBatteryOptimizations
(
packageName
))
{
return
PERMISSION_STATUS_GRANTED
;
}
else
{
return
PERMISSION_STATUS_DENIED
;
...
...
@@ -344,7 +345,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
if
(
telephonyManager
.
getPhoneType
()
==
TelephonyManager
.
PHONE_TYPE_NONE
)
{
if
(
telephonyManager
==
null
||
telephonyManager
.
getPhoneType
()
==
TelephonyManager
.
PHONE_TYPE_NONE
)
{
return
SERVICE_STATUS_NOT_APPLICABLE
;
}
...
...
@@ -426,7 +427,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
continue
;
}
if
(
permission
==
PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS
)
{
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
M
&&
permission
==
PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS
)
{
String
packageName
=
mRegistrar
.
context
().
getPackageName
();
Intent
intent
=
new
Intent
();
intent
.
setAction
(
Settings
.
ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
);
...
...
@@ -637,7 +638,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
if
(
hasPermissionInManifest
(
Manifest
.
permission
.
USE_SIP
))
permissionNames
.
add
(
Manifest
.
permission
.
USE_SIP
);
if
(
hasPermissionInManifest
(
Manifest
.
permission
.
BIND_CALL_REDIRECTION_SERVICE
))
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
Q
&&
hasPermissionInManifest
(
Manifest
.
permission
.
BIND_CALL_REDIRECTION_SERVICE
))
permissionNames
.
add
(
Manifest
.
permission
.
BIND_CALL_REDIRECTION_SERVICE
);
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
O
&&
hasPermissionInManifest
(
Manifest
.
permission
.
ANSWER_PHONE_CALLS
))
...
...
@@ -775,7 +776,6 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
return
isNeverAskAgainSelected
;
}
@SuppressWarnings
(
"deprecation"
)
private
boolean
isLocationServiceEnabled
(
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
P
)
{
final
LocationManager
locationManager
=
context
.
getSystemService
(
LocationManager
.
class
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment