Adapt to Android 12 or later.

This commit is contained in:
dxl
2023-05-09 14:13:43 +08:00
parent 9ae12ee99e
commit 666a3bc7d6
22 changed files with 96 additions and 50 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
applicationId "com.rfidresearchgroup.rfidtools"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 33
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
versionCode 26
versionName "1.4.8 SDK21 && PM3 CWD"
+12 -4
View File
@@ -2,8 +2,16 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.rfidresearchgroup.rfidtools">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- Request legacy Bluetooth permissions on older devices. -->
<uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
@@ -22,7 +30,7 @@
android:usesCleartextTraffic="true"
tools:targetApi="q">
<activity android:name="com.rfidresearchgroup.activities.tools.LoginActivity">
<activity android:name="com.rfidresearchgroup.activities.tools.LoginActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -42,7 +50,7 @@
android:name="com.rfidresearchgroup.activities.connect.Proxmark3Rdv4RRGConnectActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />
<activity android:name="com.rfidresearchgroup.activities.main.GeneralNfcDeviceMain">
<activity android:name="com.rfidresearchgroup.activities.main.GeneralNfcDeviceMain" android:exported="true">
<!-- NFC Tech Filter -->
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
@@ -3,6 +3,7 @@ package com.rfidresearchgroup.activities.tools;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
@@ -27,6 +28,10 @@ import com.rfidresearchgroup.common.implement.PermissionCallback;
import com.rfidresearchgroup.common.util.FragmentUtil;
import com.rfidresearchgroup.common.util.PermissionUtil;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
/*
* 登陆界面,,用于登陆用户系统,初始化环境,对于用户的验证,都放在这里实现
*/
@@ -90,11 +95,21 @@ public class LoginActivity
}
});
String[] permissionArray = new String[]{
ArrayList<String> permissionArray = new ArrayList<>();
Collections.addAll(permissionArray,
// 以下是一定要添加的权限
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
};
permissionUtil.setPermissions(permissionArray);
Manifest.permission.READ_EXTERNAL_STORAGE
);
// android 12或者以上,要单独申请蓝牙权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
permissionArray.add( Manifest.permission.BLUETOOTH_SCAN);
permissionArray.add( Manifest.permission.BLUETOOTH_CONNECT);
permissionArray.add( Manifest.permission.BLUETOOTH_ADVERTISE);
}
permissionUtil.setPermissions(permissionArray.toArray(new String[]{}));
permissionUtil.checks();
}
+1 -1
View File
@@ -5,7 +5,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath('com.github.dcendents:android-maven-gradle-plugin:1.5')
}
}
+1 -1
View File
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 33
}
buildTypes {
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 33
}
buildTypes {
@@ -185,7 +185,12 @@ public class UsbSerialControl implements DriverInterface<String, UsbManager> {
//如果对于这个设备没有权限!
if (!usbManager.hasPermission(usbDevice)) {
//发送广播申请权限
PendingIntent intent = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_PERMISSION), 0);
PendingIntent intent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
intent = PendingIntent.getActivity(mContext, 0, new Intent(ACTION_PERMISSION), PendingIntent.FLAG_IMMUTABLE);
} else {
intent = PendingIntent.getActivity(mContext, 0, new Intent(ACTION_PERMISSION), PendingIntent.FLAG_ONE_SHOT);
}
//Log.d(LOG_TAG, "尝试获得USB权限!");
usbManager.requestPermission(usbDevice, intent);
//当没有权限的时候应当直接返回
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 33
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static'
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 33
externalNativeBuild {
cmake {
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 18
targetSdkVersion 29
targetSdkVersion 33
externalNativeBuild {
cmake {
/*
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 33
externalNativeBuild {
cmake {
-2
View File
@@ -6,8 +6,6 @@ android {
defaultConfig {
minSdk 21
targetSdk 29
versionCode 1
versionName "1.0"
}
buildTypes {
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 33
consumerProguardFiles 'consumer-rules.pro'
}
@@ -32,13 +32,15 @@ public class StdMifareIntent {
public void enableForegroundDispatch(Activity targetAct) {
if (mAdapter == null) return;
//进行前台广播拦截!
Intent intent = new Intent(targetAct,
targetAct.getClass()).addFlags(
Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(
targetAct, 0, intent, 0);
mAdapter.enableForegroundDispatch(targetAct, pendingIntent, null, new String[][]{
new String[]{MifareClassic.class.getName()}});
Intent intent = new Intent(targetAct, targetAct.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
pendingIntent = PendingIntent.getActivity(targetAct, 0, intent, PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(targetAct, 0, intent, PendingIntent.FLAG_ONE_SHOT);
}
mAdapter.enableForegroundDispatch(targetAct, pendingIntent, null, new String[][]{new String[]{MifareClassic.class.getName()}});
}
/*
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 33
}
buildTypes {
+2 -2
View File
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
// ndkVersion '21.3.6528147'
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 33
externalNativeBuild {
ndkBuild {
+2 -2
View File
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
compileSdkVersion 33
dependencies {
implementation "androidx.annotation:annotation:1.1.0"
@@ -10,7 +10,7 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 33
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
+2 -2
View File
@@ -3,7 +3,7 @@ plugins {
}
android {
compileSdkVersion 29
compileSdkVersion 33
// ndkVersion '21.3.6528147'
dependencies {
@@ -16,7 +16,7 @@ android {
defaultConfig {
// applicationId "com.termux"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 33
/*externalNativeBuild {
ndkBuild {
+3 -1
View File
@@ -74,6 +74,7 @@
android:label="@string/application_name"
android:noHistory="true"
android:resizeableActivity="true"
android:exported="true"
android:taskAffinity="com.termux.filereceiver">
<!-- Accept multiple file types when sending. -->
<intent-filter>
@@ -104,7 +105,8 @@
<activity-alias
android:name=".HomeActivity"
android:targetActivity="com.termux.app.TermuxActivity">
android:targetActivity="com.termux.app.TermuxActivity"
android:exported="true">
<!-- Launch activity automatically on boot on Android Things devices -->
<intent-filter>

Some files were not shown because too many files have changed in this diff Show More