Skip to content

Commit

Permalink
修复activity 销毁的问题
Browse files Browse the repository at this point in the history
添加低target版本的判断
  • Loading branch information
liheng committed Jun 8, 2020
1 parent 822a9dc commit 7faafe0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public boolean hasPermission(Context context, String... permissions) {

@Override
public boolean hasPermission(Context context, List<String> permissions) {
if (context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.M) return true;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return true;

AppOpsManager opsManager = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public StrictChecker() {

@Override
public boolean hasPermission(Context context, String... permissions) {
if (context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.M) return true;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return true;

for (String permission : permissions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected List<String> doInBackground(Void... voids) {

@Override
protected void onFinish(List<String> deniedList) {
if (deniedList.isEmpty()) {
if (deniedList == null || deniedList.isEmpty()) {
callbackSucceed(mPermissions);
} else {
callbackFailed(deniedList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected List<String> doInBackground(Void... voids) {

@Override
protected void onFinish(List<String> deniedList) {
if (deniedList.isEmpty()) {
if (deniedList == null || deniedList.isEmpty()) {
callbackSucceed(mPermissions);
} else {
callbackFailed(deniedList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ public TaskExecutor(Context context) {

@Override
protected final void onPreExecute() {
if (!mDialog.isShowing()) {
mDialog.show();
try {
if (!mDialog.isShowing()) {
mDialog.show();
}
} catch (Throwable throwable) {
throwable.printStackTrace();
cancel(false);
onFinish(null);
}
}

Expand Down

0 comments on commit 7faafe0

Please sign in to comment.